
/* --------------------------------------------------- */
/* VALIDATE DOCUMENT FILE UPLOAD */
/* --------------------------------------------------- */
function validateCont(theForm) {
		
	var msg = "The following fields were left blank:\n\n";
	var error = false
	var msg2 = "The following errors have occurred:\n\n";
	var error2 = false
	
	if (theForm.contactDate.value != "")
	{		
		return false;
	}
	if (theForm.fname.value == "") {
		error = true
		msg += " - First Name\n";
	} 
	if (theForm.lname.value == "") {
		error = true
		msg += " - Last Name\n";
	}
	
	var p=0;
	p=theForm.email.value.indexOf('@');
		
	
	if (theForm.email.value == "") 
	{
		error = true
		msg += " - Email.\n";
	}
	
	if ((p<1 || p==(theForm.confEmail.value.length-1)) && theForm.email.value != "")
	{
		error2=true
		msg2 += " - Please check the email address.\n";
	}
		
	
	p=theForm.confEmail.value.indexOf('@');
	
	if (theForm.email.value !== theForm.confEmail.value && theForm.email.value != "")
	{
		error2 = true
		msg2 += " - Please re-confirm your email.\n";
	}
	else if ((p<1 || p==(theForm.confEmail.value.length-1)) && theForm.email.value != "")
	{
		error2=true
		msg2 += " - Please check the email address for confirmation.\n";
	}
	
	if (theForm.city.value == "") {
		error = true
		msg += " - City\n";
	}
	if (theForm.state.value == "") {
		error = true
		msg += " - State\n";
	}
	if (error && !error2) {
		alert(msg)
		return false;
	} else if (!error && error2) {
		alert(msg2)
		return false;
	} else if (error && error2) {
		alert(msg + "\n\n" + msg2)
		return false
	} else {
		return true
	}
}


function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=650,height=500,left = 1,top = 1');");
}


/* --------------------------------------------------- */
/* POP-UP WINDOW */
/* --------------------------------------------------- */
function openwin(URL,theHeight,theWidth) {
	var nXpos = (screen.availWidth - theWidth) / 2; 
	var nYpos = (screen.availHeight - theHeight) / 2; 
	var win = window.open(URL, 'popupWin', 'top=' + nYpos + ',left=' + nXpos + ',screenY=' + nYpos + ',screenX=' + nXpos + ',height=' + theHeight + ',width=' + theWidth + 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0');
	win.focus();
}