/* --------------------DropListCss.js------------------------ */

var DropList_imgPath = "images/"


/*滚动条				*/		var SCROLL_BODY_COLOR = "#ffffff";
/*滚动条边框			*/		var SCROLL_BORDER_COLOR = "#AAAAAA";



document.write("<style>");

document.write(".DropList {");
document.write("border-top:1px solid #9C9A9C;");
document.write("border-left:1px solid #9C9A9C;");
document.write("border-bottom:1px solid #9C9A9C;");
document.write("border-right:0px;");
document.write("width:133px;");
document.write("height:20px;");
document.write("font-family:verdana;font-size:12px;");
document.write("padding-top:2px;");
document.write("}");

document.write(".DropListDiv {");
document.write("position:absolute;");
document.write("border-top:1px solid #9C9A9C;");
document.write("border-left:1px solid #9C9A9C;");
document.write("border-bottom:1px solid #9C9A9C;");
document.write("border-right:1px solid #9C9A9C;");
document.write("background-color: #ffffff;");
document.write("font-family:verdana;font-size:12px;");
document.write("overflow:auto;");
document.write("}");



document.write(".DropListData {");
document.write("padding-left:5px;");
document.write("height:18px;");
document.write("font-family:verdana;font-size:12px;");
document.write("}");


document.write(".DropListData_Over {");
document.write("padding-left:5px;");
document.write("height:18px;");
document.write("background-color:#EFF7FF;");
document.write("font-family:verdana;font-size:12px;");
document.write("cursor:default;");
document.write("}");


document.write(".DropListData_Selected {");
document.write("padding-left:5px;");
document.write("height:18px;");
document.write("background-color:#BDC3D6;");
document.write("font-family:verdana;font-size:12px;");
document.write("}");


document.write(".DropDateCell {");
document.write("text-align:center;");
document.write("vertical-align:center;");
document.write("font-size:9px;font-family:verdana;");
document.write("cursor:default;");
document.write("color:#333333;");
document.write("background-color:#eeeeee;");
document.write("border:1px solid #eeeeee;");
document.write("padding-top:1px;padding-bottom:1px;");
document.write("width:14%;height:16px;");
document.write("}");


document.write(".DropDateCell_over {");
document.write("text-align:center;");
document.write("font-size:9px;font-family:verdana;");
document.write("cursor:default;");
document.write("background-color:#ffffff !important;");
document.write("border:1px solid #eeeeee;");
document.write("padding-top:1px;padding-bottom:1px;");
document.write("width:14%;height:15px;");
document.write("}");


document.write(".DropDateCell_today {");
document.write("text-align:center;");
document.write("font-size:9px;font-family:verdana;");
document.write("cursor:default;");
document.write("background-color:#ffeeee !important;");
document.write("border:1px solid #ffffff;");
document.write("padding-top:1px;padding-bottom:1px;");
document.write("width:14%;height:15px;");
document.write("}");





document.write(".DropDateCellTitle {");
document.write("text-align:center;");
document.write("font-size:12px;font-family:verdana;");
document.write("cursor:default;");
document.write("background-color:#eeeeee;");
document.write("border:1px solid #eeeeee;");
document.write("padding-top:3px;padding-bottom:1px;");
document.write("width:14%;");
document.write("}");


document.write(".DropDateTitle {");
document.write("text-align:center;");
document.write("font-size:12px;font-family:verdana;");
document.write("cursor:default;");
document.write("background-color:#dddddd;");
document.write("padding-top:1px;padding-bottom:1px;");
document.write("width:14%;height:20px;");
document.write("}");

document.write("a.DropListTextLink:link,a.DropListTextLink:hover,a.DropListTextLink:visited {");
document.write("cursor:default;");
document.write("text-decoration:none !important;");
document.write("color:#999999;");
document.write("}");





document.write(".DropDateInput {");
document.write("border:1px solid #999999;");
document.write("height:14px;");
document.write("padding:0px;");
document.write("font-size:9px;font-family:verdana;");
document.write("color:#666666;");
document.write("}");



document.write("</style>");
/*------------------DropListModel.js----------------------*/

