// Bookmark code
function favoris() {
	if ( navigator.appName != 'Microsoft Internet Explorer' )
	{ window.sidebar.addPanel("EnterF1 Tickets & Merchandise","http://www.enterf1.com",""); }
	else { window.external.AddFavorite("http://www.enterf1.com","EnterF1 Tickets & Merchandise"); } }
	

// Generic AJAX code - use to trigger: javascript:AjaxLoad('bite-point-comments-box','_bite-point-read-comments.asp')"
function LoadResults(xDiv, xPath) {
	document.getElementById(xDiv).style.display = "block" ;
	document.getElementById(xDiv).innerHTML = document.getElementById("ajaxloading").innerHTML;
	$("#" + xDiv).load(xPath);
}

function AjaxLoad(xDiv, xPath) {
	document.getElementById(xDiv).style.display = "block" ;
	document.getElementById(xDiv).innerHTML = document.getElementById("ajaxloading").innerHTML;
	$("#" + xDiv).load(xPath);
}

// TICKET LISTS
function ShowAllTicketLinksText(xAction)
{
	if (xAction == "show") {
		
		$("#full-ticket-list-text").show(1000);
		$("#short-ticket-list-text").hide(500);										
	}else{
		$("#short-ticket-list-text").show(2000);
		$("#full-ticket-list-text").hide(1000);
		
	}	
}


// Contact form
function disableSubmit() {
	vName = document.getElementById("name").value;
	vEmail = document.getElementById("email").value;
	vComment = document.getElementById("comment").value;
	vAntiSpam = document.getElementById("antispam").value;

	if ( (vName != "") && (vEmail != "") && (vComment != "") && (vAntiSpam != "") ) {
		document.getElementById("submitButton").disabled = "";
	}else{
		document.getElementById("submitButton").disabled = "disabled";
	}
}

function suggestionClose(){
	$("#feedback-form").fadeOut("slow", function() {
		$("#feedback-text").fadeIn("slow");
	});
}

function suggestionOpen(){
	$("#feedback-text").fadeOut("slow", function() {
		$("#feedback-form").fadeIn("slow");
		//document.location="#comment_show";
	});
}


function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Look like an invalid e-mai address. Please check!")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Look like an invalid e-mai address. Please check!")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Look like an invalid e-mai address. Please check!")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Look like an invalid e-mai address. Please check!")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Look like an invalid e-mai address. Please check!")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Look like an invalid e-mai address. Please check!")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Look like an invalid e-mai address. Please check!")
		    return false
		 }

 		 return true					
	}

function ValidateForm(){
	var emailID= document.getElementById("email")
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please enter your e-mail address.")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.focus()
		return false
	}
	return true
 }
 
 
//setTimeout("AdsenseDisplay()",8000)
 
function AdsenseDisplay() {
	$("#adsense-bottom").fadeIn(2000);
}

function GlobalOnLoad() {
	$("table.standard-table tr:even").addClass("even");
	$("table.standard-table tr:odd").addClass("odd");
}

function isNumberKey(evt) {
	var charCode = (evt.which) ? evt.which : event.keyCode
	if (charCode > 31 && (charCode < 48 || charCode > 57)) {
		alert("Enter the NUMBER only, not a word please");
		return false;
	}else{
		return true;
	}
}


