<!--

window.addEvent('domready', SetupPage);

function SetupPage()
{
	PopupManager.SetColors({
		title: { border: '#000042', dark: '#2c8eb1', hilite: '#3a96b6', body: '#0077a2', font: '#ffffff' },
		content: { border: '#802900', dark: '#f26f31', hilite: '#f18957', body: '#f36523', font: '#000000' },
		footer: { border: '#802900', dark: '#f26f31', hilite: '#f18957', body: '#f36523', font: '#000000'}
	});
}

function PopupMessage(iId, iType, sTitle, iFrom, iTo)
{
	var sUri = '../../messageform.php?id='+iId+'&type='+iType+'&from='+iFrom+'&to='+iTo;
	PopupManager.CreatePopup({title:sTitle, size:{x:450, y:390}, source:sUri, contentType: 'iframe', resizable: false, dragContainer:Everything, type:'rounded', footer:false });
}

function OpenReport(iType)
{
	var sStart = "";
	var sEnd = "";
	var sUri = "";

	if (DateSet) {
		sStart = Validator.dateTime.filterDateTime(CalFirstDate.toLocaleString(), "Y-M-D");
		sEnd = Validator.dateTime.filterDateTime(CalLastDate.toLocaleString(), "Y-M-D");
	}

	sUri = '../../rentalreport.php?type='+iType+'&start='+sStart+'&end='+sEnd;
	PopupManager.CreatePopup({title:"Rental Reports", size:{x:760, y:400}, source:sUri, contentType: 'iframe', resizable: false, dragContainer:Everything, type:'rounded', footer:false });
}

function SearchPage()
{
	var iCatId = document.getElementById("Category").value;
	var sZipCode = document.getElementById("ZipCode").value;
	var sUri = "./findlistings.php?Category="+iCatId+"&ZipCode="+sZipCode;

	document.location.href = sUri;
}

function PopupPicure(sTitle, sImage, iWidth, iHeight)
{
	sImage = "<center><img src=\"../."+sImage+"\" style=\"border:0px none transparent;witdh:"+iWidth+"px;height:"+iHeight+"px;\" /></center>";
	PopupManager.CreatePopup({title:sTitle, size:{x:(iWidth+20), y:(iHeight+10)}, source:sImage, resizable: false, dragContainer:Everything, type:'rounded', footer:false });
}

function PopupText(sTitle, sText, iWidth, iHeight)
{
	var sMessage = "<table cellspacing=\"0\" cellpadding=\"0\" border=\"1\" width=\"100%\">\n";
	sMessage += "<tr><td valign=\"top\" bgcolor=\"#ebf5f5\" style=\"padding:20px 20px 20px 20px\">\n";
	sMessage += "<strong>"+sText+"</strong>\n";
	sMessage += "</td></tr></table>\n";
	PopupManager.CreatePopup({title:sTitle, size:{x:iWidth, y:iHeight}, source:sMessage, resizable: false, dragContainer:Everything, type:'rounded', footer:false });
}

function GetZipCodes(oCats)
{
	var sUri = "./getzipcodes.php?cat="+oCats.options[oCats.selectedIndex].value;
	LoadZipXML(sUri);
}

function PopulateZipCodes(sList)
{
	var oZips = document.getElementById("ZipCode");
	var aList = sList.split(",");

	oZips.length = 1;
	for (var i = 0; i < aList.length; i++) {
		var oOption = document.createElement('option');
		
		oOption.text = aList[i];
		oOption.value = aList[i];
		
		try {
			oZips.add(oOption, null);
		}
		catch(ex) {
			oZips.add(oOption);
		}
	}
}

function LoadZipXML(sUri)
{
	bToolTipStored = true;
	var req;
	req = false;
  // branch for native XMLHttpRequest object
  if(window.XMLHttpRequest) {
  	try {
			req = new XMLHttpRequest();
    }
		catch(e) {
			req = false;
    }
    	// branch for IE/Windows ActiveX version
  }
	else if(window.ActiveXObject) {
  	try {
   		req = new ActiveXObject("Msxml2.XMLHTTP");
  	}
		catch(e) {
    	try {
    		req = new ActiveXObject("Microsoft.XMLHTTP");
    	}
			catch(e) {
    		req = false;
    	}
		}
  }
	if(req) {
		//req.onreadystatechange = processReqChange;
		req.open("GET", sUri, true);
		req.onreadystatechange = function () {
		if (req.readyState == 4) {
			if(req.status == 200)
				PopulateZipCodes(req.responseText);
			else
				PopulateZipCodes("Error loading children");
			}
		};
		req.send(null);
	}
}
//-->