<!--

var overImg = null;
var normImg = null;

var loadDone = false;


////////////////////////////////////////////////////////////////////////
/* bookmark function for numeruos browsers  */

function bookmarkinit() {
var IE = navigator.appName.match(/(Microsoft Internet Explorer)/gi), 
    NS = navigator.appName.match(/(Netscape)/gi), 
    OP = navigator.appName.match(/(Opera)/gi), 
    BK = document.getElementById("bookmark");



    BK.onmouseout = function(){ 
       window.status = ''; 
       return true; 
    } 

    if(IE && document.uniqueID){ 
       BK.onclick = function(){ 
          window.external.AddFavorite(location.href,document.title); 
       } 
       BK.onmouseover = function(){ 
          window.status='Click to add this page to your '+RegExp.$1+' favorites'; 
          return true; 
       } 
    } 

    else if(OP || IE && !document.uniqueID){ 
       BK.onclick = function(){ 
          alert('Your '+RegExp.$1+' browser requires that you\nPress Ctrl & T to Bookmark this page.'); 
       } 
       BK.onmouseover = function(){ 
          window.status='Your '+RegExp.$1+' browser requires that you Press Ctrl & T to Bookmark this page.'; 
          return true; 
       } 
    } 

    else if(NS){ 
       BK.onclick = function(){ 
          alert('Your '+RegExp.$1+' browser requires that you\nPress Ctrl & D to Bookmark this page.'); 
       } 
       BK.onmouseover = function(){ 
          window.status='Your '+RegExp.$1+' browser requires that you press Ctrl & D to Bookmark this page.'; 
          return true; 
       } 
    } 

    else{ BK.innerHTML = '' }

}

///////////////////////////////////////////////////////////////////////////////////////////////


////////////////////////////////////////////////////////////////////////

/* function for body.onLoad */

function initPage() {
	preloadMenu(8);
	loadDone = true;
}

////////////////////////////////////////////////////////////////////////

/* functions for menu and other images */
function preloadMenu(count) {
	overImg = new preloadImages(count, "/data/images/design/menu/menu-", "-on.gif");
	normImg = new preloadImages(count, "/data/images/design/menu/menu-", "-off.gif");
}

function preloadImages(length, path, type) {
    for(var i = 2; i <= length; i++) {
	this[i]= new Image();
	this[i].src= path + i + type;
    }
    return this;
}

function rollOn(num) {
    if(loadDone && document.images) { 
	document.images["m-" + num].src = overImg[num].src;
    }
}

function rollOff(num) {
    if(loadDone && document.images){
	document.images["m-" + num].src = normImg[num].src;
    }
}

function sizeImg(obj, _width) {
    var tmpImg = new Image();
    tmpImg.src = obj.src;
    if (tmpImg.width > _width) { obj.width = _width; }
}

////////////////////////////////////////////////////////////////////////

/* function to open print\email window */

function PrinterFriendly(url) {
    var width = 700,
        height = 550;

    remote = window.open("http://" + getDomainName() + url, "opener", "scrollbars=1,resizable=1,toolbar=1,left=" + ((screen.availWidth  - width) / 2) + ",top=" + ((screen.availHeight  - height) / 2) + ",width=" + width + ",height=" + height);

    if (remote.opener == null) remote.opener = window;
}

function getDomainName() {
	/*var url = window.location.href;
	var end = url.indexOf("/", 7);
	if (end == -1) { end = url.length; }
	return url.substring(7, end);*/
	return "www.firerehab.com";
}

/* function that show tip on your status bar when you take mouse over print\email link */

function showText(obj) {
    obj.onmouseout = function() { window.status = ""; }
    window.status = obj.innerText;
}

////////////////////////////////////////////////////////////////////////

/* functions that check different forms for correct information */


function checkEmail(email) {
    var myRegExp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    return myRegExp.test(email);
}

