function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function MM_jumpMenuopen(targ,selObj,restore){ //v3.0
 var temp = selObj.options[selObj.selectedIndex].value
 window.open(temp,"_blank");
 if (restore) selObj.selectedIndex=0;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

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());
}

function Cti2007delCookie(name)
{
	document.cookie = name + "=; expires=Thu, 01-Jan-70 00:00:01 GMT" + "; path=/";
}
function CreatDiv(whitchdiv,divTop,divLeft) 
{
 var oDIVResults=document.createElement('div');
	    oDIVResults.id=whitchdiv;
	    document.getElementsByTagName("body").item(0).appendChild(oDIVResults);
	    oDIVResults=document.getElementById(whitchdiv);
	    oDIVResults.style.position="absolute";
		oDIVResults.style.display="none"
	    oDIVResults.style.left=divTop;
	    oDIVResults.style.top=divTop;
}
function CreatScript(Src) 
{
	var oDIVResults=document.createElement('script'); 
	oDIVResults.charset="big5";
	oDIVResults.src=Src; 
	document.getElementsByTagName("head").item(0).appendChild(oDIVResults);
}
function CreatScriptU(Src) 
{
	var oDIVResults=document.createElement('script'); 
	oDIVResults.charset="utf-8";
	oDIVResults.src=Src; 
	document.getElementsByTagName("head").item(0).appendChild(oDIVResults);
}
function makeContent(url,whichDiv) {

var http_request = false;
var content;
var timer = 0;

function makeRequest(url) {
    
    timer++;
    if (window.XMLHttpRequest) { // Mozilla, Safari,...
        http_request = new XMLHttpRequest();
        if (http_request.overrideMimeType) {
            http_request.overrideMimeType('text/xml');
        }
    } else if (window.ActiveXObject) { // IE
		var sCHValue="MSXML2.XMLHttp.5.0,MSXML2.XMLHttp.4.0,MSXML2.XMLHttp.3.0,MSXML2.XMLHttp,Microsoft.XMLHttp";
        var aVersions = sCHValue.split(",");
		for (var i = 0; i < aVersions.length; i++) {
	        try {
	            http_request = new ActiveXObject(aVersions[i]);
	           
	        } catch (oError) {
	        }
	    }

    }

    if (!http_request) {
        return false;
    }

    http_request.onreadystatechange = insertContents;
    http_request.open('GET', url, true);
    http_request.send(null);

}

function insertContents() {
	try {
    if (http_request.readyState == 4) {
        if (http_request.status == 200 && document.getElementById(whichDiv)) {
          document.getElementById(whichDiv).innerHTML=http_request.responseText;
        } else {
		   
			var str='setTimeout("makeContent(';
			    str=str+"'"+url+"','"+whichDiv+"');";
				str=str+'",100);';
			eval(str);
			
        }
    } else {
	}
    } catch(e) {
    
	}
}   

makeRequest(url);

}
function MakeFwdContent()
{
	if(document.getElementById("CtiFwd") ==null)
	{ 
		CreatDiv("CtiFwd",100,100);
		makeContent("/2007Cti/2007Cti-Common/Inc/2007-TotalHeader/1,4554,THpJd01EZERkR2t2TWpBd04wTjBhUzFEYjIxdGIyNHZTVzVqTHpJd01EZERkR2t0Um05eWQyRnlaQT09,00.jhtml","CtiFwd");
	
	}
	
	document.getElementById('CtiFwd').style.top=parseInt(parent.document.body.scrollTop)+100;
	document.getElementById("CtiFwd").style.display="block";
	document.getElementById("CtiFwd").style.zIndex=100;
}
function MakeFwdContentClose()
{
if(document.getElementById("CtiFwd"))
	{ 
		document.getElementById("ctiforwarddiframe").src="/2007Cti/2007Cti-Common/Inc/2007Cti-Forward-iFrame/0,4684,,00.html";
		document.getElementById("CtiFwd").style.display="none";
	}
}