global_removers=[];		/*objects need to release , something like event*/
global_droplist={};		/*save all droplistdown object in this page*/
global_documentClick=false;
DropList = function(id){
	this.id=id;
	this.editable=false;
	this.datas=[];
	this.labels=[];
	this.rowCount=5;
	this.width=133;
	this.height=20;
	this.isopen=0;
	this.dropDate=false;
	this.dropTree=false;
	this.treeDiv='';
	this.serveryear=null;
	this.servermonth=null;
	this.serverday=null;
	this.serverweekday=null;
	this.dropDateFormat = "yyyy-mm-dd";
	this.method="dropListGetValue";
	this.dropDivName="__DropListDiv";

	
	this.addItem = function(data,label){
		this.datas.push(data);
		this.labels.push(label);
	}

	this.removeItem = function(index){
		this.datas.splice(index,1);
		this.labels.splce(index,1);
	}

	this.getItemAt = function(index){
		return {
			data:this.datas[index],
			label:this.labels[index]
		}
	}
	
	this.getItems = function(){
		return {
			datas:this.datas,
			labels:this.labels
		}
	}

	this.getDatas = function(){
		return this.getItems().datas;
	}

	this.getLabels = function(){
		return this.getItems().labels;
	}


	this.refresh = function(){
		var obj=document.getElementById(this.id);
		if (!obj){
			obj=document.getElementsByName(this.id)[0];
		}
		

		/*the input object does not exist*/
		if (obj==null){
			return;
		}

		obj.className = "DropList";
		obj.style.width=this.width+"px";
		obj.parentNode.style.whiteSpace="nowrap";


		var img=document.createElement("IMG");
		if (this.dropDate){
			img.src=DropList_imgPath+"dropBtnDate.gif";
		}else{
			img.src=DropList_imgPath+"dropBtn.gif";
		}
		img.style.cursor="default";
	
		if (img.attachEvent){
			img.attachEvent("onclick",imgClick); /*imgClick DropList button method,find it in droplistEvent.js*/
			if (!global_documentClick){document.attachEvent("onclick",closeAll);global_documentClick=true;}
		}else{
			img.addEventListener("click",imgClick,true);
			if (!global_documentClick){document.addEventListener("click",closeAll,true);global_documentClick=true;}
		}

		if (document.all){
			img.style.verticalAlign="-2";
		}else{
			img.style.verticalAlign="-5";
		}


		obj.parentNode.insertBefore(img,obj.nextSibling);
		
		if (!this.editable){
			obj.readOnly=true;
			obj.style.cursor="default";
		}



		/*if the drop list is a date drop , make the drop layer width more then 140 pixel*/
		if (this.dropdate && this.width<140){
			this.width=140;
		}

		/*if the droplist is editable , to catch the value user typed in*/
		if (this.editable){
			if (obj.attachEvent){
				obj.attachEvent("onkeyup",setKeyValue);
			}else{
				obj.addEventListener("keyup",setKeyValue,true);
			}
			global_removers.push(new Remover(obj,"keyup",setKeyValue));
		}
		function setKeyValue(){
			obj.setAttribute("data",obj.value);
		}



		/*save object who need release*/
		global_removers.push(new Remover(img,"click",imgClick));
		if (global_documentClick){global_removers.push(new Remover(document,"click",imgClick));};
		/*save droplistdown in pages,that event can find them*/
		global_droplist[this.id]=this;

	}

	this.open = function(){
		var dlv = new DropListView(this);
		delete dlv;
		
	}


	this.close = function(){
		document.getElementById(this.dropDivName).innerHTML="";
		document.getElementById(this.dropDivName).style.display="none";
	}

}

/*remove Object model*/
Remover = function(obj,ev,f){
	return{
		object:obj,
		event:ev,
		func:f
	}
}

/*------------------DropListView.js----------------------*/

