jQuery(document).ready(function($) {

	//When page loads...
	$(".content").hide(); //Hide all content
	$(".tabs a:first").addClass("active").show(); //Activate first tab
	$("#tab_content div:first").show(); //Show first tab content
    $("#stepsvideo").removeClass("show");//hide the video first
    
	//On Click Event
	$("div.tabs a").click(function() {

		$("div.tabs a").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$("#tab_content div").hide(); //Hide all tab content
        $("#stepsvideo").removeClass("show");//hide video
        
		var activeTab = $(this).attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active ID content
		
        if(activeTab=="#content4"){
            $("#stepsvideo").addClass("show");//show the video if on step 4
        };
        
        return false;
	});

});


jQuery(document).ready(function($) {

	//When page loads...
	$("#variable_content div").hide(); //Hide all variable
    $("#variable_content a.close").hide();
    
	//On Click Event
	$("a.variable_link").click(function() {
        
        $("#variable_content div").hide(); //Hide all current variable
        
         
        var position = $(this).position();
        var activeLink = $(this).attr("href"); //Find the href attribute value to identify the variable content
		$(activeLink).css('margin-top', position.top);
        $(activeLink).fadeIn(); //Fade in the active ID content
        $("#variable_content a.close").fadeIn();
		return false;
	});
    
    //Add close function to all windows
    $("#variable_content a.close").click(function(e) {  
        e.preventDefault();
        $("#variable_content div").fadeOut();
        $(this).fadeOut();
    });

});

jQuery(document).ready(function($) {

	//When page loads...
	$(".videoPopUp").hide(); //Hide all videos

	//On Click Event
	$(".videoLink").click(function(event) {
        $(".videoPopUp").hide(); //Hide all other videos, stops having two videos open at the same time
        event.stopPropagation();
        var videodiv = $(this).attr("rel");
        var position = $(this).position();
        $("#"+ videodiv +"").css('top', position.top);
        $("#"+ videodiv +"").fadeIn(); //Fade in the active video content
		return false;
      });
    
    
    //Add close function to all windows
    $(".videoPopUp a.close").click(function(event) {  
        //event.preventDefault();
        $(".videoPopUp").fadeOut();  
    });

});
