		var directory = "";
		var today = new Date();
		var monthLength = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
		var hiddenArray = new Array(35);

		var currentyear = today.getYear();
		var currentmonth = today.getMonth();
		var currenttime = today.getHours() + ":" + today.getMinutes( ) + ":" + today.getSeconds();
		if (currentyear < 1000) {currentyear += 1900;}
		var dp_dir = "AK_DatePicker/";
		var newWin_doc = null;
		var newWin = null;
		var txtboxObj = null;

		function formatdate(dd,mm,yy){
		
			if ( dd < 10 )
			{
				dd = "0" + dd;
			}
			
			if ( mm < 10 )
			{
				mm = "0" + mm;
			}
			
			var strf = newWin_doc.getElementById('dateformat').value;
			var chr = '/';
			var dstr = "";
			if (strf.charAt(3)== '1') {chr = '-';}
			else if (strf.charAt(3)== '3') {chr = '.';}

			for (var a=0; a<3; a++){
				if (strf.charAt(a)== 'd') {dstr += dd;}
				else if (strf.charAt(a)== 'm') {dstr += mm;}
				else if (strf.charAt(a)== 'y') {dstr += yy;}

				if (a < 2) {dstr += chr;}
			}
			/*
			if (newWin_doc.getElementById('including').checked) {
				dstr += " " + newWin_doc.getElementById('time').value;
			}
			*/
			return dstr;
		}

		function returndate(indx){
	   		if(hiddenArray[indx] > 0) {
				if (txtboxObj) {
					document.getElementById(txtboxObj).value = formatdate(hiddenArray[indx],newWin_doc.getElementById('months').options.selectedIndex+1,parseInt(newWin_doc.getElementById('years').value));
				}
				newWin.close();
			}

		}
		function updateoutput() {
			var ml = newWin_doc.getElementById('months').options.selectedIndex;
			var sday = new Date(parseInt(newWin_doc.getElementById('years').value),ml,01)
			var startindex = sday.getDay();
			var numberOfDays = monthLength[ml];
			var str = "";
			startindex = startindex+1;
			/*
			document.write(startindex);
			if (startindex==0) {startindex = 1;}
			if (startindex==1) {startindex = 2;}
			if (startindex==2) {startindex = 3;}
			if (startindex==3) {startindex = 4;}
			if (startindex==4) {startindex = 5;}
			if (startindex==5) {startindex = 6;}
			if (startindex==6) {startindex = 7;}
			*/

			if (ml==1 && (parseInt(newWin_doc.getElementById('years').value)%4) == 0){numberOfDays = 29;}

			for (var n=0; n<35; n++) {
				str = "c"+n;
				newWin_doc.getElementById(str).src =dp_dir + "0.gif";
				hiddenArray[n] = 0;
			}

			for (var m=0; m<numberOfDays; m++)
			{
				str = "c"+((startindex+m-1)%35);
				newWin_doc.getElementById(str).src =dp_dir + (m+1) + ".gif";
				hiddenArray[((startindex+m-1)%35)] = (m+1);
			}
		}

		function updateyears()
		{
			var tempyear = newWin_doc.getElementById('years').value;
			var styear = tempyear - 10;
			var i;
			for (i= 1930; i <= currentyear + 10; i++) {
				var s = "yopt"+i;
				newWin_doc.getElementById(s).text = (i);
				newWin_doc.getElementById(s).value = (i);
			}
			for (i = 0; i < newWin_doc.getElementById('years').options.length; i++ )
			{
				if (newWin_doc.getElementById('years').options[i].value == ""+tempyear)
				{
			  		newWin_doc.getElementById('years').options.selectedIndex = i;
					break;
				}
			}
		}


