function form_validator(theForm)
{

if((theForm.db_id.value == "") && (theForm.db.value == "")){
	theForm.search_and_display_db_button.value = "";
		return (true);
	}

    if((theForm.db_id.value != "") && (theForm.db.value == "")) {
         alert("Please Select A State.");
         theForm.db.focus();
	     return (false);
    }
	theForm.search_and_display_db_button.value = "on";
    return (true);
}

function form_validator1(theForm)
{

    if(theForm.keywords.value == "") {
         alert("Please enter any keywords.");
         theForm.keywords.focus();
		  return (false);
    }

    if(theForm.db.value == "") {
         alert("Please Select A State.");
         theForm.db.focus();
	     return (false);
    }

    return (true);
}
function form_validator2(theForm)
{

    if(theForm.db.value == "") {
         alert("Please Select A State.");
         theForm.db.focus();
	     return (false);
    }

    return (true);
}



function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=500,height=358,scrollbars=no');
return false;
}

browser = (((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 3 )) || ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4 )))
// preload universal images
if (browser) {
Question_off = new Image;
Question_off.src = "http://www.business-forsale.com/resumes/img/goldquestion.gif";
Question_roll = new Image;
Question_roll.src = "http://www.business-forsale.com/resumes/img/goldquestion_mo.gif";

Boss_off = new Image;
Boss_off.src = "http://www.business-forsale.com/resumes/img/boss.gif";
Boss_roll = new Image;
Boss_roll.src = "http://www.business-forsale.com/resumes/img/boss_mo.gif";
}

function putImage(imgDocID,imgObjName) {
if (browser) {
        document.images[imgDocID].src = eval(imgObjName + ".src")
}
}



   function getSelectedValue(list) {
              location.href = list.options[list.selectedIndex].value;
   }

function LivePageWidth() {
 if (window.innerWidth!= null)
  return window.innerWidth;
 if (document.body.clientWidth!= null)
  return document.body.clientWidth;
 return screen.availWidth;
}
function changeZip()
{
	splitval = document.rform.property_city.value.split("|");
	local_cnt = 1;
	document.rform.property_zip.value = splitval[1];
	document.rform.property_zip.value = splitval[2];
	document.rform.property_zip.options.length = 0;
	while(splitval[local_cnt]){
		document.rform.property_zip.options[document.rform.property_zip.options.length] = new Option(splitval[local_cnt++]);
	}
}
function form_validator123(theForm)
{

    if(theForm.id.value == "") {
         alert("Please enter the Business ID.");
         theForm.id.focus();
         return(false);
    }

    if(theForm.db[0].selected == true) {
         alert("Please Select A State.");
         theForm.db.focus();
         return(false);
    }

    return (true);
}
function GetValue( Offset )
{
  var End = document.cookie.indexOf (";", Offset);
  if( End == -1 )
	End = document.cookie.length;

// Return the portion of the cookie beginning with the offset
// and ending with the ";".

  return unescape( document.cookie.substring( Offset, End) );
}

function GetCookie( Name )
{
  var Len = Name.length;

// Look at each substring that's the same length as the cookie name
// for a match.  If found, look up the value and return it.

  var i = 0;
  while( i < document.cookie.length )
  {
 	var j = i + Len + 1;
	if( document.cookie.substring( i, j) == (Name + "=") )
		return GetValue( j );
	i = document.cookie.indexOf( " ", i ) + 1;
	if( i == 0)
		break;
  }
  var a = "";
  return a;
}

// Create or change a cookie given its name and value.  The name and value
// are required, but the expiration date isn't.  Note that if you don't specify
// an expiration date, the cookie only exists for the current session.

function SetCookie( Name, Value, Expire )
{
  document.cookie = Name + "=" + escape( Value ) + ";expires=" + Expire;
}

// Write all the cookies for the LOGON form.

function WriteCookies()
{
//  var Expire = "Friday,25-Feb-2000 12:00:00 GMT";
  var Expire = "$cookie_expiration_date";

  with( document.LOGON )
  {
	SetCookie( "username", auth_user_name.value, Expire );
	SetCookie( "password", auth_password.value, Expire );
		/*if ( auth_remember_login.value == "on" ) { 
			SetCookie( "remember_login", auth_remember_login.value, Expire );
		}*/
  }
}

// Load the form with the values in the cookie

function GetCookies()
{
  with( document.LOGON )
  {
	auth_user_name.value = GetCookie( "username" );
	auth_password.value = GetCookie( "password" );
	if(auth_user_name.value == ""){
		auth_user_name.value = 'User Name';
	}
	if(auth_password.value == ""){
		auth_password.value = 'Password';
	}
	/*auth_remember_login.value = GetCookie( "remember_login" );
if ( auth_remember_login.value == "on" ) { 
auth_remember_login.checked = true; }*/

  }
}

function FixCookieDate (date) {
  var base = new Date(0);
  var skew = base.getTime(); // dawn of (Unix) time - should be 0
  if (skew > 0)  // Except on the Mac - ahead of its time
    date.setTime (date.getTime() - skew);
}

var expdate = new Date ();
FixCookieDate (expdate); // Correct for Mac date bug - call only once for given Date object!
expdate.setTime (expdate.getTime() + (24 * 60 * 60 * 1000 * 365)); // 365 days from now 

function IsValid()
	{
	 blnValid = true;

	 with( document.LOGON )
	  {
		if(( auth_user_name.value == "" ) || ( auth_password.value == "" ))
		{
		  window.alert( "You must enter both your user name and your password" );
		  blnValid = false;
		}

		var Username = auth_user_name.value;
		var Password = auth_password.value;
/*if (auth_remember_login.checked) {
		var Remember_login = "onn";
		}*/

	   }
	if( blnValid )
if (Remember_login == "onn") {
document.cookie = "username=" + Username + ";expires=" + expdate.toGMTString() + ";";
document.cookie = "password=" + Password + ";expires=" + expdate.toGMTString() + ";";
document.cookie = "remember_login=" + Remember_login + ";expires=" + expdate.toGMTString() + ";";
}


	  return blnValid;
	}


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_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
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 MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
