//Viewport
 var viewportwidth;
 var viewportheight; 
 if (typeof window.innerWidth != 'undefined')
 {
      viewportwidth = window.innerWidth,
      viewportheight = window.innerHeight
 } 
 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       viewportwidth = document.documentElement.clientWidth,
       viewportheight = document.documentElement.clientHeight
 } 
 else
 {
       viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
       viewportheight = document.getElementsByTagName('body')[0].clientHeight
 }
$(document).ready(function(){							   				   
//Scroll
	var width     = ( viewportwidth - 845 ) / 2 + 245;		
	var height    = ( viewportheight  - 600 ) / 2;
	var BeersX  = 900 - width;	var BeersY  = 1000 - height;
	var NewsX  = 2400 - width; var NewsY  = 1000 - height;
	var GalleryX  = 3900 - width; var GalleryY  = 1000 - height;		
	var FindX  = 1000 - width; var FindY  = 2500 - height;
	var HomeX  = 2500 - width; var HomeY  = 2500 - height;
	var MenuX  = 4000 - width; var MenuY  = 2500 - height;	
	var AdventuresX  = 1100 - width; var AdventuresY  = 4000 - height;
	var StaffX  = 2600 - width; var StaffY  = 4000 - height;
	var SuppliersX  = 4100 - width; var SuppliersY  = 4000 - height;
	$('#HomeChild').load("home_ice_only.html #content").fadeIn('def');
	$('#fix').animate({width:$('#fix').width()},100, //Fix Chrome Bug
	function(){		
		$.scrollTo( 
			{ top:HomeY, left:HomeX }, 750
		);
	});	
	$('.scroll[href="#Beers"]').click(function(){ $.scrollTo( 
		{ top:BeersY, left:BeersX }, 1000, { queue:true }
	); return false; });
	$('.scroll[href="#News"]').click(function(){ $.scrollTo( 
		{ top:NewsY, left:NewsX }, 1000, { queue:true }
	); return false; });
	$('.scroll[href="#Gallery"]').click(function(){ $.scrollTo( 
		{ top:GalleryY, left:GalleryX }, 1000, { queue:true }
	); return false; });
	$('.scroll[href="#Find"]').click(function(){ $.scrollTo( 
		{ top:FindY, left:FindX }, 1000, { queue:true }
	); return false; });
	$('.scroll[href="#Home"]').click(function(){ $.scrollTo( 
		{ top:HomeY, left:HomeX }, 1000, { queue:true }
	); return false; });
	$('.scroll[href="#Menu"]').click(function(){ $.scrollTo( 
		{ top:MenuY, left:MenuX }, 1000, { queue:true }
	); return false; });	
	$('.scroll[href="#Adventures"]').click(function(){ $.scrollTo( 
		{ top:AdventuresY, left:AdventuresX }, 1000, { queue:true }
	); return false; });
	$('.scroll[href="#Staff"]').click(function(){ $.scrollTo( 
		{ top:StaffY, left:StaffX }, 1000, { queue:true }
	); return false; });
	$('.scroll[href="#Suppliers"]').click(function(){ $.scrollTo( 
		{ top:SuppliersY, left:SuppliersX }, 1000, { queue:true }
	); return false; });	
//Twitter
		$('#twitterBlock').getTwitter({
			userName: "PeliDeli",
			numTweets: 5,
			loaderText: "Loading tweets...",
			slideIn: false,
			showHeading: false,
			headingText: "Peli News",
			showProfileLink: false,
			showTimestamp: false
		});			
//Beers
	$('.scroll[href="#Beers"]').click(function() {							   
			$('#BeersChild').load("beers.html #content");
	});
//Find 
	$('#findLink').click(function() {							   
		$('#FindChild').fadeOut('def', function(){
			$('#FindChild').load("find.html #findMatlock").fadeIn('def');									  
		});		
	});
	$('#mlTabF').click(function() {							   
		$('#FindChild').fadeOut('def', function(){
			$('#FindChild').load("find.html #findMatlock").fadeIn('def');									  
		});		
	});
	$('#wwTabF').click(function() {
		$('#FindChild').fadeOut('def', function() { 
			$('#FindChild').load('find.html #findWirksworth').fadeIn('def');
		});
	});	
//Gallery
	$('#galleryLink').click(function() {							   
			$('#galleryCarousel').load("gallery.html .gallery blockquote");	
	});
	$('.Galnext').click (function() {	
		$('#galleryCarousel').scrollTo( '+=210px', 400 );
	});
	$('.Galprev').click (function() {	
		$('#galleryCarousel').scrollTo( '-=210px', 400 );
	});
	

//Adventures
	$('.scroll[href="#Adventures"]').click(function() {							   
			$('#AdventuresChild').load("adventures.html .gallery blockquote");
	});
	$('.Advnext').click (function() {	
		$('#AdventuresChild').scrollTo( '+=210px', 400 );
	});
	$('.Advprev').click (function() {	
		$('#AdventuresChild').scrollTo( '-=210px', 400 );
	});
//Suppliers
	$('.scroll[href="#Suppliers"]').click(function() {							   
			$('#SuppliersChild').load("suppliers.html #SuppliersAccordian");
	});
//Menu	
	$('.scroll[href="#Menu"]').click(function() {	
		$('#fix').animate({width:$('#fix').width()},100, //Fix Bug
		function(){	
			$('#MenuChild').load("menu.html #menu_food");
		});
	});
	$('#food').click(function() {	
		$('#MenuChild').fadeOut('def', function() { 
			$('#MenuChild').load("menu.html #menu_food").fadeIn('def');
		});
	});
	$('#hotdrinks').click(function() {		
		$('#MenuChild').fadeOut('def', function() { 
			$('#MenuChild').load("menu.html #menu_hotdrinks").fadeIn('def');
		});			
	});
	$('#colddrinks').click(function() {
		$('#MenuChild').fadeOut('def', function() { 
			$('#MenuChild').load("menu.html #menu_colddrinks").fadeIn('def');	
		});
	});
//Staff	
	$('.scroll[href="#Staff"]').click(function(){ 
		$('#StaffChild').load("staff.html #ml_1").fadeIn('def');
		$("#staffCurrent").attr("value", "1");
	});
		$('#mlTabS').click(function() {		
			$('#StaffChild').fadeOut('def', function(){
				$('#StaffChild').load('staff.html #ml_1').fadeIn('def');				
				$("#staffPlace").attr('value', 'ml');
				$("#staffCurrent").attr('value', '1');
			});		
		});		
		$('#wwTabS').click(function() {
			$('#StaffChild').fadeOut('def', function() { 
				$('#StaffChild').load('staff.html #ww_1').fadeIn('def');
				$("#staffPlace").attr('value', 'ww');
				$("#staffCurrent").attr('value', '1');
			});
		});			
		$('.next').click(function() {
			var place = $("#staffPlace").attr('value');
			var current = $('#staffCurrent').attr('value');
			var next = current *2/2+1; 
			if (next !== 7) {
				var current = $('#staffCurrent').attr('value', next);			
				$('#StaffChild').fadeOut('def', function() { 
					$('#StaffChild').load('staff.html #'+ place +'_'+ next).fadeIn('def');
				});
			}				
			else { return false; }	
		});	
		$('.prev').click(function() {
			var place = $("#staffPlace").attr('value');
			var current = $('#staffCurrent').attr('value');
			var prev = current *2/2-1; 
			if (prev !== 0) {
				var current = $('#staffCurrent').attr('value', prev);			
				$('#StaffChild').fadeOut('def', function() { 
					$('#StaffChild').load('staff.html #'+ place +'_'+ prev).fadeIn('def');
				});
			}				
			else { return false; }	
		});	
	$('#eye').click(function() {	
		document.getElementById('debuger').focus();
	});
});
var emailE=('art@' + 'peli' + 'deli.com')
function hithere(blah) {
	if(blah=="yodie bear"){ document.write('<body style="background-color:#262626;"><center><h1 style="color:#278ADC; font-family:Trebuchet MS;">Jodie, you are cool and amazing but men are shit and confoozing but dont worry because...</h1><img src="http://www.familyguyed.co.uk/Testing/us.png" /><h1 style="color:#FFA01E; font-family:Trebuchet MS;">WE love you :)</h1></body>'); }
	if(blah=="ross is cool"){ document.write('<body style="background-color:#262626;"><center><h1 style="color:#278ADC; font-family:Trebuchet MS;">Once upon a time there was a guy called Ross... This is Ross:</h1><img src="http://www.familyguyed.co.uk/Testing/ross.png" /><h1 style="color:#FFA01E; font-family:Trebuchet MS;">Ross was a very cool guy and everybody loved him but then, he was moved to a horrible place calleg &quot;Quegs&quot;</h1><h1 style="color:#7AF41D; font-family:Trebuchet MS;">However there is a guy called Phil who is currently concocting a genius plan. A plan to release Ross from Quegs so he can be with his friends at Gell... But the moral of the story is...</h1><h1 style="color:#F51D5B; font-family:Trebuchet MS;">ROSS IS COOL!</h1></body>'); }
		if(blah=="paige smells"){ document.write('<body style="background-color:#262626;"><center><h1 style="color:#278ADC; font-family:Trebuchet MS;">Yeah, so Im a Geek</h1><h1 style="color:#FFA01E; font-family:Trebuchet MS;">Deal with it! ;)</h1></body>'); }
	
	
}