<!-- Hide script from older browsers 
function showUserDirListings(vps_Field,vps_Value) {
	document.formhid.action="validateappraisersearchdata.asp";
	document.formhid.hidActionType.value="newsearch";
	document.formhid.hidSortField.value="";
	document.formhid.hidField.value=vps_Field;
	document.formhid.hidValue.value=vps_Value;
	document.formhid.submit(); 
}

function whiteSpace() {
	document.write("<BR>");
	if (navigator.appName=="Netscape") {
		document.write("<BR>");
	}
}

function setReqFldsMyAccount() {
	var modeE,modeP;
	var rcolor="#FFCC66";
	var ncolor="#FFFFFF";
	modeE = document.forms["frmMyAccount"].elements["chkEnews"].checked ? true : false;
	modeP = document.forms["frmMyAccount"].elements["chkPrint"].checked ? true : false;
	if(modeE) 
		document.forms["frmMyAccount"].elements["txtEmail"].style.backgroundColor = rcolor;
	if (modeP) {
		document.forms["frmMyAccount"].elements["txtAddr1"].style.backgroundColor = rcolor;
		document.forms["frmMyAccount"].elements["txtCity"].style.backgroundColor = rcolor;
		document.forms["frmMyAccount"].elements["txtState"].style.backgroundColor = rcolor;
		document.forms["frmMyAccount"].elements["txtZIP"].style.backgroundColor = rcolor;		
		document.forms["frmMyAccount"].elements["cboTitle"].style.backgroundColor = rcolor;		
		document.forms["frmMyAccount"].elements["cboOrganizationType"].style.backgroundColor = rcolor;		
		document.forms["frmMyAccount"].elements["cboNumEmployees"].style.backgroundColor = rcolor;		
		document.forms["frmMyAccount"].elements["cboAnnualSales"].style.backgroundColor = rcolor;		
		document.forms["frmMyAccount"].elements["cboIndustry"].style.backgroundColor = rcolor;		
		document.forms["frmMyAccount"].elements["cboYearsBusiness"].style.backgroundColor = rcolor;		
		}
	else {
		document.forms["frmMyAccount"].elements["txtAddr1"].style.backgroundColor = ncolor;
		document.forms["frmMyAccount"].elements["txtCity"].style.backgroundColor = ncolor;
		document.forms["frmMyAccount"].elements["txtState"].style.backgroundColor = ncolor;
		document.forms["frmMyAccount"].elements["txtZIP"].style.backgroundColor = ncolor;		
		document.forms["frmMyAccount"].elements["cboTitle"].style.backgroundColor = ncolor;		
		document.forms["frmMyAccount"].elements["cboOrganizationType"].style.backgroundColor = ncolor;		
		document.forms["frmMyAccount"].elements["cboNumEmployees"].style.backgroundColor = ncolor;		
		document.forms["frmMyAccount"].elements["cboAnnualSales"].style.backgroundColor = ncolor;		
		document.forms["frmMyAccount"].elements["cboIndustry"].style.backgroundColor = ncolor;		
		document.forms["frmMyAccount"].elements["cboYearsBusiness"].style.backgroundColor = ncolor;		
	}
}

function printWindow(){
   bV = parseInt(navigator.appVersion)
   if (bV >= 4) window.print()
}

function redirectme() {
	if (navigator.cookieEnabled!=-true) {
		window.location="needcookies.asp";
		return
	}
	if (navigator.javaEnabled()!=-true)	{
		window.location="needjavascript.asp";
		return
	}
}

function subForm1(form) {
	alert(form.name);
}

function subForm() {
var xFrm
xFrm=document.forms["frmMyAccount"];
xFrm.action='myaccountedit.asp';
xFrm.submit();
return false;
	//document.Forms[srcForm].action=destForm;
//	alert(xFrm.name);
//	xFrm.submit();
	//return false;
}

function sImg() { //v3.0
	var i,j=0,x,a=sImg.arguments; document.sr=new Array; 
	for(i=0;i<(a.length-2);i+=3)
		if ((x=findObj(a[i]))!=null) {
			document.sr[j++]=x; 
			if(!x.oSrc) x.oSrc=x.src; 
			x.src=a[i+2];
			//alert(x.name);
		}
}

function sImgRest() { //v3.0
	var i,x,a=document.sr; 
	for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)
		x.src=x.oSrc;
		//alert(x.name);
}
	
function jf_string_trim(x) {return x.replace(/(^ +)|( +$)/g,'')}

