$(document).ready(function() {
    $(window).ready(function(){
        //var h = $(window).height();
        var h = $.browser.safari ? document.documentElement.clientHeight : $(window).height();
        var w = $(window).width();
        var m = 0;
        if (h > 611)
        {
        	m = (h - 611) / 2;
        }
        //window.alert("ready:" + h);
        $('#content').css({ 'margin-top' : m + 'px' });
        $('#content').css({ 'margin-bottom' : m + 'px' });
    });

    $(window).resize(function(){
        var h = $(window).height();
        var w = $(window).width();	        
        var m = 0;
        if (h > 611)
        {
        	m = (h - 611) / 2;
        }
        //window.alert("resize: " + h);
        $('#content').css({ 'margin-top' : m + 'px' });
		$('#content').css({ 'margin-bottom' : m + 'px' });
    });

 	recycle();
});

function recycle() {
	$('#s1').cycle({ 
	    fx:    'fade',
	    speed:	2000,
	    delay: -6000,
	    timeout: 12000
	});	
	//$('#s1').cycle('pause'); 				
	$('#s2').cycle({ 
	    fx:    'fade',
	    speed:	2000,
	    delay: -12000,
	    timeout: 12000	    	
	});	
	//$('#s2').cycle('pause'); 				
	$('#s3').cycle({ 
	    fx:    'fade',
	    speed:	2000,
	    delay: -8000,
	    timeout: 12000	    
	});	
	//$('#s3').cycle('pause');     
	$('#s4').cycle({ 
	    fx:    'fade',
	    speed:	2000,
	    delay: -2000,
	    timeout: 12000	    
	});	
	//$('#s4').cycle('pause'); 				
	$('#s5').cycle({ 
	    fx:    'fade',
	    speed:	2000,
	    delay: -10000,
	    timeout: 12000	    
	});	
	//$('#s5').cycle('pause'); 				
	$('#s6').cycle({ 
	    fx:    'fade',
	    speed:	2000,
	    delay: -4000,
	    timeout: 12000	    
	});	
	//$('#s6').cycle('pause');    	 
}

function reset() {
	$.Lightbox.construct({
		show_info: true,
		show_extended_info: true,
		download_link: false,
		show_linkback: false,
		auto_resize: true
	});
}