function array_unique (array) {
    // %          note 1: the second argument, sort_flags is not implemented
    // *     example 1: array_unique(['Kevin','Kevin','van','Zonneveld','Kevin']);
    // *     returns 1: ['Kevin','van','Zonneveld']
    // *     example 2: array_unique({'a': 'green', 0: 'red', 'b': 'green', 1: 'blue', 2: 'red'});
    // *     returns 2: {'a': 'green', 0: 'red', 1: 'blue'}
    
    var key = '', tmp_arr1 = {}, tmp_arr2 = {};
    var val = '';
    tmp_arr1 = array;
    
    var __array_search = function (needle, haystack) {
        var fkey = '';
        for (fkey in haystack) {
            if ((haystack[fkey] + '') === (needle + '')) {
                return fkey;
            }
        }
        return false;
    };
 
    for (key in tmp_arr1) {
        val = tmp_arr1[key];
        if (false === __array_search(val, tmp_arr2)) {
            tmp_arr2[key] = val;
        }
        
        delete tmp_arr1[key];
    }
    
    return tmp_arr2;
}

function setCookieByName(name, value) {
      var valueEscaped = escape(value);
      var expiresDate = new Date();
      /*expiresDate.setTime(expiresDate.getTime() + 365 * 24 * 60 * 60 * 1000); // ???? - 1 ???, ?? ??? ????? ????????
      var expires = expiresDate.toGMTString();// + "; path=/; expires=" + expires;*/
      var newCookie = name + "=" + valueEscaped;
      if (valueEscaped.length <= 4000) document.cookie = newCookie + ";path=/";
} 

function getCookieByName(name) {
	    var prefix = name + "=";
      var cookieStartIndex = document.cookie.indexOf(prefix);
      if (cookieStartIndex == -1) return null;
      var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length);
      if (cookieEndIndex == -1) cookieEndIndex = document.cookie.length;
      return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex)); 
}

function changeCompare(id) {
      var x = parseInt(id);
      if (!isNaN(x)) {
            var newElements = "";
            var allElement = getCookieByName('compareElements');
            if (allElement == "") allElement = "|";
            if (allElement == null)
                  newElements = "|" + x +"|";
            else
                  if (String(allElement).indexOf("|" + x + "|") == -1)
                        newElements = allElement + x + "|";
                  else
                        newElements = String(allElement).replace("|" + x + "|", "|");
            setCookieByName('compareElements', newElements);
      }
}

function CheckCompareById(id, obj) {
      var x = parseInt(id);
      if (!isNaN(x)) {
            var checkComp = false;
            var allElement = getCookieByName('compareElements');
            if (allElement != null)
                  if (String(allElement).indexOf("|" + x + "|") != -1)
                        checkComp = true;
            obj.checked = checkComp;
      }
}

function getCookie(name) {

	var regExp 	= new RegExp(name + "=([^;]*)","gi");
	var ck 		= regExp.exec(String(document.cookie));	
	ck 			= RegExp.$1;

	return ck;
}



function httpRequestCreate() {
	
	// ==================================
	// Check browser capability.
	// ==================================
	var httpRequest = false;

	if ( window.XMLHttpRequest ) 
	{ // Mozilla, Safari
		httpRequest = new XMLHttpRequest();
	
		if ( httpRequest.overrideMimeType ) {
			// ==================================
			// For FF (generats an error in javascript console)
			// ==================================
	
			httpRequest.overrideMimeType('text/xml');
		}
	} else if ( window.ActiveXObject ) 
	{ // IE
		try {
			httpRequest = new ActiveXObject("MSXML2.XMLHTTP.3.0");
		} catch (e) {
			try {
				httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) { document.write(e); }
		}
	}

	return httpRequest;
	
}

function validateFR1Reg(f) {
  if (f.hint_answer.value == "") {alert("Please Enter Password Hint Answer"); f.hint_answer.focus(); return false;}
  if (f.rank_job.selectedIndex == 0) {alert("Please Select Title/Rank"); f.rank_job.focus(); return false;}
  if (f.rank_job[f.rank_job.selectedIndex].value == "0") {
    if (f.rank_job_other.value == "") {alert("Please Enter Title/Rank (Other)"); f.rank_job_other.focus(); return false;}
  }
  if (f.org_type.selectedIndex == 0) {alert("Please Select Type of Organization"); f.org_type.focus(); return false;}
  if (f.org_type[f.org_type.selectedIndex].value == "0") {
    if (f.org_type_other.value == "") {alert("Please Enter Type of Organization (other)"); f.org_type_other.focus(); return false;}
  }
  if (f.company_name.value == "") {alert("Please Enter Department/Organization Name"); f.company_name.focus(); return false;}
  
  return true;
}

