// Global variables
var imageLoadFlag = 0;
var imageCache = new Array();
var setTime = 0;
var setThing = "";
var ns = (navigator.appName == 'Netscape');
var ns4 = (ns && parseInt(navigator.appVersion) >= 4 && parseInt(navigator.appVersion) < 5);
var ie = (navigator.appName == 'Microsoft Internet Explorer');
var ie4 = (ie && parseInt(navigator.appVersion) >= 4);
var docom = (document.getElementById);
var dhtmlBrowser = (ie4 || ns4 || docom);
var SHOW, HIDE;

if (ie4 || docom) {
  SHOW = "visible";
  HIDE = "hidden";
} else if (ns4) {
  SHOW = "show";
  HIDE = "hide";
}


//var objwin=null;
function openobjwin(objid,objtype)
{
// if (!objwin||objwin.closed)
// {
  var w,h;
//  w=window.screen.availWidth-30;
//  h=window.screen.availHeight-80;
 w=790;
 h=490;
  if (objtype==3 || objtype==9) 
  {w=600;
   h=425;
  	};
	  if (objtype==15) 
  {w=790;
   h=470;
  	};
	if (objtype==2) 
  {w=790;
   h=478;
  	};
if (objtype==10) 
  {w=798;
   h=458;
  	};
 objwin=window.open("/big5/phoweb/asp/objdetail.asp?objid=" + objid + "&objtype=" + objtype,objid+'obj',
"top=60,left=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=" +w + ",height=" +h); 
// }else{
//  objwin.focus();
// }
//if it open more obj window, it will apear the same obj content.
}

//只为打标而用 
function openthesiswin(thesisid)
{  
 window.open(str="/big5/phoweb/asp/thesisDetail.asp?thesisid=" + thesisid,thesisid+'thesis',
"top=92,left=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=790,height=450"); 
}

function openthesiswin2(thesisid,thesistype,thesisname)
{ var w,h;
  var aspname;
  if (thesistype==0) 
  {aspname="/big5/phoweb/asp/thesis0.asp?thesisid=";
  window.open(aspname+thesisid+'&thesistype='+thesistype+'&thesisname='+thesisname,thesisid+'thesis2',
"top=92,left=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=790,height=450"); 
  }
  else if(thesistype==1) {
  w=window.screen.availWidth-80;
  h=window.screen.availHeight-90;
  aspname="/big5/phoweb/asp/thesis1.asp?thesisid=";
   window.open(aspname+thesisid+'&thesistype='+thesistype+'&thesisname='+thesisname,thesisid+'thesis2',
"top=40,left=40,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=yes,width=" +w + ",height=" +h); 
   }
  else { 
  aspname="/big5/phoweb/asp/thesis2.asp?thesisid=";
  window.open(aspname+thesisid+'&thesistype='+thesistype+'&thesisname='+thesisname,thesisid+'thesis2',
"top=92,left=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=790,height=450"); 
  }
  
 
}

function openthesisloc(thesisid,pagenum,thesisname)
{
  var w,h;
  var aspname;
  w=window.screen.availWidth-80;
  h=window.screen.availHeight-90;
  
 window.open("/big5/phoweb/asp/thesischapter.asp?thesisid="+thesisid+'&pagenum='+pagenum+'&thesisname='+thesisname,thesisid+pagenum+'loc',
"top=40,left=40,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=yes,width=" +w + ",height=" +h); 
}

function openlemmawinimg(lemmaid)
{
  var w,h;
  w=window.screen.availWidth-200;
  h=window.screen.availHeight-100;
  lemmawin=window.open("/big5/phoweb/asp/lemmadetail.asp?lemmaid=" + lemmaid ,lemmaid+'lemma',
"top=100,left=100,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=700,height=450"); 
}

function openlemmawin(lemmaid)
{
  var w,h;
  w=window.screen.availWidth-200;
  h=window.screen.availHeight-100;
  lemmawin=window.open("/big5/phoweb/asp/lemmadetail.asp?lemmaid=" + lemmaid ,lemmaid+'lemma',
"top=100,left=100,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=440,height=280"); 
}


function openmidimgwin(imageid,suffix,width,height,havemid,havelp,imgtitle) 
{  
var w,h;
w=width;
h=height
if (width==0 ||width=="") w=window.screen.availWidth-200;
if (height==0 ||height=="") h=window.screen.availHeight-100;
window.open("/big5/phoweb/asp/showbigimg.asp?imageid=" +imageid +"&image_suffix=" +suffix+"&havemid=" +havemid+"&havelp=" +havelp+"&imgtitle=" +imgtitle ,imageid+'midimg');
} 


function openlpimgwin(id,havelp,imgtitle) 
{  
window.open("/big5/phoweb/asp/showlp.asp?imageid=" + id + "&havelp=" +havelp+"&imgtitle=" +imgtitle,id+'lp');
} 


function openmoreimgwin(objid)
{
  //var w,h;
  //w=window.screen.availWidth-50;
  //h=window.screen.availHeight-80;
  window.open("/big5/phoweb/asp/moreimg.asp?objid=" + objid ,objid+'moreimg',
"top=92,left=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=790,height=450"); 
}

