﻿function doClick(url, target)
{
	window.open(url,target);
}

function addLoadEvent(func)
{	
	var oldonload = window.onload;
	if (typeof window.onload != 'function'){
    	window.onload = func;
	} else {
		window.onload = function(){
		oldonload();
		func();
		}
	}
}

var browser=navigator.appName;
var enterframeArray = new Array();
function addEnterFrame(func)
{
	enterframeArray.push(func);
}

function updateEnterFrame()
{
    var currentWidth = 0;
    var currentHeight = 0;
		var pageOffsetX = 0;
		var pageOffsetY = 0;
		var iebody=(document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body

		pageOffsetX=document.all? iebody.scrollLeft : pageXOffset
		pageOffsetY=document.all? iebody.scrollTop : pageYOffset
	
		if( typeof( window.innerWidth ) == 'number' ) {
      //Non-IE
      currentWidth = window.innerWidth - 20;
      currentHeight = window.innerHeight - 1;
    } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
      //IE 6+ in 'standards compliant mode'
      currentWidth = document.documentElement.clientWidth;
      currentHeight = document.documentElement.clientHeight;
    } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
      //IE 4 compatible
      currentWidth = document.body.clientWidth;
      currentHeight = document.body.clientHeight;
    }
		document.getElementById("lightboxBackground").style.left = pageOffsetX+'px';
		document.getElementById("lightboxBackground").style.top = pageOffsetY+'px';
    document.getElementById("lightboxBackground").style.width = currentWidth+'px';
    document.getElementById("lightboxBackground").style.height = currentHeight+'px';
    for(var i=0; i<enterframeArray.length; i++)
		{
			var tmpFunc = enterframeArray[i];
			tmpFunc(currentWidth, currentHeight, pageOffsetX, pageOffsetY);
		}
}