function validateJobPostForm(f) {
var chlvl = document.getElementsByTagName("input");
var blvl = false;
for (lvl in chlvl) {
  if (String(chlvl[lvl].name).indexOf("level") > -1)
    if (chlvl[lvl].checked)
      blvl=true;
}
  //if (f.cfname.value == "") {alert("Please Enter First Name"); f.cfname.focus(); return false;}
  if (f.clname.value == "") {alert("Please Enter Last Name"); f.clname.focus(); return false;}
  if (f.cemail.value == "") {alert("Please Enter Email"); f.cemail.focus(); return false;}
  if (!checkEmail(f.cemail.value)) {alert("Email Incorrect"); f.cemail.focus(); return false;}
  if (f.agency.value == "") {alert("Please Enter Agency"); f.agency.focus(); return false;}
  if (f.city.value == "") {alert("Please Enter City"); f.city.focus(); return false;}
  if (f.county.value == "") {alert("Please Enter County"); f.county.focus(); return false;}
  if (f.state.selectedIndex == -1) {alert("Please Select State"); f.state.focus(); return false;}
  if (String(document.location.href).indexOf("/test") > -1) {
    if (f.zip.value == "") {alert("Please Enter Zip"); f.zip.focus(); return false;}
    //else if (isNaN(parseInt(f.zip.value)) || parseInt(f.zip.value) != f.zip.value) {alert("Please Enter Valid Zip"); f.zip.focus(); return false;}
  }
  if (f.position.value == "") {alert("Please Enter Position"); f.position.focus(); return false;}
  if (!blvl) {alert("Please Select Level"); return false;}
  //var chlvl = document.getElementByTagName("imput"); 
  if ((f.fdeadlineM.value > "")||(f.fdeadlineD.value > "")||(f.fdeadlineY.value > "")) {
    if (f.fdeadlineM.value == "") {alert("Please Enter Filing Deadline Month"); f.fdeadlineM.focus(); return false;}
    if (f.fdeadlineD.value == "") {alert("Please Enter Filing Deadline Day"); f.fdeadlineD.focus(); return false;}
    if (f.fdeadlineY.value == "") {alert("Please Enter Filing Deadline Year"); f.fdeadlineY.focus(); return false;}
    if (isNaN(parseInt(f.fdeadlineM.value))) {alert("Filing Deadline Month Incorrect"); f.fdeadlineM.focus(); return false;}
    if (isNaN(parseInt(f.fdeadlineD.value))) {alert("Filing Deadline Day Incorrect"); f.fdeadlineD.focus(); return false;}
    if (isNaN(parseInt(f.fdeadlineY.value))) {alert("Filing Deadline Year Incorrect"); f.fdeadlineY.focus(); return false;}
    if (!/(20(\d{2}))(-)([0]{1}[1-9]{1}|([1]{1}[0-2]{1}))(-)(([0-2]{1}[0-9]{1})|([3]{1}[0-1]{1}))/.test(f.fdeadlineY.value + "-" + f.fdeadlineM.value + "-" +f.fdeadlineD.value)){
      alert("Filing Deadline Date Incorrect"); f.fdeadlineY.focus(); return false;
    }   
  }
  if (f.requirements.value == "") {alert("Please Enter Requirements"); f.requirements.focus(); return false;}
  if (String(f.requirements.value).length > 4000) {alert("Requirements length > 4000"); f.requirements.focus(); return false;}
  if (f.nimm.value > "") {
    if (isNaN(parseInt(f.nimm.value)) || parseInt(f.nimm.value) != f.nimm.value) {
      alert("Number of Immediate openings Incorrect"); f.nimm.focus(); return false;
    }
  }  
  if (f.nexp.value > "") {
    if (isNaN(parseInt(f.nexp.value)) || parseInt(f.nexp.value) != f.nexp.value) {
      alert("Number of Expected openings Incorrect"); f.nexp.focus(); return false;
    }
  }  
  if ((f.wtdateM.value > "")||(f.wtdateD.value > "")||(f.wtdateY.value > "")) {
    if (f.wtdateM.value == "") {alert("Please Enter Written Test Date Month"); f.wtdateM.focus(); return false;}
    if (f.wtdateD.value == "") {alert("Please Enter Written Test Date Day"); f.wtdateD.focus(); return false;}
    if (f.wtdateY.value == "") {alert("Please Enter Written Test Date Year"); f.wtdateY.focus(); return false;}
    if (isNaN(parseInt(f.wtdateM.value))) {alert("Written Test Date Month Incorrect"); f.wtdateM.focus(); return false;}
    if (isNaN(parseInt(f.wtdateD.value))) {alert("Written Test Date Day Incorrect"); f.wtdateD.focus(); return false;}
    if (isNaN(parseInt(f.wtdateY.value))) {alert("Written Test Date Year Incorrect"); f.wtdateY.focus(); return false;}
    if (!/(20(\d{2}))(-)([0]{1}[1-9]{1}|([1]{1}[0-2]{1}))(-)(([0-2]{1}[0-9]{1})|([3]{1}[0-1]{1}))/.test(f.wtdateY.value + "-" + f.wtdateM.value + "-" +f.wtdateD.value)){
      alert("Written Test Date Incorrect"); f.wtdateY.focus(); return false;
    }   
  }
  if ((f.patdateM.value > "")||(f.patdateD.value > "")||(f.patdateY.value > "")) {
    if (f.patdateM.value == "") {alert("Please Enter Physical Agility Test Date Month"); f.patdateM.focus(); return false;}
    if (f.patdateD.value == "") {alert("Please Enter Physical Agility Test Date Day"); f.patdateD.focus(); return false;}
    if (f.patdateY.value == "") {alert("Please Enter Physical Agility Test Date Year"); f.patdateY.focus(); return false;}
    if (isNaN(parseInt(f.patdateM.value))) {alert("Physical Agility Test Date Month Incorrect"); f.patdateM.focus(); return false;}
    if (isNaN(parseInt(f.patdateD.value))) {alert("Physical Agility Test Date Day Incorrect"); f.patdateD.focus(); return false;}
    if (isNaN(parseInt(f.patdateY.value))) {alert("Physical Agility Test Date Year Incorrect"); f.patdateY.focus(); return false;}
    if (!/(20(\d{2}))(-)([0]{1}[1-9]{1}|([1]{1}[0-2]{1}))(-)(([0-2]{1}[0-9]{1})|([3]{1}[0-1]{1}))/.test(f.patdateY.value + "-" + f.patdateM.value + "-" +f.patdateD.value)){
      alert("Physical Agility Test Incorrect"); f.patdateY.focus(); return false;
    }   
  }
  if (f.dtype.selectedIndex == 0) {alert("Please Select Department Type"); f.dtype.focus(); return false;}
  if (f.toapply.value == "") {alert("Please Enter To Apply"); f.toapply.focus(); return false;}
  if (String(f.toapply.value).length > 4000) {alert("To Apply length > 4000"); f.toapply.focus(); return false;}
  if (String(f.notes.value).length > 4000) {alert("Notes length > 4000"); f.notes.focus(); return false;}
  if (f.pfdistr.value > "") {
    if (isNaN(parseInt(f.pfdistr.value)) || parseInt(f.pfdistr.value) != f.pfdistr.value) {
      alert("Population of Fire District Incorrect"); f.pfdistr.focus(); return false;
    }
  }  
  if (f.npers.value > "") {
    if (isNaN(parseInt(f.npers.value)) || parseInt(f.npers.value) != f.npers.value) {
      alert("Number of Personnel Incorrect"); f.npers.focus(); return false;
    }
  }  
  if (f.captcha.value == "") {alert("Please Enter Code"); f.captcha.focus(); return false;}
  return true;
}
function changeCounter(eText, eCounterID, limitCh) {
  var keyValid = true;
  if (eText.value.length > limitCh) {
    eText.value = eText.value.substring(0, limitCh);
    alert("Your message may not exceed " + limitCh + " characters in length");
    keyValid = false;
  }
  document.getElementById(eCounterID).innerHTML = limitCh - eText.value.length;
  return keyValid;
}


