//<script>

function NewWindow(strPageURL,intNewWinHeight,intNewWinWidth) {

	// Place the window
	var intNewWinPutX=0;
	var intNewWinPutY=0;
	var strNewWin;
	// open window
	
	strNewWin = '"toolbar=no,menubar=no,scrollbars=no,location=no,directories=no,status=no,resizable=yes,height=' + intNewWinHeight + ',width=' + intNewWinWidth + '"';
	var objPopUp = window.open(strPageURL,"PhotoPopUp",config=strNewWin);
	// set position
	objPopUp.moveTo(intNewWinPutX,intNewWinPutY);
	return false;
			
}

function OpenPurWindow(strPageURL,intNewWinHeight,intNewWinWidth) {

	// Place the window
	var intNewWinPutX=0;
	var intNewWinPutY=0;
	var strNewWin;
	// open window
	
	strNewWin = '"toolbar=no,menubar=no,scrollbars=yes,location=no,directories=no,status=no,resizable=yes,height=' + intNewWinHeight + ',width=' + intNewWinWidth + '"';
	var objPopUp = window.open(strPageURL,"PhotoPopUp",config=strNewWin);
	// set position
	objPopUp.moveTo(intNewWinPutX,intNewWinPutY);
	return false;
			
}


function CheckReqFields() {
	
	var blnIsValid = true;
	
	// Check the Name field.
	if (frmQuery.txtFName.value == "") {
		reqFName.style.visibility = "visible";
		blnIsValid = false;
	} else {
		reqFName.style.visibility = "hidden";
	}
	// Check the Last Name field.
	if (frmQuery.txtLName.value == "") {
		reqLName.style.visibility = "visible";
		blnIsValid = false;
	} else {
		reqLName.style.visibility = "hidden";
	}
	// Check the Address field.
	if (frmQuery.txtAddress1.value == "") {
		reqAddress1.style.visibility = "visible";
		blnIsValid = false;
	} else {
		reqAddress1.style.visibility = "hidden";
	}
	// Check the State field.
	if (frmQuery.txtStateProv.value == "") {
		reqStateProv.style.visibility = "visible";
		blnIsValid = false;
	} else {
		reqStateProv.style.visibility = "hidden";
	}
	// Check the PostZip field.
	if (frmQuery.txtPostZipCode.value == "") {
		reqPostZipCode.style.visibility = "visible";
		blnIsValid = false;
	} else {
		reqPostZipCode.style.visibility = "hidden";
	}
	// Check the Email field.
	if (frmQuery.txtEmail.value == "") {
		reqEmail.style.visibility = "visible";
		blnIsValid = false;
	} else {
		reqEmail.style.visibility = "hidden";
		if (!ValidEmailCheck(frmQuery.txtEmail.value)) {
			alert("Your email address seems incorrect.  Please try again (check the '@' and '.'s in the email address). \nAlso check for illigal characters (!\"£$%\^&\*\(\)<>:;,\s\|\\\/@]).");
			blnIsValid = false;
		}
	}
	// If the form is valid send it.
	if (blnIsValid == true) {
		frmQuery.submit();
		return true;
	} else {
		return false;
	}
}
function ValidEmailCheck(strFieldName) {

	var strValue = strFieldName;
	
	if(strValue.length == 0) { return true; } // empty string
	
	var strEmailPat =/^([^\.!"£$%\^&\*\(\)<>:;,\s\|\\\/@][^!"£$%\^&\*\(\)<>:;,\s\|\\\/@]*[^\.!"£$%\^&\*\(\)<>:;,\s\|\\\/@])@([^\.!"£$%\^&\*\(\)<>:;,\s\|\\\/@][^!"£$%\^&\*\(\)<>:;,\s\|\\\/@]*\.[^!"£$%\^&\*\(\)<>:;,\s\|\\\/@]*[^\.!"£$%\^&\*\(\)<>:;,\s\|\\\/@])$/
	var ArrMatch = strValue.match(strEmailPat);
	var strTemp = ".."
	if ((ArrMatch == null)||(ArrMatch[0].indexOf(strTemp) != -1)) {
	// pattern didn't match
		return false;
	}
	return true;
}