var currentTab = '#video-holder';
var pageHeight = 0;
var currentTabId = '';

function ExtractNumber(value) { 
var n = parseInt(value); 
return n == null || isNaN(n) ? 0 : n; 
} 

$(document).ready(function() {

	isShown = false;

	$("#videocover").mouseover(function () {
		if(!isShown){
			isShown = true;
        	$("#entersite").fadeIn(500);
        }
	});
	$("#videocover").mouseout(function () {
		if(isShown){
        	$("#entersite").fadeOut(500);
        	isShown = false;
        }
	});
	
});


function loadPage(pageName){

if(currentTab != pageName){

$(currentTab).fadeOut(800); 
setTimeout(function(){

unloadMenu(currentTabId);

switch(pageName){

	case '#homePage':
		pageHeight = 480;
		currentTab = '#homePage';
		currentTabId = 'home_tab';
		break;
		
	case '#contactPage':
		pageHeight = 420;
		currentTab = '#contactPage';
		currentTabId = 'contact_tab';
		break;
		
	case '#galleryPage':
		pageHeight = 800;
		currentTab = '#galleryPage';
		currentTabId = 'gallery_tab';
		break;
		
	case '#videoPage':
		pageHeight = 360;
		currentTab = '#videoPage';
		currentTabId = 'video_tab';
		break;
		
	case '#schedulePage':
		pageHeight = 630;
		currentTab = '#schedulePage';
		currentTabId = 'schedule_tab';
		break;
		
	case '#directionsPage':
		pageHeight = 400;
		currentTab = '#directionsPage';
		currentTabId = 'directions_tab';
		break;
		
	case '#ticketsPage':
		pageHeight = 520;
		currentTab = '#ticketsPage';
		currentTabId = 'tickets_tab';
		break;
	
	case '#faqPage':
		pageHeight = 730;
		currentTab = '#faqPage';
		currentTabId = 'faq_tab';
		break;
		
}

$("#allPageContent").animate({height: pageHeight}, 500);

setTimeout(function(){
	$(pageName).fadeIn(800);
	loadMenu();
}, 500);

}, 800);
}
}


function unloadMenu(tabName){

	if(tabName)
		document.getElementById(tabName).style.backgroundPosition = 'center -40px';

}


function loadMenu(){

	document.getElementById(currentTabId).style.backgroundPosition = 'center center';

}

currentAnswer = 0;

function switchToAnswer(num, answerHeight){

if(currentAnswer == num){
	hideAnswer(num);
	currentAnswer = 0;
}else if(currentAnswer == 0){
	showAnswer(num, answerHeight);
	currentAnswer = num;
}else{
	hideAnswer(currentAnswer);
	showAnswer(num, answerHeight);
	currentAnswer = num;
}

}

function showAnswer(num, answerHeight){
	$("#answer-" + num).show();
}

function hideAnswer(num){
	$("#answer-" + num).hide();
}



function submitContactForm() {
	$('#contact-form-bg').css('display', 'none');
	$('#messageSent').css('display', 'block');
	$('#messageSent').html('Sending message... Please wait.');
	var dataString = $('#contactForm').serialize();
	
	$.ajax({
    	type: "POST",
    	url: "send.php",
    	data: dataString,
    	success: function(msg){
    		$('#messageSent').html(msg);
    	}
	});
	
    return false;
}