function wordCounter() {
	var strx;
	var dest;
	strx=jf_string_trim(document.forms["frmListing"].elements["txtListing"].value);
	dest=document.forms["frmListing"].elements["txtWordsRem"];
	wordcounter=1;
	if (strx.length==0) {
		dest.value = "You've typed 0 words.";
		document.forms["frmListing"].elements["hidDispWords"].value=0;
		}
	else {
		for (x=0;x<strx.length;x++) {
			if (strx.charAt(x) == " " && strx.charAt(x-1) != " ")  {wordcounter++}  // Counts the spaces while ignoring double spaces, usually one in between each word.
			if (wordcounter > 100) {strx = strx.substring(0, x);}
			else {
					 dest.value = "You've typed " + wordcounter + " words.";
					 document.forms["frmListing"].elements["hidDispWords"].value=wordcounter;					 
			}
		}
	}
}

function fillCost() {
	var tcost,mode,index,words;
	index=document.forms["frmListing"].elements["cboListingTypeID"].selectedIndex;
	tcost=cost[index];
	mode =document.forms["frmListing"].elements["chkLinkEmailYN"].checked ? true : false;
	if (mode) tcost=tcost+emailcost[index];
	mode =document.forms["frmListing"].elements["chkLinkURLYN"].checked ? true : false;
	if (mode) tcost=tcost+urlcost[index];
	mode =document.forms["frmListing"].elements["chkLinkImgYN"].checked ? true : false;
	if (mode) tcost=tcost+imgcost[index];
	document.forms["frmListing"].elements["txtAnnualRate"].value=formatCurrency(tcost,2);
	document.forms["frmListing"].elements["txtEmailCost"].value="("+formatCurrency(emailcost[index],2)+")";
	document.forms["frmListing"].elements["txtURLCost"].value="("+formatCurrency(urlcost[index],2)+")";
	document.forms["frmListing"].elements["txtImgCost"].value="("+formatCurrency(imgcost[index],2)+")";
	words=descwords[index]
	document.forms["frmListing"].elements["txtDescWords"].value="Up to "+words+" words will be displayed.";
	document.forms["frmListing"].elements["hidDispWords"].value=words;
}

function preloadImage() { //v3.0
	var d=document; 
	if(d.images){
		if(!d.p) d.p=new Array();
		var i,j=d.p.length,a=preloadImage.arguments; 
		for(i=0; i<a.length; i++)
			if (a[i].indexOf("#")!=0){
				 d.p[j]=new Image; 
				 d.p[j++].src=a[i];
		}
	}
}
	
function preLoadImages() {
	preloadImage('images/btn_r1_c1.gif');
	preloadImage('images/btn_r1_c2.jpg');
	preloadImage('images/btn_r1_c3.gif');
	preloadImage('images/btn_r2_c1.jpg');
	preloadImage('images/btn_r2_c3.jpg');
	preloadImage('images/btn_r3_c1.gif');
}
	
function 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=findObj(n,d.layers[i].document);
		if(!x && document.getElementById) x=document.getElementById(n); return x;
}
	
function openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}

function popSignUp(url) { 
	agent = navigator.userAgent;
	windowName = "_blank";
	p_Width = 225
	p_Height = 200
	params  = "";
	params += "toolbar=0,";
	params += "location=0,";
	params += "directories=0,";
	params += "status=0,";
	params += "menubar=0,";
	params += "scrollbars=0,";
	params += "resizable=1,";
	params += "top=200,";
	params += "left=200,";
	params += "width=" + p_Width + ",";
	params += "height=" + p_Height;
// close the window to vary the window size
	if (typeof(win) == "object" && !win.closed){
			win.close();
	}
	win = window.open(url, windowName , params);
	if (agent.indexOf("Mozilla/2") != -1 && agent.indexOf("Win") == -1) {
			win = window.open(url, windowName , params);
	}
	if (!win.opener) {
			win.opener = window;
	}
	// bring the window to the front
	win.focus();	
}

function popImageUpload(url) { 
	agent = navigator.userAgent;
	windowName = "_blank";
	params  = "";
	params += "toolbar=0,";
	params += "location=0,";
	params += "directories=0,";
	params += "status=0,";
	params += "menubar=0,";
	params += "scrollbars=0,";
	params += "resizable=1,";
	params += "top=250,";
	params += "left=100,";
	params += "width=600,";
	params += "height=360";
// close the window to vary the window size
	if (typeof(win) == "object" && !win.closed){
			win.close();
	}
	win = window.open(url, windowName , params);
	if (agent.indexOf("Mozilla/2") != -1 && agent.indexOf("Win") == -1) {
			win = window.open(url, windowName , params);
	}
	if (!win.opener) {
			win.opener = window;
	}
	// bring the window to the front
	win.focus();	
}

