	// Global Vars
	var offsiteURL = "";
	
	// These four functions return document measurements when needed
	function f_clientWidth() {
		return f_filterResults (
			window.innerWidth ? window.innerWidth : 0,
			document.documentElement ? document.documentElement.clientWidth : 0,
			document.body ? document.body.clientWidth : 0
		);
	}
	function f_scrollTop() {// Returns the user's Vertical scroll position
		return f_filterResults (
			window.pageYOffset ? window.pageYOffset : 0,
			document.documentElement ? document.documentElement.scrollTop : 0,
			document.body ? document.body.scrollTop : 0
		);
	}
	function f_scrollLeft() {// Returns the user's horizontal scroll position
		return f_filterResults (
			window.pageXOffset ? window.pageXOffset : 0,
			document.documentElement ? document.documentElement.scrollLeft : 0,
			document.body ? document.body.scrollLeft : 0
		);
	}
	function f_filterResults(n_win, n_docel, n_body) {
		var n_result = n_win ? n_win : 0;
		if (n_docel && (!n_result || (n_result > n_docel)))
			n_result = n_docel;
		return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
	}

	//Hide / Show the Select tags when Modal Window is enabled / disabled (For IE6 or less)
	function toggleSelect(){
		if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
			var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
			if (ieversion<=6){
				var theRules = new Array();
				theRules = document.styleSheets[0].rules
				if (theRules[theRules.length-1].style.visibility == 'hidden'){
					theRules[theRules.length-1].style.visibility = 'visible';
				}else{
					theRules[theRules.length-1].style.visibility = 'hidden';
				}
			}
		}
	}
	
	function reloadPage(){
		window.location.reload();
	}
	
	// Modal Window Object
	function modalWindow(elId, w) {
		this.elId = (!elId)?"modalMsg":elId;
		this.w = (!w)?"380":w;
	}
	// Toggle Modal Window
	function toggleModalWindow(e){
		if($E.getTarget(e).className=='offsiteLink'){
			if($E.getTarget(e).href){
				offsiteURL = $E.getTarget(e).href;
				$E.stopEvent(e);
			}else if($E.getTarget(e).value=='Continue'){
				openWin(offsiteURL,'','');
			}
		}
		var mwObj = document.getElementById(this.elId);
		var mw = document.getElementById(this.elId).style;
		var mbl = document.getElementById("modalBackLayer").style;
		var docHeight = (document.body.scrollHeight>document.body.clientHeight)?document.body.scrollHeight:document.body.clientHeight;
		var docWidth = f_clientWidth();
		var modalCitySelect = document.getElementById("modalCitySelect");
		if (mw.visibility == "hidden"){
			mbl.height = docHeight + "px";
			mbl.width = docWidth+f_scrollLeft() + "px";
			mbl.display = "";
			mw.width = this.w + "px";
			mw.top = $D.getViewportHeight()/2 - mwObj.offsetHeight/2 + f_scrollTop() + "px";
			mw.left = docWidth/2 - mwObj.offsetWidth/2 + f_scrollLeft() + "px";
			mw.visibility="";
			if(mwObj.id=="modalPhotos")
				modalCitySelect.className="on";
		}else{
			mw.visibility="hidden";
			mbl.display="none";
			if(mwObj.id=="modalPhotos")
				modalCitySelect.className="off";
		}
		toggleSelect();
		$E.stopPropagation(e);
	}
