
			// Browser Caps object
			function Browser()
			{
				var agent = navigator.userAgent.toLowerCase();
				this.major = parseInt(navigator.appVersion);
				this.minor = parseFloat(navigator.appVersion);
				this.ns = ((agent.indexOf('mozilla')!=-1) && ((agent.indexOf('spoofer')==-1) && (agent.indexOf('compatible') == -1)));
				this.ns2 = (this.ns && (this.major == 2));
				this.ns3 = (this.ns && (this.major == 3));
				this.ns4 = (this.ns && (this.major == 4));
				this.ns5 = (this.ns && (this.major > 4));
				this.ns6 = (this.ns && (agent.indexOf('netscape6')!=-1) );
				this.ns7 = (this.ns && (agent.indexOf('netscape/7')!=-1) );
				this.ns7pr = (this.ns && (agent.indexOf('netscape/7.0b1')!=-1) );
				this.ie = (agent.indexOf("msie") != -1);
				this.ie3 = (this.ie && (this.major == 2));
				this.ie4 = (this.ie && (this.major >= 4));
				this.ie5 = (this.ie && (agent.indexOf('msie 5')!=-1) );
				this.ie6 = (this.ie && (agent.indexOf('msie 6')!=-1) );
				this.op3 = (agent.indexOf("opera") != -1);
				this.pc  = (agent.indexOf("win") != -1);
				this.mac = (agent.indexOf("mac") != -1);
				this.unix = (agent.indexOf("X11") != -1);
				this.oldBrowser = ((this.major<4) || ((this.major<5) && (this.ns)));
			}

			var browser = new Browser()

			var dWidth = 400;
			var dHeight = 400;

			var lowWidth = 1024;
			var lowHeight = 768;

			function setNewOnChangeHandler()
			{
				var theForm = getFormByName("top_links:ChangeCountry");
				if (theForm==null){return;}
				var theElem = getFormElementByName(theForm, "top_links:lstCountries");
				if (theElem==null){return;}
				theElem.onchange = null;
				theElem.onchange = __doPostBackFix4NS;
			}

			function __doPostBackFix4NS()
			{
                var theform = getFormByName("top_links:ChangeCountry");
                theform.__EVENTTARGET.value = "top_links:lstCountries";
                theform.__EVENTARGUMENT.value = "";
                theform.submit();
			}

			// For NS4.xx
			function getFormByName(formName)
			{
				var theForm;
				
				for (var i=0; i<document.forms.length; i++)
				{
					theForm = document.forms[i];
					if (theForm != null)
					{
						if (theForm.name.toLowerCase() == formName.toLowerCase())
						{
							return theForm;
						}
					}	// if ... !=null...
				}	// for...
				return null;
			}

			function getFormElementByName(theForm, elemName)
			{
				var theElem;

				for (var i=0; i<theForm.elements.length; i++)
				{
					theElem = theForm.elements[i];
					if (theElem != null)
					{
						if (theElem.name.toLowerCase() == elemName.toLowerCase())
						{
							return theElem;
						}
					}
				}
				return null;
			}

			function cleanDropDowns()
			{
				if (browser.oldBrowser)
				{
					var theForm = getFormByName("QuickSearch");
					if (theForm==null){return;}
					var theElem = getFormElementByName(theForm, "header_section:City");
					if (theElem!=null){
						theElem[theElem.length - 1] = null; }
					theElem = getFormElementByName(theForm, "header_section:PropertyTypes");
					if (theElem!=null){
						theElem[theElem.length - 1] = null; }
				}
			}

			/* Utils: */
			function openWin(url, optName, optWidth, optHeight, optScroll, optResize, optStatus, optPos)
			{
				var winPtr;
				var w = dWidth;
				var h = dHeight;
				var s = "yes";
				var r = "yes";
				var status = "";
				var p = "";

				if (!isNaN(optWidth))
					w = parseInt(optWidth);
				if (lowWidth < w)
					w = lowWidth;

				if (!isNaN(optHeight))
					h = parseInt(optHeight);
				if (lowHeight < h)
					h = lowHeight;

				if (optPos)
 					p = optPos;
				
				if (typeof(optName) == "undefined" || !optName || optName == null || optName == "")
					optName ="_blank";

				if ((arguments.length > 4) && optScroll == false)
					s = "no";
				if ((arguments.length > 5) && optResize == false)
					r = "no";
				if ((arguments.length > 6) && optStatus == true)
					status = ",status";

				var location;
				if (browser.ie4 && browser.mac)
					location = "";
				else
					location = getNewWinLocation(w,h, p);

				var features = "width="+w+",height="+h+",resizable="+r+",scrollbars="+s+status+location;

				winPtr = top.open(url, optName, features);

				// IE 4 barfs on this
				if (!browser.ie4 && winPtr && (winPtr.closed == false))
					winPtr.focus();
				return winPtr;
			}

			function getNewWinLocation (w,h,p)
			{
				var OFFSET = 20;
				var xCoord = 0;
				var yCoord = 0;

				var Xname = ",screenX=";
				var Yname = ",screenY=";

				if (browser.ns && browser.major>=4)
				{
					xCoord = window.screenX;
					yCoord = window.screenY;
				}
				else if (browser.ie)
				{
					if (!(browser.major>=4 && (browser.ie5 || browser.ie6)) || browser.mac)
						return "";
					xCoord = window.top.screenLeft;
					yCoord = window.top.screenTop - 20;
					Xname = ",left=";
					Yname = ",top=";
				}
				else
				{
					// let the app/os guess
					return "";
				}


				if (xCoord < 0)
					xCoord = 0;
				if (yCoord < 0)
					yCoord = 0;

				var newX;
				var newY;



				if (p == "center")
				{	
					if (browser.ns && browser.major>=4)
					{
						parentWidth = window.outerWidth;
						parentHeight = window.outerHeight;
					}
					else
					{
						parentWidth = window.top.document.body.clientWidth;
						parentHeight = window.top.document.body.clientHeight;
					}

					if (screen.availWidth < (xCoord + (parentWidth/2)) - (w/2))
						newX = xCoord;
					else
						newX = xCoord + parentWidth/2 - w/2;
					if (screen.availHeight < (yCoord + (parentHeight/2)) - (h/2))
						newY = yCoord;
					else
						newY = (yCoord + (parentHeight/2)) - (h/2);
				}
				else
				{
					if (screen.availWidth > xCoord + w + OFFSET * 2)
						newX = xCoord + OFFSET;
					else	
						newX = screen.availWidth - w - OFFSET * 2;
					if (screen.availHeight > yCoord + h + OFFSET * 2)
						newY = yCoord + OFFSET;
					else
						newY = screen.availHeight - h - OFFSET * 2;
					}
				
				if (newX < 0)
					newX = 0;
				if (newY < 0)
					newY = 0;

				return Xname + newX + Yname + newY;
			}