function checkCapsLock( e ) {
	var myKeyCode=0;
	var myShiftKey=false;
	var myMsg='Caps Lock is On.\n\nTo prevent entering your password incorrectly,\nyou should press Caps Lock to turn it off.';
	// Internet Explorer 4+
	if ( document.layers ) {
		myKeyCode=e.which;
		myShiftKey=( myKeyCode == 16 ) ? true : false;
	// Netscape 6
	} else if ( document.getElementById ) {
		myKeyCode=e.which;
		myShiftKey=( myKeyCode == 16 ) ? true : false;
	}
	// Upper case letters are seen without depressing the Shift key, therefore Caps Lock is on
	if ( ( myKeyCode >= 65 && myKeyCode <= 90 ) && !myShiftKey ) {
		alert( myMsg );
	// Lower case letters are seen while depressing the Shift key, therefore Caps Lock is on
	} else if ( ( myKeyCode >= 97 && myKeyCode <= 122 ) && myShiftKey ) {
		alert( myMsg );
	}
}

function openLostPword() { //v2.0
	window.location.href("lostpassword.asp?u=" + document.forms["frmLogin"].elements["txtUserName"].value); 
}

function makeUserName() {
	var strFName
	var strLName
	var vfs_UserName
	if (document.frmMyAccount.txtUserName.value=="") {
		strFname=document.frmMyAccount.txtFirstName.value
		strLName=document.frmMyAccount.txtLastName.value
		vfs_UserName=strFname.substring(0,1)+strLName
		vfs_UserName=vfs_UserName.toLowerCase()
		document.frmMyAccount.txtUserName.value = vfs_UserName
	}
}

function formatCurrency(num,dec) {
	num = num.toString().replace(/\$|\,/g,'');
	if(isNaN(num)) num = "0";
	if(isNaN(dec)) dec = "2";
	sign = (num == (num = Math.abs(num)));
	num = Math.floor(num*100+0.50000000001);
	cents = num%100;
	num = Math.floor(num/100).toString();
	if(cents<10)
	cents = "0" + cents;
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
	num = num.substring(0,num.length-(4*i+3))+','+
	num.substring(num.length-(4*i+3));
	if (dec==2) 
		return (((sign)?'':'-') + '$' + num + '.' + cents)
	else
		return (((sign)?'':'-') + '$' + num );	
}

function popPreview(url) { 
	agent = navigator.userAgent;
	windowName = "_blank";
	p_Width = 480
	p_Height = 430
	params  = "";
	params += "toolbar=0,";
	params += "location=0,";
	params += "directories=0,";
	params += "status=0,";
	params += "menubar=0,";
	params += "scrollbars=0,";
	params += "resizable=1,";
	params += "top=200,";
	params += "left=200,";
	params += "width=" + p_Width + ",";
	params += "height=" + p_Height;
// close the window to vary the window size
	if (typeof(win) == "object" && !win.closed){
			win.close();
	}
	win = window.open(url, windowName , params);
	if (agent.indexOf("Mozilla/2") != -1 && agent.indexOf("Win") == -1) {
			win = window.open(url, windowName , params);
	}
	if (!win.opener) {
			win.opener = window;
	}
	// bring the window to the front
	win.focus();	
}


var timerID ;
function tzone(tz, os, ds, cl) {
	this.ct = new Date(0) ;		// datetime
	this.tz = tz ;		// code
	this.os = os ;		// GMT offset
	this.ds = ds ;		// has daylight savings
	this.cl = cl ;		// font color
}

function UpdateClocks() {
	// www.timeanddate.com/worldclock
	var ct = new Array(
		new tzone('SFO: ', -6, 1, 'lime'),
		new tzone('TYO: ', +8, 0, 'violet')
	) ;
	var dt = new Date() ;	// [GMT] time according to machine clock
	var startDST = new Date(dt.getFullYear(), 3, 1) ;
	while (startDST.getDay() != 0)
		startDST.setDate(startDST.getDate() + 1) ;
	var endDST = new Date(dt.getFullYear(), 9, 31) ;
	while (endDST.getDay() != 0)
		endDST.setDate(endDST.getDate() - 1) ;
	var ds_active ;		// DS currently active
	if (startDST < dt && dt < endDST)
		ds_active = 1 ;
	else
		ds_active = 0 ;
	// Adjust each clock offset if that clock has DS and in DS.
	for(n=0 ; n<ct.length ; n++)
		if (ct[n].ds == 1 && ds_active == 1) ct[n].os++ ;
	// compensate time zones
	gmdt = new Date() ;
	for (n=0 ; n<ct.length ; n++)
		ct[n].ct = new Date(gmdt.getTime() + ct[n].os * 3600 * 1000) ;
	document.getElementById('Clock0').innerHTML = ClockString(ct[0].ct);
	document.getElementById('Clock1').innerHTML = ClockString(ct[1].ct) ;
	timerID = window.setTimeout("UpdateClocks()", 1001) ;
}