DropListView = function(droplist){
	if (document.getElementById(droplist.dropDivName)==null){
		var div = document.createElement("DIV");
		div.setAttribute("id",droplist.dropDivName);
		div.style.top="-1200px";
		div.style.left="-1200px";
		div.style.zIndex="9999";
		document.body.appendChild(div);
	}else{
		var div=document.getElementById(droplist.dropDivName);
		div.style.display="block";
	}

	div.style.width=(droplist.width+17)+"px";
	if (droplist.dropDate && droplist.width<161){
		div.style.width="170px";
	}
	div.className="DropListDiv";
	/*IE bug , if previous droplist has scroll , the next droplist will have too. the code will show scroller in right way.*/
	div.style.overflow = "hidden";
	div.style.overflow = "auto";
	/*------------------------------------*/
	
	
	var tmpLen = Math.min(droplist.datas.length,droplist.rowCount);
	if (tmpLen == 0){
		tmpLen = 1;
	}
	div.style.height=((tmpLen*18)+2)+"px";
	if (droplist.dropDate){
		document.all?div.style.height="162px":div.style.height="174px";
	}
	if (droplist.dropTree){
		div.style.height=(droplist.height+20)+"px";
	}

	this.head = function(){
		if (droplist.dropDate){/*Normal drop list down object*/
			return "<Table cellpadding=\"0\" cellspacing=\"2\" border=0 width=\"100%\"><tr><td class=\"DropDateCellTitle\" style=\"background-color:#ccbbbb\">日</td><td class=\"DropDateCellTitle\">一</td><td class=\"DropDateCellTitle\">二</td><td class=\"DropDateCellTitle\">三</td><td class=\"DropDateCellTitle\">四</td><td class=\"DropDateCellTitle\">五</td><td class=\"DropDateCellTitle\" style=\"background-color:#bbccbb\">六</td></tr>";
		}else if (droplist.dropTree){
			return "<Table cellpadding=\"0\" cellspacing=\"0\" border=0 width=\"100%\">";
		}else{
			return "<Table cellpadding=\"0\" cellspacing=\"0\" border=0 width=\"100%\">";
		}
	}

	this.body = function(){
		var tmpCode="";
		if (droplist.dropDate){/*Normal drop list down object*/
			for (var i=0;i<5;i++){
				tmpCode += "<tr>";
				tmpCode += "<td class=\"DropDateCell\" onmouseover=\"this.className='DropDateCell_over'\" onmouseout=\"this.className='DropDateCell'\" style=\"background-color:#ccbbbb\" onclick=\"getDropListDate(this,'"+droplist.id+"')\"></td>";
				tmpCode += "<td class=\"DropDateCell\" onmouseover=\"this.className='DropDateCell_over'\"  onmouseout=\"this.className='DropDateCell'\" onclick=\"getDropListDate(this,'"+droplist.id+"')\"></td>";
				tmpCode += "<td class=\"DropDateCell\" onmouseover=\"this.className='DropDateCell_over'\"  onmouseout=\"this.className='DropDateCell'\" onclick=\"getDropListDate(this,'"+droplist.id+"')\"></td>";
				tmpCode += "<td class=\"DropDateCell\" onmouseover=\"this.className='DropDateCell_over'\"  onmouseout=\"this.className='DropDateCell'\" onclick=\"getDropListDate(this,'"+droplist.id+"')\"></td>";
				tmpCode += "<td class=\"DropDateCell\" onmouseover=\"this.className='DropDateCell_over'\"  onmouseout=\"this.className='DropDateCell'\" onclick=\"getDropListDate(this,'"+droplist.id+"')\"></td>";
				tmpCode += "<td class=\"DropDateCell\" onmouseover=\"this.className='DropDateCell_over'\"  onmouseout=\"this.className='DropDateCell'\" onclick=\"getDropListDate(this,'"+droplist.id+"')\"></td>";
				tmpCode += "<td class=\"DropDateCell\" onmouseover=\"this.className='DropDateCell_over'\" onmouseout=\"this.className='DropDateCell'\" style=\"background-color:#bbccbb\" onclick=\"getDropListDate(this,'"+droplist.id+"')\"></td>";
				tmpCode += "</tr>";
			}
				tmpCode += "<tr>";
				tmpCode += "<td class=\"DropDateCell\" onmouseover=\"this.className='DropDateCell_over'\" onmouseout=\"this.className='DropDateCell'\" style=\"background-color:#ccbbbb\" onclick=\"getDropListDate(this,'"+droplist.id+"')\"></td>";
				tmpCode += "<td class=\"DropDateCell\" onmouseover=\"this.className='DropDateCell_over'\" onmouseout=\"this.className='DropDateCell'\" onclick=\"getDropListDate(this,'"+droplist.id+"')\"></td>";
				tmpCode += "<td id=\"__adders\" class=\"DropDateCell\" colspan=\"5\">";
				
				
				/*previousYear*/
				tmpCode += "<a href=\"#\" class=\"DropListTextLink\" onclick=\"dropPrevYear(this.nextSibling,'"+droplist.id+"');return false;\">&#9664;</a>";
				/*YearInput*/
				tmpCode += "<input type=\"text\" class=\"DropDateInput\" maxlength=4 style=\"width:32px\" onblur=\"dropGoYear(this,'"+droplist.id+"')\" onkeyup=\"if(this.value.length==4 || event.keyCode==13){this.blur()}\" onmouseover=\"this.focus();\"/>";
				/*nextYear*/
				tmpCode += "<a href=\"#\" class=\"DropListTextLink\" onclick=\"dropNextYear(this.previousSibling,'"+droplist.id+"');return false;\">&#9654;</a><img src=\""+DropList_imgPath+"year.gif\" style=\"vertical-align:middle\"> ";
				

				/*previousMonth*/
				tmpCode += "<a href=\"#\" class=\"DropListTextLink\" onclick=\"dropPrevMonth(this.previousSibling.previousSibling.previousSibling.previousSibling,'"+droplist.id+"');return false;\">&#9664;</a>";
				/*MonthInput*/
				tmpCode += "<input type=\"text\" class=\"DropDateInput\" maxlength=2 style=\"width:16px\" onblur=\"dropGoMonth(this.previousSibling.previousSibling.previousSibling.previousSibling.previousSibling,'"+droplist.id+"')\" onkeyup=\"if(this.value.length==2 || event.keyCode==13){this.blur()}\" onmouseover=\"this.focus();this.select() \"/>";
				/*nextMonth*/
				tmpCode += "<a href=\"#\" class=\"DropListTextLink\" onclick=\"dropNextMonth(this.previousSibling.previousSibling.previousSibling.previousSibling.previousSibling.previousSibling,'"+droplist.id+"');return false;\">&#9654;</a><img src=\""+DropList_imgPath+"month.gif\" style=\"vertical-align:middle\">";

				
				tmpCode += "</td>";
				tmpCode += "</tr>";
				tmpCode += "<tr>";
				tmpCode += "<td id=\"__adders\" class=\"DropDateTitle\" colspan=\"7\"></td>";
				tmpCode += "</tr>";

		}else if (droplist.dropTree){
			var TreeOfCod;
			if (document.getElementById(droplist.treeDiv+'Data').value!=""){
				TreeOfCod=document.getElementById(droplist.treeDiv+'Data').value;
			}else{
				TreeOfCod=document.getElementById(droplist.treeDiv).innerHTML;
				document.getElementById(droplist.treeDiv+'Data').value = TreeOfCod;
			}
			tmpCode += "<tr><td>"+TreeOfCod+"</td></tr>";
			document.getElementById(droplist.treeDiv).innerHTML = "";
		}else{
			for (var i=0;i<droplist.datas.length;i++){
				tmpCode+="<tr><td class=\"DropListData\" onmouseover=\"this.className='DropListData_Over'\"  onmouseout=\"this.className='DropListData'\" index=\""+i+"\" onclick=\""+droplist.method+"('"+droplist.id+"',"+i+")\">"+droplist.labels[i]+"</td></tr>";
			}
			if (tmpCode==""){
				tmpCode="<tr><td class=\"DropListData\" onmouseover=\"this.className='DropListData_Over'\"  onmouseout=\"this.className='DropListData'\" align=\"center\">--------</td></tr>"
			}
		}
		return tmpCode;

	}
	
	this.foot = function(){ return "</table>"; }


	div.innerHTML = this.head()+this.body()+this.foot();

	if (droplist.dropDate){
		dropDateFill(droplist,droplist.serveryear,droplist.servermonth,droplist.serverday,droplist.serverweekday);
	}
}



