$(document).ready(function(){					   				   
	// #Beers
	// #News
	// #Gallery
	// #Find
	// #Home
	// #Menu
	// #Adventures
	// #Staff
	// #Suppliers


$('#HomeChild').load("home_ice_only.html #content").fadeIn('def');

// Scrolling variables
	var width;
	var height;
	var X;
	var Y;
	var location;
// Scrolling function
	function goTo(id){
		width = $(window).width();
		height = $(window).height();
		X = $("#"+id).offset().left - 245 + 300 - ( width - 245 ) * 0.5;
//		alert(X);
		Y = $("#"+id).offset().top - (height) * 0.5 + 300;
//		alert(Y);
		$('html,body').animate({ scrollTop:Y }, 500).animate({ scrollLeft:X }, 500);
		

	}
	
// Initial scroll to home…
	goTo("Home");
// Scrolling capture
	$(".scroll").click(function(){
		location = $(this).attr("title").toString();
		goTo(location);
		return false;
	});








// .:.:.:.:.:.:.:.:.:.:.:.:.:. //
// Sort out this stuff in v2.0 //
// .:.:.:.:.:.:.:.:.:.:.:.:.:. //

	
//Twitter
//		$('#twitterBlock').getTwitter({
//			userName: "PeliDeli",
//			numTweets: 5,
//			loaderText: "Loading tweets...",
//			slideIn: false,
//			showHeading: false,
//			headingText: "Peli News",
//			showProfileLink: false,
//			showTimestamp: false
//		});			
//Beers
	$('#beerLink').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
	$('#adventuresLink').click(function() {							   
		$('#AdventuresChild').load("adventures.html .gallery blockquote");
	});
	$('.Advnext').click (function() {	
		$('#AdventuresChild').scrollTo( '+=210px', 400 );
	});
	$('.Advprev').click (function() {	
		$('#AdventuresChild').scrollTo( '-=210px', 400 );
	});
//Suppliers
	$('#suppliersLink').click(function() {							   
			$('#SuppliersChild').load("suppliers.html #SuppliersAccordian");
	});
//Menu	
	$('#menuLink').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	
	$('#staffLink').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')
