	<!--
	/*
	check_date.js is a pre=requisite
	 */

	/************************* EDIT BELOW *************************/
	var sep_out = "-";
	var date_format = "ymd"; //m=month d=day y=year

	/************************* NOTHING TO EDIT BELOW *************************/

	var month_name_long = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
	var month_name_short = new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
	var day_name_long = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
	var day_name_short = new Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat');	 
	document.write('<style>');
	document.write('.td_cal_month {cursor:pointer;text-align:center;background-color:#EEEEEE;font-family:tahoma;font-size:8pt;color:#000;font-weight:bold;font-style:normal;text-decoration:none;padding: 2px 2px 2px 2px;} ');
	document.write('.td_cal_dow {cursor:pointer;text-align:center;width:20px;font-family:tahoma;font-size:8pt;background-color:#000;color:#fff;font-weight:none;font-style:normal;text-decoration:none;padding: 2px 2px 2px 2px;}	');
	document.write('.td_cal_day_real, .td_cal_day_real a {text-align:center;width:20px;cursor:pointer;font-family:tahoma;font-size:8pt;background-color:#F00;color:#FFF;font-weight:normal;font-style:normal;text-decoration:none;padding: 2px 2px 2px 2px;}');
	document.write('.td_cal_day, .td_cal_day a {text-align:center;width:20px;cursor:pointer;font-family:tahoma;font-size:8pt;color:#000;font-weight:normal;font-style:normal;text-decoration:none;padding: 2px 2px 2px 2px;}');
	document.write('.td_cal_sunday, .td_cal_sunday a {text-align:center;width:20px;cursor:pointer;font-family:tahoma;font-size:8pt;color:#F00;font-weight:normal;font-style:normal;text-decoration:none;padding: 2px 2px 2px 2px;}');
	document.write('</style>');
	/*
	static
	fixed
	absolute
	relative
	*/
	document.write('<div id=pop_cal style="position:absolute;display:none;z-index:100;filter: progid:DXImageTransform.Microsoft.Shadow(color=#bbbbbb,direction=135);" ></div>');

	var IE = document.all?true:false;
	if (!IE) document.captureEvents(Event.MOUSEMOVE);
	document.onmousemove = getMouseX;
	var tempX = 0;
	var tempY = 0;

	function copy() {
		var str = 'DHTML Date Selector v1.0\n';
		str += '(c) May 2007 Author: Leo David\n\n';
		str += 'Date Selection:\n';
		str += '\t- Click the arrows < > to switch month\n';
		str += '\t- Click the arrows << >> to switch year\n';
		str += '\t- Click the arrows <<< >>> to switch by 10 years \n';
		str += '\t- Click TODAY to switch to today\'s date \n';
		str += '\t- Click X to close calendar \n';
		str += '\n\n\n';
		alert(str);
	}

	function getMouseX(e) {
		if (IE) { // grab the x-y pos.s if browser is IE
			tempX = event.clientX + document.body.scrollLeft;
			tempY = event.clientY + document.body.scrollTop;
		}
		else {  // grab the x-y pos.s if browser is NS
			tempX = e.pageX;
			tempY = e.pageY;
		}  
		if (tempX < 0) tempX = 0;
		if (tempY < 0) tempY = 0;  
		//document.itemForm.x.value=tempX;
		//document.itemForm.y.value=tempY;

		return true;
	}

	function build_cal(m,y,f,e) {
			/*
			m = month
			y = year
			f = form field
			e = event
			*/

			if (e==1) {		
				document.getElementById('pop_cal').style.display='';
			}
			if (m==13) y =   y + 1;
			if (m==0) y =   y - 1;
			var real_petsa = new Date();
			var real_buwan = real_petsa.getMonth();
			var real_araw = real_petsa.getDate();
			var real_taon = real_petsa.getFullYear();

			var petsa = new Date();
			petsa.setMonth(m-1);
			petsa.setFullYear(y);
			
			var tmp_petsa = petsa;
			var buwan = petsa.getMonth();
			var taon = petsa.getFullYear();
			var prev_buwan = buwan - 1;
			var next_buwan = buwan + 1;
			if (buwan<0) {
				prev_buwan = 11;
			}
			if (buwan>11) {
				next_buwan = 0;
			}

			var araw = petsa.getDate();		
			tmp_petsa.setDate(1);
			var cal_string = "";

			cal_string += '<table border=1 cellpadding=0 cellspacing=0 bordercolor="#888888"> ';
			cal_string += '<tr> ';
			cal_string += '<td> ';

			cal_string += '<table border=0 cellpadding=0 cellspacing=2 bgcolor="#FFFFFF"> ';
			cal_string += '<tr> ';
			cal_string += '<td class=td_cal_month onclick="copy()">?</td> ';
			cal_string += '<td class=td_cal_month colspan=5>'+month_name_long[buwan]+" "+taon+'</td> ';
			cal_string += '<td class=td_cal_month onclick="close_cal()">X</td> ';
			cal_string += '</tr> ';
			cal_string += '<tr> ';
			cal_string += '<td class=td_cal_month onclick="build_cal('+(prev_buwan+2)+','+(taon-10)+',\''+f+'\',0)">&lt;&lt;&lt;</td> ';
			cal_string += '<td class=td_cal_month onclick="build_cal('+(prev_buwan+2)+','+(taon-1)+',\''+f+'\',0)">&lt;&lt;</td> ';
			cal_string += '<td class=td_cal_month onclick="build_cal('+(prev_buwan+1)+','+taon+',\''+f+'\',0)">&lt</td> ';
			cal_string += '<td class=td_cal_month onclick="build_cal('+(real_buwan+1)+','+real_taon+',\''+f+'\',0)">Now</td> ';
			cal_string += '<td class=td_cal_month onclick="build_cal('+(next_buwan+1)+','+taon+',\''+f+'\',0)">&gt;</td> ';
			cal_string += '<td class=td_cal_month onclick="build_cal('+next_buwan+','+(taon+1)+',\''+f+'\',0)">&gt;&gt;</td> ';
			cal_string += '<td class=td_cal_month onclick="build_cal('+next_buwan+','+(taon+10)+',\''+f+'\',0)">&gt;&gt;&gt;</td> ';
			cal_string += '</tr> ';
			cal_string += '<tr bgcolor="#EEEEEE"> ';
			for (i=0;i<day_name_short.length;i++) {
				cal_string += '<td class=td_cal_dow bgcolor="#cccccc">'+day_name_short[i]+'</td>';
			}
			cal_string += '</tr> ';
			cal_string += '<tr bgcolor="#EEEEEE" onmouseover="this.style.backgroundColor=\'#dedede\'"  onmouseout="this.style.backgroundColor=\'#EEEEEE\'"> ';
			var pre_fill = false;
			var ctr = 0;
			for (i=0;i<tmp_petsa.getDay();i++) {
				cal_string += '<td class=td_cal_day>&nbsp;</td>';
				pre_fill = true;
				ctr++;
			}

			for (i=1;i<32;i++) {
				
				if (check_date((buwan+1)+sep_out+i+sep_out+taon)) {
					if (ctr==0) css = "td_cal_sunday";
					else css = "td_cal_day";
					if ( (buwan==real_buwan) &&  (i==real_araw) &&  (taon==real_taon) ) css = "td_cal_day_real";
					
					cal_string += '<td class="'+css+'" ';
					cal_string += 'onclick="pass_date('+(buwan+1)+','+i+','+taon+', \''+f+'\') " ';
					cal_string += '>';
					cal_string += i;
					cal_string += '</td>';
					ctr++;
					if (ctr>6) {
						cal_string += '</tr> ';
						cal_string += '<tr bgcolor="#EEEEEE" onmouseover="this.style.backgroundColor=\'#dedede\'"  onmouseout="this.style.backgroundColor=\'#EEEEEE\'"> ';
						ctr = 0;
					}
				}
			}
			if (ctr!=0) {
				for (i=0;i<(7-ctr);i++) {
					cal_string += '<td class=td_cal_day>&nbsp;</td>';
				}
			}
			cal_string += '</tr> ';
			cal_string += '</table>';			
			
			cal_string += '</td >';
			cal_string += '</tr  > ';
			cal_string += '</table > ';

			if (e==1) {			
				//document.getElementById("pop_cal").style.left=(tempX+20)+"px";
				//document.getElementById("pop_cal").style.top=(tempY-90)+"px";
				//alert(tempX);
				//alert(tempY);
				document.getElementById("pop_cal").style.left=tempX+"px";
				document.getElementById("pop_cal").style.top=tempY+"px";
			}
			document.getElementById('pop_cal').innerHTML = cal_string;
	}

	function pass_date(m,d,y,form_field){
		var date_string ="";
		if (m<10) m ='0'+m;
		if (d<10) d ='0'+d;
		for (i=0;i<date_format.length;i++) {
			if (date_format.charAt(i)=='m')  date_string += m;
			if (date_format.charAt(i)=='d')  date_string += d;
			if (date_format.charAt(i)=='y')  date_string += y;			
			if (i!=(date_format.length-1)) date_string +=sep_out;			
		}
		eval(form_field).value = date_string;
		close_cal();
	}

	function close_cal() {
		document.getElementById('pop_cal').style.display='none';
	}

	/*************************** FUNCTIONS TO CHECK IF DATE IS VALID ***************************/
	function check_date(thisdate) {
	
		//alert(thisdate);
		var strDatestyle = "US"; //United States date style
		//var strDatestyle = "EU";  //European date style
		var strDate;
		var strDateArray;
		var strDay;
		var strMonth;
		var strYear;
		var intday;
		var intMonth;
		var intYear;
		var booFound = false;
		var strSeparatorArray = new Array("-"," ","/",".");
		var intElementNr;
		var err = 0;
		var strMonthArray = new Array(12);
		strMonthArray[0] = "Jan";
		strMonthArray[1] = "Feb";
		strMonthArray[2] = "Mar";
		strMonthArray[3] = "Apr";
		strMonthArray[4] = "May";
		strMonthArray[5] = "Jun";
		strMonthArray[6] = "Jul";
		strMonthArray[7] = "Aug";
		strMonthArray[8] = "Sep";
		strMonthArray[9] = "Oct";
		strMonthArray[10] = "Nov";
		strMonthArray[11] = "Dec";
		strDate = thisdate;

		if (strDate.length < 1) {
			return true;
		}
		for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) {
			if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) {
				strDateArray = strDate.split(strSeparatorArray[intElementNr]);
				if (strDateArray.length != 3) {
					err = 1;
					return false;
				}
				else {
					strDay = strDateArray[0];
					strMonth = strDateArray[1];
					strYear = strDateArray[2];
				}
				booFound = true;
			}
		}
		if (booFound == false) {
			if (strDate.length>5) {
				strDay = strDate.substr(0, 2);
				strMonth = strDate.substr(2, 2);
				strYear = strDate.substr(4);
			}
		}
		if (strYear.length == 2) {
			strYear = '20' + strYear;
		}
		// US style
		if (strDatestyle == "US") {
			strTemp = strDay;
			strDay = strMonth;
			strMonth = strTemp;
		}
		intday = parseInt(strDay, 10);
		if (isNaN(intday)) {
			err = 2;
			return false;
		}
		intMonth = parseInt(strMonth, 10);
		if (isNaN(intMonth)) {
			for (i = 0;i<12;i++) {
				if (strMonth.toUpperCase() == strMonthArray[i].toUpperCase()) {
					intMonth = i+1;
					strMonth = strMonthArray[i];
					i = 12;
				}
			}
			if (isNaN(intMonth)) {
				err = 3;
				return false;
		   }
		}
		intYear = parseInt(strYear, 10);
		if (isNaN(intYear)) {
			err = 4;
			return false;
		}

		//remark this the following 7 lines of script if you don't want 
		//to check if the input year is greater than or equal to todays year
		//var intTodayYear=new Date();
		//var intTodayYear=intTodayYear.getFullYear();
		//if (intYear>=intTodayYear) {
		//	err = 4;
		//	return false;
		//}

		if (intMonth>12 || intMonth<1) {
			err = 5;
			return false;
		}
		if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) {
			err = 6;
			return false;
		}
		if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) {
			err = 7;
			return false;
		}
		if (intMonth == 2) {
			if (intday < 1) {
				err = 8;
				return false;
			}
			if (LeapYear(intYear) == true) {
				if (intday > 29) {
					err = 9;
					return false;
				}
			}
			else {
				if (intday > 28) {
					err = 10;
					return false;
				}
			}
		}
		//if (strDatestyle == "US") {
		//	thiselement.value = strMonthArray[intMonth-1] + " " + intday+" " + strYear;
		//}
		//else {
		//	thiselement.value = intday + " " + strMonthArray[intMonth-1] + " " + strYear;
		//}
		return true;
	}

	function LeapYear(intYear) {
		if (intYear % 100 == 0) {
			if (intYear % 400 == 0) { return true; }
		}
		else {
			if ((intYear % 4) == 0) { return true; }
		}
		return false;
	}

	/*************************** FUNCTIONS TO CHECK IF DATE IS VALID ***************************/
	//-->