/* Utilizes GLOBAL_ROOT variable */try { GLOBAL_ROOT } catch(e) { GLOBAL_ROOT = "./"; }months = new Array('jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec')days = new Array('sunday','monday','tuesday','wednesday','thursday','friday','saturday')months2 = new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec')days2 = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday')function writeDateFull(){now = new Date()document.write(days[now.getDay()]+", "+now.getDate()+" "+months[now.getMonth()]+" "+now.getFullYear())}function writeDateFull2(){now = new Date()document.write(days2[now.getDay()]+", "+now.getDate()+" "+months2[now.getMonth()]+" "+now.getFullYear())}  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_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_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_controlSound(x, _sndObj, sndFile) { //v3.0  var i, method = "", sndObj = eval(_sndObj);  if (sndObj != null) {    if (navigator.appName == 'Netscape') method = "play";    else {      if (window.MM_WMP == null) {        window.MM_WMP = false;        for(i in sndObj) if (i == "ActiveMovie") {          window.MM_WMP = true; break;      } }      if (window.MM_WMP) method = "play";      else if (sndObj.FileName) method = "run";  } }  if (method) eval(_sndObj+"."+method+"()");  else window.location = sndFile;}function MM_validateForm() { //v3.0  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);    if (val) { nm=val.name; if ((val=val.value)!="") {      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';      } else if (test!='R') { num = parseFloat(val);        if (val!=''+num) errors+='- '+nm+' must contain a number.\n';        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');          min=test.substring(8,p); max=test.substring(p+1);          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }  } if (errors) alert('The following error(s) occurred:\n'+errors);  document.MM_returnValue = (errors == '');}function PopupSales(){	var screenheight;	var screenwidth;	if (screen.width<900)	{		screenheight=540;		screenwidth=780;	}	if (screen.width>=900 & screen.width<=1100)	{		screenheight=700;		screenwidth=836;	}	if (screen.width>1100)	{		screenheight=950;		screenwidth=836;	}	var winl = (screen.width - 800) / 2;	var newWin;	newWin =window.open(GLOBAL_ROOT+"saleEditPopup.asp","SaleWindow",'scrollbars=1,resizable=1,height='+screenheight+',width='+screenwidth+', left=' + winl + ', toolbar=no')	newWin.focus();}/*function DisableEnter (field, event) {	var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;	if (keyCode == 13) 		return false;	else		return true;}      */function DisableEnter (field, event) {	var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;	if ((keyCode == 13) && (event.srcElement.type != "textarea")) 		return false;	else		return true;}      function GetTodayDate(fieldobj){	var today;	today = new Date();	theDay = today.getDate();	theMonth = today.getMonth()+1;	theYear = today.getFullYear();	fieldobj.value=theMonth + "/" +theDay + "/" +theYear;}function PopupInbox(){	var winl = (screen.width - 890) / 2;	var newWin;	newWin =window.open(GLOBAL_ROOT+"inboxPopup.asp","inboxWindow",'scrollbars=1,resizable=1,height=650,width=890, left=' + winl + ',toolbar=no')	newWin.focus();}function formatPhone(fieldObj){   var phoneNum=fieldObj.value;  var areacode=document.form1.DefaultPhoneAreaCode.value;  /*   * 7181238748 to 1(718)123-8748   */   if(phoneNum.length == 10 && IsNumeric(phoneNum))  { 	fieldObj.value="("+phoneNum.substring(0,3)+") "+phoneNum.substring(3,6)+"-"+phoneNum.substring(6,10);  }    if(phoneNum.length == 7 && IsNumeric(phoneNum))  { 	fieldObj.value="("+areacode+") "+phoneNum.substring(0,3)+"-"+phoneNum.substring(3,7);  }  if(phoneNum.length == 8)  { 	fieldObj.value="("+areacode+") "+phoneNum.substring(0,3)+"-"+phoneNum.substring(4,8);  }} function IsNumeric(strString)//  check for valid numeric strings	{   var strValidChars = "0123456789";   var strChar;   var blnResult = true;   //  test strString consists of valid characters listed above   for (i = 0; i < strString.length && blnResult == true; i++)      {      strChar = strString.charAt(i);      if (strValidChars.indexOf(strChar) == -1)         {         blnResult = false;         }      }   return blnResult;}function PopupSalesEdit(SaleID){	var screenheight;	var screenwidth;	if (screen.width<900)	{		screenheight=540;		screenwidth=780;	}	if (screen.width>=900 & screen.width<=1100)	{		screenheight=700;		screenwidth=836;	}	if (screen.width>1100)	{		screenheight=950;		screenwidth=836;	}	var winl = (screen.width - 800) / 2;	var newWin;	newWin =window.open(GLOBAL_ROOT+"SaleEditPopup.asp?comefrom=edit&saleid="+SaleID,"SaleWindow",'scrollbars=1,resizable=1,height='+screenheight+',width='+screenwidth+', left=' + winl + ', toolbar=no')	newWin.focus();}function PopupHelp(helpfile){	var newWin;	newWin =window.open(helpfile,"helpWindow",'scrollbars=1,resizable=1,height=500,width=400, left=0, top=0,toolbar=no')	newWin.focus();}function PopupAutoEmail(){	var winl = (screen.width - 760) / 2;	var newWin;	newWin =window.open(GLOBAL_ROOT+"checkautoemail.asp","EmailWindow",'scrollbars=1,resizable=1,height=590,width=836, left=' + winl + ',toolbar=no')}// PopupAddNewContract - Displays new window for Add New Contract// PRE: none// POST: Add New Contract page displayed in a new window// INPUTS: none// RETURNS: nonefunction PopupAddNewContract(){	// === Create Popup Window	var winl = (screen.width - 800) / 2;	var newWin;	newWin = window.open(GLOBAL_ROOT+"sales/sales_Contract_Editor.asp","editContract",'scrollbars=1,status=0,resizable=1,height=690,width=785, left=' + winl + ',toolbar=no');}function PopupUnitInventory(){	// === Create Popup Window	var winl = (screen.width - 800) / 2;	var newWin;	newWin = window.open(GLOBAL_ROOT+"sales/Sales_UnitsSetup.asp","EditUnit",'scrollbars=1,status=0,resizable=1,height=690,width=785, left=' + winl + ',toolbar=no, top=0');}function PopupInventoryReport(){	// === Create Popup Window	var winl = (screen.width - 800) / 2;	var url = GLOBAL_ROOT+"Report_inventory.asp";	var newWin;	newWin = window.open(url,"InventoryReport",'scrollbars=1,status=0,resizable=1,height=520,width=700, left=' + winl + ', toolbar=yes, top=0');}/* Modified: Sam *//* Date: 2005/11/15/* Adjusted window sizing as the popup did not fit in the window */function PopupOptionsAvailable (){	// === Create Popup Window	var winl = (screen.width - 800) / 2;	var newWin;	newWin = window.open(GLOBAL_ROOT+"sales/sales_RealEstateOptions.asp","EditUnit",'scrollbars=1,status=0,resizable=1,height=690,width=835, left=' + winl + ',toolbar=no, top=0');} function PopupRegany(xx,i){	//var j;	//for (j=1; j < 4; j++)	//{	//	document.form1.ChkMaxID[j].checked=true;	//}					//alert(4+" entries selected.");	var winl = (screen.width - 838) / 2;	var newWin;	//alter(i);	if (i==3)	{		newWin =window.open(GLOBAL_ROOT+"reganyPopup.asp?new=realtor&name=" + xx,"ProspectWindow",'scrollbars=1,resizable=1,height=593,width=838, left=' + winl + ',top=0,toolbar=no')	}	if (i==1)	{		newWin =window.open(GLOBAL_ROOT+"reganyPopup.asp?new=prospect&name=" + xx,"ProspectWindow",'scrollbars=1,resizable=1,height=593,width=838, left=' + winl + ',top=0,toolbar=no')	}	if (i==2)	{		newWin =window.open(GLOBAL_ROOT+"reganyPopup.asp?new=purchaser&name=" + xx,"ProspectWindow",'scrollbars=1,resizable=1,height=593,width=838, left=' + winl + ',top=0,toolbar=no')	}	newWin.focus();}//popup followups when loginfunction PopupFollowups(viewtype){	var winl = 100;	//var winl = 10;	var newWin;	if (viewtype=="list")	{		newWin =window.open(GLOBAL_ROOT+"PopupFollowups.asp?start=true", "FollowUpWindow",'scrollbars=1,resizable=1,height=440,width=760, left=' + winl + ',toolbar=no');	}	else	{		newWin =window.open(GLOBAL_ROOT+"Popupfollowups-calendar.asp?from=start&date=today", "FollowUpWindow",'scrollbars=1,resizable=1,height=440,width=760, left=' + winl + ',toolbar=no');	}	newWin.focus();}//popup followups when clicking menu function PopupFollowups(){	var winl = 100;	//var winl = 10;	var newWin;	newWin =window.open(GLOBAL_ROOT+"Popupfollowups-calendar.asp?from=start&date=today&click=menu", "FollowUpWindow",'scrollbars=1,resizable=1,height=440,width=760, left=' + winl + ',toolbar=no');	newWin.focus();}function PopupAddressBook(where,type){	var winl = 100;	//var winl = 10;	var newWin;	newWin =window.open(GLOBAL_ROOT+"addressBook.asp?from="+where+"&type="+type, "AddressBook",'scrollbars=0,resizable=0,height=345,width=500,top=250, left=' + winl + ',toolbar=no');	newWin.focus();}function EmailAddressEntriesValid(boxname){	if (boxname=="Email")	{		var str=document.form1.Email.value;			}	if (boxname=="BCC")	{		var str=document.form1.BCC.value;			}	if (boxname=="CC")	{		var str=document.form1.CC.value;			}	if (boxname=="to1")	{		var str=document.form1.to1.value;			}		if (str!=="")	{		var newstr = replaceAll(str, ' ', '');		str=replaceAll(newstr, ',', ';');		//alert(str);				var str_array=str.split(";");				//alert(str_array.length);		newstr=str_array[0];		checkit(str_array[0]);		for(i=1; i<str_array.length; i++)		{			checkit(str_array[i]);			newstr=newstr+";"+str_array[i];		}		//alert(newstr);		if (boxname=="Email")		{			document.form1.Email.value=newstr;				}		if (boxname=="BCC")		{			document.form1.BCC.value=newstr;				}		if (boxname=="CC")		{			document.form1.CC.value=newstr;				}		if (boxname=="to1")		{			document.form1.to1.value=newstr;				}	}}function EmailAddressEntriesValid_v2(obj){	var str = obj.value;			if (str!=="")	{		var newstr = replaceAll(str, ' ', '');		str=replaceAll(newstr, ',', ';');		//alert(str);				var str_array=str.split(";");				//alert(str_array.length);		newstr=str_array[0];		checkit(str_array[0]);		for(i=1; i<str_array.length; i++)		{			checkit(str_array[i]);			newstr=newstr+";"+str_array[i];		}		//alert(newstr);		obj.value = newstr;			}}function replaceAll(str, from, to) {    var idx = str.indexOf( from );    while ( idx > -1 ) {        str = str.replace( from, to );         idx = str.indexOf( from );    }    return str;}function checkit(str){	var filter=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;	if (filter.test(str))	{		//return true;	}	else	{		alert("Please make sure "+str+" is a valid email address!");	}}function PopupAddNewContract(){	// === Create Popup Window	var winl = (screen.width - 820) / 2;	var newWin;	newWin = window.open(GLOBAL_ROOT+"sales/sales_Contract_Editor.asp","editContract",'scrollbars=1,status=0,resizable=1,height=690,width=820, left=' + winl + ',toolbar=no');}function PopupUnitSelect(){	var winl = (screen.width - 345) / 2;	var newWin;	newWin = window.open(GLOBAL_ROOT+"sales/sales_contract_selectnewUnit.asp","UnitSelect",'scrollbars=1,status=0,resizable=1,height=690,width=345, left=' + winl + ',toolbar=no');}function CheckRealtorBox(){	if (document.form1.RealtorID.value=="")	{		alert("Select an agent first.");		document.form1.MailCCRealtor.checked=false;	}}