$(document).ready(function() {
	$("dt a#menu-company").click(function(){
		if ($("#imagebank").hasClass("project")) {
			$.ajax({
			  url: "default-imagebank.html",
			  cache: true,
			  success: function(html) {
			    $("#imagebank").html(html);
				recycle(); 				    
			  }
			});	
			$("#imagebank").removeClass("project"); 				
		}

		$("#statement").fadeOut("slow", function(){
			$("#statement").html("<p>Sign Design have developed the concept of bringing together graphic design, fabrication expertise and project management enabling them to be integrated seamlessly on a single project.</p>");
			$("#statement").fadeIn("slow");
			return false;
		});						
	});
					
	$("dt a#menu-services").click(function(){
		if ($("#imagebank").hasClass("project")) {
			$.ajax({
			  url: "default-imagebank.html",
			  cache: true,
			  success: function(html) {
			    $("#imagebank").html(html);
			    recycle();
			  }
			});	
			$("#imagebank").removeClass("project");								
		}
	
		$('ul li a').removeClass("selected");
							
		$("#statement").fadeOut("slow", function(){
			$("#statement").html("<p>Our services are based in three core areas, our in house design team, outsourcing specialist fabrication and efficient project management.</p>");
			$("#statement").fadeIn("slow");
			return false;
		});						
	});
	$("a#menu-services-graphic-design").click(function(event){
		event.preventDefault();
		$('ul li a').removeClass("selected");
		$("a#menu-services-graphic-design").addClass("selected");
		
		$("#statement").fadeOut("slow", function(){
			$("#statement").html("<p>We are an experienced, multi-award winning team specializing in design for print and signage.</p>");
			$("#statement").fadeIn("slow");
			return false;
		});						
	});
	$("a#menu-services-fabrication").click(function(event){
		event.preventDefault();
		$('ul li a').removeClass("selected");
		$("a#menu-services-fabrication").addClass("selected");

		$("#statement").fadeOut("slow", function(){
			$("#statement").html("<p>Sign Design place the greatest possible emphasis on using the correct skills for a project, utilising specialist craftsmen in various fields for a particular project.</p>");
			$("#statement").fadeIn("slow");
			return false;
		});						
	});
	$("a#menu-services-project-management").click(function(event){
		event.preventDefault();
		$('ul li a').removeClass("selected");
		$("a#menu-services-project-management").addClass("selected");

		$("#statement").fadeOut("slow", function(){
			$("#statement").html("<p>Whether a project consists purely of brochure design, or involves fabrication and installation of a signage project there is a need for faultless coordination. For this reason project management takes on an increasingly important role as work progresses.</p>");
			$("#statement").fadeIn("slow");
			return false;
		});						
	});
						
	$("dt a#menu-projects").click(function(event){
		event.preventDefault();
		$('ul li a').removeClass("selected");
	
		$("#statement").fadeOut("slow", function(){
			$("#statement").html("<p>Our projects show a selection of recent work from a cross section of our clients.</p>");
			$("#statement").fadeIn("slow");
			return false;
		});						
	});
			
	$("a#menu-projects-1").click(function(event) {
		event.preventDefault();
		$('ul li a').removeClass("selected");
		$("a#menu-projects-1").addClass("selected");
		$("#imagebank").addClass("project");

		$("#statement").fadeOut("slow", function(){
			$("#statement").html("<p>Sales brochures for the Country House and International departments of the leading UK Estate Agency.<br /><br /><a href='http://www.knightfrank.co.uk/' target='blank'>www.knightfrank.co.uk</a></p>");
			$("#statement").fadeIn("slow");
			return false;
		});
			
		$.ajax({
		  url: "project-1.html",
		  cache: true,
		  success: function(html){
		    $("#imagebank").html(html);
		    reset();
		  }
		});	
		$("#imagebank").addClass("project");
	});
						
	$("a#menu-projects-2").click(function(event){
		event.preventDefault();
		$('ul li a').removeClass("selected");
		$("a#menu-projects-2").addClass("selected");
		$("#imagebank").addClass("project");		

		$("#statement").fadeOut("slow", function(){
			$("#statement").html("<p>Environmental graphics for Kensington and Chelsea's prime residential developer.<br /><br /><a href='http://www.northacre.co.uk/' target='blank'>www.northacre.co.uk</a></p>");
			$("#statement").fadeIn("slow");
			return false;
		});
			
		$.ajax({
		  url: "project-2.html",
		  cache: true,
		  success: function(html){
		    $("#imagebank").html(html);
		    reset();
		  }
		});	
		$("#imagebank").addClass("project");				
	});
	
	$("a#menu-projects-3").click(function(event){
		event.preventDefault();
		$('ul li a').removeClass("selected");
		$("a#menu-projects-3").addClass("selected");
		$("#imagebank").addClass("project");		

		$("#statement").fadeOut("slow", function(){
			$("#statement").html("<p>Working with Together Design we created identity and wayfinding signage for Kings Place, London's newest concert hall, which is also a creative hub, dining venue, gallery, conference centre and office complex.<br /><br /><a href='http://www.togetherdesign.co.uk/' target='blank'>www.togetherdesign.co.uk</a></p>");
			$("#statement").fadeIn("slow");
			return false;
		});
			
		$.ajax({
		  url: "project-3.html",
		  cache: true,
		  success: function(html){
		    $("#imagebank").html(html);
		    reset();
		  }
		});	
		$("#imagebank").addClass("project");				
	});
	$("a#menu-projects-4").click(function(event){
		event.preventDefault();
		$('ul li a').removeClass("selected");
		$("a#menu-projects-4").addClass("selected");
		$("#imagebank").addClass("project");		

		$("#statement").fadeOut("slow", function(){
			$("#statement").html("<p>Comprehensive signage programme for a refurbishment of Europe's premier interior design destination.<br /><br /><a href='http://www.designcentrechelseaharbour.co.uk/' target='blank'>www.designcentrechelseaharbour.co.uk</a></p>");
			$("#statement").fadeIn("slow");
			return false;
		});
			
		$.ajax({
		  url: "project-4.html",
		  cache: true,
		  success: function(html){
		    $("#imagebank").html(html);
		    reset();
		  }
		});	
		$("#imagebank").addClass("project");				
	});

	$("dt a#menu-contact").click(function(){
		if ($("#imagebank").hasClass("project")) {
			$.ajax({
			  url: "default-imagebank.html",
			  cache: true,
			  success: function(html) {
			    $("#imagebank").html(html);
			    recycle();
			  }
			});	
			$("#imagebank").removeClass("project");
		}
	
		$("#statement").fadeOut("slow", function(){
			$("#statement").html("<p>The Sign Design Partnership Ltd</p><table><thead><tr><td>Enquiries</td><td>Registered Address</td></tr></thead><tr><td>Telephone: 020 7823 3776</td><td>8 Lonsdale Gardens</td></tr><tr><td><a href='mailto:info@signdesignlimited.com'>info@signdesignlimited.com</a></td><td>Tunbridge Wells, Kent TN1 1NU</td></tr></table>");
			$("#statement").fadeIn("slow");
			return false;
		});						
	});
});