function fourdigits(number)	{
	return (number < 1000) ? number + 1900 : number;
}

function ClockString(dt) {
	var stemp, ampm ;
	var dt_year = dt.getUTCFullYear() ;
	var dt_month = dt.getUTCMonth();
	var dt_day = dt.getUTCDate() ;
	var dt_dow = dt.getUTCDay() ;
	var dt_hour = dt.getUTCHours() ;
	var dt_minute = dt.getUTCMinutes() ;
	var dt_second = dt.getUTCSeconds() ;
	var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
	var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');

	dt_year = dt_year.toString() ;
	if (0 <= dt_hour && dt_hour < 12)
	{
		ampm = 'AM' ;
		if (dt_hour == 0) dt_hour = 12 ;
	} else {
		ampm = 'PM' ;
		dt_hour = dt_hour - 12 ;
		if (dt_hour == 0) dt_hour = 12 ;
	}
	if (dt_minute < 10)
		dt_minute = '0' + dt_minute ;
	if (dt_second < 10)
		dt_second = '0' + dt_second ;
	//stemp = dt_month + '/' + dt_day + '/' + dt_year.substr(2,2) ;
	//stemp = stemp + ' ' + dt_hour + ":" + dt_minute + ":" + dt_second + ' ' + ampm ;
	stemp = ' ' + dt_hour + ":" + dt_minute + ":" + dt_second + ' ' + ampm ;
	var date = ((dt<10) ? "0" : "")+ dt;
	today =  days[dt_dow] + ", " + months[dt_month] + " " + dt_day + ", " + (fourdigits(dt.getYear())) ;
	stemp = stemp + " " + today;
	return stemp ;
}

function greet() {
	Today = new Date();
	time = Today.getHours();
	document.write("Good ");
	if (time < 6)
		document.write("(early) morning");
	else if (time < 12)
		document.write("morning");
	else if (time <= 18)
		document.write("afternoon");
	else
		document.write("evening");
}

function deleteUser(vfi_UserID, vfs_UserName) { 
	if (confirm("Are you sure you want to delete user '"+vfs_UserName+"'?")) {
		document.formhid.action="validateuserdata.asp";
		document.formhid.hidActionType.value="delete";
		document.formhid.hidSortField.value="";
		document.formhid.hidUserID.value=vfi_UserID;
		document.formhid.submit(); 
	}
}
function sortAppraisers(sortField) { 
	document.formhid.hidSortField.value=sortField;
	document.formhid.submit(); 
} 
function editAppraiser(vfi_UserID) { 
	document.formhid.action="officeeditappraiser.asp";
	document.formhid.hidActionType.value="edit";
	document.formhid.hidSortField.value="";
	document.formhid.hidUserID.value=vfi_UserID;
	document.formhid.submit(); 
}
function addAppraiser() { 
	document.formhid.action="officeeditappraiser.asp";
	document.formhid.hidActionType.value="add";
	document.formhid.hidSortField.value="";
	document.formhid.submit(); 
} 