/*------------------DropListEvent.js----------------------*/

window.onunload = function(){
	for (var i=0;i<global_removers.length;i++){
		if (document.detachEvent){
			global_removers[i].object.detachEvent("on"+global_removers[i].event,global_removers[i].func);
		}else{
			global_removers[i].object.removeEventListener(global_removers[i].event,global_removers[i].func,true);
		}
	}
	delete global_removers;
}


dropListUnload = function(imgObj){
	if (document.detachEvent){
		imgObj.detachEvent("onclick",imgClick);
	}else{
		imgObj.removeEventListener("click",imgClick,true);
	}
}


imgClick = function(e){
	if (!e) e = window.event;
	if (e.stopPropagation){
		e.stopPropagation();
	}else{
		e.cancelBubble = true;
	}

	var obj;
	if (e.srcElement){
		obj=e.srcElement;
	}else{
		obj=e.target;
	}




	var droplist;
	if(global_droplist[obj.previousSibling.getAttribute("id")]){
		droplist=global_droplist[obj.previousSibling.getAttribute("id")];
	}else{
		droplist=global_droplist[obj.previousSibling.getAttribute("name")];
	};
	

	if (droplist.isopen==0){
		droplist.open();
		droplist.isopen=1;
	}else{
		droplist.close();
		droplist.isopen=0;
	}

	/*when a drop list clicked , make others closed*/
	closeAll(e);

	
	/*move div to the object position*/
	var tmpobj = obj;
	var xl=0;	/*scrollLeft*/
	var xt=0;	/*scrollTop*/
	do{
		if (!isNaN(tmpobj.scrollTop)){
			xt+=tmpobj.scrollTop;
			xl+=tmpobj.scrollLeft;
		}
		tmpobj=tmpobj.parentNode;
		if (tmpobj.tagName=="DIV"){
			if (tmpobj.addEventListener){
				tmpobj.addEventListener("scroll",scrollDiv,true);
			}else{
				tmpobj.attachEvent("onscroll",scrollDiv);
			}
			global_removers.push(new Remover(tmpobj,"scroll",scrollDiv))
		}
	}
	while (tmpobj.tagName!="BODY");


	function scrollDiv(){
		rePositionDiv(obj,droplist);
	}






	var input = obj.previousSibling;
	var l=0;
	var t=0;
	t=input.offsetTop;
	l=input.offsetLeft;
	while(input=input.offsetParent){
		t+=input.offsetTop;
		l+=input.offsetLeft;
	}
	if (document.all){
		document.getElementById(droplist.dropDivName).style.top=(t+21-xt)+"px";
		document.getElementById(droplist.dropDivName).style.left=(l-xl)+"px";
	}else{
		document.getElementById(droplist.dropDivName).style.top=(t+22-xt)+"px";
		document.getElementById(droplist.dropDivName).style.left=(l-xl)+"px";
	}


}

