﻿function ffMouseDownLock()
{
	document.onmousedown = click;
	if (document.layers) window.captureEvents(Event.MOUSEDOWN); window.onmousedown=click;
}

function click(e)
{
	if (navigator.appName == 'Netscape') {
		if (e.which != 1) {
			alert("因版權問題請勿下載");
			return false;
		}
	}
	if (navigator.appName == "Microsoft Internet Explorer") {
		if (event.button != 1) {
			alert("因版權問題請勿下載");
			return false;
		}
	}
}

//ffMouseDownLock();

function ToExecPopAD()
{
	var sCtDyADCook="null";
	sCtDyADCook=""+Cti2007getCookie("CtPopAD");
	if(sCtDyADCook=="null") {
		ToLoadPopAD();
	}
}

function ToLoadPopAD()
{
	var expDy = new Date();
	expDy.setTime(expDy.getTime() + (1000*60*10));//1000*60*10
	Cti2007setCookie("CtPopAD", "y", expDy);

	var popunderad="http://taiwan.chinatimes.com/event/ad.htm";
	var xWidth  = 800;
	var xHeight = 600;

	win2=window.open(popunderad,"post1","menubar=1,toolbar=1,location=1,directories=1,status=1,resizable=1,scrollbars=1,width=" + xWidth + ",height=" + xHeight);
}

function Cti2007getCookie(name)
{
	var cname = name + "=";
	var dc = document.cookie;
	if (dc.length>0) {
		var begin = dc.indexOf(cname);
		if (begin != -1) {
			begin += cname.length;
			var end = dc.indexOf(";" , begin);
			if (end == -1) {
				end = dc.length;
			}
			return unescape(dc.substring(begin,end));
		}
	}
	return null;
}

function Cti2007setCookie(name, value, expires)
{
	document.cookie = name + "=" + escape(value) + "; path=/" + ((expires == null) ? " " : "; expires=" + expires.toGMTString());
}
//ToExecPopAD();

function ciDynamicIncludeJs(sJsSrc)
{
	var oJSResults = document.createElement('script');
	oJSResults.setAttribute("language","JavaScript");
	oJSResults.setAttribute("src", sJsSrc);
	document.getElementsByTagName("head").item(0).appendChild(oJSResults);
}