/* 
PopupWindow.js
Author: Matt Kruse
Last modified: 02/16/04

DESCRIPTION: This object allows you to easily and quickly popup a window
in a certain place. The window can either be a DIV or a separate browser
window.

COMPATABILITY: Works with Netscape 4.x, 6.x, IE 5.x on Windows. Some small
positioning errors - usually with Window positioning - occur on the 
Macintosh platform. Due to bugs in Netscape 4.x, populating the popup 
window with <STYLE> tags may cause errors.

USAGE:
// Create an object for a WINDOW popup
var win = new PopupWindow(); 

// Create an object for a DIV window using the DIV named 'mydiv'
var win = new PopupWindow('mydiv'); 

// Set the window to automatically hide itself when the user clicks 
// anywhere else on the page except the popup
win.autoHide(); 

// Show the window relative to the anchor name passed in
win.showPopup(anchorname);

// Hide the popup
win.hidePopup();

// Set the size of the popup window (only applies to WINDOW popups
win.setSize(width,height);

// Populate the contents of the popup window that will be shown. If you 
// change the contents while it is displayed, you will need to refresh()
win.populate(string);

// set the URL of the window, rather than populating its contents
// manually
win.setUrl("http://www.site.com/");

// Refresh the contents of the popup
win.refresh();

// Specify how many pixels to the right of the anchor the popup will appear
win.offsetX = 50;

// Specify how many pixels below the anchor the popup will appear
win.offsetY = 100;

NOTES:
1) Requires the functions in AnchorPosition.js

2) Your anchor tag MUST contain both NAME and ID attributes which are the 
   same. For example:
   <A NAME="test" ID="test"> </A>

3) There must be at least a space between <A> </A> for IE5.5 to see the 
   anchor tag correctly. Do not do <A></A> with no space.

4) When a PopupWindow object is created, a handler for 'onmouseup' is
   attached to any event handler you may have already defined. Do NOT define
   an event handler for 'onmouseup' after you define a PopupWindow object or
   the autoHide() will not work correctly.
*/ 

// Set the position of the popup window based on the anchor
function PopupWindow_getXYPosition(anchorname) {
	var coordinates;
	if (this.type == "WINDOW") {
		coordinates = getAnchorWindowPosition(anchorname);
		}
	else {
		coordinates = getAnchorPosition(anchorname);
		}
	this.x = coordinates.x;
	this.y = coordinates.y;
	}
// Set width/height of DIV/popup window
function PopupWindow_setSize(width,height) {
	this.width = width;
	this.height = height;
	}
// Fill the window with contents
function PopupWindow_populate(contents) {
	this.contents = contents;
	this.populated = false;
	}
// Set the URL to go to
function PopupWindow_setUrl(url) {
	this.url = url;
	}
// Set the window popup properties
function PopupWindow_setWindowProperties(props) {
	this.windowProperties = props;
	}
// Refresh the displayed contents of the popup
function PopupWindow_refresh() {
	if (this.divName != null) {
		// refresh the DIV object
		if (this.use_gebi) {
			document.getElementById(this.divName).innerHTML = this.contents;
			}
		else if (this.use_css) { 
			document.getElementById(this.divName).innerHTML = this.contents;
			}
		else if (this.use_layers) { 
			var d = document.layers[this.divName]; 
			d.document.open();
			d.document.writeln(this.contents);
			d.document.close();
			}
		}
	else {
		if (this.popupWindow != null && !this.popupWindow.closed) {
			if (this.url!="") {
				this.popupWindow.location.href=this.url;
				}
			else {
				this.popupWindow.document.open();
				this.popupWindow.document.writeln(this.contents);
				this.popupWindow.document.close();
			}
			this.popupWindow.focus();
			}
		}
	}
// Position and show the popup, relative to an anchor object
function PopupWindow_showPopup(anchorname) {
	this.getXYPosition(anchorname);
	this.x += this.offsetX;
	this.y += this.offsetY;
	if (!this.populated && (this.contents != "")) {
		this.populated = true;
		this.refresh();
		}
	if (this.divName != null) {
		// Show the DIV object
		if (this.use_gebi) {
			document.getElementById(this.divName).style.left = this.x + "px";
			document.getElementById(this.divName).style.top = this.y + "px";
			document.getElementById(this.divName).style.visibility = "visible";
			}
		else if (this.use_layers) {
			document.layers[this.divName].left = this.x;
			document.layers[this.divName].top = this.y;
			document.layers[this.divName].visibility = "visible";
			}
		}
	else {
		if (this.popupWindow == null || this.popupWindow.closed) {
			// If the popup window will go off-screen, move it so it doesn't
			if (this.x<0) { this.x=0; }
			if (this.y<0) { this.y=0; }
			if (screen && screen.availHeight) {
				if ((this.y + this.height) > screen.availHeight) {
					this.y = screen.availHeight - this.height;
					}
				}
			if (screen && screen.availWidth) {
				if ((this.x + this.width) > screen.availWidth) {
					this.x = screen.availWidth - this.width;
					}
				}
			var avoidAboutBlank = window.opera || ( document.layers && !navigator.mimeTypes['*'] ) );
			this.popupWindow = window.open(avoidAboutBlank?"":"about:blank","window_"+anchorname,this.windowProperties+",width="+this.width+",height="+this.height+",screenX="+this.x+",left="+this.x+",screenY="+this.y+",top="+this.y+"");
			}
		this.refresh();
		}
	}
