﻿var specialweatherobject;

function MM_jumpMenu(targ,selObj,restore){
 eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
 if (restore) selObj.selectedIndex=0;
}

function MM_openBrWindow(theURL,winName,features) {
if (features==null) features="";
if (winName==null) winName="";
window.open(theURL,winName,features);
}

function openDialogWindow(theURL)
{
window.open(theURL,"","");
}

function openDialogWindowEx(theURL)
{
window.open(theURL,"","toolbar=no,location=no,directories=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no");
}

function showWindowMax(theURL,winName,features) {
if (features==null) features="";
if (winName==null) winName="";

var maxwidth = screen.width-12;
var maxheight = screen.height-86;
if (features=="") {
features="width="+maxwidth+",height="+maxheight;
} else {
features+=",width="+maxwidth+",height="+maxheight;
}
window.open(theURL,winName,features);
}

function areaonload()
{
var obj=document.all["modifydateshow"];
if (obj!=null) {
modifydateshow.title=modifydate.value;
}
}

function showupdatetime()
{
 var s = modifydate.value;
 if (s!="") alert(s);
}

function resizemainframe()
{
var i=mainframe.document.body.scrollHeight;

if (i<1) {
for (j=0;j<100;j++) {
i=mainframe.document.body.scrollHeight;
if (i>1) break;
}
if (i<1) i=500;
}

mainframediv.style.height=i;
mainframetd.style.height=i+2;

i=document.body.scrollWidth;
if (i>520)
dynamicinfodiv.style.width=i-510;
}

function showInfo(docid,isevent) {
if (isevent==null)
theURL="showcomp.jsp?id=InfoShowTemp&docid="+docid;
else
theURL="showcomp.jsp?id=InfoShowTemp&isev=1&docid="+docid;

var maxwidth = screen.width-12;
var maxheight = screen.height-86;
window.open(theURL,"","toolbar=yes,location=no,directories=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,top=0,left=0,width="+maxwidth+",height="+maxheight+"");
}

function showInfoEx(docid,attid) {
var theURL="showcomp.jsp?id=InfoShowTemp&docid="+docid+"&attid="+attid;
var maxwidth = screen.width-12;
var maxheight = screen.height-86;
window.open(theURL,"","toolbar=yes,location=no,directories=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,top=0,left=0,width="+maxwidth+",height="+maxheight+"");
}

function showMain1(ppage,curl,cateid) {
this.location="showcomp.jsp?id="+curl+"&cid="+cateid;
}

function showMain2(curl,cateid,showtype) {
theURL=curl+"?cid="+cateid;
if (showtype==null)
this.location=theURL;
else
window.open(theURL,"",showtype);
}

function areaClick(url) {
obj=document.getElementById("waitinfo");
if (obj!=null) obj.style.display="";
document.location=url;
}

function langClick(langid,areaid) {
//document.location="langver.jsp?l="+langid+"&p="+areaid;
changelangform.f.value=mainframe.location;
changelangform.l.value=langid;
changelangform.p.value=areaid;
changelangform.submit();
}

function areaMouseOver() {
event.srcElement.style.cursor="hand";
}

function compTitleMouseOver() {
 obj=event.srcElement;
 obj.style.cursor="hand";
 obj.style.fontStyle ="italic";
}

function compTitleMouseOut() {
 obj=event.srcElement;
 obj.style.cursor='default';
 obj.style.fontStyle ='normal';
}

function compTitleClick(type,cid) {
this.location="maininfo.jsp?id="+type+"&cid="+cid;
}

function showHideLayers(objName) {
var i,obj;
var spanobjs = document.all.tags("SPAN");
for (i=0; i<spanobjs.length; i++){
 if (spanobjs[i].id.substring(0,4)=="menu")
 spanobjs[i].style.visibility="hidden";
}
if (objName!=null) {
 obj=document.getElementById(objName);
if (obj!=null) {
eSrc=window.event.srcElement;
obj=obj.style;
obj.top=eSrc.offsetTop+eSrc.offsetHeight-1;
obj.left=eSrc.offsetLeft-1;
obj.visibility="visible";
}
 }
}

function formSubmit(pageno){
 myform=document.infoshowmainform;
 myform.proid.value=pageno;
 myform.submit();
}

function gotopage(){
myform=document.infoshowmainform;
pageno=myform.gotopageno.value;
if (pageno!='') {
if (isNaN(parseInt(pageno)))
pageno='1';
else {
if (parseInt(pageno)<1)
pageno=1
else
pageno=Math.min([myform.maxpageno.value],[parseInt(pageno)]);
}
myform.gotopageno.value=pageno;
if (myform.gotopageno.value!=myform.currentpageno.value);
formSubmit(pageno);
} else {
 alert("Please input page no!");
 myform.gotopageno.focus(); }
}

