$().ready(function() {

    hash = window.location.hash;
    if(hash == "#feedback") {
        $(window).load(function() {
            $('a#feedback').click();
            $('#button_blue').click(); 
        });
    }
    
    // if(hash == "") { $(window).load(function() { $('#button_blue').click(); }); }
    
    if(hash == "#blue") { $(window).load(function() { $('#button_blue').click(); }); }
    if(hash == "#home") { $(window).load(function() { $('#button_blue').click(); }); }
    if(hash == "#hello!") { $(window).load(function() { $('#button_blue').click(); }); }
    
    if(hash == "#red") { $(window).load(function() { $('#button_red').click(); }); }
    if(hash == "#art") { $(window).load(function() { $('#button_red').click(); }); }
    
    if(hash == "#purple") { $(window).load(function() { $('#button_purple').click(); }); }
    if(hash == "#clients") { $(window).load(function() { $('#button_purple').click(); }); }
    
    if(hash == "#green") { $(window).load(function() { $('#button_green').click(); }); }
    if(hash == "#about") { $(window).load(function() { $('#button_green').click(); }); }
    
    // set custom jquery title with hash
    custom_title = 'Leo Mancini Design - ' + hash.replace('#', '');
    document.title = custom_title;
        
	// Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ  BEGIN START CODE Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ 
    
	/* left and right arrow key... disabled for now (i dont think it works with the new slider code <-- not sure)
	$(document).keydown(function(e) {
		switch(e.which) {
			case 37:	 $('div#section_content span#sliderprev a').click(); break;	// left arrow key
			case 39:	 $('div#section_content span#slidernext a').click(); break;	// right arrow key
		}
	});
	*/
	
	/* don't think this works for the new slider code either...
    $(document).keypress(function(e) {
		switch(e.which) {
			case 97:	 $('div#section_content span#sliderprev a').click(); break;	// A key
			case 115:	 $('div#section_content span#slidernext a').click(); break;	// S key
			case 13:	 $('div#section_content span#slidernext a').click(); break;	// return key
			case 9:	 $('div#section_content span#slidernext a').click(); break;	// tab key
		}
	});
	*/
	
	// cycles through art sections... not really necessary or widely used
    $(document).keypress(function(e) {
		switch(e.which) {
			case 53:	 $('div#design.red_button').click(); break;	// number 5 key
			case 54:	 $('div#graphics.red_button').click(); break;	// number 6 key
			case 55:	 $('div#drawings.red_button').click(); break;	// number 7 key
			case 56:	 $('div#mixed.red_button').click(); break;	// number 8 key
			case 57:	 $('div#photo.red_button').click(); break;	// number 9 key
			case 48:	 $('div#code.red_button').click(); break;	// number 0 key
		}
	});
	
	/* causes interference when user types number in a text field -- disabled until resolved
    $(document).keypress(function(e) {
		switch(e.which) {
			case 49:	 $('div#button_blue').click(); break;	 // number 1 key
			case 50:	 $('div#button_red').click(); break; // number 2 key
			case 51:	 $('div#button_purple').click(); break; // number 3 key
			case 52:	 $('div#button_green').click(); break; // number 4 key
		}
	});
    */

    // preload function
    jQuery.preloadImages = function() {
        for(var i = 0; i<arguments.length; i++) {
            jQuery("<img>").attr("src", arguments[i]);
        }
    }
    
    // lets preload some images
    $.preloadImages("images/icons/zoomin_active.png", "images/icons/zoomout.png", "images/icons/zoomout_active.png", "images/palette/sidebar/blue.png", "images/palette/sidebar/purple.png", "images/palette/sidebar/red.png", "images/palette/sidebar/green.png", "images/palette/blue_dark.png", "images/palette/purple_dark.png", "images/palette/red_dark.png", "images/palette/green_dark.png", "images/core/white_fadeout.png");
    
    // hide loading spinner
    $('#loading').hide(); 
    
	// Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ  END START CODE Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ 
	
	// Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ  START BUTTON BLUE Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ 
	
    $("#button_blue").click(function(){
        window.location.hash = "#hello!";
        document.title = 'Leo Mancini Design - hello!';
        // $("#pagepermalink").attr("href", "http://www.leomancinidesign.com/blog");
        var defaultpage = $("#title").attr("class");
        $('#content').fadeOut();  
        $('#clientele').fadeOut("slow");  
		$("#right").animate({marginLeft:'-251px'},'slow');		
        $("#button_blue").addClass("selected");
        $("#button_purple").removeClass("selected");
        $("#button_red").removeClass("selected");
        $("#button_green").removeClass("selected");
        $(this).delay(500,function(){
            $("#content").addClass("blue").removeClass("purple").removeClass("red").removeClass("green");
            $("#sidebar").addClass("blue").removeClass("purple").removeClass("red").removeClass("green");
        });
        $(this).delay(500,function() {
            $.get("content/blue.php?post=" + defaultpage, function(data){
                $(this).delay(200,function(){
                        $.get("content/sidebar/blue.php?post=" + defaultpage, function(data){
                            $("#content").css("overflow", "visible");
                            $('#sidebar').empty().html(data);
                            
                            $(".contact#phone").mouseover(function(){
                                $(".sidebar_arrow.contact").animate({marginLeft:'9px'},'fast');	
                                $("h1#contact").html("+1 718 440 1964");
                            });
                            $(".contact#email").mouseover(function(){
                                $(".sidebar_arrow.contact").animate({marginLeft:'85px'},'fast');	
                                $("h1#contact").html("leo@leomancinidesign.com");
                            });
                            $(".contact#aim").mouseover(function(){
                                $(".sidebar_arrow.contact").animate({marginLeft:'155px'},'fast');	
                                $("h1#contact").html("leo@leomancini.net");
                            });
                            
                            $(".smallicon_network.1").mouseover(function(){
                                $(".sidebar_arrow.networks").animate({marginLeft:'9px'},'fast');	
                                $("h1#networks").html("network &raquo; twitter");
                            });
                            $(".smallicon_network.2").mouseover(function(){
                                $(".sidebar_arrow.networks").animate({marginLeft:'34px'},'fast');	
                                $("h1#networks").html("network &raquo; facebook");
                            });
                            $(".smallicon_network.3").mouseover(function(){
                                $(".sidebar_arrow.networks").animate({marginLeft:'60px'},'fast');	
                                $("h1#networks").html("network &raquo; last.fm");
                            });
                            $(".smallicon_network.4").mouseover(function(){
                                $(".sidebar_arrow.networks").animate({marginLeft:'86px'},'fast');	
                                $("h1#networks").html("network &raquo; pandora");
                            });
                            $(".smallicon_network.5").mouseover(function(){
                                $(".sidebar_arrow.networks").animate({marginLeft:'112px'},'fast');	
                                $("h1#networks").html("network &raquo; tumblr");
                            });
                            $(".smallicon_network.6").mouseover(function(){
                                $(".sidebar_arrow.networks").animate({marginLeft:'138px'},'fast');	
                                $("h1#networks").html("network &raquo; google");
                            });
                            $(".smallicon_network.7").mouseover(function(){
                                $(".sidebar_arrow.networks").animate({marginLeft:'164px'},'fast');	
                                $("h1#networks").html("network &raquo; youtube");
                            });
                            $(".smallicon_network.8").mouseover(function(){
                                $(".sidebar_arrow.networks").animate({marginLeft:'191px'},'fast');	
                                $("h1#networks").html("network &raquo; skype");
                            });
                            
                            $("#title").attr("class", "BLOGHOME");
                        });
                    $('#content').empty().html(data).hide();     
                    $('#content').fadeIn();  
                    $("a.fancybox").fancybox({
                        'transitionIn': 'fade',
                        'transitionOut': 'fade',
                        'overlayColor': '#000', 
                        'overlayOpacity': '0.9',
                        'imageScale': true,
                        'centerOnScroll': true
                    });
                    
                    $("#welcome_slides_mousehack").mouseover(function(){
                        $("#welcome_slides_moreart").fadeIn();
                    });
                    $("#welcome_slides_mousehack").mouseout(function(){
                        $("#welcome_slides_moreart").fadeOut();
                    });
                    ;
                    $("#toggle_welcome_slides").click(function(){
                        $('.welcome_slides').html("<img src='../images/core/bluedefault/slides/debug.png'>");
                    });
                                                
                    $('.welcome_slides').cycle({
                        fx: 'fade',
                        timeout: 3000
                    });
                    
                    /*automatic welcome image transitions
                    $(this).delay(3500,function(){
                        $("#welcome_img3").fadeOut("slow");                        
                        $(this).delay(400,function(){
                            $("#welcome_img2").animate({left: '633px'});
                            $("#welcome_img1").animate({left: '474px'});
                            $("#welcome_img0").fadeIn("slow");
                        });      
                    });
                    
                    $(this).delay(4000,function(){
                        $("#welcome_img2").fadeOut("slow");                        
                        $(this).delay(400,function(){
                            $("#welcome_img1").animate({left: '633px'});
                            $("#welcome_img0").animate({left: '474px'});
                        });      
                    });
                    */
                    
                    /* from deprecated blog system
                    $(".more_posts").click(function(){
                        $("#content").css("overflow", "visible");
                        $("#blogpost").css("overflow", "visible");
                        $("#left").css("overflow", "visible");
                        $("#blue_default_fade").hide();
                        $("#homeblogheader").show("slow");
                        $("#longposts").show();
                        $("#shortposts").hide()
                        $("#welcome").animate({height: '0px', marginBottom: '15px'},500);
                        $(".i").fadeOut();	
                        $(this).delay(400,function(){
                            $("#welcome").fadeOut().empty();	
                        });
                    });
                */
                });
            });  
        });
        $(this).delay(1800,function(){
            $("#right").animate({marginLeft:'0px'},'slow');	
        });
        $("#title").attr("class", "");
	});		
	
	// Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ  END BUTTON BLUE Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ 
	
	// Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ  BEGIN COMMON/LIVE FUNCTIONS Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ 
    $("#comment").validate({
        rules: {
            user_name: {
				required: true
			},
            user_email: {
				required: true,
				email: true
			},
            comment_textarea: {
				required: true
			},
        },
		messages: {
            user_name: {
				required: ""
            },
            user_email: {
				required: "",
				email: ""
            },
            comment_textarea: {
				required: ""
            }
		},
        submitHandler: function(form) {
            $(form).ajaxSubmit({
                success: sendAnimation  // post-submit callback 
            });
        }
    });
		
    function sendAnimation(responseText, statusText, xhr, $form) {  
        $("form#comment input.submit").animate({width:'517px', left:'0px'},'slow').attr("style", "background-image: url(../images/core/envelope.png);").attr("value", "");
        $(this).delay(500,function(){
            user_name = $('#user_name').val();
            user_email = $('#user_email').val();
            $("#envelopeinfo").html(user_name + "<br>" + user_email).fadeIn('fast');
            $("form#comment input#user_name, input#user_email, textarea#comment_textarea").hide();
        });
        $(this).delay(1000,function(){
            $("#comment_wrapper #sending").fadeIn("slow");
        });
        $(this).delay(2500,function(){
            $("#comment_wrapper #sending").fadeOut();
        });
        $(this).delay(3000,function(){
            $("form#comment input.submit").animate({left:'-1000px'},'slow');
            $("#envelopeinfo").animate({left:'-1000px'},'slow');
        });
        $(this).delay(4000,function(){    
            $("#comment_wrapper #sent").fadeIn();
        });
        $(this).delay(8000,function(){
            $("#comment_wrapper").animate({left:'-100%'},'slow');
        });
    } 


         

           
	$(".secondclientclick").live("click", function() {
        var defaultpage = client;
        var client = $(this).attr("id");
        $.get("content/purple.php?client=" + client, function(data){
            $('#content').fadeOut();
            $('#clientele').fadeOut();  
            $(this).delay(500,function(){
                $('#clientele').empty().html(data);     
                $('#clientele').fadeIn();  
                $('#content').fadeIn();  
            });
        });
	});		
                
    $("a.clientbox").livequery( function(){	
		$(this).fancybox({ 
            'transitionIn': 'fade',
            'transitionOut': 'fade',
            'overlayColor': '#000',
            'overlayOpacity': '0.9',
            'imageScale': true,
            'centerOnScroll': true
        });
	});
	
    $("#backtoclientlist").live("click", function() {
        $("#button_purple").click();
    });
    
	// Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ  END LIVE FUNCTIONS Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ 	
	
	// Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ  BEGIN BUTTON RED Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ 	
    $("#button_red").click(function(){    
        $("#design").addClass("red_button_selected").removeClass("red_button");  
        window.location.hash = "#art";
        document.title = 'Leo Mancini Design - art';
        $('#comments').hide();  
        $("#pagepermalink").attr("href", "http://www.leomancinidesign.com/art");
        var defaultpage = $("#title").attr("class");
        $('#content').fadeOut();  
        $('#welcome').fadeOut("slow");       
         
        $("#right").animate({marginLeft:'-251px'},'slow');		
            $("#button_blue").removeClass("selected");
            $("#button_purple").removeClass("selected");
            $("#button_red").addClass("selected");
            $("#button_green").removeClass("selected");
            $(this).delay(600,function(){
                $("#content").removeClass("blue").removeClass("purple").addClass("red").removeClass("green");
                $("#sidebar").removeClass("blue").removeClass("purple").addClass("red").removeClass("green");
            });
                
        $(this).delay(1800,function(){
            $("#right").animate({marginLeft:'0px'},'slow');	
        });	   
             
        $.get("content/red.php?page=design", function(data) {
               $(this).delay(500,function(){
            
            $.get("content/sidebar/red.php", function(data){
                    $('#sidebar').empty().html(data);
                });                 
            /*     
            if(defaultpage == "red") { defaultpage = "design"; } 
            if(defaultpage == "") { defaultpage = "design"; } 
            if(defaultpage == "none") { defaultpage = "design"; } 
            if(defaultpage == "BLOGHOME") { defaultpage = "design"; } 
            */
            
            $.get("content/additional/art.php?section=design", function(section_content) {
                $('#section_content').empty().html(section_content);
                $("#design").addClass("red_button_selected").removeClass("red_button");  
                /*
                $(".red_highlight").cyclicFade({
                    repeat: 0,
                    params: [
                        {fadeout:1000, stayout:100, opout:0, fadein:1000, stayin:100, opin:1.0}
                    ]
                });
                */
                
                // ON DEFAULT PAGE LOAD
                $("a.fancybox").fancybox({
                    'transitionIn': 'fade',
                    'transitionOut': 'fade',
                    'overlayColor': '#000',
                    'overlayOpacity': '0.9',
                    'imageScale': true,
                    'centerOnScroll': true
                });
                
                // initialize scrollable 
                $("#chained").scrollable({
                    size: 1,
                    speed: 500,
                    clickable: false,
                    easing: 'swing',
                    keyboard: false
                }).navigator(); 
        
                // PROJECT VIEW
                $(".showprojectview").click(function() { 
                    projectname = $(this).attr("id");
                    $.get("content/additional/art_projectview.php?project=" + projectname, function(projectview) {
                        $('.projectview').empty().html(projectview);  
                        $('#harrisfest_scroller').jScrollHorizontalPane({
                            scrollbarHeight:1,
                            resize: false
                        });
                        $("a.projectview_thumb_link").fancybox({
                            'transitionIn': 'fade',
                            'transitionOut': 'fade', 
                            'overlayColor': '#000',
                            'overlayOpacity': '0.9',
                            'imageScale': true,
                            'centerOnScroll': true
                        });            
                        $(".projectview_escape").click(function(){  
                            $('.projectview').fadeOut("slow").empty();   
                        });
                    });
                    $(this).delay(1000,function(){
                        $('.projectview_wait').fadeOut("slow");   
                    });
                    $('.projectview').fadeIn();   
                });
        });
            
            $('#content').empty().html(data).hide();                 
            $('#content').fadeIn();  
            
            $(".red_button").live("click", function() {
                var section = $(this).attr("id");    
                $('.red_button_switch_wait').fadeIn();   
                $(this).delay(1300,function(){
                    $('.red_button_switch_wait').fadeOut();   
                });
                $(this).addClass("red_button_selected").removeClass("red_button");  
                $(".red_button").not(this).removeClass("red_button_selected");      
                $(".red_button_selected").not(this).removeClass("red_button_selected").addClass("red_button");                   
                $("#pagepermalink").attr("href", "http://www.leomancinidesign.com/art:" + section);
                $(this).delay(200,function(){
                    $.get("content/additional/art.php?section=" + section, function(section_content){
                    $('#section_content').empty().html(section_content);        
                    // ON SECONDARY CLICK
                    $("a.fancybox").fancybox({
                        'transitionIn': 'fade',
                        'transitionOut': 'fade',
                        'overlayColor': '#000',
                        'overlayOpacity': '0.9',
                        'imageScale': true,
                        'centerOnScroll': true
                    });
        
                    // initialize scrollable 
                    $("#chained").scrollable({
                        size: 1,
                        speed: 500,
                        clickable: false,
                        easing: 'swing',
                        keyboard: false
                    }).navigator(); 
            
                    // PROJECT VIEW
                    $(".showprojectview").click(function() { 
                        projectname = $(this).attr("id");
                        $.get("content/additional/art_projectview.php?project=" + projectname, function(projectview) {
                            $('.projectview').empty().html(projectview);  
                            $('#harrisfest_scroller').jScrollHorizontalPane({
                                scrollbarHeight:1,
                                resize: false
                            });
                            $("a.projectview_thumb_link").fancybox({
                                'transitionIn': 'fade',
                                'transitionOut': 'fade', 
                                'overlayColor': '#000',
                                'overlayOpacity': '0.9',
                                'imageScale': true,
                                'centerOnScroll': true
                            });            
                            $(".projectview_escape").click(function(){  
                                $('.projectview').fadeOut("slow").empty();   
                            });
                        });
                        $(this).delay(1000,function(){
                            $('.projectview_wait').fadeOut("slow");   
                        });
                        $('.projectview').fadeIn();   
                    });
                });
                });
            });
            
            $(".red_button_selected").click(function() {
                var section = $(this).attr("id");    
                $('.red_button_switch_wait').fadeIn();   
                $(this).delay(1000,function(){
                    $('.red_button_switch_wait').fadeOut();   
                });
                $(this).addClass("red_button_selected").removeClass("red_button");  
                $(".red_button").not(this).removeClass("red_button_selected");              
                $(".red_button_selected").not(this).removeClass("red_button_selected").addClass("red_button");        
                $.get("content/additional/art.php?section=" + section, function(section_content){
                    $('#section_content').empty().html(section_content);       
                    // ON SECONDARY CLICK
                    $("a.fancybox").fancybox({
                        'transitionIn': 'fade',
                        'transitionOut': 'fade',
                        'overlayColor': '#000',
                        'overlayOpacity': '0.9',
                        'imageScale': true,
                        'centerOnScroll': true
                    });
                    
                    // scroller code
                    $.easing.custom = function (x, t, b, c, d) { 
                        var s = 1.70158;  
                        if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; 
                        return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; 
                    }
        
                    // initialize scrollable 
                    $("#chained").scrollable({
                        size: 1,
                        speed: 500,
                        clickable: false,
                        easing: 'swing',
                        keyboard: false
                    }).navigator(); 
            
                    // PROJECT VIEW
                    $(".showprojectview").click(function() { 
                        projectname = $(this).attr("id");
                        $.get("content/additional/art_projectview.php?project=" + projectname, function(projectview) {
                            $('.projectview').empty().html(projectview);  
                            $('#harrisfest_scroller').jScrollHorizontalPane({
                                scrollbarHeight:1,
                                resize: false
                            });
                            $("a.projectview_thumb_link").fancybox({
                                'transitionIn': 'fade',
                                'transitionOut': 'fade', 
                                'overlayColor': '#000',
                                'overlayOpacity': '0.9',
                                'imageScale': true,
                                'centerOnScroll': true
                            });            
                            $(".projectview_escape").click(function(){  
                                $('.projectview').fadeOut("slow").empty();   
                            });
                        });
                        $(this).delay(1000,function(){
                            $('.projectview_wait').fadeOut("slow");   
                        });
                        $('.projectview').fadeIn();   
                    });
                });
            });
                
            });
        });
        
        $("#title").attr("class", "");
    });				

    
    
	// Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ  END BUTTON RED Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ 	
	
	// Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ  START BUTTON PURPLE Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ 
	
    $("#button_purple").live("click", function() {
        window.location.hash = "#clients";
        document.title = 'Leo Mancini Design - clients';
        $('#comments').hide();  
        $("#left").animate({paddingBottom: "0px",height: "325px"},'slow');
        $("#blogpost").animate({paddingBottom: "0px",height: "300px"},'slow');
        $("#content").animate({paddingBottom: "0px",height: "300px"},'slow');
        var defaultpage = $("#title").attr("class");
        if(defaultpage == "BLOGHOME") { defaultpage = ""; }
        if(defaultpage == "none") { defaultpage = "purple"; }
        $('#content').fadeOut();  
        $('#clientele').fadeOut();  
        $("#button_blue").removeClass("selected");
        $("#button_purple").addClass("selected");
        $("#button_red").removeClass("selected");
        $("#button_green").removeClass("selected");
        $(this).delay(500,function(){
                $("#content").removeClass("blue").addClass("purple").removeClass("red").removeClass("green");
                $("#sidebar").removeClass("blue").addClass("purple").removeClass("red").removeClass("green");
        });       
        $("#right").animate({marginLeft:'-251px'},'slow');	
        $(this).delay(1800,function(){
            $("#right").animate({marginLeft:'0px'},'slow');	
        });
        $.get("content/purple.php?defaultpage=" + defaultpage, function(data) {
            $(this).delay(200,function() {
                if(defaultpage == "purple") {
                    purplesidebar = "purple.php?moreclients=0&defaultpage=" + defaultpage;
                    $("#pagepermalink").attr("href", "http://www.leomancinidesign.com/clients");
                }
                if(defaultpage != "purple") {
                    if(defaultpage == "") {
                        purplesidebar = "purple.php?moreclients=0&defaultpage=" + defaultpage;
                        $("#pagepermalink").attr("href", "http://www.leomancinidesign.com/clients");
                    } else {
                        purplesidebar = "clientinfo.php?client=" + defaultpage;
                        $("#pagepermalink").attr("href", "http://www.leomancinidesign.com/client:" + defaultpage);
                    }
                }
                $.get("content/sidebar/" + purplesidebar, function(data) {
                    $('#sidebar').empty().html(data);
                    $(".clientclick").click(function() {     
                        $("#right").animate({marginLeft:'-251px'},'slow');	
                        $(this).delay(1800,function(){
                            $("#right").animate({marginLeft:'0px'},'slow');	
                        });
                        $('#content').fadeOut();  
                        $('#clientele').fadeOut();  
                        var client = $(this).attr("id");
                        var defaultpage = client;
                        $("#pagepermalink").attr("href", "http://www.leomancinidesign.com/client:" + client);
                        $.preloadImages("images/clientele/" + client + "_website_big.png", "images/clientele/" + client + "_website.png", "images/clientele/" + client + "_logo.png", "images/clientele/" + client + ".png");
                        $.get("content/purple.php?client=" + client + "&defaultpage=" + defaultpage, function(data){
                            $('#content').fadeOut();
                            $('#clientele').fadeOut();                                  
                            $('#clientele').empty().html(data);  
                            $('#content').fadeIn();
                            $('#clientele').fadeIn();
                        });
                        $.get("content/sidebar/clientinfo.php?client=" + client, function(data){
                            $('#sidebar').empty().html(data);
                            $(".secondclientclick").click(function() {
                                var defaultpage = client;
                                var client = $(this).attr("id");
                                $.get("content/purple.php?client=" + client, function(data){
                                    $('#content').fadeOut();
                                    $('#clientele').fadeOut();  
                                    $(this).delay(500,function(){
                                        $('#clientele').empty().html(data);     
                                        $('#clientele').fadeIn();  
                                        $('#content').fadeIn();  
                                    });
                                });
                            });
                        });
                    });
                    $(".moreclients").click(function(){
                        $("#right").animate({marginLeft:'-251px'},'slow');	
                        $(this).delay(1800,function(){
                            $("#right").animate({marginLeft:'0px'},'slow');	
                        });
                        var number = $(this).attr("id");
                        $(this).delay(500,function(){
                            $.get("content/sidebar/purple.php?moreclients=" + number, function(data){
                                $('#sidebar').empty().html(data);
                                            $(".clientclick").click(function() {     
                                                $("#right").animate({marginLeft:'-251px'},'slow');	
                                                $(this).delay(1800,function(){
                                                    $("#right").animate({marginLeft:'0px'},'slow');	
                                                });
                                                $('#content').fadeOut();  
                                                $('#clientele').fadeOut();  
                                                var client = $(this).attr("id");
                                                var defaultpage = client;
                                                $("#pagepermalink").attr("href", "http://www.leomancinidesign.com/client:" + client);
                                                $.preloadImages("images/clientele/" + client + "_website_big.png", "images/clientele/" + client + "_website.png", "images/clientele/" + client + "_logo.png", "images/clientele/" + client + ".png");
                                                $.get("content/purple.php?client=" + client + "&defaultpage=" + defaultpage, function(data){
                                                    $('#content').fadeOut();
                                                    $('#clientele').fadeOut();                                  
                                                    $('#clientele').empty().html(data);  
                                                    $('#content').fadeIn();
                                                    $('#clientele').fadeIn();
                                                });
                                                $.get("content/sidebar/clientinfo.php?client=" + client, function(data){
                                                    $('#sidebar').empty().html(data);
                                                    $(".secondclientclick").click(function() {
                                                        var defaultpage = client;
                                                        var client = $(this).attr("id");
                                                        $.get("content/purple.php?client=" + client, function(data){
                                                            $('#content').fadeOut();
                                                            $('#clientele').fadeOut();  
                                                            $(this).delay(500,function(){
                                                                $('#clientele').empty().html(data);     
                                                                $('#clientele').fadeIn();  
                                                                $('#content').fadeIn();  
                                                            });
                                                        });
                                                    });
                                                });
                                            });
                            });
                        });      
                    });
                });
                    $(this).delay(700,function() {
                    $('#content').empty().html(data);     
                    $('#content').fadeIn();  
                    $("a.fancybox").fancybox({
                        'transitionIn': 'fade',
                        'transitionOut': 'fade',
                        'overlayColor': '#000',
                        'overlayOpacity': '0.9',
                        'imageScale': true,
                        'centerOnScroll': true
                    });
                    $("#shootemail1").click(function(){
                        $("#shootemail1").animate({marginLeft:'-154px'},'slow');		
                        $("#shootemail1").css("opacity", "0.57");
                        $("#shootemail2").css("opacity", "0.0");
                        $(this).delay(500,function() {
                            $("#shootemail4").show();	
                            $("#shootemail5").show();	
                            $("#shootemail3").hide();	
                        });
                    });
                });
            });
        });
        $("#title").attr("class", "");
	});			

	// Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ  END BUTTON PURPLE Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ 
	
	// Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ  BEGIN BUTTON GREEN Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ 
	
    $("#button_green").click(function(){  
        window.location.hash = "#about";
        document.title = 'Leo Mancini Design - about';
        $('#comments').hide();  
        $("#pagepermalink").attr("href", "http://www.leomancinidesign.com/about");
        $('#content').fadeOut();  
        $('#clientele').fadeOut("slow");  
		$("#right").animate({marginLeft:'-251px'},'slow');		
        $("#button_blue").removeClass("selected");
        $("#button_purple").removeClass("selected");
        $("#button_red").removeClass("selected");
        $("#button_green").addClass("selected");
        $(this).delay(600,function(){
            $("#content").removeClass("blue").removeClass("purple").removeClass("red").addClass("green");
            $("#sidebar").removeClass("blue").removeClass("purple").removeClass("red").addClass("green");
        });
        $(this).delay(1800,function(){
            $("#right").animate({marginLeft:'0px'},'slow');	
        });
        $.get("content/green.php", function(data){
            $(this).delay(500,function(){
                $.get("content/sidebar/green.php", function(data){
                    $('#sidebar').empty().html(data);
                });
                $('#content').empty().html(data).hide();     
                $(".get_randomfacts").click(function(){
                    $.get("content/additional/green_helper.php", function(data1){
                        $('#randomfacts1').empty().html(data1);
                    });
                    $.get("content/additional/green_helper.php", function(data2){
                        $('#randomfacts2').empty().html(data2);
                    });
                    $.get("content/additional/green_helper.php", function(data3){
                        $('#randomfacts3').empty().html(data3);
                    });
                });
                $('.get_randomfacts').click();
                $('#content').fadeIn();  
            });
        });	
        $("#title").attr("class", "");
	});		
    
	// Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ  END BUTTON GREEN Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ Ñ 

	
    $("a#feedback").click(function() {        
        document.title = 'Leo Mancini Design - feedback';
        $("#comment_wrapper").animate({width:'100%'},1000);	
        $("form#comment").animate({left:'0px'},1000);	
    });
	
});