if (document.getElementById) {
// GLOBAL VARIABLES
	var op = 0;
	var MS = "Microsoft Internet Explorer";
	var sec; var doc; var popup; var popup_Height; var popup_Width;
	
	function closeLayer() {
		if (navigator.appName == MS) self.setTimeout("fadeOutLayer(popup.filters.alpha, 0, 10)", 5);
		else self.setTimeout("fadeOutLayer(popup.style, 0.0, 0.1)", 5);
	}
	function displayLayer() {
		var wrap = document.createElement("div");
		wrap.setAttribute('id','popup_ad');
		doc.appendChild(wrap);
		wrap.style.backgroundColor = "transparent";
		wrap.style.height = popup_Height;
		wrap.style.margin = "0px auto";
		wrap.style.position = "relative";
		wrap.style.width = popup_Width;
		
		if (navigator.appName == MS) wrap.style.filter = 'alpha(opacity=0)'; /* IE ONLY */
		else wrap.style.opacity = 0.0;
		
		popup = wrap;
				
		while (doc.firstChild.id != 'popup_ad') {
			element = doc.firstChild;
			doc.removeChild(element);
			wrap.appendChild(element);
		}
				
		doc.style.display = 'block';
		var topPos = document.body.scrollTop + document.body.clientHeight/2 - wrap.offsetHeight/2;
		if (topPos < 0) topPos = 0; 
		doc.style.top = topPos;
				
		if (navigator.appName == MS) self.setTimeout("fadeInLayer(popup.filters.alpha, 100, 10)", 1);
		else self.setTimeout("fadeInLayer(popup.style, 1.0, 0.1)", 1);
	}
	function fadeInLayer(styleAttribute, maxAmount, counter) {
		op+=counter;
		styleAttribute.opacity = op;
		
		if (styleAttribute.opacity < maxAmount) {
			if (navigator.appName == MS) self.setTimeout("fadeInLayer(popup.filters.alpha, 100, 10)", 5);
			else self.setTimeout("fadeInLayer(popup.style, 1.0, 0.1)", 5);
		}
	}
	function fadeOutLayer(styleAttribute, maxAmount, counter) {
		op-=counter;
		styleAttribute.opacity = op;
		if (styleAttribute.opacity > maxAmount) {
			if (navigator.appName == MS) self.setTimeout("fadeOutLayer(popup.filters.alpha, 0, 10)", 5);
			else self.setTimeout("fadeOutLayer(popup.style, 0.0, 0.1)", 5);
		}
		else doc.style.display = 'none';
	}
	
	function runFakePopup(num, popHeight, popWidth) {
		var num = num * 1000;
		doc = document.getElementById('fake_popup');
		sec = num;
		popup_Height = popHeight;
		
		if (popWidth == "auto") popup_Width = 960;
		else popup_Width = popWidth;
		
		doc.style.display = "none";
		doc.style.height = "auto";
		doc.style.position = "absolute";
		doc.style.textAlign = "center";
		if (navigator.appName == MS) doc.style.left = -100;
		doc.style.top = 0;
		doc.style.width = 960; 
		doc.style.zIndex = 100;
		
		self.setTimeout("displayLayer()", num);
	}	
}