// Hide the popup
function PopupWindow_hidePopup() {
	if (this.divName != null) {
		if (this.use_gebi) {
			document.getElementById(this.divName).style.visibility = "hidden";
			}
		else if (this.use_layers) {
			document.layers[this.divName].visibility = "hidden";
			}
		}
	else {
		if (this.popupWindow && !this.popupWindow.closed) {
			this.popupWindow.close();
			this.popupWindow = null;
			}
		}
	}
// Pass an event and return whether or not it was the popup DIV that was clicked
function PopupWindow_isClicked(e) {
	if (this.divName != null) {
		if (this.use_layers) {
			var clickX = e.pageX;
			var clickY = e.pageY;
			var t = document.layers[this.divName];
			if ((clickX > t.left) && (clickX < t.left+t.clip.width) && (clickY > t.top) && (clickY < t.top+t.clip.height)) {
				return true;
				}
			else { return false; }
			}
		else if (this.use_gebi && e) {
			var t = e.originalTarget;
			while (t.parentNode != null) {
				if (t.id==this.divName) {
					return true;
					}
				t = t.parentNode;
				}
			return false;
			}
		return false;
		}
	return false;
	}

// Check an onMouseDown event to see if we should hide
function PopupWindow_hideIfNotClicked(e) {
	if (this.autoHideEnabled && !this.isClicked(e)) {
		this.hidePopup();
		}
	}
// Call this to make the DIV disable automatically when mouse is clicked outside it
function PopupWindow_autoHide() {
	this.autoHideEnabled = true;
	}
// This global function checks all PopupWindow objects onmouseup to see if they should be hidden
function PopupWindow_hidePopupWindows(e) {
	for (var i=0; i<popupWindowObjects.length; i++) {
		if (popupWindowObjects[i] != null) {
			var p = popupWindowObjects[i];
			p.hideIfNotClicked(e);
			}
		}
	}
// Run this immediately to attach the event listener
function PopupWindow_attachListener() {
	if (document.layers) {
		document.captureEvents(Event.MOUSEUP);
		}
	window.popupWindowOldEventListener = document.onmouseup;
	if (window.popupWindowOldEventListener != null) {
		document.onmouseup = new Function("window.popupWindowOldEventListener(); PopupWindow_hidePopupWindows();");
		}
	else {
		document.onmouseup = PopupWindow_hidePopupWindows;
		}
	}
// CONSTRUCTOR for the PopupWindow object
// Pass it a DIV name to use a DHTML popup, otherwise will default to window popup
function PopupWindow() {
	if (!window.popupWindowIndex) { window.popupWindowIndex = 0; }
	if (!window.popupWindowObjects) { window.popupWindowObjects = new Array(); }
	if (!window.listenerAttached) {
		window.listenerAttached = true;
		PopupWindow_attachListener();
		}
	this.index = popupWindowIndex++;
	popupWindowObjects[this.index] = this;
	this.divName = null;
	this.popupWindow = null;
	this.width=0;
	this.height=0;
	this.populated = false;
	this.visible = false;
	this.autoHideEnabled = false;
	
	this.contents = "";
	this.url="";
	this.windowProperties="toolbar=no,location=no,status=no,menubar=no,scrollbars=auto,resizable,alwaysRaised,dependent,titlebar=no";
	if (arguments.length>0) {
		this.type="DIV";
		this.divName = arguments[0];
		}
	else {
		this.type="WINDOW";
		}
	this.use_gebi = false;
	this.use_css = false;
	this.use_layers = false;
	if (document.getElementById) { this.use_gebi = true; }
	else if (document.layers) { this.use_layers = true; }
	else { this.type = "WINDOW"; }
	this.offsetX = 0;
	this.offsetY = 0;
	// Method mappings
	this.getXYPosition = PopupWindow_getXYPosition;
	this.populate = PopupWindow_populate;
	this.setUrl = PopupWindow_setUrl;
	this.setWindowProperties = PopupWindow_setWindowProperties;
	this.refresh = PopupWindow_refresh;
	this.showPopup = PopupWindow_showPopup;
	this.hidePopup = PopupWindow_hidePopup;
	this.setSize = PopupWindow_setSize;
	this.isClicked = PopupWindow_isClicked;
	this.autoHide = PopupWindow_autoHide;
	this.hideIfNotClicked = PopupWindow_hideIfNotClicked;
	}
	