function httpRequest(url, encoding, toReceive) {
	
	return httpRequestPost(url, encoding, toReceive,"");
	
	
	/*var toResolve		= 10000;
	var toConnect		= 10000;
	var toSend			= 40000;

	var request;
	var WinHttpReq;

	var request = "";
	try {
		var xmlHttpReq = httpRequestCreate(); //new ActiveXObject("MSXML2.XMLHTTP.3.0");
		xmlHttpReq.open("GET", url, false);
		xmlHttpReq.send();
		return xmlHttpReq.responseText;
		
		if(WinHttpReq.StatusText == "OK") {
			request = BinaryToString1(WinHttpReq.ResponseBody, encoding);
		} else { request = "1- " + WinHttpReq.StatusText; }
	} catch(e) { request = "2- " + "WinHttpRequest has caused an error"; }
	return request;*/
}

function httpRequestPost(url, encoding, toReceive, params) {
	var toResolve		= 10000;
	var toConnect		= 10000;
	var toSend			= 40000;

	var request;
	var WinHttpReq;
	
	var request = "";
	try {
		var xmlHttpReq = httpRequestCreate(); //new ActiveXObject("MSXML2.XMLHTTP.3.0");
		xmlHttpReq.open("POST", url, false);
		xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlHttpReq.setRequestHeader('HTTP_COOKIE', document.cookie);
		xmlHttpReq.send(params);
		return xmlHttpReq.responseText;

		
		if(WinHttpReq.StatusText == "OK") {
			request = BinaryToString1(WinHttpReq.ResponseBody, encoding);
		} else { request = "2-1 " + WinHttpReq.StatusText; }
	} catch(e) { request = "2-2 " + "WinHttpRequest has caused an error"; }
	return request;
}


