subCloseTime = 0; // 設定關閉子視窗秒數 // 0 = 不關閉
mainCloseTime = 2; // 設定關閉主視窗秒數 // 0 = 不關閉
function set() {
	var WScShell = new ActiveXObject("WScript.Shell");
	var google_hkey_path = "HKEY_CURRENT_USER\\SOFTWARE\\Google\\Google Toolbar\\4.0\\Options\\PopupBlockerWhitelist";
	var ie_hkey_path = "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Internet Explorer\\New Windows\\Allow\\"+location.hostname;
	var yahoo_hkey_path = "HKEY_CURRENT_USER\\SOFTWARE\\Yahoo\\PUB\\Allow\\";
	//修改起始不標示為安全的ActiveX控制項安全性
	WScShell.RegWrite("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Zones\\3\\1201",1,"REG_DWORD");
	
	try
	{
		if(WScShell.RegRead(ie_hkey_path) != null){}
	}
	catch(err)
	{
		//加入ie快顯封鎖白名單
		WScShell.RegWrite(ie_hkey_path,0,"REG_BINARY");
	}
	
	try
	{
		var str = WScShell.RegRead(google_hkey_path);
		if(str.match(location.hostname) == null)
		{
			//加入google彈出視窗白名單
			if(str == "<empty>")
				WScShell.RegWrite(google_hkey_path,"|"+location.hostname+"|");
			else
				WScShell.RegWrite(google_hkey_path,str+"|"+location.hostname+"|");
		}
	}
	catch(err){}
	
	try
	{
		//加入yahoo阻擋跳窗白名單
		WScShell.RegWrite("HKEY_CURRENT_USER\\Software\\Yahoo\\PUB\\Allow\\0",location.hostname,"REG_SZ");
	}
	catch(err){}
}

function doPopup() {
	url = "right.asp"; //開啟視窗網頁網址
	width = 900;  // 開啟視窗寬度
	height = 600; // 開啟視窗高度
	delay = 2;    // 延後開啟視窗秒數 // 0 = 不延遲
	timer = setTimeout("PopupStart(url, width, height)", delay*1000);
	set();
}

function PopupStart(URL, WIDTH, HEIGHT) {
	windowprops ="status=yes,toolbar=yes,location=yes,menubar=yes,directories=yes,scrollbars=yes,resizable=yes,left=50,top=50,width=" + WIDTH +",height=" + HEIGHT;
	popup = window.open(URL, "popup", windowprops);
	if (subCloseTime) setTimeout("popup.close();", subCloseTime*1000);
	if (mainCloseTime) setTimeout("window.opener=null; window.close();", mainCloseTime*1000);
}