


function chkVer(imagename,objectsrc){
	var n=navigator.appName
	var v=parseInt(navigator.appVersion)
	var browsok=((n=="Netscape")&&(v>=3))
	var browsok2=((n=="Microsoft Internet Explorer")&&(v>=4))
	if((browsok)||(browsok2))
	document.images[imagename].src=eval(objectsrc+".src")
}

function Starthw(page,height,width){
	Openwin = this.open(page, "NewWin", "width="+width+",height="+height+",scrollbars=no,resizable=no,status=no");
}

function Start(page){
	Openwin = this.open(page, "NewWin", "width=670,height=550,scrollbars=yes,resizable=yes,menubar,toolbar,status=yes");
}

function Startb(page){
        Openwin = this.open(page, "NewWin800", "width=725,scrollbars=yes,resizable=yes,menubar,status=yes");
}
function Startc(page){
        Openwin = this.open(page, "NewWin800", "width=725,scrollbars=yes,resizable=yes,menubar,toolbar,status=yes");
}

function Startd(page){
	Openwin = this.open(page, "NewWin", "width=725,height=550,scrollbars=yes,resizable=yes,statusbar");
}

function checkInput(f){
	if (f.SearchString.value==""){
		alert("Please enter some text you want to search for.");
		f.SearchString.focus();
		return false;
	}
	else
		f.submit();
		return true;
}

function textcolor(obj,color) {
		obj.style.color=color;
	}


function Testbox(form, button) {
	if (form.first.value==""){
		alert("Please enter the Applicant's First Name");
		form.first.focus();
		return (false);	
	}
	if (form.last.value==""){
		alert("Please enter the Applicant's Last Name");
		form.last.focus();
		return (false);	
	}
	if (form.add.value=="")	{
		alert("Please enter the Applicant's Address");
		form.add.focus();
		return (false);	
	}
	if (form.city.value==""){
		alert("Please enter the Applicant's City");
 		form.city.focus();
		return (false);	
	}
	if (form.state.value==""){
		alert("Please enter the Applicant's State");
 		form.state.focus();
		return (false);	
	}
	if (form.zip.value=="")	{
		alert("Please enter the Applicant's Zip code");
 		form.zip.focus();
		return (false);	
	}
	if (form.emailapp.checked){
		if (form.email.value==""){
			alert("Please enter the Applicant's E-mail Address")
			form.email.focus();
			return (false);		
		}
	}
	
	if (form.email.value!="")
		if (!(emailCheck(form.email.value))){
			form.email.focus();
			return (false);
		}
	
	if (form.agency.value=="")	{
		if(form.name=="ryp")
			alert("Please enter Referring Agency");
		else
			alert("Please enter Name of College");
 		form.agency.focus();
		return (false);	
	}
	if (form.firststaff.value=="")	{
		alert("Please enter name of Referring Staff Member");
		form.firststaff.focus();
		return (false);	
	}
	if (form.laststaff.value=="")	{
		alert("Please enter name of Referring Staff Member");
		form.laststaff.focus();
		return (false);	
	}
	if (form.agencyadd.value==""){
		if(form.name=="ryp")
			alert("Please enter address of the Referring Agency");
		else
			alert("Please enter address of College");
		form.agencyadd.focus();
		return (false);	
	}
	if (form.agencycity.value==""){
		if(form.name=="ryp")
			alert("Please enter city of the Referring Agency");
		else
			alert("Please enter city of College");
 		form.agencycity.focus();
		return (false);	
	}
	
	if (form.agphone1.value==""){
		alert("Please enter complete phone number");
		form.agphone1.focus();
		return (false);	
	}
	if (form.agphone2.value==""){
		alert("Please enter complete phone number");
		form.agphone2.focus();
		return (false);	
	}
	if (form.agphone3.value==""){
		alert("Please enter complete phone number");
		form.agphone3.focus();
		return (false);	
	}

	if (form.agemail.value==""){
		alert("Please enter e-mail");
		form.agemail.focus();
		return (false);
	}	
	else{
		if (!(emailCheck(form.agemail.value))){
			form.agemail.focus();
			return (false);
		}
	}
	
	return (true);
}

function doNothing(){

}

function defaultImage(id){
	elem = document.getElementById(id);
	var img_name = elem.getAttribute("onbut");
	//	elem.removeAttribute('href')
// for IE
	elem.onmouseout="change_image('"+id+"','"+img_name+"')";
// for FireFox
	elem.setAttribute("onMouseOut", function() {change_image(id,img_name);});
//change default image to on.  DW 4/26/06
	change_image(id,img_name);
}
function undoimage(id){
	



}

function change_image(img_name,img_src){
	
	document[img_name].src=img_src;
}

function checkrequired(elem){
	if (elem.checked)
		document.getElementById('emailreq').style.display = "";
	else
		document.getElementById('emailreq').style.display = "none";	
}

function emailCheck(emailStr) {
	var emailPat = /^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;
	//var emailPat = /^(\".*\"|[A-Za-z0-9]\w*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z]\w*(\.[A-Za-z]\w*)+)$/;
	
	var matchArray = emailStr.match(emailPat);
	if (matchArray == null) {
		alert("Your e-mail address syntax appears incorrect.  Please try again.");
		return false;
	}

	return true;
}