// jDiv - a jQuery plugin
// (c) Skyrocket Labs
// http://www.skyrocketlabs.com
// fred@skyrocketlabs.com
// Created: 10.24.2009
// Last updated: 02.06.2010

// DISPLAYS HIDDEN DIVS AS SUBMENUS ON HOVER

$(document).ready(function() {
	
	//Default Action
	$(".course-detail").hide(); //Hide all content
	$("ul#page-nav li:first").addClass("active").show(); //Activate first tab
	$(".course-detail:first").show(); //Show first tab content
	
	//On Click Event
	$("ul#page-nav  li").click(function() {
		$("ul#page-nav  li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".course-detail").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content
		return false;
	});
	//Default Action
	$(".media-scroll").hide(); //Hide all content
	$("ul#media-nav li:first").addClass("active").show(); //Activate first tab
	$(".media-scroll:first").show(); //Show first tab content
	
	//On Click Event
	$("ul#media-nav  li").click(function() {
		$("ul#media-nav  li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".media-scroll").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content
		return false;
	});
	
	
	var images = ['image1.jpg', 'image2.jpg', 'image3.jpg', 'image4.jpg', 'image5.jpg', 'image6.jpg'];
	$('#leftBan').css({'background-image': 'url(assets/home/' + images[Math.floor(Math.random() * images.length)] + ')'});

    var hide01 = false;
    // Shows the DIV on hover with a fade in
	$("li#sub-one a").click(function(){          
	   if (hide01) clearTimeout(hide01);
        $("#guitar-course").fadeIn();
        // The main nav menu item is assigned the 'active' CSS class
		$(this).addClass("active");
		$("#guitar-course").css('z-index',100);
		$("#bass-course").css('z-index',99);
		$("#bass-course").css('display',"none");
		$("#drum-course").css('z-index',99);
		$("#drum-course").css('display',"none");
		$("#vocal-course").css('z-index',99);
		$("#vocal-course").css('display',"none");
		$("#song-course").css('z-index',99);
		$("#music-business").css('display',"none");
		$("#music-business").css('z-index',99);
		$("#song-course").css('display',"none");
		$("#specialist-course").css('z-index',99);
		$("#specialist-course").css('display',none);
		$("#guitar-course").fadeIn();
    }, function() {
        // Fades out the DIV and removes the 'active' class from the main nav menu item
		hide01 = setTimeout(function() {$("#guitar-course").fadeOut("fast");});
		$("li#sub-one a").removeClass("active");
    });
	// Ensures the DIV displays when your mouse moves away from the main nav menu item
    $("#guitar-course").hover(function(){
        if (hide01) clearTimeout(hide01);
        $("li#sub-one a").addClass("active");
    }, function() {
        // If your mouse moves out of the displayed hidden DIV, the DIv fades out and removes the 'active' class
		hide01 = setTimeout(function() {$("#guitar-course").fadeOut("fast");});
		$("li#sub-one a").removeClass("active");
    });
    
    
    var hide02 = false;
    // Shows the DIV on hover with a fade in
	$("li#sub-two a").click(function(){          
	   if (hide02) clearTimeout(hide02);
	    $("#guitar-course").css('z-index',99);
		$("#bass-course").css('z-index',100);
		$("#drum-course").css('z-index',99);
		$("#vocal-course").css('z-index',99);
		$("#song-course").css('z-index',99);
		$("#specialist-course").css('z-index',99);
		
	    $("#guitar-course").css('display',"none");
		$("#drum-course").css('display',"none");
		$("#vocal-course").css('display',"none");
		$("#song-course").css('display',"none");
		$("#specialist-course").css('display',"none");
		$("#music-business").css('display',"none");
		$("#music-business").css('z-index',99);
		
		
	   
        $("#bass-course").fadeIn();
        // The main nav menu item is assigned the 'active' CSS class
		$(this).addClass("active");
    }, function() {
        // Fades out the DIV and removes the 'active' class from the main nav menu item
		hide02 = setTimeout(function() {$("#bass-course").fadeOut("fast");});
		$("li#sub-two a").removeClass("active");
    });
	// Ensures the DIV displays when your mouse moves away from the main nav menu item
    $("#bass-course").hover(function(){
        if (hide02) clearTimeout(hide02);
        $("li#sub-two a").addClass("active");
    }, function() {
        // If your mouse moves out of the displayed hidden DIV, the DIv fades out and removes the 'active' class
		hide02 = setTimeout(function() {$("#bass-course").fadeOut("fast");});
		$("li#sub-two a").removeClass("active");
    });
    


var hide03 = false;
// Shows the DIV on hover with a fade in
$("li#sub-three a").click(function(){          
   if (hide03) clearTimeout(hide03);
   $("#guitar-course").css('z-index',99);
		$("#bass-course").css('z-index',99);
		$("#drum-course").css('z-index',100);
		$("#vocal-course").css('z-index',99);
		$("#song-course").css('z-index',99);
		$("#specialist-course").css('z-index',99);
		
		$("#guitar-course").css('display',"none");
		$("#bass-course").css('display',"none");
		$("#vocal-course").css('display',"none");
		$("#song-course").css('display',"none");
		$("#specialist-course").css('display',"none");
		$("#music-business").css('display',"none");
		$("#music-business").css('z-index',99);
		
    $("#drum-course").fadeIn();
    // The main nav menu item is assigned the 'active' CSS class
	$(this).addClass("active");
}, function() {
    // Fades out the DIV and removes the 'active' class from the main nav menu item
	hide03 = setTimeout(function() {$("#drum-course").fadeOut("fast");});
	$("li#sub-three a").removeClass("active");
});
// Ensures the DIV displays when your mouse moves away from the main nav menu item
$("#drum-course").hover(function(){
    if (hide03) clearTimeout(hide03);
    $("li#sub-three a").addClass("active");
}, function() {
    // If your mouse moves out of the displayed hidden DIV, the DIv fades out and removes the 'active' class
	hide03 = setTimeout(function() {$("#drum-course").fadeOut("fast");});
	$("#drum-course").stop().fadeIn();
	$("li#sub-three a").removeClass("active");
});

             

	
        var hide04 = false;
        // Shows the DIV on hover with a fade in
        $("li#sub-four a").click(function(){          
           if (hide04) clearTimeout(hide04);
		$("#guitar-course").css('z-index',99);
		$("#bass-course").css('z-index',99);
		$("#drum-course").css('z-index',99);
		$("#vocal-course").css('z-index',100);
		$("#song-course").css('z-index',99);
		$("#specialist-course").css('z-index',99);
		
		$("#guitar-course").css('display',"none");
		$("#bass-course").css('display',"none");
		$("#drum-course").css('display',"none");
		$("#song-course").css('display',"none");
		$("#specialist-course").css('display',"none");
		$("#music-business").css('display',"none");
		$("#music-business").css('z-index',99);
		
            $("#vocal-course").fadeIn();
            // The main nav menu item is assigned the 'active' CSS class
        	$(this).addClass("active");
        }, function() {
            // Fades out the DIV and removes the 'active' class from the main nav menu item
        	hide04 = setTimeout(function() {$("#vocal-course").fadeOut("fast");});
        	$("li#sub-four a").removeClass("active");
        });
        // Ensures the DIV displays when your mouse moves away from the main nav menu item
        $("#vocal-course").hover(function(){
            if (hide04) clearTimeout(hide04);
            $("li#sub-four a").addClass("active");
        }, function() {
            // If your mouse moves out of the displayed hidden DIV, the DIv fades out and removes the 'active' class
        	hide04 = setTimeout(function() {$("#vocal-course").fadeOut("fast");});
        	$("#vocal-course").stop().fadeIn();
        	$("li#sub-four a").removeClass("active");
        });
                
             

	
var hide05 = false;
// Shows the DIV on hover with a fade in
$("li#sub-five a").click(function(){          
   if (hide05) clearTimeout(hide05);
   	    $("#guitar-course").css('z-index',99);
		$("#bass-course").css('z-index',99);
		$("#drum-course").css('z-index',99);
		$("#vocal-course").css('z-index',99);
		$("#song-course").css('z-index',100);
		$("#specialist-course").css('z-index',99);
		
		$("#guitar-course").css('display',"none");
		$("#bass-course").css('display',"none");
		$("#drum-course").css('display',"none");
		$("#vocal-course").css('display',"none");
		$("#specialist-course").css('display',"none");
		$("#music-business").css('display',"none");
		$("#music-business").css('z-index',99);
		
    $("#song-course").fadeIn();
    // The main nav menu item is assigned the 'active' CSS class
	$(this).addClass("active");
}, function() {
    // Fades out the DIV and removes the 'active' class from the main nav menu item
	hide05 = setTimeout(function() {$("#song-course").fadeOut("fast");});
	$("li#sub-five a").removeClass("active");
});
// Ensures the DIV displays when your mouse moves away from the main nav menu item
$("#song-course").hover(function(){
    if (hide05) clearTimeout(hide05);
    $("li#sub-five a").addClass("active");
}, function() {
    // If your mouse moves out of the displayed hidden DIV, the DIv fades out and removes the 'active' class
	hide05 = setTimeout(function() {$("#song-course").fadeOut("fast");});
	$("#song-course").stop().fadeIn();
	$("li#sub-five a").removeClass("active");
});

    
var hide06 = false;
// Shows the DIV on hover with a fade in
$("li#sub-six a").click(function(){          
   if (hide06) clearTimeout(hide06);
   	    $("#guitar-course").css('z-index',99);
		$("#bass-course").css('z-index',99);
		$("#drum-course").css('z-index',99);
		$("#vocal-course").css('z-index',99);
		$("#song-course").css('z-index',99);
		$("#specialist-course").css('z-index',100);
		
		$("#guitar-course").css('display',"none");
		$("#bass-course").css('display',"none");
		$("#drum-course").css('display',"none");
		$("#vocal-course").css('display',"none");
		$("#song-course").css('display',"none");
		$("#music-business").css('display',"none");
		$("#music-business").css('z-index',99);
		
    $("#specialist-course").fadeIn();
    // The main nav menu item is assigned the 'active' CSS class
	$(this).addClass("active");
}, function() {
    // Fades out the DIV and removes the 'active' class from the main nav menu item
	hide06 = setTimeout(function() {$("#specialist-course").fadeOut("fast");});
	$("li#sub-six a").removeClass("active");
});
// Ensures the DIV displays when your mouse moves away from the main nav menu item
$("#specialist-course").hover(function(){
    if (hide06) clearTimeout(hide06);
    $("li#sub-six a").addClass("active");
}, function() {
    // If your mouse moves out of the displayed hidden DIV, the DIv fades out and removes the 'active' class
	hide06 = setTimeout(function() {$("#specialist-course").fadeOut("fast");});
	$("#specialist-course").stop().fadeIn();
	$("li#sub-six a").removeClass("active");
});

var hide07 = false;
// Shows the DIV on hover with a fade in
$("li#sub-seven a").click(function(){          
   if (hide07) clearTimeout(hide07);
   	    $("#guitar-course").css('z-index',99);
		$("#bass-course").css('z-index',99);
		$("#drum-course").css('z-index',99);
		$("#vocal-course").css('z-index',99);
		$("#song-course").css('z-index',99);
		$("#specialist-course").css('z-index',99);
		
		$("#guitar-course").css('display',"none");
		$("#bass-course").css('display',"none");
		$("#drum-course").css('display',"none");
		$("#vocal-course").css('display',"none");
		$("#song-course").css('display',"none");
		$("#specialist-course").css('display',"none");
		$("#music-business").css('z-index',100);
		
    $("#music-business").fadeIn();
    // The main nav menu item is assigned the 'active' CSS class
	$(this).addClass("active");
}, function() {
    // Fades out the DIV and removes the 'active' class from the main nav menu item
	hide07 = setTimeout(function() {$("#music-business").fadeOut("fast");});
	$("li#sub-seven a").removeClass("active");
});
// Ensures the DIV displays when your mouse moves away from the main nav menu item
$("#music-business").hover(function(){
    if (hide06) clearTimeout(hide07);
    $("li#sub-seven a").addClass("active");
}, function() {
    // If your mouse moves out of the displayed hidden DIV, the DIv fades out and removes the 'active' class
	hide07 = setTimeout(function() {$("#music-business").fadeOut("fast");});
	$("#music-business").stop().fadeIn();
	$("li#sub-seven a").removeClass("active");
});

             
});	

