// JScript source code
function IsObject(obj){     
            return obj ? true : false;
}

function MoveToNextField(szFieldIn,szFieldToMoveTo,iItemsInField){
		if(document.forms[0][szFieldIn].value.length >= iItemsInField)
			document.forms[0][szFieldToMoveTo].select();
	}
function checkEmail(email)
{
if(email.length > 0)
	{
	if (email.indexOf(' ') >= 0)
		alert("Emails cannot have spaces in them. Please enter a valid email.");
	else if (email.indexOf('@') == -1)
		alert("Emails must have a @. Please enter a valid email.");
	}
}		

//This will check to make sure the email is a valid email.
function isEmail(Mail){
	var reg = /^([a-z]+)([a-z0-9\-\_\.]{1,100})([a-z0-9]+)\@([a-z0-9]+)([a-z0-9\-\.]*)([a-z0-9]+)\.([a-z]{2,6})$/;
	Mail=Mail.toLowerCase();
	if(reg.test(Mail) == false) {
		alert('Invalid Email Address');
		document.forms[0].Email.focus();
		return Mail;	
	}
	else {
		return Mail;
	}
}

function Rcertify(){
	popupWin = window.open('http://www.bbbonline.org/cks.asp?id=10305301412232616', 'Participant','location=yes,scrollbars=yes,width=450,height=300'); 
	window.name = 'opener';
} 

var allowChars = "123456789.";
function numbersonly(myfield, e, dec){
	var key;
	var keychar;

	if (window.event)
	   key = window.event.keyCode;
	else if (e)
	   key = e.which;
	else
	   return true;

	keychar = String.fromCharCode(key);

	// control keys
	if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27))
	   return true;
	else if ((("0123456789.").indexOf(keychar) > -1)) // numbers
	   return true;
	else
	   return false;
}

function numbersonlyamount(myfield, e, dec){
	var key;
	var keychar;

	if (window.event)
	   key = window.event.keyCode;
	else if (e)
	   key = e.which;
	else
	   return true;

	keychar = String.fromCharCode(key);

	// control keys
	if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27))
	   return true;
	else if ((("0123456789.").indexOf(keychar) > -1)) // numbers
	   return true;
	else
	   return false;
}

function numbersonlydate(myfield, e, dec){
	var key;
	var keychar;

	if (window.event)
	   key = window.event.keyCode;
	else if (e)
	   key = e.which;
	else
	   return true;
	keychar = String.fromCharCode(key);

	// control keys
	if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27))
	   return true;
	else if ((("0123456789/").indexOf(keychar) > -1)){ // numbers
		if((myfield.value).indexOf(".") > -1){
			if(keychar == ".")
				return false
			else
				return true
		}
		else
			return true;
	}
	else
		return false;
}

//This only allows uppercase and lowercase A-z, -, ][ and \. I am not sure how these "][\" got in there.
function valid(f) {
	!/^[A-z-']*$/.test(f.value)?f.value = f.value.replace(/[^A-z-']/g,''):null;
} 

//This only allows alphanumeric, (-), (#), (.), (').
function validaddress(f) {
	!/^[A-z0-9-'.# ]*$/.test(f.value)?f.value = f.value.replace(/[^A-z0-9-'.# ]/g,''):null;
}
		
//This only allows numeric 0-9.
function validnumbers(f) {
	!/^[0-9]*$/.test(f.value)?f.value = f.value.replace(/[^0-9]/g,''):null;
} 
//This only allows alphanumeric, (-), (.).
function validwebsite(f) {
	!/^[A-z0-9-.]*$/.test(f.value)?f.value = f.value.replace(/[^A-z0-9-.]/g,''):null;
}
function validloginpass(f) {
	!/^[A-z0-9-.@]*$/.test(f.value)?f.value = f.value.replace(/[^A-z0-9-.@]/g,''):null;
}
//This only allows uppercase and lowercase A-z, -, ][, spaces and \. I am not sure how these "][\" got in there.
function validnamespace(f) {
	!/^[A-z-' ]*$/.test(f.value)?f.value = f.value.replace(/[^A-z-' ]/g,''):null;
}

//Hide status bar msg II script- by javascriptkit.com
//Visit JavaScript Kit (http://javascriptkit_com) for script
//Credit must stay intact for use

//function hidestatus(){
//window.status=''
//return true
//}

//if (document.layers)
//document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)

//document.onmouseover=hidestatus
//document.onmouseout=hidestatus

function IsCCValid( CC ){                         
	if (CC.length > 19)
		return (false);

	var sum = 0; 
	var multiple = 1; 
	var CCLength = CC.length;
	var digit;
	for (i = 0; i < CCLength; i++){
		digit = CC.substring(CCLength-i-1,CCLength-i);
		tproduct = parseInt(digit ,10)*multiple;
		if (tproduct >= 10)
				sum += (tproduct % 10) + 1;
		else
				sum += tproduct;
		if (multiple == 1)
				multiple++;
		else
				multiple--;
	}
	if ((sum % 10) == 0)
		return (true);
	else
		return (false);
}

