<!--
var browser=navigator.appName;
if(browser=="Microsoft Internet Explorer")browser="IE";
if(browser=="Netscape")browser="FF";
if(browser=="IE"){
	var browser_v=navigator.appVersion;
	var ver=browser_v.substring(browser_v.indexOf('MSIE')+5,browser_v.indexOf('MSIE')+6)
}
document.onkeydown=function(e){
	window.document.key_id=window.event ? event.keyCode : e.keyCode;
}
function $() {
  return document.getElementById(arguments[0]);
}
function $$() {
	if(arguments.length=='2'){
		if(typeof(arguments[1]) == 'object'){
			return arguments[1].getElementsByTagName(arguments[0]);
		}else{
			return $(arguments[1]).getElementsByTagName(arguments[0]);
		}
	}
	return document.getElementsByTagName(arguments[0]);
}
function autotab(obj,nxt,frm){
	var f=frm ? $(frm) : document.forms[0];
	if(obj.value.length==obj.maxLength){
		if(window.document.key_id && window.document.key_id!=8 && window.document.key_id!=9 && window.document.key_id!=16){
			f[nxt].focus();
			return false;
		}
	}
}
String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
function empty(obj,min_,max_){
	obj.value=obj.value.trim();
	if(max_ && obj.maxLength!=obj.value.length)return 1;
	return min_ ? (obj.value.length<min_?1:0):obj.value.length?0:1;
}
function force_numeric(obj){
	obj.value=obj.value.replace(/[\D]/g,"");
}
function form_check(f)
{
	inputs=[];
	inputs['first_name']=["Please provide your first name.",2];
	inputs['last_name']=["Please provide your last name.",2];
	inputs['phone1_p1']=["Sorry, your phone's area code appears to be invalid. Please check the number and try again.",3,/[2-9]{1}[0-8]{1}[0-9]{1}/g];
	inputs['phone1_p2']=["Sorry, your phone's prefix appears to be invalid. Please check the number and try again.",3,/[2-9]{1}[0-9]{2}/g];
	inputs['phone1_p3']=["Sorry, your phone's suffix appears to be invalid. Please check the number and try again.",4,/[0-9]{4}/g];
	inputs['street']=["Please provide you street address."];
	inputs['city']=["Please provide you city."];
	inputs['state']=["Please provide you state."],2;
	inputs['email']=["Please provide a valid email address.",1,/^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,6}|[0-9]{1,3})(\]?)$/];
	inputs['zip']=["Please provide your zip code.",5];
	var inp=$$('input',f);
	for(j in inp){
		if(typeof(inp[j]) == "object"){
			var fail=0;
			var i=inp[j];
			if(inputs[i.name]){
				if((inputs[i.name][1] && empty(i,inputs[i.name][1])) || empty(i)){
					fail=1;
				}
				if(inputs[i.name][2]){
					var filter=inputs[i.name][2];
					var res=filter.test(i.value).toString();
					void(filter.test(i.value)+'_'+res);
					if(res==='false')fail=1;
				}
				if(fail){
					alert(inputs[i.name][0]);
					i.focus();
					return false;
				}
			}
		}
	}
	if(window.fc_under){
		window.fc_under.close();
	}
	return true;
}
//-->