function openmorethesiswin(objid)
{
 window.open("/big5/phoweb/asp/morethesis.asp?objid=" + objid ,objid+'morethesis',
"top=92,left=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=790,height=450"); 
}

function openmoreconwin(objid)
{
  var w,h;
  //w=window.screen.availWidth-50;
  //h=window.screen.availHeight-80;
  window.open("/big5/phoweb/asp/mingrenjuanzeng.asp?objid=" + objid ,objid+'morecon',
"top=30,left=30,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=790,height=450"); 
}


function openztjzwin(classid)
{
  var w,h;
  w=558;
  h=426;
  window.open("/big5/phoweb/asp/ztjzList.asp?classid=" + classid ,classid+'moreztjz',"top=30,left=30,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=" +w + ",height=" +h); 
}


function click() 
{
 if (event.button==2) return alert('NOT\r');
}
//document.onmousedown= click;


//for gif use

function LoadImages() {
 if (document.images) {
  for (var loadProg = 0; loadProg < LoadImages.arguments.length; loadProg++) {
    cI = LoadImages.arguments[loadProg];
    imageCache[loadProg] = new Image();
    imageCache[loadProg].src =  cI;
  }
 imageLoadFlag = 1;
 }
}


function CloseIt(imagename,id,layername,state)
{
 if (ie4 || docom) {
      document.all[layername].style.visibility = HIDE;
  } else if (ns4) {
      document.layers[layername].visibility = HIDE;
 }
 showimg(imagename,id,state);
}

function show(imagename, id,layername, state) {
  if (imageLoadFlag == 1) {
    if (state == SHOW) {
      if (setThing) {
        eval(setThing);
        clearTimeout(setTime);
      }
    }
   setThing = "";
   if (docom) document.getElementById(layername).style.visibility = state;
   else if (ie4) eval('document.all.' + layername + '.style.visibility = "' + state + '"');
   else if (ns4) eval('document.' + layername + '.visibility = "' + state + '"');
   showimg(imagename,id,state);
  }
}

function showimg(imagename,id,state){
if (state==SHOW)
   {
   if (ns4 && document.layer1) eval('document.layer1.document.' + imagename +'.src= "'+ imageCache[2*id-1].src + '"');
   if(ie4)  document[imagename].src =  imageCache[2*id-1].src;
} else {
   if (ns4 && document.layer1) eval('document.layer1.document.' + imagename +'.src= "'+ imageCache[2*id-2].src + '"');
   if(ie4)  document[imagename].src =  imageCache[2*id-2].src;
}

}

function notshow(imagename, id,layername) {
  if (imageLoadFlag) {
    setThing = "show('" + imagename + "', '" + id+ "', '"+ layername +"', HIDE)";
    setTime = setTimeout(setThing, 12000);
  }
}

 
 function notshowlayer(imagename, id,layername) {
  if (imageLoadFlag) {
    setThing = "show('" + imagename + "', '" + id+ "', '"+ layername +"', HIDE)";
    setTime = setTimeout(setThing, 12000);
  }
}

function openloadwin(id,downloadnum,PresentUrl) 
{  
window.open("/big5/phoweb/asp/presentupdate.asp?id=" +id+"&downloadnum="+downloadnum+"&PresentUrl="+PresentUrl,"礼品下载","top=20,left=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=300,height=150");
} 

function openplaywin(id,downloadnum,PresentUrl) 
{  
window.open("/big5/phoweb/asp/playmusic.asp?id=" +id+"&downloadnum="+downloadnum+"&PresentUrl="+PresentUrl,"礼品下载","top=100,left=100,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=456,height=304");
} 

function openloadimgwin(id,downloadnum,PresentUrl) 
{ var w,h;
  w=window.screen.availWidth;
  h=window.screen.availHeight; 
window.open("/big5/phoweb/asp/Wpaperupdate.asp?id=" +id+"&downloadnum="+downloadnum+"&PresentUrl="+PresentUrl,"礼品下载","top=0,left=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width="+w+",height="+h);
} 

function openforwardplatewin(objid,suffix)
{
 window.open("/big5/phoweb/asp/objdetail.asp?objid=" + objid + "&objtype=11&suffix=" + suffix,objid+suffix,
"top=92,left=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=790,height=490"); 
}

if (window.Event) 
document.captureEvents(Event.MOUSEUP); 

function nocontextmenu() 
{
event.cancelBubble = true
event.returnValue = false;

return false;
}

function norightclick(e) 
{
if (window.Event) 
{
if (e.which == 2 || e.which == 3)
return false;
}
else
if (event.button == 2 || event.button == 3)
{
event.cancelBubble = true
event.returnValue = false;
return false;
}

}

document.oncontextmenu = nocontextmenu; // for IE5+
document.onmousedown = norightclick; // for all others

//document.images.galleryimg = false
document.write("<META HTTP-EQUIV=\"imagetoolbar\" CONTENT=\"no\">");



function openxgcxskwin(classid,siteclass_name)
{
  var w,h;
  w=558;
  h=426;
  window.open("/big5/phoweb/asp/xgcxskList.asp?classid=" + classid +"&siteclass_name=" +siteclass_name ,classid+'moreztjz',"top=30,left=30,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=" +w + ",height=" +h); 
}