<!--

// 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,'winname','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);
}

// open popup window
function open_window_noscroll(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,'winname','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);
}

// 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) {
			alert("Please fill in a valid email address.");
			return false
		}
	}
	atPos = email.indexOf("@",1)			// there must be one "@" symbol
		if (atPos == -1) {
		alert("Please fill in a valid email address.");
		return false
	}
	if (email.indexOf("@",atPos+1) != -1) {	// and only one "@" symbol
		alert("Please fill in a valid email address.");
		return false
	}
	periodPos = email.indexOf(".",atPos)
		if (periodPos == -1) {					// and at least one "." after the "@"
		alert("Please fill in a valid email address.");
		return false
	}
	if (periodPos+3 > email.length)	{		// must be at least 2 characters after the "."
		alert("Please fill in a valid email address.");
		return false
	}
	alert("Thank you, you have been signed up.");
	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;
}

// go to area from drop down
function go(what) {
	
	if (what != 0) {
		location.href = what;
	}
}

// ---------------------------------------------------
// PRELOAD THE MENU IMAGES
// ---------------------------------------------------

t1On  = new Image;
t1On.src="_images/nav_home.gif";
t2On = new Image;
t2On.src="_images/nav_profiles.gif";
t3On = new Image;
t3On.src="_images/nav_presenters.gif";
t4On = new Image;
t4On.src="_images/nav_wallchart.gif";
t5On = new Image;
t5On.src="_images/nav_review.gif";
t6On = new Image;
t6On.src="_images/nav_rules.gif";
t7On = new Image;
t7On.src="_images/nav_greats.gif";
t8On = new Image;
t8On.src="_images/nav_sms.gif";
t9On = new Image;
t9On.src="_images/nav_forum.gif";
t10On = new Image;
t10On.src="_images/nav_newsletter.gif";
t11On = new Image;
t11On.src="_images/nav_contact.gif";

t1Over  = new Image;
t1Over.src="_images/nav_home_over.gif";
t2Over = new Image;
t2Over.src="_images/nav_profiles_over.gif";
t3Over = new Image;
t3Over.src="_images/nav_presenters_over.gif";
t4Over = new Image;
t4Over.src="_images/nav_wallchart_over.gif";
t5Over = new Image;
t5Over.src="_images/nav_review_over.gif";
t6Over = new Image;
t6Over.src="_images/nav_rules_over.gif";
t7Over = new Image;
t7Over.src="_images/nav_greats_over.gif";
t8Over = new Image;
t8Over.src="_images/nav_sms_over.gif";
t9Over = new Image;
t9Over.src="_images/nav_forum_over.gif";
t10Over = new Image;
t10Over.src="_images/nav_newsletter_over.gif";
t11Over = new Image;
t11Over.src="_images/nav_contact_over.gif";

// the arrow
arr = new Image;
arr.src="_images/arrow.gif";

// the arrow
arrBlank = new Image;
arrBlank.src="_images/blank.gif";


// Declare the variables
ns4 = (document.layers)? true:false
ns6 = (document.getElementById)? true:false
ie4 = (document.all)? true:false

// change
function layerWrite(i,id,nestref,text) {

	if (ns4) {
		var lyr = (nestref)?
		eval('document.'+nestref+'.document.'+id+'.document') : document.layers[id].document
		lyr.open()
		lyr.write(text)
		lyr.close()
	}
	
	if (ie4) {
		document.all[id].innerHTML = text
	}
	
	// NS 6
	if (ns6) {
		document.getElementById('answer' + i).innerHTML = text;
	}
}

//-->
