// JavaScript Document

   $(document).ready(function(){
     
	 
		var getPrevLink  = $("#navSelected").parent().prev().children().attr("href"); // finds previous url 
		var getNextLink  = $("#navSelected").parent().next().children().attr("href"); // finds next url
		
		$(".linkPortRight").attr("href", getNextLink); // puts previous url in previous link
		$(".linkPortLeft").attr("href", getPrevLink); // puts next url in next link
		
	 
	 // all below fades in all content when browser is loaded
	$(document).ready(function(){ // when all images and html fully loaded
		$("#content").hide().fadeIn("slow").animate({opacity: 1}, 400);
		
	 	$(".homeBg").hide().fadeIn("slow").animate({opacity: 1}, 800);
		$("#contentContHome").animate({opacity: 1}, 3800).fadeOut();
		$("#footerCover").fadeOut(3800);
		<!-- $(".linkLogoInt").hide().fadeIn("slow").animate({opacity: 1}, 200); -->
		$(".homeBox1").hide().animate({opacity: 0.01}, 300).fadeIn("slow").animate({opacity: 0.7}, 800);
		$(".homeBox2").hide().animate({opacity: 0.01}, 800).fadeIn("slow").animate({opacity: 0.8}, 800);
		$(".homeBox2 h12").hide().animate({opacity: 0.01}, 800).fadeIn("slow").animate({opacity: 1}, 800);
		
		$(".imgBox11").hide().fadeIn("slow").animate({opacity: 1}, 800).fadeIn("slow");
		$(".imgBox1").hide().animate({opacity: 0.01}, 600).fadeIn("slow").animate({opacity: 1}, 800);
		$(".imgBox2").hide().animate({opacity: 0.01}, 3000).fadeIn("slow").animate({opacity: 1}, 800);
		$(".imgBox3").hide().animate({opacity: 0.01}, 5000).fadeIn("slow").animate({opacity: 1}, 800);
		$(".imgBox4").hide().animate({opacity: 0.01}, 7000).fadeIn("slow").animate({opacity: 1}, 800);
		$(".imgBox6").hide().animate({opacity: 0.01}, 5700).fadeIn("slow").animate({opacity: 1}, 800);
		$(".imgBox5").hide().animate({opacity: 0.01}, 7600).fadeIn("slow").animate({opacity: 1}, 800);
		
		$(".brandsBox1").hide().animate({opacity: 0.01}, 400).fadeIn("slow").animate({opacity: 1}, 800);
		$(".brandsBox2").hide().animate({opacity: 0.01}, 1000).fadeIn("slow").animate({opacity: 1}, 800);
		$(".brandsBox3").hide().animate({opacity: 0.01}, 1600).fadeIn("slow").animate({opacity: 1}, 800);
		$(".brandsBox4").hide().animate({opacity: 0.01}, 2000).fadeIn("slow").animate({opacity: 1}, 800);
		
		$(".brandsBox5").hide().animate({opacity: 0.01}, 400).fadeIn("slow").animate({opacity: 1}, 800);
		$(".brandsBox6").hide().animate({opacity: 0.01}, 1000).fadeIn("slow").animate({opacity: 1}, 800);
		$(".brandsBox7").hide().animate({opacity: 0.01}, 1600).fadeIn("slow").animate({opacity: 1}, 800);
		
		$(".textHide1").animate({opacity: 1}, 1500).animate({opacity: 0}, 1700);
		$(".textHide2").animate({opacity: 1}, 2000).animate({opacity: 0}, 1700);
		$(".brandTextHide1").animate({opacity: 1}, 2600).animate({opacity: 0}, 1700).fadeOut();
		$(".brandTextHide2").animate({opacity: 1}, 3100).animate({opacity: 0}, 1700).fadeOut();
		<!-- $(".textBox").hide().animate({opacity: 0.01}, 1000).fadeIn("slow").animate({opacity: 1}, 1000);-->
	 	});
		
		// all link stuff
		$(".linkPortLeft").click(function(){ // when link clicked
			timerPrev(); // get timer below with page going to
			fadeOut(); // execute fade out below
		});
		$(".linkPortRight").click(function(){
			timerNext();
			fadeOut();
		});
		$(".linkHome").click(function(){
			timerIndex();
			fadeOut();
		});
		$(".linkIndex").click(function(){
			timerHome();
			fadeOut();
		});
		
		$(".linkHomeGlobal").click(function(){
			timerGlobal();
			fadeOut();
		});
		
		$(".btnAbout").click(function(){
			timerAbout();
			fadeOut();
		});
		
		$(".btnNews").click(function(){
			timerNews();
			fadeOut();
		});
		$(".btnContact").click(function(){
			timerContact();
			fadeOut();
		});
		
		$(".link1").click(function(){
			timer1();
			fadeOut();
		});
		$(".link2").click(function(){
			timer2();
			fadeOut();
		});
		$(".link3").click(function(){
			timer3();
			fadeOut();
		});
		$(".link4").click(function(){
			timer4();
			fadeOut();
		});
		$(".link5").click(function(){
			timer5();
			fadeOut();
		});
		$(".link6").click(function(){
			timer6();
			fadeOut();
		});
		$(".link7").click(function(){
			timer7();
			fadeOut();
		});
		
		// stops main link from working
		$("a").click(function(){
			return false;
		});
		
		
	 });
	 
	 
	 // fades out all content once link is clicked
	 function fadeOut() {
		 
		 	$(".hideFirst").hide();
				
			$("#content").fadeOut("slow");
			$(".homeBg").fadeOut("slow");
			$(".homeBox1").fadeOut("slow");
			$(".homeBox2").fadeOut("slow");
			$(".homeBox2 h12").fadeOut("slow");
			<!-- $(".linkLogoInt").fadeOut("slow"); -->
			
			$(".imgBox11").fadeOut("slow");
			$(".imgBox1").hide();
			$(".imgBox2").fadeOut("slow");
			$(".imgBox3").fadeOut("slow");
			$(".imgBox4").fadeOut("slow");
			$(".imgBox6").fadeOut("slow");
			$(".imgBox5").fadeOut("slow");
			
			$(".brandsBox1").fadeOut("slow");
			$(".brandsBox2").fadeOut("slow");
			$(".brandsBox3").fadeOut("slow");
			$(".brandsBox4").fadeOut("slow");
			
			$(".brandsBox5").fadeOut("slow");
			$(".brandsBox6").fadeOut("slow");
			$(".brandsBox7").fadeOut("slow");
			
			$(".textHide1").animate({opacity: 1}, 500);
			$(".textHide2").animate({opacity: 1}, 500);
		
		}
	 
	 
	 function timerPrev() {
		window.location.href = getPrevLink;
		}
	 function timerNext() {
		window.location.href = getNextLink;
		}
	 
	 // sets page time out - delays page going to next page and stores page going to after delay
	 function timerHome() {
		var time = window.setTimeout("location.href = 'http://www.wsdv.co.uk/'", 500);
		}
	function timerGlobal() {
		var time = window.setTimeout("location.href = 'http://www.wsdv.com'", 500);
		}
	 function timerIndex() {
		var time = window.setTimeout("location.href = 'index.php'", 500);
		}
	 function timerAbout() {
		var time = window.setTimeout("location.href = 'about.php'", 500);
		}
	 function timerContact() {
		var time = window.setTimeout("location.href = 'contact.php'", 500);
		}
	 function timerNews() {
		var time = window.setTimeout("location.href = 'news.php'", 500);
		}
	 function timer1() {
		var time = window.setTimeout("location.href = 'contents.php'", 500);
		}
	 function timer2() {
		var time = window.setTimeout("location.href = 'pringles.php'", 500);
		}
	 function timer3() {
		var time = window.setTimeout("location.href = 'hellmanns.php'", 500);
		}
	 function timer4() {
		var time = window.setTimeout("location.href = 'berio.php'", 500);
		}
	 function timer5() {
		var time = window.setTimeout("location.href = 'pg_tips.php'", 500);
		}
	 function timer6() {
		var time = window.setTimeout("location.href = 'schweppes.php'", 500);
		}
	 function timer7() {
		var time = window.setTimeout("location.href = 'polo.php'", 500);
		}
