﻿// JavaScript Document
//********************************************************************************************
//*
//*               此功能为让层Layer自动居中。
//*
//*******************************************************************************************

//*
//*********************结束*******************************************************************


//********************************************************************************************
//*
//*               此JAVASCRIPT 作用为“timePopup”秒钟后自动关闭批定图层。图层名：Layer
//*				  时间设置为：timePopup
//*
//*******************************************************************************************
timePopup=3;// 此处设置为5秒，可根据最后要求自动设置
//var ns=(document.layers)?true:false;
var ns=false;
var ie=(document.all)?true:false;
var w3=(document.getElementById && !ie)?true:false;
adCount=0;



function initPopup()
	{
		if(!ns && !ie && !w3) 
			return;
		if(ie)
			adDiv=eval('document.all.Layer.style');
		else if(ns) 
			adDiv=eval('document.layers["Layer"]');
		else if(w3) 
			adDiv=eval('document.getElementById("Layer").style');
			
		if (ie||w3) 
			adDiv.visibility="visible";
		else 
			adDiv.visibility ="show";
			
		showPopup();
	}

function showPopup()
	{
		if(adCount<timePopup*10)
			{
				adCount+=1;
				if (ie)
					{
						documentWidth  =document.body.offsetWidth/2+document.body.scrollLeft-20;
						documentHeight =document.body.offsetHeight/2+document.body.scrollTop-20;
					}
				else if (ns)
					{
						documentWidth=window.innerWidth/2+window.pageXOffset-20;
						documentHeight=window.innerHeight/2+window.pageYOffset-20;
					}
				else if (w3)
					{
						documentWidth=self.innerWidth/2+window.pageXOffset-20;
						documentHeight=self.innerHeight/2+window.pageYOffset-20;
					}
				//adDiv.left=documentWidth-250;//控制位置
				//adDiv.top =documentHeight-150; //控制位置
				setTimeout("showPopup()",100);
			}
		else 
			closePopup();
	}
	
function closePopup()
	{
		if (ie||w3) {
			adDiv.display="none";
		}
		else 
			adDiv.visibility ="hide";
	}
//onload=initPopup;