function checkABA(s) {

  var i, n, t;

  // First, remove any non-numeric characters.

  t = "";
  for (i = 0; i < s.length; i++) {
    c = parseInt(s.charAt(i), 10);
    if (c >= 0 && c <= 9)
      t = t + c;
  }

  // Check the length, it should be nine digits.

  if (t.length != 9)
    return false;

  // Now run through each digit and calculate the total.

  n = 0;
  for (i = 0; i < t.length; i += 3) {
    n += parseInt(t.charAt(i),     10) * 3
      +  parseInt(t.charAt(i + 1), 10) * 7
      +  parseInt(t.charAt(i + 2), 10);
  }

  // If the resulting sum is an even multiple of ten (but not zero),
  // the aba routing number is good.

  if (n != 0 && n % 10 == 0)
    return true;
  else
    return false;
}

function doPopUp(popup){
	window.open(popup,"","width=600,height=600,screenX=50,left=50,screenY=50,top=50,dependent,scrollbars,resizable");
}

function doPopUpL(popup){
	window.open(popup,"","width=800,height=600,screenX=50,left=50,screenY=50,top=50,dependent,scrollbars,resizable");
}

function refreshParent(refresh) {
 	if (refresh == 'Y') {
	 	window.opener.location.href = window.opener.location.href;
		if (window.opener.progressWindow) {
			alert("refresh");
			window.opener.progressWindow.close();
		}
	}
	window.close();
}
function gotoFormElement() {
	// may need to use eval function
	if (document.forms[0]) {
		if (document.forms[0].elements[0]) {
			if (document.forms[0].elements[0].type != "hidden") {
				document.forms[0].elements[0].focus();
			}
		}
	}
}
function Trim(s) 
{
  // Remove leading spaces and carriage returns
  // || (s.substring(0,1) == '\n') || (s.substring(0,1) == '\r')
  while ((s.substring(0,1) == ' '))  {
    s = s.substring(1,s.length);
  }

  // Remove trailing spaces and carriage returns
 // || (s.substring(s.length-1,s.length) == '\n') || (s.substring(s.length-1,s.length) == '\r')
  while ((s.substring(s.length-1,s.length) == ' '))  {
    s = s.substring(0,s.length-1);
  }
  return s;
}
// to use checkEnter add onKeyPress="return checkEnter(event)" to each field
NS4 = (document.layers) ? true : false;
function checkEnter(event)
{ 	
	var code = 0;
	
	if (NS4)
		code = event.which;
	else
		code = event.keyCode;
	if (code==13)
		document.forms[0].submit();
}

// ***DHTML Layer Pop-up - Free Credit Consultation - 20 seconds
function twentysecpop(){
var df,rf=false,na=navigator.userAgent,dt=document,op=(na.indexOf('Opera')!=-1),dm=(dt.getElementById)?true:false,ie5x=(dt.all&&dm),mci=(na.indexOf('Mac')!=-1);df=((ie5x||op)&&mci);decide();function decide(){if(df){return;}else{rf=true;}}
if(rf){
function initADP(){bdf=0;
// *** Begin advanced user scripting area ***
   htmlstring="<iframe src=\"http://www.legacylegal.com/freeconsult_framed.asp\" name=\"fccframe\" id=\"fccframe\" width=100% height=100% align=\"left\" Frameborder=\"0\" Scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\"></iframe>      ";
   new adp("llsfccpopup",htmlstring,"100% Private-No Obligation FREE Credit Consultation!");
   new adpMask('adpMask');
   if(isc)return;
   adpTimer('llsfccpopup','adpDropin','adpShow','','',20,'');setTimeout("adpShowMask('adpMask')",20000);
// *** End advanced user scripting area ***
}
if(window.attachEvent){window.attachEvent('onload', initADP);}else{if(typeof window.onload == 'function'){var preADP = window.onload;window.onload = function(){preADP();initADP();}}else{window.onload = initADP;}}
}
}
// End 20 Second timer, begin 40 second
function fortysecpop(){
var df,rf=false,na=navigator.userAgent,dt=document,op=(na.indexOf('Opera')!=-1),dm=(dt.getElementById)?true:false,ie5x=(dt.all&&dm),mci=(na.indexOf('Mac')!=-1);df=((ie5x||op)&&mci);decide();function decide(){if(df){return;}else{rf=true;}}
if(rf){
function initADP(){bdf=0;
// *** Begin advanced user scripting area ***
   htmlstring="<iframe src=\"http://www.legacylegal.com/freeconsult_framed.asp\" name=\"fccframe\" id=\"fccframe\" width=100% height=100% align=\"left\" Frameborder=\"0\" Scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\"></iframe>      ";
   new adp("llsfccpopup",htmlstring,"100% Private-No Obligation FREE Credit Consultation!");
   new adpMask('adpMask');
   if(isc)return;
   adpTimer('llsfccpopup','adpDropin','adpShow','','',20,'');setTimeout("adpShowMask('adpMask')",40000);
// *** End advanced user scripting area ***
}
if(window.attachEvent){window.attachEvent('onload', initADP);}else{if(typeof window.onload == 'function'){var preADP = window.onload;window.onload = function(){preADP();initADP();}}else{window.onload = initADP;}}
}
}