/* 
AnchorPosition.js
Author: Matt Kruse
Last modified: 10/11/02

DESCRIPTION: These functions find the position of an <A> tag in a document,
so other elements can be positioned relative to it.

COMPATABILITY: Netscape 4.x,6.x,Mozilla, IE 5.x,6.x on Windows. Some small
positioning errors - usually with Window positioning - occur on the 
Macintosh platform.

FUNCTIONS:
getAnchorPosition(anchorname)
  Returns an Object() having .x and .y properties of the pixel coordinates
  of the upper-left corner of the anchor. Position is relative to the PAGE.

getAnchorWindowPosition(anchorname)
  Returns an Object() having .x and .y properties of the pixel coordinates
  of the upper-left corner of the anchor, relative to the WHOLE SCREEN.

NOTES:

1) For popping up separate browser windows, use getAnchorWindowPosition. 
   Otherwise, use getAnchorPosition

2) Your anchor tag MUST contain both NAME and ID attributes which are the 
   same. For example:
   <A NAME="test" ID="test"> </A>

3) There must be at least a space between <A> </A> for IE5.5 to see the 
   anchor tag correctly. Do not do <A></A> with no space.
*/ 

// getAnchorPosition(anchorname)
//   This function returns an object having .x and .y properties which are the coordinates
//   of the named anchor, relative to the page.
function getAnchorPosition(anchorname) {
	// This function will return an Object with x and y properties
	var useWindow=false;
	var coordinates=new Object();
	var x=0,y=0;
	// Browser capability sniffing
	var use_gebi=false, use_css=false, use_layers=false;
	if (document.getElementById) { use_gebi=true; }
	else if (document.layers) { use_layers=true; }
	// Logic to find position
	if (use_gebi) {
		var o=document.getElementById(anchorname);
		x=AnchorPosition_getPageOffsetLeft(o);
		y=AnchorPosition_getPageOffsetTop(o);
		}
	else if (use_layers) {
		var found=0;
		for (var i=0; i<document.anchors.length; i++) {
			if (document.anchors[i].name==anchorname) { found=1; break; }
			}
		if (found==0) {
			coordinates.x=0; coordinates.y=0; return coordinates;
			}
		x=document.anchors[i].x;
		y=document.anchors[i].y;
		}
	else {
		coordinates.x=0; coordinates.y=0; return coordinates;
		}
	coordinates.x=x;
	coordinates.y=y;
	return coordinates;
	}

// getAnchorWindowPosition(anchorname)
//   This function returns an object having .x and .y properties which are the coordinates
//   of the named anchor, relative to the window
function getAnchorWindowPosition(anchorname) {
	var coordinates=getAnchorPosition(anchorname);
	var x=0;
	var y=0;
	if (document.getElementById) {
		if (isNaN(window.screenX)) {
			x=coordinates.x-document.body.scrollLeft+window.screenLeft;
			y=coordinates.y-document.body.scrollTop+window.screenTop;
			}
		else {
			x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
			y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
			}
		}
	else if (document.layers) {
		x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
		y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
		}
	coordinates.x=x;
	coordinates.y=y;
	return coordinates;
	}

// Functions for IE to get position of an object
function AnchorPosition_getPageOffsetLeft (el) {
	var ol=el.offsetLeft;
	while ((el=el.offsetParent) != null) { ol += el.offsetLeft; }
	return ol;
	}
function AnchorPosition_getWindowOffsetLeft (el) {
	return AnchorPosition_getPageOffsetLeft(el)-document.body.scrollLeft;
	}	
function AnchorPosition_getPageOffsetTop (el) {
	var ot=el.offsetTop;
	while((el=el.offsetParent) != null) { ot += el.offsetTop; }
	return ot;
	}
function AnchorPosition_getWindowOffsetTop (el) {
	return AnchorPosition_getPageOffsetTop(el)-document.body.scrollTop;
	}
	
	
