/*if (!document.all)
document.captureEvents(Event.MOUSEMOVE)


document.onmousemove = getPosition;

*/
var X = 0
var Y = 0

var version = navigator.userAgent;
var findIE6 = version.indexOf('MSIE 6');
function getPosition(args) 
{
  // Gets IE browser position
  if (document.all) 
  {
    X = event.clientX + document.body.scrollLeft
    Y = event.clientY + document.body.scrollTop
  }
  
  // Gets position for other browsers
  else 
  {  
    X = args.pageX
    Y = args.pageY
  }
}

function findPosY()
  {
	 obj =  document.getElementById("height_div");
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }

function backgroundFilter()
{
    var div;
    
    if(document.getElementById)
    // Standard way to get element
    div = document.getElementById('backgroundFilter'); 
    else if(document.all) 
    // Get the element in old IE's 
    div = document.all['backgroundFilter']; 
	
	winH = findPosY();
	
    // if the style.display value is blank we try to check it out here 
    if(div.style.display==''&&div.offsetWidth!=undefined&&div.offsetHeight!=undefined)
    {
       
		div.style.display = (div.offsetWidth!=0&&div.offsetHeight!=0)?'block':'none'; 
		div.style.height = winH;
		div.style.visibility="visible";
		if(findIE6 != -1)
		{	
			document.getElementById("menu4iframe").style.display = "block";
			document.getElementById("menu4iframe").style.height = winH;
		}
	}
    
    // If the background is hidden ('none') then it will display it ('block').
    // If the background is displayed ('block') then it will hide it ('none').
    div.style.display = (div.style.display==''||div.style.display=='block')?'none':'block';
}

imgcross = 0;
function popUp(showcross)
{
    var div;
    if(typeof showcross !== "undefined")
	{
		imgcross = 1;
	}
	else
	{
		imgcross = 0;
	}
    if(document.getElementById)
    // Standard way to get element
    div = document.getElementById('popupWindow'); 
    else if(document.all) 
    // Get the element in old IE's 
    div = document.all['popupWindow']; 
    
    // if the style.display value is blank we try to check it out here 
    if(div.style.display==''&&div.offsetWidth!=undefined&&div.offsetHeight!=undefined)
    {
        
		div.style.display = (div.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none'; 
    }
    
    // If the PopUp is hidden ('none') then it will display it ('block').
    // If the PopUp is displayed ('block') then it will hide it ('none').
    div.style.display = (div.style.display==''||div.style.display=='block')?'none':'block';
    ajaxpage("http://"+this_domain+"/custom/pop_div/update_stats.php","dis_nothing");
    // Off-sets the X position by 15px
    /*X = X + 15;*/
    
    // Sets the position of the DIV
    /*div.style.left = X+'px';
    div.style.top = Y+'px';*/
	div.style.left = '25%';
    //div.style.top =  Y+'px';
	
	scrollDiv();
}


function posTop()
{
	return typeof window.pageYOffset != 'undefined' ?  window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0;
}

function pageWidth() 
{
	return window.innerWidth != null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;
}

function scrollDiv()
{
	var divElement=document.getElementById("popupWindow");
	if(divElement)
	{
		var browser=navigator.appName;
		var agentWidth=pageWidth();
	
		
		if(browser=="Microsoft Internet Explorer")
			var perspectiveWidth=(0.84*agentWidth);
		else
			var perspectiveWidth=(0.8*agentWidth)+8;
		
	
		var mixPixel=posTop()+70;
	
	
	
		if(divElement.style.visibility=="hidden")
	
		{
			divElement.style.visibility="visible";
	
			
		}
		divElement.style.top=mixPixel;
	}

}

window.onload=scrollDiv;
window.onscroll=scrollDiv;
window.onresize=scrollDiv;