//Name:  default_script.js
//Created By:  Mark Cline
//Company:  Square Root Solutions, Inc.
//Date: October 11, 2005
//Description: This file holds all the default javascript used by all the pages.

//Temp code for simulating CMS LOGIN 
window.onload = function (){
	ToolbarReady();
}	

function ToolbarReady(){
var tempString;
tempString = true;
}

function NewWindow(mypage, myname, mywidth, myheight) {
var winl = (screen.width - mywidth) / 2;
var wint = (screen.height - myheight) / 2;
winprops =
'height='+myheight+',width='+mywidth+',top='+wint+',left='+winl+',scrollbars=yes,resizeable=no'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function NewsSiteplanWindow(mypage, myname, mywidth, myheight) {
var winl = (screen.width - mywidth) / 2;
var wint = (screen.height - myheight) / 2;
winprops =
'height='+myheight+',width='+mywidth+',top='+wint+',left='+winl+',scrollbars=yes,resizeable=no'
win = window.open(mypage, 'SitePlan', winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function printWindow() {
bV = parseInt(navigator.appVersion);
if (bV >= 4) window.print();
}

//Send text link to site(template) when selected in dropdown menu
function gotosite(site) {            
        if (site != "") {                    
                self.location=site; 
        }
 }
 
function closeWindow() {
close();
}

function back() {
window.history.back()
}

function loadNewContent(dest) 
{
  var destURL = "/popup_lotinfo.aspx?id=" + dest
  
  try 
  { // Moz supports XMLHttpRequest. IE uses ActiveX.  
    // browser detction is bad. object detection works for any browser
	xmlhttp = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");
  }
  catch (e) 
  { 
    // browser doesn't support ajax. handle however you want
	document.location.href = destURL
  }
	
  // the xmlhttp object triggers an event everytime the status changes  
  // triggered() function handles the events
  
  xmlhttp.onreadystatechange = triggered;
	
  // open takes in the HTTP method and url.
  xmlhttp.open("GET", destURL);
  // send the request. if this is a POST request we would have  
  // sent post variables: send("name=aleem&gender=male)  
  // Moz is fine with just send(); but  
  // IE expects a value here, hence we do send(null);
  xmlhttp.send(null);
}

function triggered() 
{ // if the readyState code is 4 (Completed)  
  // and http status is 200 (OK) we go ahead and get the responseText  
  // other readyState codes:  
  // 0=Uninitialised 1=Loading 2=Loaded 3=Interactive
  if ((xmlhttp.readyState == 4) && ((xmlhttp.status == 200) || (xmlhttp.status == 500))) 
	{
		// xmlhttp.responseText object contains the response.
		document.getElementById("Lotsinfo").innerHTML = xmlhttp.responseText;
		//document.getElementById("spanImg").innerHTML = "";
		//document.getElementById("spanImg").style.visibility = "hidden";
		//document.getElementById("container").style.backgroundimage = "url(../../images/bkgd_twocol.jpg)";
		//document.getElementById("gallery").innerHTML = "ghere";
	}
}

function AssignPosition(d) {
d.style.left = (cX+10) + "px";
d.style.top = (cY+10) + "px";
}
function HideContent(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "none";
}
function ShowContent(d,id) {
if(d.length < 1) { return; }
var dd = document.getElementById(d);
AssignPosition(dd);
dd.style.display = "block";
this.alt="";
loadNewContent(id); 
}
function ReverseContentDisplay(d) {
if(d.length < 1) { return; }
var dd = document.getElementById(d);
AssignPosition(dd);
if(dd.style.display == "none") { dd.style.display = "block"; }
else { dd.style.display = "none"; }
}
