//@2010 WEBBER DESIGN CREATIVE FAMILY www.webbersites.com All Rights Reserved.

var firstHome = true;

//$('#Container').hide(0);


$(function() {
	$('#pane1').jScrollPane({scrollbarWidth:12, scrollbarMargin:0});
	$('#pane2').jScrollPane({scrollbarWidth:12, scrollbarMargin:0});
	$('#pane3').jScrollPane({scrollbarWidth:12, scrollbarMargin:0});
	});


$(document).ready(function () {
	fontReplace();
	$("#BurningTree").animate({top:"-800px"}, 0).delay(200).animate({top:"-14px"}, 6000);	
	$('#pane1').jScrollPane();
	$('#pane2').jScrollPane();
	$('#pane3').jScrollPane();
	$('.VideoBtnSeeAll').hide(0);	
	
	$('.VideoBtn').click(function () {
			$('#VideoPaper').css('z-index','10');
			$('.VideoBtn').hide(500);
			$('.VideoBtnSeeAll').show(500);
			return false;
			});
		
	$('.VideoBtnSeeAll').click(function () {
			$('#VideoPaper').css('z-index','12');
			$('.VideoBtn').show(500);
			$('.VideoBtnSeeAll').hide(500);
			return false;
			});
	
	$('.ajaxButton').address(function() {  
		
		return $(this).attr('href').replace(/^#/, ''); 
		loadThis($(this))
		//return $(this).attr('href').replace(/^#/, ''); 
		//loadThis($(this))
		});	
	
});
		

$.address.change(function(event) { 	
	
	if (event.value=="/") {
	//alert(event.value);
	} else {loadThis(event.value);}
	
	//alert(event.value);
	/*
	if (event.value="/") {
		alert(event.value);
	//loadThis(event.value);
	} else {loadThis(event.value);}*/
	});  


function loadThis(linkURL){
	
	if (firstHome==false) {
	$('#Container').fadeOut("slow");
	
	}
	
	
	//var linkObj= linkURL;
	var ajaxURL= linkURL + "&showtemplate=false";
	contentDisp(ajaxURL);
	}

function contentDisp(linkURL){
	$.ajax({
	url : linkURL,
	success : function (data) {
	$("#Container").html(data);
	
	var finder="";
	finder=linkURL;
	
	//if (firstHome==false) {
		//}
	firstHome=false;
	
	
	if (firstHome==false) {
		$('#Container').fadeIn("slow");
		}
		
	
	fontReplace();
	$('#pane1').jScrollPane();
	$('#pane2').jScrollPane();
	$('#pane3').jScrollPane();
	//$('#pane4').jScrollPane();
	
	animations(finder);
	}
});
}






function fontReplace(){
	Cufon.replace('#HomeTour', { fontFamily: 'Futura LT Condensed' });
	Cufon.replace('#HomeNews', { fontFamily: 'Futura LT CondensedLight' });
	Cufon.replace('#BookStories', { fontFamily: 'Futura LT CondensedLight' });
	Cufon.replace('#NewsPage', { fontFamily: 'Futura LT CondensedLight' });
	Cufon.replace('#NewsPage a', { fontFamily: 'Futura LT Condensed' });
	Cufon.replace('#BookStories a', { fontFamily: 'Futura LT Condensed' });
	//Cufon.replace('#cal-calendar', { fontFamily: 'Futura LT CondensedLight' });
	Cufon.replace('#TwitterInner a', { fontFamily: 'Futura LT CondensedLight' });
	Cufon.replace('h1', { fontFamily: 'Futura LT Condensed' });
	Cufon.replace('h2', { fontFamily: 'pencilPete FONT' });
	Cufon.replace('h3', { fontFamily: 'Futura LT Condensed' });
	Cufon.replace('.showDate', { fontFamily: 'Futura LT Condensed' });
	Cufon.replace('.showLocation', { fontFamily: 'Futura LT Condensed' });
	Cufon.replace('.showVenue', { fontFamily: 'Futura LT Condensed' });
	Cufon.replace('#MailingList', { fontFamily: 'pencilPete FONT' });
	Cufon.replace('.VideoBtnSeeAll', { fontFamily: 'pencilPete FONT' });
	Cufon.replace('.VideoBtn', { fontFamily: 'pencilPete FONT' });
	
	Cufon.replace('.CGBlogSummaryLink a', { fontFamily: 'Futura LT Condensed' });
	}
	
function animations(url){
	
		
		
		
		if (url=="/index.php?page=home&showtemplate=false"){
			//$("#HomeSlice").fadeIn("slow");
			$("#BurningTree").animate({top:"-14px"}, 6000);
			
			}  else {
				$("#BurningTree").animate({top:"-800px"}, 6000);
			//$("#HomeSlice").fadeOut("slow");
			}
			
			if (url=="tour"){
			$("#TotalFooter").animate({top:"900px"}, 2000);
			} 
			
		
		if (url=="/index.php?page=tour&showtemplate=false"){
			$("#TotalFooter").animate({top:"950px"}, 2000);
			} 
		
		if (url=="/index.php?page=home&showtemplate=false"){
			$("#TotalFooter").animate({top:"720px"}, 2000);
			} 
		
		if (url=="/index.php?page=pics&showtemplate=false"){
			$("#TotalFooter").animate({top:"770px"}, 2000);
			} 
		
		if (url=="/index.php?page=stories&showtemplate=false"){
			$("#TotalFooter").animate({top:"820px"}, 2000);
			}
		
		if (url=="/index.php?page=music&showtemplate=false"){
			$("#TotalFooter").animate({top:"720px"}, 2000);
			 
			}
		
		if (url=="/index.php?page=flicks&showtemplate=false"){
			$("#TotalFooter").animate({top:"800px"}, 2000);
			callToMusicPlayer('stop');
			}
		if (url=="/index.php?page=news&showtemplate=false"){
			$("#TotalFooter").animate({top:"780px"}, 2000);
			}
		if (url=="/index.php?page=guestbook&showtemplate=false"){
			$("#TotalFooter").animate({top:"740px"}, 2000);
			}
			
	}
	
	
	
	
function getFlashMovie(movieName) {
		var isIE = navigator.appName.indexOf("Microsoft") != -1;
		return (isIE) ? window[movieName] : document[movieName];
		}
	
function callToActionscript(str) {
		getFlashMovie("header").sendToActionscript(str);
		}

function callToMusicPlayer(url) {
		getFlashMovie("MusicPlayer").sendToMusicPlayer(url);
		}
		
		