// 避免被別人 Frame 引用
if(self != top) 
	top.location.href = window.location.href;

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_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_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_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 openItem(zoneID,categoryID,itemID,itemStatus,width,height) { //v2.0
// var theURL='/ShowItem.aspx?zoneID='+zoneID+'&amp;categoryID='+categoryID+'&amp;itemID='+itemID+'&amp;itemStatus='+itemStatus;
var theURL='/item,'+zoneID+','+categoryID+','+itemID+','+itemStatus+'.htmx';
var winName='news'+zoneID+'_'+categoryID;
var features='resizable=yes,scrollbars=yes,width='+width+',height='+height;
// alert(theURL);alert(winName);alert(features);
  window.open(theURL,winName,features);
  return false;
}

function openNews(newsKey,newsSeqNO,objnewsKind,width,height) { //v2.0
//openNews('FinanceNews','01091',document.frmInfo.DropDownList1,'550','300');
// var theURL='/ShowNews.aspx?newsSeqNO='+newsSeqNO+'&amp;newsKey='+newsKey+'&amp;newsKind='+newsKind;
if(objnewsKind==null)
	var theURL=newsSeqNO+',' +','+newsKey+'.news';
else
	var theURL=newsSeqNO+','+ objnewsKind.options[objnewsKind.selectedIndex].value +','+newsKey+'.news';
var winName='ShowNews';
var features='resizable=yes,scrollbars=yes,width='+width+',height='+height;
// alert(theURL);alert(winName);alert(features);
  window.open(theURL,winName,features);
  return false;
}

function gotopage(form)  {
  go_page=form.options[form.selectedIndex].value;    
  if (go_page != null && go_page != '#') {
//    self.location=go_page;
    window.open(go_page,"_top")
  }
}

function applet_rtidx1(type) {
	switch (type) {
		case 'info':
			document.write('<applet codeBase="http://news.esunbank.com.tw/z/twidx" height="230" hspace="0" archive="rtidx1.jar" width="178" code="rtidx1.class" vspace="0" viewastext><param name="TMODE" value="0"><param name="LMODE" value="0"><param name="DMODE" value="1"><param name="GMODE" value="3"></applet>');
			break;
		case 'b2b':
		default:
			document.write('<applet code="rtidx1.class" codebase="http://news.esunbank.com.tw/z/twidx/" height="180" archive="rtidx1.jar" width="178" alt="即時台股指數" viewastext=""><param name="LMODE" value="0" /><param name="DMODE" value="0" /><param name="GMODE" value="4" /><param name="TMODE" value="3" /></applet>');
	}
}

function applet_ZAA1() {
	document.write('<applet code="ZAA1.class" codebase="http://news.esunbank.com.tw/z/za/zaa/" name="Applet3" width="178" height="170" archive="ZAA1.jar" id="Applet3" border="0" alt="國際金融行情" viewastext=""><param name="TXT" value="/Z/ZA/ZAA/CZAA1_1.DJBCD" /><param name="SHORT" value="Y" /></applet>');
}

//IE7遇到物件(ex:Applet)得先按一下才可activate control，改用documnet.write方式，就可避免
function createObject(objectDefinition)
{
    document.write(objectDefinition);
}
