<!--
// declare the variables
var ns,ie,ns6,layername,state,lay,strVideo,strSaver

// get the settings for the different browsers
if (document.layers) {
	ns = true;
} else if (document.all) {
	ie = true;
} else if (document.getElementById) {
	ns6 = true;
}

if (ns6) {

}

// show / hide layer
function layerstatus(layername,state) {

	if (state == "hide") {
		if (ns) { eval('document.layers["layername"].visibility  = "hide"'); }
		if (ie) {  lay = eval(layername); lay.style.visibility = "hidden"; }
		if (ns6) { document.getElementById(layername).style.visibility = "hidden"; }
	} else if (state == "show") {
	 	if (ns) { eval('document.layers["layername"].visibility  = "show"'); }
		if (ie) { lay = eval(layername); lay.style.visibility = "visible"; }
		if (ns6) { document.getElementById(layername).style.visibility = "visible"; }
	}
}

// show the random card
function fnCard() {

	card = "card_" + Math.floor(Math.random()* 3)
	layerstatus(card,'show');
	
	// show video
	if (strVideo == true) {
		layerstatus('overlay2','show');
	}
	
	// show video
	if (strSaver == true) {
		layerstatus('saver','show');
	}
}

// open popup window
function open_window(url,width,height) {
	
	// the width and height
	if (!width) { width = 700; }
	if (!height) { height = 600; }
	
	//get the top left corner for the popup
	sx = screen.width/2 - width/2;
	sy = screen.height/2 - height/2;
	
	// open the popup window
	window.open(url,'','width='+width+',height='+height+',resizable=no,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,screenX='+sx+',screenY='+sy+',top='+sy+',left='+sx);
}

// open popup window
function open_window_bar(url,width,height) {
	
	// the width and height
	if (!width) { width = 700; }
	if (!height) { height = 600; }
	
	//get the top left corner for the popup
	sx = screen.width/2 - width/2;
	sy = screen.height/2 - height/2;
	
	// open the popup window
	window.open(url,'','width='+width+',height='+height+',resizable=no,toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=0,screenX='+sx+',screenY='+sy+',top='+sy+',left='+sx);
}

// open popup window
function open_window_scroll(url,width,height) {
	
	// the width and height
	if (!width) { width = 700; }
	if (!height) { height = 600; }
	
	//get the top left corner for the popup
	sx = screen.width/2 - width/2;
	sy = screen.height/2 - height/2;
	
	// open the popup window
	window.open(url,'','width='+width+',height='+height+',resizable=no,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,screenX='+sx+',screenY='+sy+',top='+sy+',left='+sx);
}

// go to area from drop down
function go(what) {
	if (what != 0) {
		location.href = what;
	}
}

function go2(what) {
	where = (document.drop_form2.drop_select.options[what].value);
	location.href = where;
}

function go3(what) {
	where = (document.drop_form3.drop_select.options[what].value);
	location.href = where;
}

// Check whether string s is empty.
function isEmpty(s) { return ((s == null) || (s.length == 0)) }
	  
// validate contribution emails
function validate_email_contribute() {

	name = document.contribute_form.strName.value;
	email = document.contribute_form.strEmail.value;
	text = document.contribute_form.strText.value;
	
	if (!isEmpty(name) || !isEmpty(email) || !isEmpty(text)) {
		
		if ((email.indexOf("@") != -1) && (email.indexOf(".") != -1)) {
		
			alert("Thank you. Your message has been sent.");
			return true;
			
		} else {
			
			alert("Please fill in a valid amail address.");
			return false;
		}
		
	} else {
		
		alert("Please fill in all the details.");
		return false;
	}
}

// validate newsletter emails
function validate_email_newsletter() {

	email = document.newsletter_form.email.value;
	
	if (!isEmpty(email)) {
		
		if ((email.indexOf("@") != -1) && (email.indexOf(".") != -1)) {
		
			alert("Thank you. You have been added to the newsletter.");
			return true;
			
		} else {
			
			alert("Please fill in a valid amail address.");
			return false;
		}
		
	} else {
		
		alert("Please fill in an email address.");
		return false;
	}
}



// validate holding page emails
var invalidChars = " /:,;";

function validEmail(email) {
		
	if (email.length <=0)	{
	return false
	}
	
	for (i=0; i<invalidChars.length; i++) {	// does it contain any invalid characters?
	badChar = invalidChars.charAt(i)
		if (email.indexOf(badChar,0) > -1) {
			return false
		}
	}
	atPos = email.indexOf("@",1)			// there must be one "@" symbol
		if (atPos == -1) {
		return false
	}
	if (email.indexOf("@",atPos+1) != -1) {	// and only one "@" symbol
		return false
	}
	periodPos = email.indexOf(".",atPos)
		if (periodPos == -1) {					// and at least one "." after the "@"
		return false
	}
	if (periodPos+3 > email.length)	{		// must be at least 2 characters after the "."
		return false
	}
	return true
}

function checkForm(passForm)	{ 
	
	if (!validEmail(passForm.email.value))	{
		alert('Invalid email address')
		passForm.email.focus()
		passForm.email.select()
		return false;
	}
	
	return true
}


function validate1() {

	if (document.frmQ1.Name.value==""){
		alert("Please fill in your name.");
		return false;
	}
	
	if ((document.frmQ1.Email.value.indexOf("@") == -1) || (document.frmQ1.Email.value.indexOf(".") == -1)){
		alert('Invalid email address');
		return false;
	}
	
	return true;
}


function validate2() {

	if (document.frmQ2.Name.value==""){
		alert("Please fill in your name.");
		return false;
	}
	
	if ((document.frmQ2.Email.value.indexOf("@") == -1) || (document.frmQ2.Email.value.indexOf(".") == -1)){
		alert('Invalid email address');
		return false;
	}
	
	return true;
}


function testAnswer(Answer){
	if (Answer==""){
		alert("Please fill in your answer then submit");
		return false;
	} else return true;
}
		
// ---------------------------------------------------
// PRELOAD THE MENU IMAGES
// ---------------------------------------------------

t1  = new Image;
t1.src="images/nav_the_show.gif";
t2 = new Image;
t2.src="images/nav_features.gif";
t3 = new Image;
t3.src="images/nav_contribute.gif";
t4 = new Image;
t4.src="images/nav_archive.gif";
t5 = new Image;
t5.src="images/nav_contact.gif";

t1Over  = new Image;
t1Over.src="images/nav_the_show_over.gif";
t2Over = new Image;
t2Over.src="images/nav_features_over.gif";
t3Over = new Image;
t3Over.src="images/nav_contribute_over.gif";
t4Over = new Image;
t4Over.src="images/nav_archive_over.gif";
t5Over = new Image;
t5Over.src="images/nav_contact_over.gif";


// get the settings for the different browsers
if (document.layers) {
	document.write("<link rel='stylesheet' href='_style/default.css' type='text/css'>");
} else {
	document.write("<link rel='stylesheet' href='_style/default.css' type='text/css'>");
}

//-->
