
// Validate Email Address


function validateEmail(formName,inputName) {
	
// Validate email address

	var inputObject = document.forms[formName].elements[inputName];
	var atSign = inputObject.value.indexOf('@');
	var dot = inputObject.value.lastIndexOf('.');
	var space = inputObject.value.indexOf(' ');
	var emailLength = inputObject.value.length - 1;

	if ((atSign < 1) || (space != -1) || (dot <= atSign + 1) || (dot == emailLength)) { 
 		alert('Please enter a valid email address');
		inputObject.focus();
		return false;
	}
	return true;
}


//------------------------------------------------------------------------------------------------------


// Validate Password to Submit


function validatepassword(formName,password,passwordconfirm) {

	var inputObject = document.forms[formName].elements[password];
	var first = document.forms[formName].elements[password].value;
	var second = document.forms[formName].elements[passwordconfirm].value;	

	if (first != second) { 
 		alert('Your password did not confirm, please try again');
		document.forms[formName].elements[password].value = "";
		document.forms[formName].elements[passwordconfirm].value = "";
		inputObject.focus();
		return false;
	}
	return true;
}


//------------------------------------------------------------------------------------------------------

// Swap Image



function swapimage(name,image){
		
	document[name].src = "images/home_hidden_" + image + ".gif";
}


//------------------------------------------------------------------------------------------------------


// Disclaimer Window


function cert(number) {

var file = "cert_window.cfm?cert=" + number;

var winTop = (screen.height / 2) - 330;
var winLeft = (screen.width / 2) - 380;
windowFeatures = "width=765, height=550,";
windowFeatures = windowFeatures + "left=" + winLeft + ",";
windowFeatures = windowFeatures + "top=" + winTop + ",";
windowFeatures = windowFeatures + "toolbar=no, location=no, resizable=no, scrollbars=yes, status=yes";


     window.open(file,'cert',windowFeatures);
}


//------------------------------------------------------------------------------------------------------


// Advertisement Pop-up


function ad(message) {

var file = "ad.cfm?image=" + message;

var winTop = (screen.height / 2) - 300;
var winLeft = (screen.width / 2) - 200;
windowFeatures = "width=400, height=200,";
windowFeatures = windowFeatures + "left=" + winLeft + ",";
windowFeatures = windowFeatures + "top=" + winTop + ",";
windowFeatures = windowFeatures + "toolbar=no, location=no, resizable=no, scrollbars=no, status=no";


     window.open(file,'ad',windowFeatures);
}


//------------------------------------------------------------------------------------------------------



// Admin Login 


function admin(){
	
var winTop = (screen.height / 2) - 250;
var winLeft = (screen.width / 2) - 180;
windowFeatures = "width=350, height=190,";
windowFeatures = windowFeatures + "left=" + winLeft + ",";
windowFeatures = windowFeatures + "top=" + winTop + ",";
windowFeatures = windowFeatures + "toolbar=no, location=no, resizable=no, scrollbars=no, status=no";

	 msgWindow=open('login.cfm', 'window2',windowFeatures);
    if (msgWindow.opener == null) msgWindow.opener = self;
	}

//------------------------------------------------------------------------------------------------------