function QuickRegistrtion(x) {
    if (x) {
      if ($("#quicklogin").attr("value") > "" || $("#quickpass").attr("value") > "")
        $("#qreg").attr("checked", 1);
    } else {
      $("#quicklogin").attr("value", "");
      $("#quickpass").attr("value", "");
    }
}

function FR1Reg() {
  if ($("#fr1regtable").css("display") == "none")
    $("#fr1regtable").css("display", "");
  else
    $("#fr1regtable").css("display", "none");
}

function TryAg() {
  $("#tryagmsg").css("display", "none");
  $("#tryag").css("display", "");
}

function validateCC(f) {
/*  if (f.cemail.value == "") {alert("Please Enter Email"); f.cemail.focus(); return false;}
  if (!checkEmail(f.cemail.value)) {alert("Email Incorrect"); f.cemail.focus(); return false;}*/
  var dd = new Date();
var ddm = dd.getMonth()+1;
var ddy = dd.getFullYear();
//if (f.ptype[0].checked) {
  if (f.bplan.value=="-1") { alert("Please Select biling plan"); f.bplan.focus(); return false; }
  if (f.card_type.value=="-1") { alert("Please Select Credit Card Type"); f.card_type.focus(); return false; }
  if (!(f.ccnum.value>"")) { alert("Please Enter credit card number"); f.ccnum.focus(); return false; }
  if (!(f.fname.value>"")) { alert("Please Enter first name"); f.fname.focus(); return false; }
  if (!(f.lname.value>"")) { alert("Please Enter last name"); f.lname.focus(); return false; }
  if (!(f.addr.value>"")) { alert("Please Enter address"); f.addr.focus(); return false; }
  if (!(f.code.value>"")) { alert("Please Enter credit card secure code"); f.code.focus(); return false; }
  if ((f.expMonth.value < ddm && f.expYear.value == ddy) || f.expYear.value < ddy) { alert("Please Enter right date"); f.expMonth.focus(); return false; }
//} else {
//  if (!(f.bname.value>"")) { alert("Please Enter Billing Contact Name"); f.bname.focus(); return false; }
//}
if (!(f.agree.checked)) { alert("Please Agree Firerecruit.com Terms "); f.agree.focus(); return false; }
if (!(f.bemail.value>"")) { alert("Please Enter Billing Contact Email"); f.bemail.focus(); return false; }
if (!checkEmail(f.bemail.value)) {alert("Email Incorrect"); f.bemail.focus(); return false;}
  return true
}

