﻿//-------------------------------------------------------------------------------------------------
//--  ShowBase FUNCTION  ----------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
function ShowBase(shimid, color)
{
	var shim = document.getElementById(shimid).style;
	shim.position = 'absolute';
	shim.width = MaxWidth() + 'px';
	shim.height = MaxHeight()+ 'px';
	shim.left = '0px';
	shim.top = '0px';
	shim.backgroundcolor = color;
	shim.visibility="visible";
}
function HideBase(shimid)
{
     document.getElementById(shimid).style.visibility="hidden";	
}
function Fade(id, opacity)
{
    var object = document.getElementById(id);
    object.style.filter = "alpha(opacity=" + opacity + ")"; 
    object.style.opacity = (opacity / 100);
    object.style.MozOpacity = (opacity / 100);
    object.style.KhtmlOpacity = (opacity / 100); 
}

function CenterLayer(id)
{
    var ele = document.getElementById(id);
    ele.style.display = '';
	ele.style.left = CenterX(ele) + 'px';
	ele.style.top = CenterY(ele) + 'px';
}
function CenterX(ele)
{
    var left = 0;
	left = (WinWidth()/2) - (parseInt(ele.style.width)/2); 
   
	if(ScrollLeft() == 0)
	    return left;
	else
		return ScrollLeft() + left;
}
function CenterY(ele)
{
    var top = 0;
    top = (WinHeight()/2) - (parseInt(ele.style.height)/2); 
        
	if(ScrollTop() == 0)
		return top; 
	else
		return ScrollTop() + top; 
}
function WinWidth()
{
	var myWidth = 0;
	if( typeof(window.innerWidth) == 'number') //Non-IE
	    myWidth = window.innerWidth;
	else if(document.documentElement && document.documentElement.clientWidth) 
	    //IE 6+ in 'standards compliant mode'
	    myWidth = document.documentElement.clientWidth;
	else if(document.body && document.body.clientWidth) 
	    //IE 4 compatible
	    myWidth = document.body.clientWidth;
  
  	return myWidth;
}
function WinHeight()
{
	var myHeight = 0;
	if(typeof(window.innerWidth) == 'number') //Non-IE
	    myHeight = window.innerHeight;
  	else if(document.documentElement && document.documentElement.clientHeight)
	    //IE 6+ in 'standards compliant mode'
	    myHeight = document.documentElement.clientHeight;
	else if(document.body && document.body.clientHeight) 
	    //IE 4 compatible
	    myHeight = document.body.clientHeight;

	return myHeight;
}
function ElementWH(widthheight)
{
	var len = widthheight.length;
	return	widthheight.substring(0,len-2); 
}
function MaxWidth()
{
	return ScrollLeft() + WinWidth(); 
}
function MaxHeight()
{	
	return ScrollTop() + WinHeight();	
}

function ScrollWidth()
{
	var iebody=(document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body
	return document.all? iebody.scrollWidth : iebody.clientWidth
}
function ScrollHeight()
{
	var iebody=(document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body
	return document.all? iebody.scrollHeight :  iebody.clientHeight
}

function ScrollLeft()
{
	var iebody=(document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body
	return document.all? iebody.scrollLeft : pageXOffset
}
function ScrollTop()
{
	var iebody=(document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body
	return document.all? iebody.scrollTop : pageYOffset
}