
function  calendarClass(){
	this.path="../";  // 当前路径和SYSTEM目录的相对位置
	this.titleCss="";  //表格头的样式;
	this.tabCss="";    //表格的样式
	this.borderColor="#c0c0c0";  //表格线的默认颜色
	this.bodyCss="";      //表体的样式
	this.thisDayBgColor = "#efefef"; //当前日期格背景颜色.
	this.onMouseOverTxt="";   //鼠标移上去要执行的方法
	this.onClickTxt="";   //鼠标点击要执行的方法
	this.onMouseOutTxt="";   //鼠标移开要执行的方法
	this.obj=null;
	this.tdWidth="";
	
	var d=new Date();

	var year=d.getYear();
	var month=d.getMonth() + 1;
	var day=d.getDate() ;
	var mObj=null;
	var yObj=null;
	
	//设置年份
	this.setYears=function(v){
		if (isNaN(v)){return;}
		if (v>2040){v=2040;}
		if (v<1910){v=1910;}
		year=v;
	}
	
	//设置月份
	this.setMonths=function(v){
		if (isNaN(v)){return;}
		if (v>12){v=12;}
		if (v<1){v=1;}
		month=v;
	}
	
	//创建选择年的下拉菜单
	this.createYear=function(obj){
		for (var i=1900;i<2049;i++){
			var opt=document.createElement("option");
			opt.text=i;
			opt.value=i;
			if (i==year){
				opt.selected=true;	
			}
			obj.options.add(opt);	
		}
		yObj=obj;
		this.findDate();
		
	}
		
	//创建选择月的下拉菜单
	this.createMonth=function(obj){
		for (var i=1;i<13;i++){
			var opt=document.createElement("option");
			opt.text=i;
			opt.value=i;
			if (i==year){
				opt.month=true;	
			}
			obj.options.add(opt);	
		}
		mObj=obj;
		this.findDate();
	}
	
	//加减年份
	this.yearModi=function (v){
		if (isNaN(v)){return;}
		year=year+v;
		if (year>2040){year=2040;}
		if (year<1910){year=1910;}
		this.creare();
		this.findDate();
	}
	
	//加减月分
	this.monthModi=function(v){
		if (isNaN(v)){return;}
		month=month+v;
		if (month>12){
			month=1;
			year++;
		}
		if (month<1){
			month=12;
			year--;
		}
		this.creare();
		this.findDate();
	}
	
	//返回今天
	this.thisDay=function(){
		
		 year=d.getYear();
		 month=d.getMonth() + 1;
		this.creare();
		this.findDate();
	}
	
	this.findDate=function(){
		if (yObj==null || mObj==null)	{return;}
		selectoption(yObj,year);
		
		selectoption(mObj,month);
		
	}
	
	
	
	
	
	
	this.creare=function(){ //在指定的对象中建立日历
		var objAjax=new JAjax();   
			var objResponse=new JHttpResponse();
			objResponse.write("titleCss",this.titleCss);
			objResponse.write("tabCss",this.tabCss);
			objResponse.write("bodyCss",this.bodyCss);
			objResponse.write("borderColor",this.borderColor);
			objResponse.write("thisDayBgColor",this.thisDayBgColor);
			objResponse.write("onMouseOverTxt",this.onMouseOverTxt);
			objResponse.write("onClickTxt",this.onClickTxt);
			objResponse.write("onMouseOutTxt",this.onMouseOutTxt);
			objResponse.write("tdWidth",this.tdWidth);
			objResponse.write("year",year);
			objResponse.write("month",month);
			objResponse.write("day",day);
			//return;
			var out=objAjax.getText("post",this.path+"system/server/hiwebServer.aspx?type=readCalendar",objResponse,null);
				//		alert(out);

			this.obj.innerHTML=out;
			
	}
	
	
}

