function getTodayNum(){
var today=new Date();
var num=(parseInt(today.getMonth())+1)*100+parseInt(today.getDate());
return num;
}

function BrowserType() {
	var ua=navigator.userAgent;
	if ((ua.indexOf('Opera')!=-1)&&(ua.charAt(ua.indexOf('Opera')+6)>=6)) return 'OP6';
	if ((ua.indexOf('MSIE')!=-1)&&(ua.charAt(ua.indexOf('MSIE')+5)>=4)) return 'IE4';
	if ((ua.indexOf('Mozilla/')!=-1)&&(ua.charAt(ua.indexOf('Mozilla/')+8)>=5)) {
		return 'NS6';
	} else {
		return 'NS4';
	}
	return 'UNKNOW';
}
function WindowSize() {
	if (BrowserType()=="IE4") {
		this.w=window.document.body.offsetWidth;
		this.h=window.document.body.offsetHeight;
		this.l=window.document.body.scrollLeft;
		this.t=window.document.body.scrollTop;
	} else {
		this.w=window.innerWidth;
		this.h=window.innerHeight;
		this.l=window.pageXOffset;
		this.t=window.pageYOffset;
	}
}
function TagSize (obj) {
	this.w=obj.offsetWidth;
	this.h=obj.offsetHeight;
	var t=0;var l=0;
	while (obj && obj.tagName!="BODY") {
		t+=obj.offsetTop;
		l+=obj.offsetLeft;
		obj=obj.offsetParent;
	}
	this.t=t;
	this.l=l;
}
function getObj(n,doc) {
	var x;
	if(!doc) var doc=document;
	if (n.indexOf('*')>-1){
		var tmp=n.split('*');
		x=eval('document.'+tmp[0]+'.'+tmp[1]+';');
		return x;
	}
	if(!(x=doc[n])&&doc.all) x=doc.all[n];
	for (i=0;!x&&i<doc.forms.length;i++) x=doc.forms[i][n];
	for(i=0;!x&&doc.layers&&i<doc.layers.length;i++) x=getStyle(n,doc.layers[i].document);
	if(!x && doc.getElementById) x=doc.getElementById(n);
	return x;
}
function getStyle(n) {
	var s=getObj(n);
//alert(n+'='+s);
	if (s.style) s=s.style;
	return s;
}
function shObj(strObjid,strAction) {
	var v,obj;
	if ((obj=getStyle(strObjid))!=null) {
		v=strAction;
		v=(v=='show')?'visible':(v=='hide')?'hidden':v;
		obj.visibility=v;
	}
}
function shObjs() {
	var arg=shObjs.arguments;
	for (var i=0;i<arg.length;i=i+2) shObj(arg[i],arg[i+1]);
}
function shForm(strForm,strAction) {
	var v,obj;
	var objForm=eval('document.'+strForm+';');
	for (var i=0;i<objForm.elements.length;i++) {
		obj=objForm.elements[i];
		if (obj.style) obj=obj.style;
		v=strAction;
		v=(v=='show')?'visible':(v=='hide')?'hidden':v;
		obj.visibility=v;
	}
}
function moveLayer(n,x,y) {
	var obj=getStyle(n);
	obj.left=x;obj.top=y;
}
function ow(uri,name,width,height) {
	var win=window.open(uri,name,"width="+width+",height="+height);
	window.focus();
	win.blur();
}
function moveToTag(strTag,strDivid,intDw,intDh) {
	var t=new TagSize(getObj(strTag));
	var w=new WindowSize();
	var top=0;var left=0;
	if (w.h-(t.t-w.t)>=intDh) {
		top=t.t;
	} else {
		top=t.t-intDh+t.h;
	}
	if (w.w-(t.l-w.l)>=intDw) {
		left=t.l;
	} else {
		left=t.l-intDw+t.w;
	}
	moveLayer(strDivid,left,top);
}
// Calendar table
var cw=156;//日历宽度
var ch=178;//日历高度
var bcolor='#7DB6C7';//背景色
var hfcolor='#FFFFFF';//抬头文字颜色
var hfsize='12px';//抬头文字字号
var wbcolor='#FFFFFF';//星期栏背景色
var wfcolor='#000000';//星期栏文字颜色
var wfsize='12px';//星期栏文字字号
var dbcolor='#E2F0F6';//日期背景色
var dfcolor='#0C687F';//日期文字颜色
var dfsize='12px';//日期文字字号
var dcbcolor='#FFFFFF';//当前日期背景颜色
var dcfcolor='#CC0000';//当前日期文字颜色

if (BrowserType()!='OP6') {
	document.write('<div id="newcalendar" style="Z-INDEX:100; position:absolute;visibility:hidden;width:'+cw+'px;height:'+ch+';background:'+bcolor+';">');
	document.write('<iframe src="calendar.htm" name="framecalendar" width="'+cw+'" height="'+ch+'" border="0" frameborder="0" marginheight="0" marginwidth="0" noresize scrolling="no"></iframe>');
	document.write('</div>');
}
//for Canendar
function showCalendar(strTag,strDivid,intDw,intDh,strTarget)
{
	if (BrowserType()=='OP6') {alert('请依照YYYY-MM-DD的格式自行填写日期。');return;}
	moveToTag(strTag,strDivid,intDw,intDh);
	shObj(strDivid,'show');
	window.frames['framecalendar'].document.printCal.transfer.value=strTarget;
}