/*select object in a div , when it scrolls , move the droplist to a right position*/
rePositionDiv = function(obj,droplist){
	var tmpobj = obj;
	var xl=0;	/*scrollLeft*/
	var xt=0;	/*scrollTop*/
	do{
		if (!isNaN(tmpobj.scrollTop)){
			xt+=tmpobj.scrollTop;
			xl+=tmpobj.scrollLeft;
		}
		tmpobj=tmpobj.parentNode;
	}
	while (tmpobj.tagName!="BODY");

	var input = obj.previousSibling;
	var l=0;
	var t=0;
	t=input.offsetTop;
	l=input.offsetLeft;
	while(input=input.offsetParent){
		t+=input.offsetTop;
		l+=input.offsetLeft;
	}
	document.getElementById(droplist.dropDivName).style.top=(t+22-xt)+"px";
	document.getElementById(droplist.dropDivName).style.left=(l-xl)+"px";

}


closeAll = function(e){
	if (!e) e = window.event;
	var obj;
	if (e.srcElement){
		obj=e.srcElement;
	}else{
		obj=e.target;
	}
	

	if (obj.tagName=="A" || obj.tagName=="INPUT"){
		obj=obj.parentNode;
		if (obj.getAttribute("id")=="__adders"){
			return;
		}
	}
	if (obj.tagName=="TD"){
		if (obj.getAttribute("id")=="__adders"){
			return;
		}
	}


	var divName=null;
	var droplist=null;
	for (var n in global_droplist){
		if (global_droplist[n].isopen==1){
			droplist=global_droplist[n];
		}
		divName = global_droplist[n].dropDivName;
	}

	if (droplist!=null && obj.tagName!="IMG"){
		global_droplist[droplist.id].isopen=0;
		document.getElementById(divName).innerHTML="";
		document.getElementById(divName).style.display="none";
	}

}



