/*
 | Browser object
 */
function plx_Browser() {
 d=document;
 this.agt=navigator.userAgent.toLowerCase();
 this.major = parseInt(navigator.appVersion);
 this.dom=(d.getElementById)?1:0; // true for ie6, ns6
 this.ns=(d.layers);
 this.ns4up=(this.ns && this.major >=4);
 this.ns6=(this.dom&&navigator.appName=="Netscape");
 this.op=this.agt.indexOf('opera')!=-1;
 this.ie=(d.all);
 this.ie4=(d.all&&!this.dom)?1:0;
 this.ie4up=(this.ie && this.major >= 4);
 this.ie5=(d.all&&this.dom);
 this.win=((this.agt.indexOf("win")!=-1) || (this.agt.indexOf("16bit")!=-1));
 this.mac=(this.agt.indexOf("mac")!=-1);
}

var brz = new plx_Browser();

// Emulation of array push/pop for those who lack it (IE 5.0/4.0)
function Array_push() {
  var A_p = 0
  for (A_p = 0; A_p < arguments.length; A_p++) {
   this[this.length] = arguments[A_p];
  }
  return this.length
}

function Array_pop() {
  var response = this[this.length - 1];
  this.length--;
  return response;
}

function Array_unshift() {
  this.reverse();
  for(var i=arguments.length-1;i>=0;i--) this[this.length]=arguments[i]
  this.reverse();
  return this.length
}

if (typeof(Array.prototype.unshift) == "undefined") {
  Array.prototype.unshift = Array_unshift;
}

if (typeof(Array.prototype.pop) == "undefined") {
  Array.prototype.pop = Array_pop;
}

if (typeof Array.prototype.push == "undefined") {
  Array.prototype.push = Array_push;
}

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];}
}
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_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.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function changeDiv(the_div,the_change)
{
  var the_style = getStyleObject(the_div);
  if (the_style != false)
  {
    the_style.display = the_change;
  }
}

function getStyleObject(objectId) {
  if (getObject(objectId)) return getObject(objectId).style;
  else return false;
}

function getObject(objectId) {
  if (document.getElementById && document.getElementById(objectId)) {
    return document.getElementById(objectId);
  } else if (document.all && document.all(objectId)) {
    return document.all(objectId);
  } else {
    return false;
  }
}

function hideObject(objectId) {
    var obj;
    if (document.getElementById && document.getElementById(objectId)) {
	obj = document.getElementById(objectId);
    } else if (document.all && document.all(objectId)) {
	obj = document.all(objectId);
    } else {
	return false;
    }

    if (obj && obj.style) {
	obj.style.display = "none";
	return true;
    }
    return false;
}

// call this to require a that a text field not be empty.
// e.g. if(!requireField("You must enter your name",document.form.name)) return false;
function requireField(message,elem)
{
  if(elem && (!elem.value || elem.value.length==0 || elem.value=="NULL" || elem.value=="Please Select"))
    return fail(message,elem);
  return true;
}

function fail(message,elem) 
{ 
    alert(message); 
    if(elem)
    {
      if(elem.select) elem.select();
      elem.focus();
    }
    return(false); 
}

function popup(url, title, width, height)
{
  var ht = 600;
  if (window.document.body.clientHeight) ht = window.document.body.clientHeight;
  else if (window.innerHeight) ht = window.innerHeight;

    if (height != 0 && width != 0)
      return window.open(url, title, 'statusbar=no,menubar=no,toolbar=no,scrollbars,resizable,top=0,height=' + height + ',width=' + width);
    else if (width != 0)
      return window.open(url, title, 'statusbar=no,menubar=no,toolbar=no,scrollbars,resizable,top=0,height=' + ht + ',width=' + width);
    else
      return window.open(url, title, 'statusbar=no,menubar=no,toolbar=no,scrollbars,resizable');
}

// privacy statement popups
function showPrivacy(host) { popup((host?host:'')+'/support/privacy_statement','privacy_statement_non_members','540','635'); }
function showPrivacyNonMembers(host) { popup((host?host:'')+'/support/privacy_statement_nonmembers','privacy_statement_non_members','540','635'); }

/* --- BEGIN VERISIGN CODE - based on http://www.verisign.com/seal/secure/install.html --- */

function popupVerisign(url) {
sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=500,height=450');
self.name = "mainWin";
}

/* --- END VERISIGN CODE --- */

/* -- BEGIN EMAIL SYNAX CHECKER CODE -- */
// note: this list of top-level domains should be periodically updated
var tld="(?:aero|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|arpa|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|fi|fj|fk|fm|fo|fr|ga|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)";
var validEmail="^[\\w.-]+@(([\\w-]+\\.)+"+tld+"|(\\d{1,3}\\.){3}\\d{1,3})$"
// RK: Commented out due to IE 5 bugs
//var validEmailPattern=new RegExp(validEmail);

/* Returns whether the given email address is valid. */
/* // js: now use EmailSyntax.js
function isValidEmail(email)
{
  if(email.length==0) return(true);
  if(email.indexOf('@')==-1 || email.indexOf('.')==-1) return(false);

  //return true;
  return(validEmailPattern.test(email)); // full regexp check
}
*/
/* -- END EMAIL SYNAX CHECKER CODE -- */

// **********************************************************************
// *  BEGIN MODAL DIALOG CODE
// **********************************************************************

// Global for brower version branching.
var Nav4 = ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4));

// One object tracks the current modal dialog opened from this window.
var dialogWin = new Object();

// Generate a modal dialog.
// Parameters:
//    url -- URL of the page/frameset to be loaded into dialog
//    width -- pixel width of the dialog window
//    height -- pixel height of the dialog window
//    returnFunc -- reference to the function (on this page)
//                  that is to act on the data returned from the dialog
//    args -- [optional] any data you need to pass to the dialog

function openModalDialog(url, width, height, returnFunc, args) {
	if (!dialogWin.win || (dialogWin.win && dialogWin.win.closed)) {
		// Initialize properties of the dialog object.
		dialogWin.returnFunc = returnFunc;
		dialogWin.returnedValue = "";
		dialogWin.args = args;
		dialogWin.url = url;
		dialogWin.width = width;
		dialogWin.height = height;
		// Keep name unique so Navigator doesn't overwrite an existing dialog.
		dialogWin.name = (new Date()).getSeconds().toString();
		// Assemble window attributes and try to center the dialog.
		if (Nav4) {
			// Center on the main window.
			dialogWin.left = window.screenX + 
			   ((window.outerWidth - dialogWin.width) / 2);
			dialogWin.top = window.screenY + 
			   ((window.outerHeight - dialogWin.height) / 2);
			var attr = "screenX=" + dialogWin.left + 
			   ",screenY=" + dialogWin.top + ",resizable=no,width=" + 
			   dialogWin.width + ",height=" + dialogWin.height;
		} else {
			// The best we can do is center in screen.
			dialogWin.left = (screen.width - dialogWin.width) / 2;
			dialogWin.top = (screen.height - dialogWin.height) / 2;
			var attr = "left=" + dialogWin.left + ",top=" + 
			   dialogWin.top + ",resizable=no,width=" + dialogWin.width + 
			   ",height=" + dialogWin.height;
		}
		// Generate the dialog and make sure it has focus.
		dialogWin.win=window.open(dialogWin.url, dialogWin.name, attr);
		if (dialogWin.win)
			dialogWin.win.focus();
		else
			alert("Error - unable to open new window.");
	} else {
		if (dialogWin.win)
			dialogWin.win.focus();
	}
}

