
	$(document).ready(function() { 
		$("#portfolio_wrapper a, #popup a").fancybox({
		'hideOnContentClick': true,
		'zoomSpeedIn': 300, 
		'zoomSpeedOut': 300 
		}); 
	}); 
	
	$(document).ready(function() { 
		$(".email_preview_popup").fancybox({
		'hideOnContentClick': true,
		'zoomSpeedIn': 300, 
		'zoomSpeedOut': 300,
		'frameWidth': 750,
		'frameHeight': 600
		}); 
	}); 
	
	
	$(document).ready(function() { 
		$("#instant_buy_now").livequery(function(){	
			$(this).fancybox({ 
				'zoomSpeedIn': 300, 
				'zoomSpeedOut': 300 
				});
		});
	});
		
	$(document).ready(function() { 
		$("#outlook a").livequery(function(){
			if($(this).children('img').is(":visible"))
			{
				$(this).fancybox({ 
						'hideOnContentClick': true,
						'hideOnOverlayClick': true,
						'overlayShow': true,
						'overlayOpacity': 0.7,
						'zoomSpeedIn': 300, 
						'zoomSpeedOut': 300 
						});
			}
			});
		});
		
	    $(document).ready(function() { 
	        $('#caseimage').cycle({ 
	        fx:     'fade', 
	        speed:    2000,
	        timeout:  4600
	        });
	    });

	    $(document).ready(function() { 
	        $('div#portfolio').cycle({ 
	        fx:     'scrollLeft', 
		    speedIn:  1000, 
		    speedOut: 1000, 
		    delay:   -4000,
		    timeout: 7000
	        });
	    });
		
		$(document).ready(function(){
		  $("#feedbackform").validate({
			rules: {
				name: "required",
				companyname: "required",
				jobnumber: "required",
				items: "required",
				textcorrect: "required",
				graphicscorrect: "required",
				terms: "required",
				project: "required",
				jobdes: "required",
				happy: "required",
				emailaddress: {// compound rule
				  required: true,
				  email: true
				}
			},
			messages: {
				name: "Please enter your name",		
				companyname: "Please enter your company name",		
				jobnumber: "Please enter your job number",	
				emailaddress: "Please enter a valid email address", 
				items: "Please make sure you have listed your items you are signing off", 
				textcorrect: "You must tick this", 
				graphicscorrect: "You must tick this", 
				terms: "You must tick this", 
				project: "You must tick this", 
				happy: "You must tick this", 
				jobdes: "Please enter a description for your job"
			}
		  });
		}); 
		    
		$(document).ready(function(){    
		  $("#feedbackform input#submit").click(function()
		  {  
		    var error;
		    if ($("#feedbackform").valid() == false )
		    {
		      error = 1;
		    }
	    
		    if (error == 1 )
		    {
			$('#tabs_nav').hide();
			jAlert('Your form has <b>not been submitted</b>. Please review the errors and submit again.', 'Ooops!');
			$('#stepone').show();
			$('#steptwo').show();
			$('#stepthree').show();
			$('#stepfour').show();
		    }
		    else
		    {
			$('#tabs_nav').hide();
			$('#stepone').hide();
			$('#steptwo').hide();
			$('#stepthree').hide();
			$('#stepfour').hide();
		    }
		  });
		});
		
	    $(document).ready(function()
	    {
		$('#printsignoff fieldset').hide();
		$('#printsignoff input#submit').hide();
		$('#printsignoff fieldset:first').show();
		$('#printsignoff #tabs_nav li:first a').addClass('active');
		
		$('#printsignoff li a').click(function()
		{
		    $('#printsignoff #tabs_nav li a').removeClass('active');
		    
		    var currentTab = $(this).attr('href');
		    
			
			if(currentTab == "#stepone")
			{
			   var nextTab = "#steptwo";
			   $("#tab1").addClass('active');
			   $('#printsignoff input#submit').hide();
			   $('#nextnav').show();
			}
			else if(currentTab == "#steptwo")
			{
			   var nextTab = "#stepthree";
			   $("#tab2").addClass('active');
			   $('#printsignoff input#submit').hide();
			   $('#nextnav').show();
			}
			else if(currentTab == "#stepthree")
			{
			   var nextTab = "#stepfour";
			   $("#tab3").addClass('active');
			   $('#printsignoff input#submit').hide();
			   $('#nextnav').show();
			}
		    	else if(currentTab == "#stepfour")
			{
			   var nextTab = "#stepone";
			   $("#tab4").addClass('active');
			   $('#printsignoff input#submit').show();
			   $('#nextnav').hide();
			}
		    
			$('#tablink').attr('href',nextTab);
			$('#printsignoff fieldset').hide();
			$(currentTab).show();
			return false;
		});
	    }); 
		
		
		
		