function validateUpdCC(f) {

  var dd = new Date();
var ddm = dd.getMonth()+1;
var ddy = dd.getFullYear();
  if (f.card_type.value=="-1") { alert("Please Select Credit Card Type"); f.card_type.focus(); return false; }
  if (!(f.ccnum.value>"")) { alert("Please Enter credit card number"); f.ccnum.focus(); return false; }
  if (!(f.fname.value>"")) { alert("Please Enter first name"); f.fname.focus(); return false; }
  if (!(f.lname.value>"")) { alert("Please Enter last name"); f.lname.focus(); return false; }
  if (!(f.addr.value>"")) { alert("Please Enter address"); f.addr.focus(); return false; }
  if (!(f.code.value>"")) { alert("Please Enter credit card secure code"); f.code.focus(); return false; }
  if ((f.expMonth.value < ddm && f.expYear.value == ddy) || f.expYear.value < ddy) { alert("Please Enter right date"); f.expMonth.focus(); return false; }
if (!(f.bemail.value>"")) { alert("Please Enter Billing Contact Email"); f.bemail.focus(); return false; }
if (!checkEmail(f.bemail.value)) {alert("Email Incorrect"); f.bemail.focus(); return false;}
  return true
}

function validateReg(f) {
  //user login
  if (!(f.username.value>"")) { alert("Please Enter User ID"); f.username.focus(); return false; }
  //user password
  if (!(f.userpass.value>"")) { alert("Please Enter Password"); f.userpass.focus(); return false; }
  //if (!(f.userpass.value.length>=6)) { alert("Password must be at least 6 characters"); f.userpass.focus(); return false; }
  if (String(document.location.href).indexOf("/test") > -1) {
    if (String(f.userpass.value).length < 6) { alert("Password must be 6 characters or more"); f.userpass.focus(); return false; }
    if (f.userpass.value == f.username.value) { alert("Password must differ from User ID"); f.userpass.focus(); return false; }
  }
  //if not equals
  if (String(f.reuserpass.value) != String(f.userpass.value)) { alert("The passwords you entered do not match."); f.userpass.focus(); return false; }
  
  if (!(f.fname.value>"")) { alert("Please Enter First Name"); f.fname.focus(); return false; }
  if (!(f.lname.value>"")) { alert("Please Enter Last Name"); f.lname.focus(); return false; }
  if (!(f.address.value>"")) { alert("Please Enter Address"); f.address.focus(); return false; }
  if (!(f.city.value>"")) { alert("Please Enter City"); f.city.focus(); return false; }
  if (f.state.value == "-1") { alert("Please Select State"); f.state.focus(); return false; }
  if (!(f.zip.value>"")) { alert("Please Enter Zip"); f.zip.focus(); return false; }
  //if (isNaN(parseInt(f.zip.value)) || parseInt(f.zip.value) != f.zip.value) { alert("Please Enter Valid Zip"); f.zip.focus(); return false; }
  if (!(f.country.value>"")) { alert("Please Enter Country"); f.country.focus(); return false; }
  if (!(f.phone.value>"")) { alert("Please Enter Phone"); f.phone.focus(); return false; }
  if (isNaN(parseInt(f.phone.value)) && parseInt(f.phone.value) != f.phone.value) { alert("Please Enter Valid Phone"); f.phone.focus(); return false; }
  if (f.fax.value > "")
    if (isNaN(parseInt(f.fax.value)) && parseInt(f.fax.value) != f.fax.value) { alert("Please Enter Valid Fax"); f.fax.focus(); return false; }
  if (!(f.mail.value>"")) { alert("Please Enter Email"); f.mail.focus(); return false; }
  
  
  if (!(checkEmail(f.mail.value))) { alert("Please Enter Valid Email"); f.mail.focus(); return false; }
  
  if (!(f.enotify[0].checked || f.enotify[1].checked)) { alert("Please Select receive email notifications of new job postings"); return false; }
  
  return true
}

