/***************************/
//@Script: Digicution Menu Fader
//@Author: Dan Perkins
//@Website: www.digicution.com
//@Email: dan@digicution.com
//@License: Freeware but please keep the credits if you can :)					
/***************************/

$(document).ready(function(){  
	
	//Preloader For Images
jQuery(function( $ ){	
	/**
	 * All the functions below, are used to update the summary div
	 * That is not the objective of the plugin, the really important part 
	 * is the one right below. The option placeholder, and threshold.
	 */
	 
	$.preload( '.CSSPreloadImages img', {//the first argument is a selector to the images
		onRequest:request,
		onComplete:complete,
		onFinish:finish,
		placeholder:'../img/placeholder.jpg',//this is the really important option
		notFound:'../img/notfound.jpg',//optional image if an image wasn't found
		threshold: 1, //'2' is the default, how many at a time, to load.
		enforceCache: true
	});
	
	function update( data ){
		$(".QLoadWhat").fadeIn(100);
		$('#done').html( ''+data.done );
		$('#total').html( ''+data.total );
		$('#loaded').html( ''+data.loaded );
		$('#failed').html( ''+data.failed );
		$('.QLoader').css('width', Math.round((data.done/data.total)*100)+'%');
		$('.QAmt').html( ''+Math.round((data.done/data.total)*100)+'%');
	};
	function complete( data ){
		update( data );
		var justImage = (data.image).replace("http://www.digicution.com/images/","")  
		$('#image-next').html( 'none' );//reset the "loading: xxxx"
		$('#image-loaded').html( justImage );
	};
	function request( data ){
		update( data );
		$('#image-next').html( data.image );//set the "loading: xxxx"
	};
	function finish(){//hide the summary
		$(".QOverlay").fadeOut(1500);
		$("body").oneTime(1600, function() {
			$(".PreloadFader").css("display", "block");
			$("body").css("background-image", "url('../images/Digicution-Earth-Background.gif')");
			$(".Header").css("display", "block"); 
			$(".Container").css("display", "block");
			$(".Background.home").css("display", "block");
			
			$("#home").addClass("active");  
			$("#about").removeClass("active");  
			$("#folio").removeClass("active");  
			$("#contact").removeClass("active"); 
			$("#footerhome").addClass("active");  
			$("#footerabout").removeClass("active");  
			$("#footerfolio").removeClass("active");  
			$("#footercontact").removeClass("active"); 
			$("div.contentabout").css("display", "none"); 
			$("div.contentfolio").css("display", "none"); 
			$("div.contentcontact").css("display", "none"); 
			$("div.about").css("display", "none"); 
			$("div.contact").css("display", "none"); 
			$("div.about2").css("display", "none"); 
			$("div.contact2").css("display", "none"); 
			$("div.folio2").css("display", "none"); 
			$("div.home1").css("display", "none"); 
			$("div.home2").css("display", "none"); 
			
			$("div.contenthome").fadeIn(100);
			$(".PreloadFader").fadeOut(1000);
			$("div.home1").fadeIn(1500).delay(3000).fadeOut(1500);  
			$("div.home2").delay(6000).fadeIn(1500);

		});
	};
});

//Remove Solid Links
$("a").removeAttr("href");

//Add JS Class To Footer
$("#Digicution-Footer").addClass("js");

//Add Map Function
$("#DigicutionMainBoardHome").addClass("map");
$("#DigicutionMainBoardAbout").removeClass("map");
$("#DigicutionMainBoardFolio").removeClass("map");
$(function() { $('.map').maphilight(); });

//Remove Active Classes Required For Pre-loader
$("#about").removeClass("active");  
$("#folio").removeClass("active");  
$("#contact").removeClass("active");  
$("#footerabout").removeClass("active");  
$("#footerfolio").removeClass("active");  
$("#footercontact").removeClass("active"); 

//Remove Excess Contact Screens 
$("div.contact3").css("display", "none");  
$("div.contact4").css("display", "none");  

//Add Contact Screen Functionality
$(".contactmap > area").click(function(e){  
        switch(e.target.id){  
            case "contactboardemail":  
                //perform scroll baby 
                window.location.href="mailto:dan@digicution.com"
            break;  
            case "contactboardform":  
                //perform scroll baby 
                $.scrollTo(".contentcontact",1000)
            break;  
        }  
        //alert(e.target.id);  
        return false;  
});  

//Add Portfolio Screen Functionality
$(".foliomap > area").click(function(e){  
        switch(e.target.id){  
            case "folioweb":  
                //perform scroll baby 
                $.scrollTo("#websites",1000)
            break;  
            case "foliofly":  
                //perform scroll baby 
                $.scrollTo("#othermedia",1000)
            break;  
        }  
        //alert(e.target.id);  
        return false;  
});  
            
//Create Contact Board Animations For Email 
$(".contactboardemail").hover(
  function () {
    $("div.contact2").css("display", "none");
    $("div.contact3").css("display", "block");
  },
  function () {
    $("div.contact3").css("display", "none");
    $("div.contact2").css("display", "block");
  }
);

//Create Contact Board Animations For Form
$(".contactboardform").hover(
  function () {
    $("div.contact2").css("display", "none");
    $("div.contact4").css("display", "block");
  },
  function () {
    $("div.contact4").css("display", "none");
    $("div.contact2").css("display", "block");
  }
);

//Add Scroll Options To Footer
$(".footer > li").click(function(e){  
        switch(e.target.id){  
            case "footerback":  
                //perform scroll baby 
                $.scrollTo(".Header",1000)
            break;  
        }  
        //alert(e.target.id);  
        return false;  
});  

//Add Scroll Options To About Board
$(".aboutmap > area").click(function(e){  
        switch(e.target.id){  
            case "aboutme":  
                //perform scroll baby 
                $.scrollTo("#MeMeMe",1000)
            break;  
            case "aboutskills":  
                //perform scroll baby 
                $.scrollTo("#MySkills",1000)
            break;  
            case "aboutmaking":  
                //perform scroll baby 
                $.scrollTo("#MeMaking",1000)
            break;  
        }  
        //alert(e.target.id);  
        return false;  
});  


//Colour & Image Switching JQuery Code For Menu
$("#home").click(function(){
        //change status & style menu  
        $("#home").addClass("active");  
        $("#about").removeClass("active");  
        $("#folio").removeClass("active");  
        $("#contact").removeClass("active"); 
        $("#footerhome").addClass("active");  
        $("#footerabout").removeClass("active");  
        $("#footerfolio").removeClass("active");  
        $("#footercontact").removeClass("active"); 
		$("#DigicutionMainBoardHome").addClass("map");
		$("#DigicutionMainBoardAbout").removeClass("map");
		$("#DigicutionMainBoardFolio").removeClass("map");
        //cancel any in-progress anims and hide unwanted content 
		$("div.Weather").stop(true,true);
        $("div.Weather").css("display", "none"); 
        $("div.contentabout").css("display", "none"); 
        $("div.contentfolio").css("display", "none"); 
        $("div.contentcontact").css("display", "none"); 
        $("div.about2").css("display", "none"); 
        $("div.contact2").css("display", "none"); 
        $("div.folio2").css("display", "none"); 
		//perform some sexy animation
        $("div.home").fadeIn(1000);  
        $("div.about").fadeOut(1000);  
        $("div.folio").fadeOut(1000); 
        $("div.contact").fadeOut(1000);
        $("div.contenthome").fadeIn(1000);  
        $("div.Weather.cloud").delay(600).fadeIn(1150); 
        $("div.home2").fadeIn(1500); 
		$(function() { $('.map').maphilight(); });
}); 

$("#about").click(function(){
        //change status & style menu  
        $("#about").addClass("active");  
        $("#home").removeClass("active");  
        $("#folio").removeClass("active"); 
        $("#contact").removeClass("active"); 
        $("#footerabout").addClass("active");  
        $("#footerhome").removeClass("active");  
        $("#footerfolio").removeClass("active");  
        $("#footercontact").removeClass("active"); 
		$("#DigicutionMainBoardAbout").addClass("map");
		$("#DigicutionMainBoardHome").removeClass("map");
		$("#DigicutionMainBoardFolio").removeClass("map");
        //cancel any in-progress anims and hide unwanted content 
		$("div.Weather").stop(true,true);
		$("div.home2").stop(true,true);
        $("div.Weather").css("display", "none"); 
        $("div.home1").css("display", "none"); 
        $("div.home2").css("display", "none"); 
        $("div.contact2").css("display", "none"); 
        $("div.folio2").css("display", "none"); 
        $("div.contenthome").css("display", "none"); 
        $("div.contentfolio").css("display", "none"); 
        $("div.contentcontact").css("display", "none"); 
		//perform some sexy animation
        $("div.about").fadeIn(1000); 
        $("div.home").fadeOut(1000);
        $("div.folio").fadeOut(1000);  
        $("div.contact").fadeOut(1000); 
        $("div.contentabout").fadeIn(1000);  
        $("div.Weather.lightning").delay(600).fadeIn(1150); 
        $("div.about2").fadeIn(1500);  
		$(function() { $('.map').maphilight(); });
}); 

$("#folio").click(function(){
        //change status & style menu 
        $("#folio").addClass("active");  
        $("#home").removeClass("active");  
        $("#about").removeClass("active");  
        $("#contact").removeClass("active");
        $("#footerfolio").addClass("active");  
        $("#footerhome").removeClass("active");  
        $("#footerabout").removeClass("active");  
        $("#footercontact").removeClass("active"); 
		$("#DigicutionMainBoardFolio").addClass("map");
		$("#DigicutionMainBoardAbout").removeClass("map");
		$("#DigicutionMainBoardHome").removeClass("map");
        //cancel any in-progress anims and hide unwanted content 
		$("div.Weather").stop(true,true);
		$("div.home2").stop(true,true);
        $("div.Weather").css("display", "none"); 
        $("div.home1").css("display", "none"); 
        $("div.home2").css("display", "none"); 
        $("div.about2").css("display", "none"); 
        $("div.contact2").css("display", "none"); 
        $("div.contentabout").css("display", "none"); 
        $("div.contenthome").css("display", "none"); 
        $("div.contentcontact").css("display", "none"); 
		//perform some sexy animation
        $("div.folio").fadeIn(1000);
        $("div.home").fadeOut(1000); 
        $("div.about").fadeOut(1000); 
        $("div.contact").fadeOut(1000);
        $("div.contentfolio").fadeIn(1000);  
        $("div.Weather.sun").delay(600).fadeIn(1150); 
        $("div.folio2").fadeIn(1500);  
		$(function() { $('.map').maphilight(); });
}); 

$("#contact").click(function(){
        //change status & style menu  
        $("#contact").addClass("active");  
        $("#home").removeClass("active");  
        $("#about").removeClass("active");  
        $("#folio").removeClass("active");  
        $("#footercontact").addClass("active");  
        $("#footerhome").removeClass("active");  
        $("#footerabout").removeClass("active");  
        $("#footerfolio").removeClass("active"); 
		$("#DigicutionMainBoardHome").removeClass("map");
		$("#DigicutionMainBoardAbout").removeClass("map");
		$("#DigicutionMainBoardFolio").removeClass("map");
        //cancel any in-progress anims and hide unwanted content
		$("div.Weather").stop(true,true);
		$("div.home2").stop(true,true);
        $("div.home1").css("display", "none"); 
        $("div.home2").css("display", "none"); 
        $("div.about2").css("display", "none"); 
        $("div.folio2").css("display", "none"); 
        $("div.Weather").css("display", "none"); 
        $("div.contentabout").css("display", "none"); 
        $("div.contentfolio").css("display", "none"); 
        $("div.contenthome").css("display", "none"); 
		//perform some sexy animation
        $("div.contact").fadeIn(1000);
        $("div.home").fadeOut(1000);
        $("div.about").fadeOut(1000);
        $("div.folio").fadeOut(1000);
        $("div.contentcontact").fadeIn(1000);  
        $("div.Weather.night").delay(600).fadeIn(1150); 
        $("div.contact2").fadeIn(1500); 
});

    
//Colour & Image Switching JQuery Code For footer
$(".footer > li").click(function(e){  
        switch(e.target.id){  
            case "footerhome":  
                //change status & style menu  
                $("#home").addClass("active");  
                $("#about").removeClass("active");  
                $("#folio").removeClass("active");  
                $("#contact").removeClass("active");
                $("#footerhome").addClass("active");  
                $("#footerabout").removeClass("active");  
                $("#footerfolio").removeClass("active");  
                $("#footercontact").removeClass("active"); 
				$("#DigicutionMainBoardHome").addClass("map");
				$("#DigicutionMainBoardAbout").removeClass("map");
				$("#DigicutionMainBoardFolio").removeClass("map");
                //cancel any in-progress anims and hide unwanted content 
				$("div.Weather").stop(true,true);
                $("div.Weather").css("display", "none"); 
                $("div.contentabout").css("display", "none"); 
                $("div.contentfolio").css("display", "none"); 
                $("div.contentcontact").css("display", "none"); 
                $("div.about2").css("display", "none"); 
                $("div.contact2").css("display", "none"); 
                $("div.folio2").css("display", "none"); 
				//perform some sexy animation
                $("div.home").fadeIn(1000);  
                $("div.about").fadeOut(1000);  
                $("div.folio").fadeOut(1000); 
                $("div.contact").fadeOut(1000);
                $("div.contenthome").fadeIn(1000);  
                $("div.Weather.cloud").delay(600).fadeIn(1150); 
                $("div.home2").fadeIn(1500);  
				$(function() { $('.map').maphilight(); });
            break;  
            case "footerabout":  
                //change status & style menu  
                $("#about").addClass("active");  
                $("#home").removeClass("active");  
                $("#folio").removeClass("active"); 
                $("#contact").removeClass("active");
                $("#footerabout").addClass("active");  
                $("#footerhome").removeClass("active");  
                $("#footerfolio").removeClass("active");  
                $("#footercontact").removeClass("active"); 
				$("#DigicutionMainBoardAbout").addClass("map");
				$("#DigicutionMainBoardHome").removeClass("map");
				$("#DigicutionMainBoardFolio").removeClass("map");
                //cancel any in-progress anims and hide unwanted content 
				$("div.Weather").stop(true,true);
				$("div.home2").stop(true,true);
                $("div.Weather").css("display", "none"); 
                $("div.home1").css("display", "none"); 
                $("div.home2").css("display", "none"); 
                $("div.contact2").css("display", "none"); 
                $("div.folio2").css("display", "none"); 
                $("div.contenthome").css("display", "none"); 
                $("div.contentfolio").css("display", "none"); 
                $("div.contentcontact").css("display", "none"); 
				//perform some sexy animation
                $("div.about").fadeIn(1000); 
                $("div.home").fadeOut(1000);
                $("div.folio").fadeOut(1000);  
                $("div.contact").fadeOut(1000); 
                $("div.contentabout").fadeIn(1000);  
                $("div.Weather.lightning").delay(600).fadeIn(1150); 
                $("div.about2").fadeIn(1500);  
				$(function() { $('.map').maphilight(); });
            break;  
            case "footerfolio":  
                //change status & style menu 
                $("#folio").addClass("active");  
                $("#home").removeClass("active");  
                $("#about").removeClass("active");  
                $("#contact").removeClass("active");
                $("#footerfolio").addClass("active");  
                $("#footerhome").removeClass("active");  
                $("#footerabout").removeClass("active");  
                $("#footercontact").removeClass("active");
				$("#DigicutionMainBoardFolio").addClass("map");
				$("#DigicutionMainBoardAbout").removeClass("map");
				$("#DigicutionMainBoardHome").removeClass("map");
                //cancel any in-progress anims and hide unwanted content 
				$("div.Weather").stop(true,true);
				$("div.home2").stop(true,true);
                $("div.Weather").css("display", "none"); 
                $("div.home1").css("display", "none"); 
                $("div.home2").css("display", "none"); 
                $("div.about2").css("display", "none"); 
                $("div.contact2").css("display", "none"); 
                $("div.contentabout").css("display", "none"); 
                $("div.contenthome").css("display", "none"); 
                $("div.contentcontact").css("display", "none"); 
				//perform some sexy animation
                $("div.folio").fadeIn(1000);
                $("div.home").fadeOut(1000); 
                $("div.about").fadeOut(1000); 
                $("div.contact").fadeOut(1000);
                $("div.contentfolio").fadeIn(1000);  
                $("div.Weather.sun").delay(600).fadeIn(1150); 
                $("div.folio2").fadeIn(1500);  
				$(function() { $('.map').maphilight(); });
            break;  
            case "footercontact":  
                //change status & style menu  
                $("#contact").addClass("active");  
                $("#home").removeClass("active");  
                $("#about").removeClass("active");  
                $("#folio").removeClass("active");  
                $("#footercontact").addClass("active");  
                $("#footerhome").removeClass("active");  
                $("#footerabout").removeClass("active");  
                $("#footerfolio").removeClass("active");  
				$("#DigicutionMainBoardHome").removeClass("map");
				$("#DigicutionMainBoardAbout").removeClass("map");
				$("#DigicutionMainBoardFolio").removeClass("map");
                //cancel any in-progress anims and hide unwanted content
				$("div.Weather").stop(true,true);
				$("div.home2").stop(true,true);
                $("div.home1").css("display", "none"); 
                $("div.home2").css("display", "none"); 
                $("div.about2").css("display", "none"); 
                $("div.folio2").css("display", "none"); 
                $("div.Weather").css("display", "none"); 
                $("div.contentabout").css("display", "none"); 
                $("div.contentfolio").css("display", "none"); 
                $("div.contenthome").css("display", "none"); 
				//perform some sexy animation
                $("div.contact").fadeIn(1000);
                $("div.home").fadeOut(1000);
                $("div.about").fadeOut(1000);
                $("div.folio").fadeOut(1000);
                $("div.contentcontact").fadeIn(1000);  
                $("div.Weather.night").delay(600).fadeIn(1150); 
                $("div.contact2").fadeIn(1500);  
            break;  
        }  
        //alert(e.target.id);  
        return false;  
    });  
    
//Colour & Image Switching JQuery Code For Homepage Main Board
$(".HomerSimpson").click(function(e){  
        switch(e.target.id){  
            case "homenav3":  
                //change status & style menu  
                $("#home").removeClass("active"); 
                $("#about").addClass("active");  
                $("#folio").removeClass("active"); 
                $("#contact").removeClass("active"); 
                $("#footerabout").addClass("active");  
                $("#footerhome").removeClass("active");  
                $("#footerfolio").removeClass("active");  
                $("#footercontact").removeClass("active"); 
				$("#DigicutionMainBoardAbout").addClass("map");
				$("#DigicutionMainBoardHome").removeClass("map");
				$("#DigicutionMainBoardFolio").removeClass("map");
                //cancel any in-progress anims and hide unwanted content 
				$("div.Weather").stop(true,true);
				$("div.home2").stop(true,true);
                $("div.Weather").css("display", "none"); 
                $("div.home1").css("display", "none"); 
                $("div.home2").css("display", "none"); 
                $("div.contact2").css("display", "none"); 
                $("div.folio2").css("display", "none"); 
                $("div.contenthome").css("display", "none"); 
                $("div.contentfolio").css("display", "none"); 
                $("div.contentcontact").css("display", "none"); 
				//perform some sexy animation
                $("div.about").fadeIn(1000); 
                $("div.home").fadeOut(1000);
                $("div.folio").fadeOut(1000);  
                $("div.contact").fadeOut(1000); 
                $("div.contentabout").fadeIn(1000);  
                $("div.Weather.lightning").delay(600).fadeIn(1150); 
                $("div.about2").fadeIn(1500);  
				$(function() { $('.map').maphilight(); });
            break;  
            case "homenav2":  
                //change status & style menu
                $("#home").removeClass("active"); 
                $("#folio").addClass("active");  
                $("#about").removeClass("active");  
                $("#contact").removeClass("active"); 
                $("#footerfolio").addClass("active");  
                $("#footerhome").removeClass("active");  
                $("#footerabout").removeClass("active");  
                $("#footercontact").removeClass("active");
				$("#DigicutionMainBoardFolio").addClass("map");
				$("#DigicutionMainBoardAbout").removeClass("map");
				$("#DigicutionMainBoardHome").removeClass("map");
                //cancel any in-progress anims and hide unwanted content 
				$("div.Weather").stop(true,true);
				$("div.home2").stop(true,true);
                $("div.Weather").css("display", "none"); 
                $("div.home1").css("display", "none"); 
                $("div.home2").css("display", "none"); 
                $("div.about2").css("display", "none"); 
                $("div.contact2").css("display", "none"); 
                $("div.contentabout").css("display", "none"); 
                $("div.contenthome").css("display", "none"); 
                $("div.contentcontact").css("display", "none"); 
				//perform some sexy animation
                $("div.folio").fadeIn(1000);
                $("div.home").fadeOut(1000); 
                $("div.about").fadeOut(1000); 
                $("div.contact").fadeOut(1000);
                $("div.contentfolio").fadeIn(1000);  
                $("div.Weather.sun").delay(600).fadeIn(1150); 
                $("div.folio2").fadeIn(1500); 
				$(function() { $('.map').maphilight(); });
            break;  
            case "homenav1":  
                //change status & style menu 
                $("#home").removeClass("active");
                $("#contact").addClass("active");  
                $("#about").removeClass("active");  
                $("#folio").removeClass("active"); 
                $("#footercontact").addClass("active");  
                $("#footerhome").removeClass("active");  
                $("#footerabout").removeClass("active");  
                $("#footerfolio").removeClass("active"); 
				$("#DigicutionMainBoardHome").removeClass("map");
				$("#DigicutionMainBoardAbout").removeClass("map");
				$("#DigicutionMainBoardFolio").removeClass("map");
                //cancel any in-progress anims and hide unwanted content
				$("div.Weather").stop(true,true);
				$("div.home2").stop(true,true);
                $("div.home1").css("display", "none"); 
                $("div.home2").css("display", "none"); 
                $("div.about2").css("display", "none"); 
                $("div.folio2").css("display", "none"); 
                $("div.Weather").css("display", "none"); 
                $("div.contentabout").css("display", "none"); 
                $("div.contentfolio").css("display", "none"); 
                $("div.contenthome").css("display", "none"); 
				//perform some sexy animation
                $("div.contact").fadeIn(1000);
                $("div.home").fadeOut(1000);
                $("div.about").fadeOut(1000);
                $("div.folio").fadeOut(1000);
                $("div.contentcontact").fadeIn(1000);  
                $("div.Weather.night").delay(600).fadeIn(1150); 
                $("div.contact2").fadeIn(1500);
            break;  
        }  
        //alert(e.target.id);  
        return false;  
    });  
         
}); 