
document.pagename = "Home";

//calls the Resize Function, because body onResize isnt allowed anymore.
window.onresize=Resize;

//Tracks visitor in Google Analytics
function GoogleTrack(pagename)
{
	pageTracker._trackPageview(pagename);
}

//Flash tells javascript what page you're on
function SetCurrentPage(pagename)
{
	document.pagename = pagename;
}


//Forces the size of the website container div.
//This is called from flash when someone reduces 
//their browser windows below 1024x768 or so.
function ChangeSize(theheight,thewidth)
{
	
	if (theheight < GetHeight()){
		ResetHeight();
	}
	else{
		document.getElementById("ODG").style.height = theheight;
	}
	
	
	if (thewidth < GetWidth()){
		ResetWidth();
	}
	else{
		document.getElementById("ODG").style.width = thewidth;
	}
	
}



//gets the height of the browser
function GetHeight()
{

        var y = 0;
        if (self.innerHeight)
        {
                y = self.innerHeight;
        }
        else if (document.documentElement && document.documentElement.clientHeight)
        {
                y = document.documentElement.clientHeight;
        }
        else if (document.body)
        {
                y = document.body.clientHeight;
        }
        return y;

}


// gets the width of the browser
function GetWidth()
{

        var x = 0;
        if (self.innerWidth)
        {
                x = self.innerWidth;
        }
        else if (document.documentElement && document.documentElement.clientWidth)
        {
                x = document.documentElement.clientWidth;
        }
        else if (document.body)
        {
                x = document.body.clientWidth;
        }
        return x;

}


//resets website container div to 100%
function ResetHeight()
{
	document.getElementById("ODG").style.height = "100%";
}

//resets website container div to 100%
function ResetWidth()
{
	document.getElementById("ODG").style.width = "100%";
}



//Called from the window.onresize call above.
function Resize()
{
	   if (parseInt(navigator.appVersion)>3) {
			   if (navigator.appName=="Netscape") {
				winW = window.innerWidth;
				winH = window.innerHeight;
			   }
			   if (navigator.appName.indexOf("Microsoft")!=-1) {
				winW = document.body.offsetWidth;
				winH = document.body.offsetHeight;
			   }
			  }
	  
	  
	  //if width is really low, manually force it so scrollbars appear.
	  if (winW < 980)
	  {
			  thediv = document.getElementById('ODG');
			  thediv.style.width="980px";
	  }
	  else
	  {
			  thediv = document.getElementById('ODG');
			  thediv.style.width="100%";
	  }
	  
	   
	   //if we're on the homepage, restrict height too.  Unlimited on Work page though.
	   if (document.pagename == "Home")
	  {
		 if (winH < 570)
		  {
				  thediv = document.getElementById('ODG');
				  thediv.style.height="570px";
		  }
		  else
		  {
				  thediv = document.getElementById('ODG');
				  thediv.style.height="100%";
		  }
	}

}