function emailCheck (fieldName, fieldNameErr) {
	var emailStr=fieldName.value
	/* The following variable tells the rest of the function whether or not
	to verify that the address ends in a two-letter country or well-known
	TLD.  1 means check it, 0 means don't. */
	var checkTLD=1;
	
	/* The following is the list of known TLDs that an e-mail address must end with. */
	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
	
	/* The following pattern is used to check if the entered e-mail address
	fits the user@domain format.  It also is used to separate the username
	from the domain. */
	var emailPat=/^(.+)@(.+)$/;
	
	/* The following string represents the pattern for matching all special
	characters.  We don't want to allow special characters in the address. 
	These characters include ( ) < > @ , ; : \ " . [ ] */
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
	
	/* The following string represents the range of characters allowed in a 
	username or domainname.  It really states which chars aren't allowed.*/
	var validChars="\[^\\s" + specialChars + "\]";
	
	/* The following pattern applies if the "user" is a quoted string (in
	which case, there are no rules about which characters are allowed
	and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
	is a legal e-mail address. */
	var quotedUser="(\"[^\"]*\")";
	
	/* The following pattern applies for domains that are IP addresses,
	rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
	e-mail address. NOTE: The square brackets are required. */
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	
	/* The following string represents an atom (basically a series of non-special characters.) */
	var atom=validChars + '+';
	
	/* The following string represents one word in the typical username.
	For example, in john.doe@somewhere.com, john and doe are words.
	Basically, a word is either an atom or quoted string. */	
	var word="(" + atom + "|" + quotedUser + ")";
	
	// The following pattern describes the structure of the user
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	
	/* The following pattern describes the structure of a normal symbolic
	domain, as opposed to ipDomainPat, shown above. */
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
	
	/* Finally, let's start trying to figure out if the supplied address is valid. */
	/* Begin with the coarse pattern to simply break up user@domain into
	different pieces that are easy to analyze. */
	var matchArray=emailStr.match(emailPat);

	if (matchArray==null) {	/* Too many/few @'s or something; basically, this address doesn't
	even fit the general mould of a valid e-mail address. */
		fieldName.focus();
		fieldNameErr.src="images/important.gif";
		alert("Please enter a valid email address.");
		return false;
	}
	var user=matchArray[1];
	var domain=matchArray[2];

	// Start by checking that only basic ASCII characters are in the strings (0-127).
	for (i=0; i<user.length; i++) {
		if (user.charCodeAt(i)>127) {
			fieldName.focus();
			fieldNameErr.src="images/important.gif";
			alert("This username contains invalid characters.");
			return false;
		}
	}
	for (i=0; i<domain.length; i++) {
		if (domain.charCodeAt(i)>127) {
			fieldName.focus();
			fieldNameErr.src="images/important.gif";
			alert("Ths domain name contains invalid characters.");
			return false;
		}
	}

	// See if "user" is valid 
	if (user.match(userPat)==null) {		// user is not valid
		fieldName.focus();
		fieldNameErr.src="images/important.gif";
		alert("The username doesn't seem to be valid.");
		return false;
	}

	/* if the e-mail address is at an IP address (as opposed to a symbolic
	host name) make sure the IP address is valid. */
	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null) {		// this is an IP address
		for (var i=1;i<=4;i++) {
		if (IPArray[i]>255) {
			fieldName.focus();
			fieldNameErr.src="images/important.gif";
			alert("Destination IP address is invalid.");
			return false;
			 }
		}
	fieldNameErr.src="images/pixel_trans.gif"
	return true;
	}

	// Domain is symbolic name.  Check if it's valid.	 
	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	for (i=0;i<len;i++) {
		if (domArr[i].search(atomPat)==-1) {
			fieldName.focus();
			fieldNameErr.src="images/important.gif";
			alert("The domain name does not seem to be valid.");
			return false;
		}
	}

	/* domain name seems valid, but now make sure that it ends in a
	known top-level domain (like com, edu, gov) or a two-letter word,
	representing country (uk, nl), and that there's a hostname preceding 
	the domain or country. */
	if (checkTLD && domArr[domArr.length-1].length!=2 && 
		domArr[domArr.length-1].search(knownDomsPat)==-1) {
		fieldName.focus();
		fieldNameErr.src="images/important.gif";
		alert("The address must end in a well-known domain or two letter " + "country.");
		return false;
	}

	// Make sure there's a host name preceding the domain.
	if (len<2) {
		fieldName.focus();
		fieldNameErr.src="images/important.gif";
		alert("This address is missing a hostname.");
		return false;
	}

	// If we've gotten this far, everything's valid!
	fieldNameErr.src="images/pixel_trans.gif";
	return true;
}

function nameCheck (fieldName, fieldNameErr) {
	var nameStr = fieldName.value
	if (nameStr.length<1) {
		fieldName.focus();
		fieldNameErr.src="images/important.gif";
		alert("This name is missing.");
		return false;
	}
	// If we've gotten this far, everything's valid!
	fieldNameErr.src="images/pixel_trans.gif";
	return true;
}


function checkCheckBox(f) {
	if (f.checked == false ) {
		f.focus();
		document.agree_err.src="images/important.gif";
		alert('Please check the box to indicate that you have read and understand the accredited investor agreement.');
		return false;
	} else
		return true;
}

function changeBox(cbox) {
	box = eval(cbox);
	box.checked = !box.checked;
}


//-->