function profileValidate(f) {
//user login
if (!(f.username.value>"")) { alert("Please Enter User ID"); f.username.focus(); return false; }
//user password
if (!(f.userpass.value>"")) { alert("Please Enter Password"); f.userpass.focus(); return false; }
if (String(document.location.href).indexOf("/test") > -1) {
  if (String(f.userpass.value).length < 6) { alert("Password must be 6 characters or more"); f.userpass.focus(); return false; }
  if (f.userpass.value == f.username.value) { alert("Password must differ from User ID"); f.userpass.focus(); return false; }
}
//if not equals
if (String(f.reuserpass.value) != String(f.userpass.value)) { alert("The passwords you entered do not match."); f.userpass.focus(); return false; }

if (!(f.fname.value>"")) { alert("Please Enter First Name"); f.fname.focus(); return false; }
if (!(f.lname.value>"")) { alert("Please Enter Last Name"); f.lname.focus(); return false; }
if (!(f.address.value>"")) { alert("Please Enter Address"); f.address.focus(); return false; }
if (!(f.city.value>"")) { alert("Please Enter City"); f.city.focus(); return false; }
if (f.state.value == "-1") { alert("Please Select State"); f.state.focus(); return false; }
if (!(f.zip.value>"")) { alert("Please Enter Zip"); f.zip.focus(); return false; }
//if (isNaN(parseInt(f.zip.value)) || parseInt(f.zip.value) != f.zip.value) { alert("Please Enter Valid Zip"); f.zip.focus(); return false; }
if (!(f.country.value>"")) { alert("Please Enter Country"); f.country.focus(); return false; }
if (!(f.phone.value>"")) { alert("Please Enter Phone"); f.phone.focus(); return false; }
if (isNaN(parseInt(f.phone.value)) && parseInt(f.phone.value) != f.phone.value) { alert("Please Enter Valid Phone"); f.phone.focus(); return false; }
if (f.fax.value > "")
  if (isNaN(parseInt(f.fax.value)) && parseInt(f.fax.value) != f.fax.value) { alert("Please Enter Valid Fax"); f.fax.focus(); return false; }
if (!(f.mail.value>"")) { alert("Please Enter Email"); f.mail.focus(); return false; }


if (!(checkEmail(f.mail.value))) { alert("Please Enter Valid Email"); f.mail.focus(); return false; }
}

function SelectBillingPlan(x) {
  $("div.bpDescr").css("display", "none");
  $("#" + $(x).val()).css("display", "block");
}

function ChangePaymentType(x) {
  if (x) {
    $("#paymetTable select").css("display", "none");
    $("#paymetTable tr").css("display", "none");
    $("#paymetTable tr:first").css("display", "");
    $("#paymetTable tr:last").css("display", "");
    $("#pt2").css("display", "");
    $("#pt3").css("display", "");
    $("#pt14").css("display", "");
  } else {
    $("#paymetTable select").css("display", "");
    $("#paymetTable tr").css("display", "");
    $("#paymetTable tr:first").css("display", "");
    $("#pt2").css("display", "none");
  }
}

function ChangeOther(x) {
  if ($(x).val() == "Other")
    $("#other").attr("disabled", "");
  else
    $("#other").attr("disabled", "1");
}
function ChangeOtherRankJob(x) {
  if ($(x).val() == 0)
    $("#rank_job_other").attr("disabled", "");
  else
    $("#rank_job_other").attr("disabled", "1");
}
function ChangeOtherTypeOrg(x) {
  if ($(x).val() == 0)
    $("#org_type_other").attr("disabled", "");
  else
    $("#org_type_other").attr("disabled", "1");
}
function popupWnd(url, width, height){
  if(isNaN(width)) width = 300;
  if(isNaN(height)) height = 600;
  window.open(url, "_blank", "height=" + height + ",width" + width + ",directories=no,left=100,top=100,location=no,menubar=no,resizable=no,status=no,toolbar=no,scrollbars=yes");
} 
//-->
