<!--
function MM_preloadImages() { //v3.0 
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function deleteChrs(s){
	var i;
	var sDone = "";
	for (i = 0; i < s.length; i++){
		var c = s.charAt(i);
		if ((c >= "0") && (c <= "9")) sDone += c;
	}
	return sDone;
}

function checkUSPhone(txtPhone) {
    if (txtPhone.value != '') {
        var phone = deleteChrs(txtPhone.value)
        var phonelen = phone.length
        if (phonelen < 10) {
            txtPhone.value = "";
            return;
        }
        if (phone.substring(0, 1) == '1') { phone = phone.substring(1, 15); phonelen = phone.length; }
        txtPhone.value = "(" + phone.substring(0, 3) + ") " + phone.substring(3, 6) + "-" + phone.substring(6, 10)
        if (phonelen > 10) { txtPhone.value += " x " + phone.substring(10, 14); }
    }
    return;
}

function checkUSPhoneNoExt(txtPhone){
	if (txtPhone.value!=''){  
		var phone = deleteChrs(txtPhone.value)
		var phonelen = phone.length
		if(phonelen < 10){
			txtPhone.value = "";
			return;
		}
		if(phone.substring(0,1)=='1'){phone = phone.substring(1,11); phonelen = phone.length;}
		txtPhone.value = "(" + phone.substring(0,3) + ") " + phone.substring(3,6) + "-" + phone.substring(6,10)
	}
	return;
}

function checkUSPhoneExt(txtPhone){
	txtPhone.value = deleteChrs(txtPhone.value);
}

function checkSS(txtSS){
	if (txtSS.value!=''){  
		var ss = deleteChrs(txtSS.value)
		var sslen = ss.length
		if(sslen < 9){
			txtSS.value = "";
			return;
		}
		txtSS.value = ss.substring(0,3) + "-" + ss.substring(3,5) + "-" + ss.substring(5,9)
	}
	return;
}

function textToCapital(txtObj) {
	var str = txtObj.value, chrprev=' ', strf='';
	for(var i=0; i<str.length; i++){
		var c=str.charAt(i);
		if((chrprev==' ') || (chrprev=='.') || (chrprev=='-') || (chrprev=='/')){
			if((c!=' ') || (chrprev!=' ')){strf+=c.toUpperCase();}
		}else{
			strf+=c.toLowerCase();
		}
		chrprev=c;
	}
	txtObj.value=strf;
}

function textToSentence(txtObj) {
	var str = txtObj.value, chrprev='', strf='';
	for(var i=0; i<str.length; i++){
		var c=str.charAt(i);
		if((chrprev=='') || (chrprev=='.') || (chrprev=='!') || 
			(chrprev=='?') || (chrprev=='\n')){strf+=c.toUpperCase();}else{strf+=c;}
		if(c!=' '){chrprev=c;}
	}
	txtObj.value=strf;
}

function textToAllCapital(txtObj) {
	var str = txtObj.value;
	txtObj.value = str.toUpperCase();
}

function popupWindow(filename, hlpwidth, hlpheight){
	var winL=120, winT=50;
	if (parseInt(navigator.appVersion)>3) {
/*		if (navigator.appName=="Netscape") {
			winL = window.screenLeft + ((window.innerWidth - hlpwidth) / 2);
			winT = window.screenTop + ((window.innerHeight - hlpheight) / 2);
	}*/
		if (navigator.appName.indexOf("Microsoft")!=-1) {
			winL = window.screenLeft + ((document.body.offsetWidth - hlpwidth) / 2);
			winT = window.screenTop + ((document.body.offsetHeight - hlpheight) / 2);
		}
	}
	help_window = window.open( filename, "_blank", "left=" + winL + ",top=" + winT + ",width=" + hlpwidth + ",height=" + hlpheight + ",resizable=0,scrollbars=0,toolbar=0,status=0,location=0,directories=0,menubar=0");
	help_window.focus();
	return false;
}

function popupWindowScroll(filename, hlpwidth, hlpheight){
	var winL=120, winT=50;
	if (parseInt(navigator.appVersion)>3) {
		if (navigator.appName.indexOf("Microsoft")!=-1) {
			winL = window.screenLeft + ((document.body.offsetWidth - hlpwidth) / 2);
			winT = window.screenTop + ((document.body.offsetHeight - hlpheight) / 2) - 25;
		}
	}
	help_window = window.open( filename, "_blank", "left=" + winL + ",top=" + winT + ",width=" + hlpwidth + ",height=" + hlpheight + ",resizable=1,scrollbars=1,toolbar=0,status=0,location=0,directories=0,menubar=0");
	help_window.focus();
	return false;
}

//short form js

String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, '').replace(/\s+/g, ' '); };

var IsValid;

function fOnFocus(obj, value) { 
	obj.value = obj.value.replace(value, '');
	obj.style.color = 'black';
	obj.className = 'form_border';
}

function fOnBlur(obj, value) {
            obj.value = obj.value.replace(value, '').trim();
            var cur_value=obj.value;
            if (cur_value == '' || cur_value.length<2) { obj.value = value; obj.style.color = 'grey'; }
            else if (value=='Full Name')
            {
	if (!cur_value.match(/^[a-zA-Z']{2,}\s{1}[a-zA-Z']{0,}\s{0,}[a-zA-Z']{2,}$/)){
	        obj.value = value; obj.style.color = 'grey'; 
	}
            }
            else if (value == 'Email'){
	if (!cur_value.match(/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.(([0-9]{1,3})|([a-zA-Z]{2,3})|(aero|coop|info|museum|name))$/)){
	        obj.value = value; obj.style.color = 'grey'; 
	}
            }
        }

 function fValidateObject(obj, value) {
            fOnBlur(obj, value);
            if (obj.value==value){
                IsValid=false; 
                obj.className = 'form_border_error';
            }
            else {
                obj.className = 'form_border';
            }
        }

 function sfValidate(sender, args) {
            var obj;
            IsValid = true;
            obj = document.getElementById(sender.id.replace('Validator', 'Firstname'));
            fValidateObject(obj, 'First Name');
            obj = document.getElementById(sender.id.replace('Validator', 'Lastname'));
            fValidateObject(obj, 'Last Name');
            obj = document.getElementById(sender.id.replace('Validator', 'Phone'));
            checkUSPhone(obj);
            fValidateObject(obj, 'Phone');
            obj = document.getElementById(sender.id.replace('Validator', 'Email'));
            fValidateObject(obj, 'Email');
            args.IsValid = IsValid;
        }       

   function sfValidate_ShorterForm(sender, args) {
            var obj;
            IsValid = true;
            obj = document.getElementById(sender.id.replace('Validator', 'Name'));
            fValidateObject(obj, 'Full Name');
            obj = document.getElementById(sender.id.replace('Validator', 'Phone'));
            checkUSPhone(obj);
            fValidateObject(obj, 'Phone');
            obj = document.getElementById(sender.id.replace('Validator', 'Email'));
            fValidateObject(obj, 'Email');
            args.IsValid = IsValid;
        }       
        function sfValidate_ShorterLogin(sender, args) {
            var obj;
            IsValid = true;
            obj = document.getElementById(sender.id.replace('Validator', 'Password'));
            fValidateObject(obj, 'Password');
            obj = document.getElementById(sender.id.replace('Validator', 'Email'));
            fValidateObject(obj, 'Email');
            args.IsValid = IsValid;
        }       	  
//end of short form js 


// -->

