﻿function padout(number) { return (number < 10) ? '0' + number : number; }

function y2k(number) { return (number < 1000) ? number + 1900 : number; }

function compare_date(sdate, edate) {
	alert("start time :" + sdate + "end time :" + edate);
//	var ssdate = new Date(sdate.substring(0,4),sdate.substring(6,2),sdate.substring(9,2));
//	var eedate = new Date(edate.substring(0,4),edate.substring(6,2),edate.substring(9,2));
	
//	starttime = Date.UTC(y2k(ssdate.getYear()),ssdate.getMonth(),ssdate.getDate(),0,0,0);
//    endtime = Date.UTC(y2k(eedate.getYear()),eedate.getMonth(),eedate.getDate(),0,0,0);
	
	
//	if (starttime < endtime ) {
		return false;
//	}
//		return true;
}

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_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 MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function confirmSubmit(inStr) {
	var agree=confirm(inStr);
	if (agree)
		return true ;
	else
		return false ;
}

menu_status = new Array();
function showHide(theid){
	if (document.getElementById) {
		var switch_id = document.getElementById(theid);
		var link_id = document.getElementById("link_"+theid.substr(2));
//		alert(switch_id.className);
//		if(menu_status[theid] != 'show') {
		if (switch_id.className != 'show') {
		   switch_id.className = 'show';
		   link_id.innerHTML = '<img src="images/arrow_up.gif" border="0" alt="Less">';
//		   menu_status[theid] = 'show';
		} else {
		   switch_id.className = 'hide';
		   link_id.innerHTML = '<img src="images/arrow_down.gif" border="0" alt="More">';
//		   menu_status[theid] = 'hide';
		}
	}
}

function display(theid) {
	if (document.getElementById) {
		var switch_id = document.getElementById(theid);
		if(menu_status[theid] != 'show') {
		   switch_id.className = 'show';
		   menu_status[theid] = 'show';
		}
	}
}
		
function hide(theid) {
	if (document.getElementById) {
		var switch_id = document.getElementById(theid);
		if(menu_status[theid] != 'hide') {
		   switch_id.className = 'hide';
		   menu_status[theid] = 'hide';
		}
	}
}

function move(fbox, tbox) {
	var arrFbox = new Array();
	var arrTbox = new Array();
	var arrLookup = new Array();
	var i;
	for (i = 0; i < tbox.options.length; i++) {
		arrLookup[tbox.options[i].text] = tbox.options[i].value;
		arrTbox[i] = tbox.options[i].text;
	}
	var fLength = 0;
	var tLength = arrTbox.length;
	for(i = 0; i < fbox.options.length; i++) {
		arrLookup[fbox.options[i].text] = fbox.options[i].value;
		if (fbox.options[i].selected && fbox.options[i].value != "") {
			arrTbox[tLength] = fbox.options[i].text;
			tLength++;
		}
		else {
			arrFbox[fLength] = fbox.options[i].text;
			fLength++;
	   }
	}
	arrFbox.sort();
	arrTbox.sort();
	fbox.length = 0;
	tbox.length = 0;
	var c;
	for(c = 0; c < arrFbox.length; c++) {
		var no = new Option();
		no.value = arrLookup[arrFbox[c]];
		no.text = arrFbox[c];
		fbox[c] = no;
	}
	for(c = 0; c < arrTbox.length; c++) {
		var no = new Option();
		no.value = arrLookup[arrTbox[c]];
		no.text = arrTbox[c];
		tbox[c] = no;
   }
}

function movePage(url) {
	if (url != "")
		window.open(url);
}

var dt=new Date();
var month=new Array(12);
var week=new Array(7);
week[0] = "日";
week[1] = "一";
week[2] = "二";
week[3] = "三";
week[4] = "四";
week[5] = "五";
week[6] = "六";

var yyyy=dt.getYear();
var mm=dt.getMonth()+1;
var dd=dt.getDate();
var wk=dt.getDay();
showdate = yyyy+"年"+mm+"月"+dd+"日 星期"+week[wk];