dropListGetValue = function(droplistid,index){
	var droplist=global_droplist[droplistid];
	var item=droplist.getItemAt(index);
	var input=document.getElementById(droplist.id);
	if (input==null){
		input=document.getElementsByName(droplist.id)[0];
	}
	input.value=item.label;
	input.setAttribute("data",item.data)
	if(input.getAttribute("onchange")){
		if(document.all)
		input.getAttribute("onchange")();
		else
		eval(input.getAttribute("onchange")+"()");
	};
}


dropDateFill = function(droplist,y,m,d,w){
	var today=new Date();
	if (!y){
		y=today.getFullYear();
		m=today.getMonth()+1;
		d=today.getDate();
		w=today.getDay();
	}
	var table = document.getElementById(droplist.dropDivName).getElementsByTagName("TABLE")[0];
	var tds = table.getElementsByTagName("TD");
	var yearInput = document.getElementById(droplist.dropDivName).getElementsByTagName("INPUT")[0];
	var monthInput = document.getElementById(droplist.dropDivName).getElementsByTagName("INPUT")[1];

	yearInput.value = y;
	monthInput.value = m;

	
	var wMonthFirstDay = new Date(y+"/"+m+"/1").getDay();
	var monthDays = getThisMonthDays(y,m);
	var pmonth = m-1;
	var pyear = y;
	if (pmonth==0){
		pmonth=12;
		pyear--;
	}
	var pmonthDays = getThisMonthDays(pyear,pmonth);

	yearInput.setAttribute("y",y);
	yearInput.setAttribute("m",m);
	yearInput.setAttribute("d",1);
	yearInput.setAttribute("w",wMonthFirstDay);


	for (var i=7;i<tds.length-2;i++){
		if (i>6+wMonthFirstDay && i<6+wMonthFirstDay+monthDays+1){
			tds[i].innerHTML=i-(6+wMonthFirstDay);
			tds[i].setAttribute("d",i-(6+wMonthFirstDay));
			tds[i].setAttribute("m",m);
			tds[i].setAttribute("y",y);
			tds[i].style.color="";
		}else{
			if (i<=6+wMonthFirstDay){
				var mx=m-1;
				var my=y;
				if (mx<1){mx=12;my-=1;};
				tds[i].innerHTML=i-(6+wMonthFirstDay)+pmonthDays;
				tds[i].setAttribute("d",i-(6+wMonthFirstDay)+pmonthDays);
				tds[i].setAttribute("m",mx);
				tds[i].setAttribute("y",my);
			}else{
				var mx=m+1;
				var my=y;
				if (mx>12){mx=1;my+=1;};
				tds[i].innerHTML=i-(6+wMonthFirstDay)-monthDays;
				tds[i].setAttribute("d",i-(6+wMonthFirstDay)-monthDays);
				tds[i].setAttribute("m",mx);
				tds[i].setAttribute("y",my);
			}
			tds[i].style.color="#cccccc";
		}
	}
	
	tds[tds.length-1].innerHTML = y+" 年 "+m+" 月 "+d+" 日";

}


