jQuery(document).ready(function(){

	// Custom JS		Scrollpane
	$('.scroll-pane').jScrollPane();
	
	
	jQuery("#menu_container").fadeIn(500);
	
	// Custom JS		Radmenu
	jQuery("#nested_container").radmenu({
		
		listClass: 'list', // the list class to look within for items
		itemClass: 'item', // the items 
		radius: 145, // radius in pixels
		scaleAnimSpeed: 400,
		centerX: 30, // the center x axis offset
		centerY: 100, // the center y axis offset
	//	selectEvent: "click", // the select event (click)
		onSelect: nestedSelection,
		
		onHide: function($items){
						jQuery("#nested_container").radmenu("scale","0.25");
			},

		angleOffset: 0 // in radians
	});
});
var jlastSelected;
var build = true;
// the onSelect method for the main radmenu
function nestedSelection(jselected){
// make sure that there are elements
	if(jselected.length){
		// only do this if a parent menu item has been selected
		if(jlastSelected) {
			if(jlastSelected.is(":visible")){ // if theres an active radmenu item, i.e it's visible
				 // check to see if its the parent of the nested menu item
				if(jlastSelected.parents(".radial_div").length){
					jlastSelected.radmenu("hide"); // hide the radmenu
					build = false; // we don't want to build a new radmenu
				}
			}else { // this is a new selection
				jlastSelected = null;
				build = true; // we want to build the sublist if avail.
			}
		}
		if(build){
			// build the sublist radmenu and show it 
			jselected.radmenu(selectedRadmenuOptions).radmenu("show");
			// add some effects for the menu selections
			jselected.siblings().fadeTo("slow", 0.35);
			jselected.fadeTo("slow", 1);
			// store the last item so for nested elements
			jlastSelected = jselected;
		}else{
			// toggle : show the parent radmenu (i.e. 'reset' the main radmenu)
			jselected.parents(".radial_div").radmenu("show");
		}
	}
};
// sublist menu options
var selectedRadmenuOptions = {
	listClass: "sublist",
	itemClass: "subitem",
	select: "click",
	onSelect: function(jselected){
		//update the box in the top right corner with the selected item's HTML
		jQuery("#nested_selection").html(jselected.html());
		jselected.siblings().fadeTo("slow", 0.35);
		jselected.fadeTo("slow", 1);
	},
	radius: 120,
	centerX: 7,
	centerY: -92,
	angleOffset: 0
};

// CUSTOM JS		VideoJS 
    // Must come after the video.js library
    // Add VideoJS to all video tags on the page when the DOM is ready
    
    VideoJS.setupAllWhenReady();

    /* ============= OR ============ */

    // Setup and store a reference to the player(s).
    // Must happen after the DOM is loaded
    // You can use any library's DOM Ready method instead of VideoJS.DOMReady

    /*
    VideoJS.DOMReady(function(){
      
      // Using the video's ID or element
      var myPlayer = VideoJS.setup("example_video_1");
      
      // OR using an array of video elements/IDs
      // Note: It returns an array of players
      var myManyPlayers = VideoJS.setup(["example_video_1", "example_video_2", video3Element]);

      // OR all videos on the page
      var myManyPlayers = VideoJS.setup("All");

      // After you have references to your players you can...(example)
      myPlayer.play(); // Starts playing the video for this player.

    });
    */

    /* ========= SETTING OPTIONS ========= */

    // Set options when setting up the videos. The defaults are shown here.

    /*  */
    VideoJS.setupAllWhenReady({
      controlsBelow: false, // Display control bar below video instead of in front of
      controlsHiding: false, // Hide controls when mouse is not over the video
      defaultVolume: 0.85, // Will be overridden by user's last volume if available
      flashVersion: 9, // Required flash version for fallback
      linksHiding: true // Hide download links when video is supported
    });
  
    // Or as the second option of VideoJS.setup
    
    /*
    VideoJS.DOMReady(function(){
      var myPlayer = VideoJS.setup("example_video_1", {
        // Same options
      });
    });
    */
    

