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 = "%%GRAPHICS_DIR%%/goldquestion.gif";
Question_roll = new Image;
Question_roll.src = "%%GRAPHICS_DIR%%/goldquestion_mo.gif";

Boss_off = new Image;
Boss_off.src = "%%GRAPHICS_DIR%%/boss.gif";
Boss_roll = new Image;
Boss_roll.src = "%%GRAPHICS_DIR%%/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 form_validator(theForm)
{

    if(theForm.id.value == "") {
         alert("Please enter the Residential 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 LivePageWidth() {
 if (window.innerWidth!= null)
  return window.innerWidth;
 if (document.body.clientWidth!= null)
  return document.body.clientWidth;
 return screen.availWidth;
}
function changeZip()
{
	if(document.rform.name){
		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 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;
	}