function plurkRedir(surl)
{
var sHost, sSite, sCatID, sArtID, sPlurkUrl;
surl=surl.toLowerCase();
surl=surl.replace("%20", "+");
surl=surl.replace("+", "plussign");
sCatID="";
sArtID="";
sSite="news";
sHost=window.location.host;
if(surl.indexOf("rtn")>1) sSite="rtn";
if(surl.indexOf("cmoney")>1) sSite="cmoney";
if(surl.indexOf("showbiz")>1) sSite="showbiz";
if(surl.indexOf("life")>1) sSite="life";
if(surl.indexOf("tech")>1) sSite="tech";
if(surl.indexOf("sport")>1) sSite="sport";

var sRegUrlCat  = new RegExp(",[^,]+plussign");
arrMatCat = surl.match(sRegUrlCat);
	if(arrMatCat!=null)
	{
		sCatID=arrMatCat[0];
		sCatID=sCatID.replace(",","");
		sCatID=sCatID.replace("plussign","");	
	}	
var sRegUrlArt = new RegExp("plussign[^,]+,00");
arrMatArt = surl.match(sRegUrlArt);
		
	if(arrMatArt!=null)
	{
		sArtID=arrMatArt[0];
		sArtID=sArtID.replace(",00","");
		sArtID=sArtID.replace("plussign","");	
	}	
	sPlurkUrl="http://"+sHost+"/2009Cti/Common/2009Cti-News-PlurkRedirect/0,5228,"+sSite+"x"+sCatID+"x"+sArtID+",00.html";
	return(sPlurkUrl);
} 
function MakeCTIweb20 ()
{
var CTIweb20Str;
if(document.getElementById("CTIweb20"))
	{ 
		CTIweb20Str='&nbsp;';
		CTIweb20Str=CTIweb20Str+'<div class="bookmark">';
        CTIweb20Str=CTIweb20Str+'<dl class="inline-list bar-align-right">';
        CTIweb20Str=CTIweb20Str+'<dt class="ui">加入書籤：</dt>';
          
        CTIweb20Str=CTIweb20Str+'<dd class="ui"><a href="http://www.facebook.com/sharer.php?u='+ encodeURIComponent(String(window.location))+'&t='+encodeURI(define_content_1);
        CTIweb20Str=CTIweb20Str+'" title="Facebook" target=_blank><img src="http://www.chinatimes.com/2009Cti/cthead/images/ico-facebook.gif" alt="Facebook"  border="0" align="middle" class="ico-facebook"><span>Facebook</span></a></dd>';
    	  
        CTIweb20Str=CTIweb20Str+'<dd class="ui"><a href="http://twitter.com/home/?status='+encodeURI(define_content_1)+ ' ' + encodeURIComponent(String(window.location));
        CTIweb20Str=CTIweb20Str+'" title="twitter" target=_blank><img src="http://www.chinatimes.com/2009Cti/cthead/images/ico-twitter.gif" alt="twitter"  border="0" align="middle"><span>twitter</span></a></dd>';
    	  
        CTIweb20Str=CTIweb20Str+'<dd class="ui"><a href="http://www.plurk.com/?qualifier=shares&status='+ encodeURIComponent(plurkRedir(String(window.location)))+' ('+encodeURI(define_content_1)+")";
        CTIweb20Str=CTIweb20Str+'" title="plurk" target=_blank><img src="http://www.chinatimes.com/2009Cti/cthead/images/ico-plurk.gif" alt="plurk"  border="0" align="middle"><span>plurk</span></a></dd>';
	 
        CTIweb20Str=CTIweb20Str+'<dd class="ui"><a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk='+ encodeURIComponent(String(window.location))+'&amp;title='+encodeURI(define_content_1);
        CTIweb20Str=CTIweb20Str+'" title="google" target=_blank><img src="http://www.chinatimes.com/2009Cti/cthead/images/ico-google.gif" alt="Google"  border="0" align="middle"><span>Google</span></a></dd>';
    	 
        CTIweb20Str=CTIweb20Str+'<dd class="ui"><a href="http://tw.myweb2.search.yahoo.com/myresults/bookmarklet?t='+ encodeURIComponent(String(window.location))+'&amp;u='+encodeURI(define_content_1);
        CTIweb20Str=CTIweb20Str+'" title="yahoo" target=_blank><img src="http://www.chinatimes.com/2009Cti/cthead/images/ico-yahoo.gif" alt="yahoo"  border="0" align="middle"><span>yahoo</span></a></dd>';

        CTIweb20Str=CTIweb20Str+'<dd class="ui"><a href="https://favorites.live.com/quickadd.aspx?marklet=0&mkt=zh-tw&top=1&url='+ encodeURIComponent(String(window.location))+'&amp;title='+encodeURI(define_content_1)+")";
        CTIweb20Str=CTIweb20Str+'" title="windows-live" target=_blank><img src="http://www.chinatimes.com/2009Cti/cthead/images/ico-windows-live.gif" alt="windows-live"  border="0" align="middle"><span>windows-live</span></a></dd>';
    	
        CTIweb20Str=CTIweb20Str+'<dd class="ui"><a href="http://funp.com/push/submit/add.php?url='+ encodeURIComponent(String(window.location))+'&s='+encodeURI(define_content_1)+"&via=tool";
        CTIweb20Str=CTIweb20Str+'" title="funp" target=_blank><img src="http://www.chinatimes.com/2009Cti/cthead/images/ico-funp.gif" alt="funp"  border="0" align="middle"><span>funp</span></a></dd>';
    	  
        CTIweb20Str=CTIweb20Str+'<dd class="ui"><a href="http://www.hemidemi.com/user_bookmark/new?url='+encodeURIComponent(String(window.location))+'&title='+encodeURI(define_content_1);
        CTIweb20Str=CTIweb20Str+'" title="hemidemi" target=_blank><img src="http://www.chinatimes.com/2009Cti/cthead/images/ico-hemidemi.gif" alt="hemidemi" vspace="3" border="0" align="middle"><span>hemidemi</span></a></dd>';
   		
        CTIweb20Str=CTIweb20Str+'<dd class="ui last"><a href="http://myshare.url.com.tw/index.php?func=newurl&from=mysharepop&NewsMaster=1&url='+ encodeURIComponent(String(window.location))+'('+encodeURI(define_content_1)+")";
        CTIweb20Str=CTIweb20Str+'" title="myshare" target=_blank><img src="http://www.chinatimes.com/2009Cti/cthead/images/ico-myshare.gif" alt="myshare"  border="0" align="middle"><span>myshare</span></a></dd>';
        
		document.getElementById("CTIweb20").innerHTML=CTIweb20Str;
	}
}
function copyToClipboard() {
    var txt = ""
	var define_firstP =""
	if(document.getElementById("ctiMataKeywords"))
 		{
  			define_firstP = document.getElementById("ctiMataKeywords").getAttribute("CONTENT");
 		}
	txt =  define_content_1 +'\r\n\r\n' + define_firstP+'\r\n\r\n'+String(window.location) 
	if(window.clipboardData) {
           window.clipboardData.clearData();
           window.clipboardData.setData("Text", txt);
    } else if(navigator.userAgent.indexOf("Opera") != -1) {
        window.location = txt;
    } else if (window.netscape) {
        try {
            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
        } catch (e) {
            alert("很抱歉！由於Firefox瀏覽器設定問題，Firefox使用者若要使用新聞引用的功能 必須先做些設定：\r\n1. 開一個新分頁，在網址列打上 about:configrn2. 用過濾器找到 signed.applets.codebase_principal_support 這個值，用滑鼠點一下，把他改為 true");
        }
        var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
        if (!clip)
            return;
        var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
        if (!trans)
            return;
        trans.addDataFlavor('text/unicode');
        var str = new Object();
        var len = new Object();
        var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
        var copytext = txt;
        str.data = copytext;
        trans.setTransferData("text/unicode",str,copytext.length*2);
        var clipid = Components.interfaces.nsIClipboard;
        if (!clip)
            return false;
        clip.setData(trans,null,clipid.kGlobalClipboard);
    }
}
function doZoom(size){
if(document.getElementById('zoom-area') != null)
{
document.getElementById('zoom-area').style.fontSize=size+'px';
document.getElementById("font-small").className="";
document.getElementById("font-medium").className="";
document.getElementById("font-large").className="";
switch(size)
{
case 13 :
document.getElementById("font-small").className="current";
break;
case 18 :
document.getElementById("font-large").className="current";
break;
default :
document.getElementById("font-medium").className="current";
break;
}
}
else
  return;  
}