// JavaScript Document
	var s;  //保存传入的日期数组
	var e_obj; //保存事件响应控件
	var top=0; //层显示的top
	var left=0//层显示的left
	
var dayArray=new Array("日","一","二","三","四","五","六");
var monthArray=[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];

function rs(day)
{
	this.top=0;
	this.e_obj.value=window.layerYear.value+"-"+window.layerMonth.value+"-"+day;
	 window.objs.style.display="none";
	window.las.style.display="none";
	
}
//初始化日历
function init(){
	document.writeln("<div><IFRAME width=\"181\" id=\"hidexl\" height=\"185\" style=\"position:absolute;display:none;top:0px; z-index:1200;\"></IFRAME></div>");
}
	today1=new Date();
	
	document.writeln("<div id=\"las\" style=\"position:absolute; display:none;left: 69px; background-color: #CCCCCC; layer-background-color: #CCCCCC; border: 1px none #000000; width: 177px; height: 185px;Z-INDEX:1211\" onblur=\"hilayer()\" onClick=\"event.cancelBubble=true;\" onMouseout=\"lostlayerfocus()\" onMouseover=\"getlayerfocus()\">");
	document.writeln("<table border=\"1\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"#3399FF\"><tr><td><table width=\"177\" height=\"185\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"white\" ><tr align=\"center\" bgcolor=\"#FFFFFF\" height=\"25\"><td height=\"30\"><input type=\"Button\" value=\"<<\"  onclick=\"tyear(-1);\" onmouseover=\"getlayerfocus()\" style=\"color: #000099; border=0 ;background-color: #FFFFFF; cursor: hand\" > <input type=\"Button\" value=\"<\" onclick=\"tmonth(-1);\" onmouseover=\"getlayerfocus()\" style=\"color: #000099; border=0 ;background-color: #FFFFFF; cursor: hand\">");
document.writeln(" <select name=\"layerYear\" id=\"layerYear\" onblur=\"getlayerfocus()\" onmouseover=\"getlayerfocus()\" onChange=\"years(this.value);\">")
for(i=today1.getYear()-90;i<today1.getYear()+20;i++)
{
	document.writeln("<option value="+i.toString()+">"+i.toString()+"</option>");
}
document.writeln("</select><select name=\"layerMonth\" id=\"layerMonth\" onmouseover=\"getlayerfocus()\" onblur=\"getlayerfocus()\" onChange=\"ms(this.value);\">");
for(i=1;i<=12;i++)
{
	document.writeln("<option value="+i+">"+i+"</option>");
}
document.writeln("</select>");
	document.writeln("<input type=\"Button\" value=\">\"  onclick=\"tmonth(1);\" onmouseover=\"getlayerfocus()\" style=\"color: #000099; border=0 ;background-color: #FFFFFF; cursor: hand\"> <input type=\"Button\" value=\">>\"  onclick=\"tyear(1);\" onmouseover=\"getlayerfocus()\" style=\"color: #000099; border=0 ;background-color: #FFFFFF; cursor: hand\"></font></td></tr><tr><td valign=\"top\" bgcolor=\"#FFFFFF\"><span id=\"layerCalendar\"><span></td></tr><tr><td bgcolor=\"#35D4BE\" style=\"color=\"#FFFFFF\" onclick=\"hilaye()\" align=\"center\" height=\"10px\"><font color=\"#000000\"><b>关 闭</b><font></td></tr></table></td></tr></table></div>");
	
<!--
// Written by caocao
// caocao@eastday.com
// http://nethermit.yeah.net

var stringTable="<table cellspacing=\"0\"  cellpadding=\"1\" border=\"0\" align=\"center\" bordercolor=\"#BAECDF\" width=\"100%\"><tr bgcolor=\"#BAECDF\" align=\"center\" width=\"100%\">";
for (var i=0; i<dayArray.length; ++i)
{
 stringTable+="<td height=\"10px\"><font color=\"white\" ><b>"+dayArray[i]+"</b></font></td>";
}
stringTable+="</tr>";
function setValue(tag, str)
{
 document.getElementById(tag).innerHTML=str;
}
function setValue1(tag, str)
{
 document.getElementById(tag).value=str;
}
function setValue2(tag, str)
{
 document.getElementById(tag).value=str;
}
function showbq(l_obj,arr)
{
	var today=new Date();
		this.s=arr;		
	this.e_obj=l_obj;
	var eT = this.e_obj.offsetTop;   //obj 距离上方或上层控件的位置
	var eH = this.e_obj.offsetHeight+eT;  //obj 控件自身的高度
	var dH = window.las.style.pixelHeight;  
	var sT = document.body.scrollTop; 
	var sL = document.body.scrollLeft; 
event.cancelBubble=true;
this.top = event.clientX-event.offsetX+sL-5;   //设置层的left
this.left = event.clientY-event.offsetY+eH+sT-5;//设置层的高度
window.las.style.posTop=this.left;
window.las.style.posLeft=this.top;
 objs=document.all.hidexl;
objs.style.posTop=this.left;
objs.style.posLeft=this.top;
if (window.las.style.posLeft+window.las.clientWidth>document.body.clientWidth)
{
window.las.style.posLeft+=this.e_obj.offsetWidth-window.las.clientWidth;
objs.style.posLeft+=this.e_obj.offsetWidth-window.las.clientWidth;
}
 setValue1("layerYear", today.getYear());
 setValue2("layerMonth", today.getMonth()+1);
 
showTime(today.getYear(),today.getMonth()+1,this.s);
	
}
function showTime(year,month,arr)
{

//是鼠标当前相对于网页中的某一区域的位置
	var sl=this.s;
	var sl=",";
	if(s!="today")
	{
	arr1=arr.split(sl);
	}
	 var mh=false;
 var today=new Date(year,month-1,1);
	 var tdy=new Date();
	 var thisd=tdy.getDate();
	 var currentYear=today1.getFullYear()
	 if (((currentYear%4==0)&&(currentYear%100!=0))||(currentYear%400==0))
	  monthArray[1]=29;
	 var allDays=monthArray[today.getMonth()]; //获取当月的天数
	 var currentWeek=today.getDay();  //获得今天是星期几
	 var currentDay=today.getDate(); //获取今天是几号
		 var i=currentDay%7-currentWeek;
	 var threshold=(7+i)%7;
	 var isEnd=false;
	 var stringAll=stringTable;
 while (true)
 {	  if (isEnd)
	  {
		   stringAll+="<td  bgcolor=\"#FFFFFF\" height=\"10px\"></td>";
		   if (i % 7==(threshold+6)%7)
		   {
			stringAll+="</tr>";
			break;
		   }
	  }
	  else
	  {
		  var rqs1=tdy.getYear()+"/"+(tdy.getMonth()+1)+"/"+tdy.getDate();
		  var rqs2=today.getYear()+"/"+(today.getMonth()+1)+"/"+Math.abs(i);
		  var dt1=new Date(rqs1)
		  var dt2=new Date(rqs2)
		   if (i % 7==threshold )
			{
			stringAll+="<tr align=\"center\" height=\"15\">";
			}
			if(s!="today" && s!="old")
			{
			var rq3=(today.getMonth()+1)+"-"+Math.abs(i)+"-"+today.getYear();
			 for(m=0;m<arr1.length;m++)
			  {
				if((rq3==arr1[m]))
				{
					if(Math.round((dt2-dt1).valueOf()/1000/3600/24)>0)
						{	
							mh=true;
									break;  
						}
				}
				else
				{
					mh=false;
				}
			   }
			}
			else if(s=="today")
			{
		 	var rqs1=tdy.getYear()+"/"+(tdy.getMonth()+1)+"/"+tdy.getDate();
			  var rqs2=today.getYear()+"/"+(today.getMonth()+1)+"/"+Math.abs(i);
			  var dt1=new Date(rqs1)
			  var dt2=new Date(rqs2)
				  if(Math.round((dt2-dt1).valueOf()/1000/3600/24)>=0)
				  {
					mh=true;
			
				  }
					  else
					  {
						  mh=false;
					  }
				
			}
			else if(s="old")
			{
				mh=true
			}
			if(s=="")
			{
				mh=true;
			}
			   if(mh)
			   {
				 stringAll+=i>0?"<td "+(i==thisd?" bgcolor=\"#FEA477\" style=\"cursor: hand":"")+" onmouseover=\"this.bgColor='#EFFB64';\" onmouseout=\"this.bgColor=''\" height=\"15\" align=\"center\"><a href=\"javascript:void(0);\" onclick=\"rs("+i+");\"  height=\"15\" class=\"ff\"><u><b>"+i+"</b></u></a></td>":"<td bgcolor=\"#FFFFFF\" > </td>";
			   }
			   else
			   {
				stringAll+=i>0?"<td"+(i==thisd?" bgcolor=\"#FEA477\" style=\"cursor: hand":"")+" onmouseover=\"this.bgColor='#EFFB64';\" align=\"center\" onmouseout=\"this.bgColor=''\" height=\"15\"><s><b>"+i+"</b></s></td>":"<td bgcolor=\"#FFFFFF\" height=\"15\"> </td>";
			   }
				   if (i % 7==(threshold+6)%7)
				   {
					stringAll+="</tr>";
						if (i==allDays)
						 break;
					   }
			   if (i==allDays)
				isEnd=true;
		  }
	  ++i;
	 }
 stringAll+="</table>";
 setValue("layerCalendar", stringAll);
 window.objs.style.display="block";
 window.las.style.display="block";
  window.las.focus();
  
 }
function years(year)
{
	var today=new Date();
	showTime(year,window.layerMonth.value,this.s);
	window.las.focus();
}
function ms(month)
{
var today=new Date();
showTime(window.layerYear.value,month,this.s)
window.las.focus();
}



function tyear(num)
	{
		var today=new Date();
		window.layerYear.value=(parseInt(window.layerYear.value)+num);
	
	showTime(window.layerYear.value,(parseInt(window.layerMonth.value)),this.s)
window.las.focus();
	}
	function tmonth(num)
	{
	var today=new Date();
	if(window.layerMonth.value==12 && num>0)
	{
	window.layerYear.value=(parseInt(window.layerYear.value)+1);	
	window.layerMonth.value=1;	
	}
	else if(window.layerMonth.value==1 && num<0)
	{
	window.layerMonth.value=12;
	window.layerYear.value=(parseInt(window.layerYear.value)-1);
	}
	else
	{
	window.layerMonth.value=parseInt(window.layerMonth.value)+num;
		}
		showTime(window.layerYear.value,parseInt(window.layerMonth.value),this.s)
		window.las.focus();
		}
	
		
function hilayer()
{
	if (inover==false)
	{	
		this.top=0;
		var lay=document.all.las;
		lay.style.display="none";
		 window.objs.style.display="none";
	}
}
function hilaye()
{
		this.top=0;
		var lay=document.all.las;
		lay.style.display="none";
		 window.objs.style.display="none";
}
function getlayerfocus()
{
	inover=true;
}
function lostlayerfocus()
{
	inover=false;
}

init();
//>
