function ChangeBG() {
	oldImage = document.getElementById('Change').style.backgroundImage;
	if (oldImage == "url(../Images/Menu/COBUMain.gif)") {
		newImage = "url(../Images/Menu/COBUMainHover.gif)";
		newColor = "#000000";
	} else {
		newImage = "url(../Images/Menu/COBUMain.gif)";
		newColor = "#FFFFFF";
	}
    document.getElementById('Change').style.backgroundImage = newImage;
    document.getElementById('ChangeC').style.color = newColor;
}

var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
	if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
	else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
		settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
	win=window.open(mypage,myname,settings);
}

function getPageSize(){
	if (window.innerHeight && window.scrollMaxY) {
		yWithScroll = window.innerHeight + window.scrollMaxY;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight){
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	} else {
		yWithScroll = document.body.offsetHeight;
		xWithScroll = document.body.offsetWidth;
	}
	return { height: parseInt(yWithScroll), width: parseInt(xWithScroll) };
} 

function getBrowserLocation() {
	var scrOfX = 0, scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {
		scrOfY = window.pageYOffset;
		scrOfX = window.pageXOffset;
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		scrOfY = document.body.scrollTop;
		scrOfX = document.body.scrollLeft;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		scrOfY = document.documentElement.scrollTop;
		scrOfX = document.documentElement.scrollLeft;
	}
	return { top: parseInt(scrOfY), left: parseInt(scrOfX) };
}

function getBrowserSize() {
	var intH = 0;
	var intW = 0;
	if(typeof window.innerWidth  == 'number' ) {
		intH = window.innerHeight;
		intW = window.innerWidth;
    } else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
		intH = document.documentElement.clientHeight;
		intW = document.documentElement.clientWidth;
	} else if(document.body && (document.body.clientWidth || document.body.clientHeight)) {
		intH = document.body.clientHeight;
		intW = document.body.clientWidth;
	}
	return { width: parseInt(intW), height: parseInt(intH) };
}  

function setLayerPosition() {
	var Loader = document.getElementById("Loader");
	var LoaderC = document.getElementById("LoaderC");
	var bws = getBrowserSize();
	var pos = getBrowserLocation();
	var posT = getPageSize();
	if (parseInt(posT.height)<parseInt(bws.height)) {
		Loader.style.width = bws.width + "px";
		Loader.style.height = bws.height + "px";
	} else {
		Loader.style.width = posT.width + "px";
		Loader.style.height = posT.height + "px";
	}
	LoaderC.style.left = parseInt(pos.left + ((bws.width - 100) / 2)) + "px";
	LoaderC.style.top = parseInt(pos.top + ((bws.height - 100) / 2)) + "px";
	Loader = null;
	LoaderC = null;
}

function showLayer() {
	setLayerPosition();
	var Loader = document.getElementById("Loader");
	var LoaderC = document.getElementById("LoaderC");
	Loader.style.display = "block"; 
	LoaderC.style.display = "block";
	var browserName = navigator.appName; 
	if (!(browserName=="Microsoft Internet Explorer")) { 
		var pos = getBrowserLocation();
		var posT = getPageSize();
		if (parseInt(pos.top)>0) {
			document.body.style.overflow = "-moz-scrollbars-vertical";
		} else {
			document.body.style.overflow = "hidden";
		} 
	} 
	Loader = null;
	LoaderC = null;             
}

function hideLayer() {
	var Loader = document.getElementById("Loader");
	var LoaderC = document.getElementById("LoaderC");
	Loader.style.display = "none"; 
	LoaderC.style.display = "none";
	Loader = null;
	LoaderC = null; 
}

window.onresize = setLayerPosition;
