<!-- Begin
/* ------------- Script for Contact Form ------------ */
function validateForm(frm) {
	var msg = "";
	msg += checkSubject(frm.subject);
  	msg += checkEmail(frm.emailaddress);
  	msg += checkMessage(frm.message);
      
  	if (msg != "") {
    	alert("Some fields need correction:\n" + msg);
    	return false;
  	}
  	return true;
}

function checkSubject(param) {
    var error = "";
    if (param.value == "") {
        param.style.background = '#FFFF99'; 
        error = "Please enter subject.\n";
    } else {
        param.style.background = '#FFFFE6';
    }
    return error;
}

function trim(s)
{
  return s.replace(/^\s+|\s+$/, '');
}

function checkEmail(param) {
    var error="";
    var tparam = trim(param.value);         
    var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/ ;
    var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/ ;
   
    if (param.value == "") {
        param.style.background = '#FFFF99';
        error = "Please enter an email address.\n";
    } else if (!emailFilter.test(tparam)) {              //test email for illegal characters
        param.style.background = '#FFFF99';
        error = "Please enter a valid email address.\n";
    } else if (param.value.match(illegalChars)) {
        param.style.background = '#FFFF99';
        error = "The email address contains illegal characters.\n";
    } else {
        param.style.background = '#FFFFE6';
    }
    return error;
}

function checkMessage(param) {
    var error = "";
    if (param.value.length == 0) {
        param.style.background = '#FFFF99'; 
        error = "The required field has not been filled in.\n"
    } else {
        param.style.background = '#FFFFE6';
    }
    return error;  
}
/* ------------- End Contact Form ------------------ */
function popUp(URL) {
	day = new Date();
	id = day.getTime();
		eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=610,left = 340,top = 212');");
}

function expandingText(param) {
	styleObj=document.getElementById(param).style;
	if (styleObj.display=='none'){
   		styleObj.display='';
   	} else {
   		styleObj.display='none';
   	}
}

function Blank_TextField_Validator(frmadvsearch)
{
	var strtitle = frmadvsearch.title.value;
	var strauthor = frmadvsearch.author.value;
	var strabstract = frmadvsearch.abstract.value;
	var strpubin = frmadvsearch.published.value;	
	if ((strtitle == "") && (strauthor == "") && (strabstract == "") && (strpubin == "")) {
		alert("Please enter valid search terms.");
		return (false);
	}
	return (true);
}

function popUpWindow(strURL, strType, strHeight, strWidth) {
	var strOptions="";
	if (strType=="console") 
		strOptions="resizable,height="+strHeight+",width="+strWidth;
	if (strType=="fixed") 
		strOptions="status,height="+strHeight+",width="+strWidth;
	if (strType=="elastic") 
		strOptions="toolbar,statusbar,menubar,scrollbars,resizable,location,height="+strHeight+",width="+strWidth;
	window.open(strURL, 'newWin', strOptions);
}

function PreviousPage() {
  history.back(1);
}

function printWindow(){
   bV = parseInt(navigator.appVersion)
   if (bV >= 4) window.print()
}

function mailpage(){
	var mail_str = "";
	mail_str = "mailto:?subject=Check out the " + document.title;
	mail_str += "&body=I thought you might be interested in the " + document.title;
	mail_str += ". You can view it at, " + location.href;
	location.href = mail_str;
}
// End -->