function show_calendar(textfieldname, dir,type) {
	var i = 0;
	if (dir) {dp_dir = dir;}
	newWin = window.open("", "Calendar", "width=218,height=208,status=no,resizable=no,location=no, scrollbars=no,top=200,left=300");
	newWin.opener = self;
	newWin_doc = newWin.document;
	txtboxObj = textfieldname;


	newWin_doc.writeln('<html><head><title>Date Picker</title></head>');
	newWin_doc.writeln('<body  style="margin: 2px;" scroll=no  onBlur="self.focus()" bgcolor="#FF8000">');
	newWin_doc.writeln('<div align=\"center\"><table bgcolor="#FF8000" width="200" cellpadding="0" cellspacing="0"><tr><td align="center" height="35">');
	newWin_doc.writeln('<select id="months" onchange="window.opener.updateoutput();">');
		newWin_doc.writeln('<option value="1">Jan</option>');
		newWin_doc.writeln('<option value="2">Feb</option>');
		newWin_doc.writeln('<option value="3">Mar</option>');
		newWin_doc.writeln('<option value="4">Apr</option>');
		newWin_doc.writeln('<option value="5">May</option>');
		newWin_doc.writeln('<option value="6">Jun</option>');
		newWin_doc.writeln('<option value="7">Jul</option>');
		newWin_doc.writeln('<option value="8">Aug</option>');
		newWin_doc.writeln('<option value="9">Sep</option>');
		newWin_doc.writeln('<option value="10">Oct</option>');
		newWin_doc.writeln('<option value="11">Nov</option>');
		newWin_doc.writeln('<option value="12">Dec</option>');
	newWin_doc.writeln('</select>&nbsp;');

	newWin_doc.getElementById('months').options.selectedIndex = parseInt(currentmonth);

	newWin_doc.writeln('<select id="years" onchange="window.opener.updateoutput();window.opener.updateyears();">');
			//var styear = currentyear - 10;
			var styear = currentyear - 10;
			for (i=1930; i <= currentyear+ 10; i++) {
				newWin_doc.write("<option id=\"yopt"+ i +"\" value=\""+ (i) +"\">" + (i) +"</option>\n");
			}
	newWin_doc.writeln('</select>&nbsp;');

	for (i = 0; i < newWin_doc.getElementById('years').options.length; i++ )
	{
		if (newWin_doc.getElementById('years').options[i].value == ""+currentyear)
		{
	  		newWin_doc.getElementById('years').options.selectedIndex = i;
			break;
		}
	}
	newWin_doc.writeln('<select id="dateformat" class="choice">');
	if(type == 'y-m-d')
		newWin_doc.writeln('<option value="ymd1">y-m-d</option>');
	else if(type == 'm/d/y')
		newWin_doc.writeln('<option value="mdy2">m/d/y</option>');
	else if(type == 'm.d.y')
		newWin_doc.writeln('<option value="mdy3">m.d.y</option>');
	else if(type == 'd-m-y')
		newWin_doc.writeln('<option value="dmy1">d-m-y</option>');
	else if(type == 'd/m/y')
		newWin_doc.writeln('<option value="dmy2">d/m/y</option>');
	else if(type == 'd.m.y')
		newWin_doc.writeln('<option value="dmy3">d.m.y</option>');
	else if(type == 'y/m/d')
		newWin_doc.writeln('<option value="ymd2">y/m/d</option>');
	else if(type == 'y.m.d')
		newWin_doc.writeln('<option value="ymd3">y.m.d</option>');
	else
		newWin_doc.writeln('<option value="mdy1">m-d-y</option>');
	newWin_doc.writeln('</select>');
	newWin_doc.writeln('</td></tr>');
	newWin_doc.writeln('<tr><td>');

		newWin_doc.writeln('<TABLE width="100%" cellpadding="1px" cellspacing="1px">');
		newWin_doc.writeln('<TBODY>');
		newWin_doc.writeln('<TR>');
		newWin_doc.writeln('<TD align="center" width="25" bgcolor="#eeeeee"><img src="'+ dp_dir + 'd_sun.gif" width="25" height="20" alt="" border="0"></TD>');
		newWin_doc.writeln('<TD align="center" width="25" bgcolor="#eeeeee"><img src="'+ dp_dir + 'd_mon.gif" width="25" height="20" alt="" border="0"></TD>');
		newWin_doc.writeln('<TD align="center" width="25" bgcolor="#eeeeee"><img src="'+ dp_dir + 'd_tue.gif" width="25" height="20" alt="" border="0"></TD>');
		newWin_doc.writeln('<TD align="center" width="25" bgcolor="#eeeeee"><img src="'+ dp_dir + 'd_wed.gif" width="25" height="20" alt="" border="0"></TD>');
		newWin_doc.writeln('<TD align="center" width="25" bgcolor="#eeeeee"><img src="'+ dp_dir + 'd_thu.gif" width="25" height="20" alt="" border="0"></TD>');
		newWin_doc.writeln('<TD align="center" width="25" bgcolor="#eeeeee"><img src="'+ dp_dir + 'd_fri.gif" width="25" height="20" alt="" border="0"></TD>');
		newWin_doc.writeln('<TD align="center" width="25" bgcolor="#eeeeee"><img src="'+ dp_dir + 'd_sat.gif" width="25" height="20" alt="" border="0"></TD>');
		newWin_doc.writeln('</TR>');
			newWin_doc.writeln("<tr>");
			for (var j=1;j<=35;j++){
				if (j==1 || j==7 || j==8 || j==14 || j==15 || j==21 || j==22 || j==28 || j==29 || j==35) {   //for highlighting
					newWin_doc.writeln("<td align=\"center\" valign=\"middle\" width=\"25px\" bgcolor='#eeeeee' onmouseover=\"this.bgColor='#b79eeb';\" onmouseout=\"this.bgColor='#eeeeee'\"><a href=\"#\"><img id=\"c"+(j-1)+"\" src=\""+ dp_dir + "0.gif\" onclick=\"window.opener.returndate("+(j-1)+");return false;\" border=\"0\"></a></td>");
				} else {
					newWin_doc.writeln("<td align=\"center\" valign=\"middle\" width=\"25px\" bgcolor='#ffffff' onmouseover=\"this.bgColor='#b79eeb';\" onmouseout=\"this.bgColor='#ffffff'\"><a href=\"#\"><img id=\"c"+(j-1)+"\" src=\""+ dp_dir + "0.gif\" onclick=\"window.opener.returndate("+(j-1)+");return false;\" border=\"0\"></a></td>");
				}
				if ((j % 7) == 0) {newWin_doc.writeln("</tr>");}
			}
			newWin_doc.writeln("</tr>");

			//newWin_doc.writeln("<tr>");
			//newWin_doc.writeln("<td colspan=\"7\" align=\"center\" valign=\"top\"><font face=\"Arial\" size=\"-1\" color=\"#ffffff\"><strong>Time:</strong> <input type=\"Text\" id=\"time\" value=\""+ currenttime +"\" size=\"6\">");
			//newWin_doc.writeln("</font></td>");
			//newWin_doc.writeln("</tr>");
		newWin_doc.writeln('</TBODY></TABLE>');

	newWin_doc.writeln('</td></tr></table></div>');

	updateoutput();
	newWin_doc.writeln('</body></html>');	
	newWin.document.close();

	/*if(navigator.appName != "Microsoft Internet Explorer")
  	{
		newWin.close();
  	}
	*/
}

