
/* Modified by Alex Spooner, 2007-09-29 */

var ie=document.all
var ns6=document.getElementById&&!document.all

function ietruebody()
{
	return (document.compatMode && document.compatMode!="BackCompat" && !window.opera)? document.documentElement : document.body
}

function showDPOP()
{
	var divwidth = 676; 
	var divheight = 129;
	if (ie||ns6)
	{
		crossobj = document.getElementById? document.getElementById("switcher_holder") : document.all.switcher_holder
		pgyoffset=ns6? parseInt(pageYOffset) : parseInt(ietruebody().scrollTop)
		horzpos=ns6? pageXOffset+window.innerWidth/2-divwidth/2 : ietruebody().scrollLeft+ietruebody().clientWidth/2-divwidth/2
		vertpos=ns6? pgyoffset+window.innerHeight/2-divheight/2 : pgyoffset+ietruebody().clientHeight/2-divheight/2
		if (window.opera && window.innerHeight) //compensate for Opera toolbar
		vertpos=pgyoffset+window.innerHeight/2-divheight/2
		vertpos=Math.max(pgyoffset, vertpos)

		crossobj.style.left=horzpos+"px"
		crossobj.style.top=vertpos+"px"

		crazySelect(0)
		crossobj.style.display="block"
		return false
	}
}

function hideDPOP()
{
	crossobj.style.display="none"
	crazySelect(1)
}

function crazySelect(c)
{
	s = document.getElementsByTagName("select")
	for(i=0;i<s.length;i++)
	{
		if (c==0) s[i].style.visibility = 'hidden'
		else s[i].style.visibility = 'visible'
	}
}

function drag_drop(e)
{
	if (ie&&dragapproved)
	{
		crossobj.style.left=tempx+event.clientX-offsetx+"px"
		crossobj.style.top=tempy+event.clientY-offsety+"px"
	}
	else if (ns6&&dragapproved){
		crossobj.style.left=tempx+e.clientX-offsetx+"px"
		crossobj.style.top=tempy+e.clientY-offsety+"px"
	}
	return false
}

function initializedrag(e)
{
	if (ie&&event.srcElement.id=="switcher_title"||ns6&&e.target.id=="switcher_title")
	{
		offsetx=ie? event.clientX : e.clientX
		offsety=ie? event.clientY : e.clientY
		
		tempx=parseInt(crossobj.style.left)
		tempy=parseInt(crossobj.style.top)
		
		dragapproved=true
		document.onmousemove=drag_drop
	}
}

document.onmousedown=initializedrag
document.onmouseup=new Function("dragapproved=false")

var detect = navigator.userAgent.toLowerCase();
var OS,browser,version;
var version,total,thestring;
		
function DetectBrowser()
{
	if (checkIt('konqueror'))
	{
		browser = "Konqueror";
		OS = "Linux";
	}
	else if (checkIt('safari')) browser = "Safari"
	else if (checkIt('omniweb')) browser = "OmniWeb"
	else if (checkIt('opera')) browser = "Opera"
	else if (checkIt('webtv')) browser = "WebTV";
	else if (checkIt('icab')) browser = "iCab"
	else if (checkIt('msie')) browser = "Internet Explorer"
	else 
		if (!checkIt('compatible'))
		{
			browser = "Netscape Navigator"
			version = detect.charAt(8);
		}
		else 
		{
			browser = "An unknown browser";
		}
	
	if (!version) version = detect.charAt(place + thestring.length);
	if (!OS)
	{
		if (checkIt('linux')) OS = "Linux";
		else if (checkIt('x11')) OS = "Unix";
		else if (checkIt('mac')) OS = "Mac"
		else if (checkIt('win')) OS = "Windows"
		else OS="an unknown operating system";
	}
}
