
//[Gatewei] (C)2008-2009 PengJingkang

function loadcalendar(id) {
var y,m,d;
var today = new Date();
var g_year = today.getYear(); 
g_year = g_year<1900?(1900+g_year):g_year; 
var g_month = today.getMonth()+1; 
var g_day = today.getDate(); 
yeararray = new Array(2012,2011,2010,2009,2008,2007,2006,2005);
montharray = new Array(1,2,3,4,5,6,7,8,9,10,11,12);
dayarray = new Array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31);
str = '';
str += '<select id="g_calendar_year' + id + '"  name="g_calendar_year' + id + '" style="float:left;margin-left:5px;">';
for(y  in yeararray)
{
	if(yeararray[y]==g_year){
	str += '<option value=" ' + yeararray[y] + '" selected>' + yeararray[y] +'</option>';
	}else{
	str += '<option value=" ' + yeararray[y] + '">' + yeararray[y] +'</option>';
	}
}
str += '</select><label style="float:left;margin:0 5px 0 5px">年</label>';
str += '<select id="g_calendar_month' + id + '"  name="g_calendar_month' + id + '" style="float:left">';
for(m in montharray)
{
	if(montharray[m]==g_month){
	str += '<option value=" ' + montharray[m] + '" selected>' + montharray[m] +'</option>';
	}else{
	str += '<option value=" ' + montharray[m] + '">' + montharray[m] +'</option>';
	}
}
str += '</select><label style="float:left;margin:0 5px 0 5px">月</label>';
str += '<select id="g_calendar_day' + id + '" name="g_calendar_day' + id + '" style="float:left">';
for(d in dayarray)
{
	if(dayarray[d]==g_day){
	str += '<option value=" ' + dayarray[d] + '" selected>' + dayarray[d] +'</option>';
	}else{
	str += '<option value=" ' + dayarray[d] + '">' + dayarray[d] +'</option>';
	}
}
	str += '</select><label style="float:left;margin:0 5px 0 5px">日</label>';
$('calendar' + id).innerHTML = str;
}



	function showcustomtime(){
		if($("iscustom").checked == true){
			$("custom_tbody").style.display="";
			$("calendar_subtime").focus();
		}else{
			$("custom_tbody").style.display="none";
		}	
	}

	function loadcustomtime(){
		if($("iscustom").checked == true){
			$("iscustom").onclick = function() {showcustomtime()};
			$("custom_tbody").style.display="";
			$("calendar_subtime").focus();
		}else{
			$("iscustom").onclick = function() {showcustomtime()};
			$("custom_tbody").style.display="none";
		}	
	
	}