function getInternetExplorerVersion()
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).
{
  var rv = -1; // Return value assumes failure.
  if (navigator.appName == 'Microsoft Internet Explorer')
  {
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }
  return rv;
}
function checkVersion()
{
  var msg = "You're not using Internet Explorer.";
  var ver = getInternetExplorerVersion();

  if ( ver > -1 )
  {
    if ( ver >= 8.0 ) 
      msg = "You're using a recent copy of Internet Explorer."
    else
      msg = "You should upgrade your copy of Internet Explorer.";
  }
  //alert( msg );
}


function checkHeight() {
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	
	return myHeight;
	
	/*
	if (myHeight < 700) {
		$('#rbox').css('display','none');
		$('#content').css('margin-right','10px');
	} */
	//window.alert( 'Width = ' + myWidth );
	//window.alert( 'Height = ' + myHeight );
}

var boxtimer = 0;
var openboxes = new Array();

function boxop(setimg,oppct)
{
	setimg.style.filter = 'alpha(opacity=' + oppct + ')';
  	setimg.style.MozOpacity = oppct/100;
	setimg.style.opacity=(oppct/100);
}

function startboxtimer(infodiv)
{
	boxtimer = setTimeout('openbox("' + infodiv + '")',1000);
}

function stopboxtimer()
{
	clearTimeout(boxtimer);
}

function closeallboxes()
{
	for (var i=0; i < openboxes.length; i++)
	{
		closebox(openboxes[i]);
	}
	openboxes = new Array();
}

 $('html').click(function() {
	alert("help");
	closeallboxes();
});

function openbox(infodiv)
{
	setTimeout('openboxes.push("' + infodiv + '")',100);
	//var myHeight = checkHeight();
	infoelem = document.getElementById(infodiv);
	/*
	if (myHeight < 700)
	{
		infoelem.style.position = "absolute";
		infoelem.style.top = "100px";
		infoelem.style.marginLeft = "-262px";
	}
	*/
	//infoelem.innerHTML = '<img src="' + imgurl + '" />';
	infoelem.style.display = "block";
	
	for (i=0; i<=10; i++)
	{
		blackop = i * 8;
		whiteop = i * 10;
		timeout = i * 50;
		setTimeout('boxop(infoelem,' + whiteop + ')',timeout);
	}
}

function openboxurl(infodiv,openurl)
{
	openbox(infodiv);
	$.ajax({
	  url: openurl,
	  success:function(data){
		  
	  }
	});
}

function openinstant(infodiv)
{
	setTimeout('openboxes.push("' + infodiv + '")',1000);
	infoelem = document.getElementById(infodiv);
	infoelem.style.display = "block";
}

function closeinstant(infodiv)
{
	infoelem = document.getElementById(infodiv);
	infoelem.style.display = "none";
}

function closebox(infodiv)
{
	infoelem = document.getElementById(infodiv);
	infoelem.style.display = "none";
	//boxop(infoelem,0);
}