function artist_show_calendar(textfieldname, dir,type) {
	var i = 0;
	if (dir) {dp_dir = dir;}
	newWin = window.open("", "Calendar", "width=218,height=208,status=no,resizable=no, scrollbars=no,top=200,location=no,left=300");
	newWin.opener = self;
	newWin_doc = newWin.document;
	txtboxObj = textfieldname;


	newWin_doc.writeln('<html><head><title>Date Picker</title></head>');
	newWin_doc.writeln('<body  style="margin: 2px;" scroll=no  onBlur="self.focus()" bgcolor="#CCCCCC">');
	newWin_doc.writeln('<div align=\"center\"><table bgcolor="#CCCCCC" width="200" cellpadding="0" cellspacing="0"><tr><td align="center" height="35">');
	newWin_doc.writeln('<select id="months" onchange="window.opener.updateoutput();">');
		newWin_doc.writeln('<option value="1">Jan</option>');
		newWin_doc.writeln('<option value="2">Feb</option>');
		newWin_doc.writeln('<option value="3">Mar</option>');
		newWin_doc.writeln('<option value="4">Apr</option>');
		newWin_doc.writeln('<option value="5">May</option>');
		newWin_doc.writeln('<option value="6">Jun</option>');
		newWin_doc.writeln('<option value="7">Jul</option>');
		newWin_doc.writeln('<option value="8">Aug</option>');
		newWin_doc.writeln('<option value="9">Sep</option>');
		newWin_doc.writeln('<option value="10">Oct</option>');
		newWin_doc.writeln('<option value="11">Nov</option>');
		newWin_doc.writeln('<option value="12">Dec</option>');
	newWin_doc.writeln('</select>&nbsp;');

	newWin_doc.getElementById('months').options.selectedIndex = parseInt(currentmonth);

	newWin_doc.writeln('<select id="years" onchange="window.opener.updateoutput();window.opener.updateyears();">');
			//var styear = currentyear - 10;
			var styear = currentyear - 10;
			for (i=1930; i <= currentyear+ 10; i++) {
				newWin_doc.write("<option id=\"yopt"+ i +"\" value=\""+ (i) +"\">" + (i) +"</option>\n");
			}
	newWin_doc.writeln('</select>&nbsp;');

	for (i = 0; i < newWin_doc.getElementById('years').options.length; i++ )
	{
		if (newWin_doc.getElementById('years').options[i].value == ""+currentyear)
		{
	  		newWin_doc.getElementById('years').options.selectedIndex = i;
			break;
		}
	}
	newWin_doc.writeln('<select id="dateformat" class="choice">');
	if(type == 'y-m-d')
		newWin_doc.writeln('<option value="ymd1">y-m-d</option>');
	else if(type == 'm/d/y')
		newWin_doc.writeln('<option value="mdy2">m/d/y</option>');
	else if(type == 'm.d.y')
		newWin_doc.writeln('<option value="mdy3">m.d.y</option>');
	else if(type == 'd-m-y')
		newWin_doc.writeln('<option value="dmy1">d-m-y</option>');
	else if(type == 'd/m/y')
		newWin_doc.writeln('<option value="dmy2">d/m/y</option>');
	else if(type == 'd.m.y')
		newWin_doc.writeln('<option value="dmy3">d.m.y</option>');
	else if(type == 'y/m/d')
		newWin_doc.writeln('<option value="ymd2">y/m/d</option>');
	else if(type == 'y.m.d')
		newWin_doc.writeln('<option value="ymd3">y.m.d</option>');
	else
		newWin_doc.writeln('<option value="mdy1">m-d-y</option>');
	newWin_doc.writeln('</select>');
	newWin_doc.writeln('</td></tr>');
	newWin_doc.writeln('<tr><td>');

		newWin_doc.writeln('<TABLE width="100%" cellpadding="1px" cellspacing="1px">');
		newWin_doc.writeln('<TBODY>');
		newWin_doc.writeln('<TR>');
		newWin_doc.writeln('<TD align="center" width="25" bgcolor="#eeeeee"><img src="'+ dp_dir + 'd_sun.gif" width="25" height="20" alt="" border="0"></TD>');
		newWin_doc.writeln('<TD align="center" width="25" bgcolor="#eeeeee"><img src="'+ dp_dir + 'd_mon.gif" width="25" height="20" alt="" border="0"></TD>');
		newWin_doc.writeln('<TD align="center" width="25" bgcolor="#eeeeee"><img src="'+ dp_dir + 'd_tue.gif" width="25" height="20" alt="" border="0"></TD>');
		newWin_doc.writeln('<TD align="center" width="25" bgcolor="#eeeeee"><img src="'+ dp_dir + 'd_wed.gif" width="25" height="20" alt="" border="0"></TD>');
		newWin_doc.writeln('<TD align="center" width="25" bgcolor="#eeeeee"><img src="'+ dp_dir + 'd_thu.gif" width="25" height="20" alt="" border="0"></TD>');
		newWin_doc.writeln('<TD align="center" width="25" bgcolor="#eeeeee"><img src="'+ dp_dir + 'd_fri.gif" width="25" height="20" alt="" border="0"></TD>');
		newWin_doc.writeln('<TD align="center" width="25" bgcolor="#eeeeee"><img src="'+ dp_dir + 'd_sat.gif" width="25" height="20" alt="" border="0"></TD>');
		newWin_doc.writeln('</TR>');
			newWin_doc.writeln("<tr>");
			for (var j=1;j<=35;j++){
				if (j==1 || j==7 || j==8 || j==14 || j==15 || j==21 || j==22 || j==28 || j==29 || j==35) {   //for highlighting
					newWin_doc.writeln("<td align=\"center\" valign=\"middle\" width=\"25px\" bgcolor='#eeeeee' onmouseover=\"this.bgColor='#b79eeb';\" onmouseout=\"this.bgColor='#eeeeee'\"><a href=\"#\"><img id=\"c"+(j-1)+"\" src=\""+ dp_dir + "0.gif\" onclick=\"window.opener.returndate("+(j-1)+");return false;\" border=\"0\"></a></td>");
				} else {
					newWin_doc.writeln("<td align=\"center\" valign=\"middle\" width=\"25px\" bgcolor='#ffffff' onmouseover=\"this.bgColor='#b79eeb';\" onmouseout=\"this.bgColor='#ffffff'\"><a href=\"#\"><img id=\"c"+(j-1)+"\" src=\""+ dp_dir + "0.gif\" onclick=\"window.opener.returndate("+(j-1)+");return false;\" border=\"0\"></a></td>");
				}
				if ((j % 7) == 0) {newWin_doc.writeln("</tr>");}
			}
			newWin_doc.writeln("</tr>");

			//newWin_doc.writeln("<tr>");
			//newWin_doc.writeln("<td colspan=\"7\" align=\"center\" valign=\"top\"><font face=\"Arial\" size=\"-1\" color=\"#ffffff\"><strong>Time:</strong> <input type=\"Text\" id=\"time\" value=\""+ currenttime +"\" size=\"6\">");
			//newWin_doc.writeln("</font></td>");
			//newWin_doc.writeln("</tr>");
		newWin_doc.writeln('</TBODY></TABLE>');

	newWin_doc.writeln('</td></tr></table></div>');

	updateoutput();
	newWin_doc.writeln('</body></html>');	
	newWin.document.close();

	/*if(navigator.appName != "Microsoft Internet Explorer")
  	{
		newWin.close();
  	}
	*/
}