/*how many days in the argue year and month it returns*/
getThisMonthDays=function(ye,mo){
	var yflag = false;
	var days = 0;
	if (ye%100 == 0) {
		ye /= 100;
	}
	if (ye%4 == 0) {
		yflag = true;
	}

	if ((mo == 1) || (mo == 3) || (mo == 5) || (mo == 7) || (mo == 8) || (mo == 10) || (mo == 12)) {
		days = 31;
	} else if (mo != 2) {
		days = 30;
	} else if (yflag) {
		days = 29;
	} else {
		days = 28;
	}

	return days;
}


dropNextMonth = function(obj,droplistid){
	/*obj,the year Input,which save date input object*/
	y=obj.getAttribute("y");
	m=obj.getAttribute("m");
	d=obj.getAttribute("d");

	var newy=y;
	var newm=m;
	var newd=d;
	var neww=w;
	
	newm++;
	if (newm>12){
		newm=1;
		newy++;
	}

	var w = new Date(newy+"/"+newm+"/"+d).getDay();
	dropDateFill(global_droplist[droplistid],newy,newm,d,w);

}



dropNextYear = function(obj,droplistid){
	/*obj,the year Input,which save date input object*/
	y=obj.getAttribute("y");
	m=obj.getAttribute("m");
	d=obj.getAttribute("d");

	var newy=y;
	var newm=m;
	var newd=d;
	var neww=w;
	
	newy++;

	var w = new Date(newy+"/"+newm+"/"+d).getDay();
	dropDateFill(global_droplist[droplistid],newy,newm,d,w);

}

dropPrevYear = function(obj,droplistid){
	/*obj,the year Input,which save date input object*/
	y=obj.getAttribute("y");
	m=obj.getAttribute("m");
	d=obj.getAttribute("d");

	var newy=y;
	var newm=m;
	var newd=d;
	var neww=w;
	
	newy--;

	var w = new Date(newy+"/"+newm+"/"+d).getDay();
	dropDateFill(global_droplist[droplistid],newy,newm,d,w);

}





dropPrevMonth  = function(obj,droplistid){

	/*obj,the year Input,which save date input object*/
	y=obj.getAttribute("y");
	m=obj.getAttribute("m");
	d=obj.getAttribute("d");

	var newy=y;
	var newm=m;
	var newd=d;
	var neww=w;
	
	newm--;
	if (newm<1){
		newm=12;
		newy--;
	}


	var w = new Date(newy+"/"+newm+"/"+d).getDay();
	dropDateFill(global_droplist[droplistid],newy,newm,d,w);

}



dropGoMonth = function(obj,droplistid){

	var objs=obj.nextSibling.nextSibling.nextSibling.nextSibling.nextSibling;
	var y=obj.getAttribute("y");
	var m=obj.getAttribute("m");
	var d=obj.getAttribute("d");

	if (isNaN(objs.value)){
		objs.value=m;
		return;
	}
	if (parseInt(objs.value)>12 || parseInt(objs.value)<1){
		objs.value=m;
		return;
	}

	var newm=parseInt(objs.value);

	var w = new Date(y+"/"+newm+"/"+d).getDay();
	dropDateFill(global_droplist[droplistid],y,newm,d,w);

}


dropGoYear = function(obj,droplistid){

	var y=obj.getAttribute("y");
	var m=obj.getAttribute("m");
	var d=obj.getAttribute("d");

	if (isNaN(obj.value)){
		obj.value=y;
		return;
	}

	if (parseInt(obj.value)>2100 || parseInt(obj.value)<1900){
		obj.value=y;
		return;
	}

	var newy=parseInt(obj.value);

	var w = new Date(newy+"/"+m+"/"+d).getDay();
	dropDateFill(global_droplist[droplistid],newy,m,d,w);

}


getDropListDate = function(tdobj,droplistid){
	var y=tdobj.getAttribute("y");
	var m=tdobj.getAttribute("m");
	var d=tdobj.getAttribute("d");
	var droplist=global_droplist[droplistid];
	var input = document.getElementById(droplistid);
	if (!input){
		input = document.getElementsByName(droplistid)[0];
	}
	var df=droplist.dropDateFormat;
	df = df.replace("yyyy",y);
	df = df.replace("yy",y.toString().substring(y.toString().length-2,y.toString().length));
	df = df.replace("mm",m);
	df = df.replace("dd",d);
	input.value=df;
}