function menuClick(layId,curMenuNo,maxMenuNo,theURL){
 if (layId==1)
 objname="catesubmenu";
 else
 objname="catethrmenu";

 for (i=0;i<=maxMenuNo;i++) {
 obj=document.all(objname+i);
 if (obj!=null) {
 if (i==curMenuNo) {
 if (obj.style.display=="") {
 if (layId!=3)
 obj.style.display="none";
 }
 else
obj.style.display="";
 }
// else obj.style.display="none";
 }
 }

 if (theURL!=null) {
 subCateClick(theURL,true);
 }
}

function pcsClick(theURL) {
	this.location=theURL;
}

function subCateClick(theURL,parentCall){
if (theURL.substr(0,1)=="!") {
window.open(theURL.substr(1));
}
else {
if (theURL.toUpperCase().substring(0,7)=="HTTP://")
window.open(theURL);
else {
if (parentCall)
this.mainframe.location=theURL;
else
this.location=theURL;
}
}
}

function cateClick(theURL){
parentCall=(document.all('mainframe')!=null);
subCateClick(theURL,parentCall);
}

function topMoreClick(){
 this.mainframe.location="showcomp.jsp?id=HotinfoMain&cid=*hot";
}

function cateMOver(){
obj=event.srcElement;
if (obj.tagName=='SPAN'){
obj.style.cursor='hand';
//obj.style.borderWidth ='1px';
//obj.style.borderBottomStyle ='solid';
 }
}

function cateMOut(){
//obj=event.srcElement;
//if (obj.tagName=='SPAN') {
//obj.style.borderBottomStyle='none';
//}
}

function login(){
obj=document.getElementById("uid");
uid=obj.value;
if (uid=="") {
obj.focus();
return;
}
obj=document.getElementById("pwd");
pwd=obj.value;
if (pwd=="") {
obj.focus();
return;
}
document.loginform.submit();
}

function weatherColorChange(obj) {
var obj=document.getElementById("specialweather");
if (obj!=null) {
if (obj.color=="#000000")
obj.color="#ff0000"
else
obj.color="#000000";
}
}

function showtitle(titleid) {
obj = document.getElementById(titleid);
if (obj==null) return;

titletext.innerText=obj.innerText;
titlewidth = 200;
titlewin.style.width=titlewidth;
fwidth = document.body.clientWidth;
if (window.event.x+titlewidth+40>fwidth) {
titlewin.style.left=window.event.x-titlewidth-25;
} else {
titlewin.style.left=window.event.x+5;
}
titlewin.style.top=window.event.y-10;
titlewin.style.visibility='visible';

}

function showtimetitle(titleid,langid) {
obj = document.getElementById(titleid);
if (obj==null) return;

var titles0 = new Array("Exceed the time limit","报名期已过","報名期已過","Exceed the time limit");
var titles1 = new Array("Residual Days:","剩余报名天数:","剩餘報名天數:","Residual Days:");

var objstr = obj.innerText;
objstr = objstr.replace("-", "/");
var date1 = Date.parse(objstr);
var date0 = Date.parse(Date());
var iwidth = 140;
if (date0>date1) {
objstr = titles0[parseInt(langid)];
} else {
var DyMilli = 1000 * 60 * 60 * 24;
var days1 = Math.round(Math.abs(date1/DyMilli));
var days0 = Math.round(Math.abs(date0/DyMilli));
objstr = titles1[parseInt(langid)];
objstr += Math.round(days1-days0);
}

titletext.innerText=objstr;
titlewidth = iwidth;
titlewin.style.width=titlewidth;
fwidth = document.body.clientWidth;
if (window.event.x+titlewidth+40>fwidth) {
titlewin.style.left=window.event.x-titlewidth-25;
} else {
titlewin.style.left=window.event.x+5;
}
titlewin.style.top=window.event.y-10;
titlewin.style.visibility='visible';

}

function hiddentitle() {
titlewin.style.visibility='hidden';
}

function opencontactwin(theurl) {
if ( (theurl==null) || (theurl=="")) theurl="contactus.jsp";
window.open(theurl,"","height=400,width=500,left=150,top=100, toolbar=no,location=no,directories=no,menubar=no,copyhistory=no,");
//var retval = showModalDialog('contactus.jsp','','dialogHeight:350,dialogWidth:500');
//if (retval!="") alert(retval);
}

