/* js/YH_contact.js 
 * 
 * Functions used by the contact form. 
 */ 

var REQUIRED=Array('name','email','subject','message');

function gotRequired(){
	for(var i=0;i<REQUIRED.length;i++){
		eval('var whatisit=document.forms[0].'+REQUIRED[i]+'.type;'); 
		if(whatisit=='text'||whatisit=='textarea'){
			eval('var whatsitgot=document.forms[0].'+REQUIRED[i]+'.value;');
			if(whatsitgot==""){return 0};
		}else if(whatisit=='select-one'){
			eval('var whatsitgot=document.forms[0].'+REQUIRED[i]+'.selectedIndex;');
			if(whatsitgot==""){return 0};
		}
	}
	return 1;
}

function submitMe(frm){
	if(res){
		if(!gotRequired()){
			alert('Not all required information was entered! Please enter all info and re-submit the form.'+"\n"); 
			return 0;
		}
		document.forms[0].submit();
	}else{
		return 0;
	}
}

function resetMe(frm){
	var res=confirm('Are you certain you want to clear all data entered?'+"\n");
	if(res){
		return 1;
	}else{
		return 0;
	}
}