//free estimate comfirmation
function estimatenote(){
	var myform = document.frmEstimateNote;
	var ctr = 0;
	if(myform.txtFname.value == ""){
		alert("You missed to enter your Full Name!");
		myform.txtFirstName.focus();
		ctr = 1;
	}
	else if(myform.txtphone.value == ""){
		alert("You missed to enter your Phone Number!");
		myform.txtphone.focus();
		ctr = 1;
	}
	if(ctr == 0){
		//document.frmEstimateNote.action="index.html";
		myform.HIDconfirm.value = "EstimateNote";	
		myform.submit();
	}
}

/*Emergency quick Note*/
function indexnote(){
	var myform = document.frmENote;
	var ctr = 0;
	if(myform.txtFname.value == ""){
		alert("You missed to enter your Full Name!");
		myform.txtFirstName.focus();
		ctr = 1;
	}
	else if(myform.txtphone.value == ""){
		alert("You missed to enter your Phone Number!");
		myform.txtphone.focus();
		ctr = 1;
	}
		
	if(ctr == 0){
		//document.frmEstimateNote.action="index.html";
		myform.HIDconfirm.value = "IndexNote";	
		myform.submit();
	}
}

/* use as general function reference */
//onKeyPress="return keyRestrict(event,'1234567890');"
function getKeyCode(e){
	if (window.event)
	   return window.event.keyCode;
	else if (e)
	   return e.which;
	else
	   return null;
}
function keyRestrict(e, validchars){ 
	var key='', keychar='';
	key = getKeyCode(e);
	if (key == null) return true;
	keychar = String.fromCharCode(key);
	keychar = keychar.toLowerCase();
	validchars = validchars.toLowerCase();
	if (validchars.indexOf(keychar) != -1)
		return true;
	if ( key==null || key==0 || key==8 || key==9 || key==13 || key==27 )
		return true;
	return false;
}



//valid = true
function CheckEmail(email){
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)) {
		return true
	}
	
	return (false)
}

function PhoneFormat(me)
{
	if (me.value.length > 0) {
		var tValue = me.value.replace(new RegExp("-", "gi"), "");
		
		tValue = tValue.substring(0, 3) + '-' + tValue.substring(3, 6) + '-' + tValue.substring(6);
		me.value = tValue;
	}
}



