if(!Array.prototype.push)
{
	Array.prototype.push=function()
	{
		for(var i=0;i<arguments.length;i++)
			this[this.length]=arguments[i];
	};
};

var lastMouseX = 0;
var lastMouseY = 0;
var weekend = [0,6];
var selectedDateColor = "#e0e0e0";
var v_StylePrefix = "";
var v_CloseOnSelect,v_AppendOrReplace,v_AppendChar,v_ReturnData;
var v_InlineX,v_InlineY,v_Title,v_CurrentDate,v_AllowWeekends;
var v_Resizable,v_Width,v_Height,v_SelectAfter,v_NSHierarchy;
var v_SelectBefore,v_CallFunction,v_PopupX,v_PopupY,v_Holidays;
var v_Nav,v_SmartNav,v_Fix,v_ShowFix,v_WeekStart,v_Weekends;
var va_Holidays,v_ShortNames,v_AllowHolidays,v_Language,v_Stylesheet;
var $globalS=new Array();
var $today=new Date();
var $globalCal;
var $globalV;
var $globalW;
var $lockX,$lockY;
var cx,cy;
var eventX,eventY;
var arrayX, arrayY;
var $globalA;
var $globalB,$globalZ;
var $globalClickH="";
var $globalClickI="";
var p_form, p_field, p_target;
var $isNav=(navigator.appName.indexOf("Netscape")!=-1)?true:false;
var $isIE=(navigator.appName.indexOf("Microsoft")!=-1)?true:false;
var $canGetById=(document.getElementById)?true:false;
var displayMonth = 2;
Calendar.Months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
Calendar.EMonths=["January","February","March","April","May","June","July","August","September","October","November","December"];
Calendar.SEMonths=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
Calendar.EDOW=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
Calendar.DOMonth=[31,28,31,30,31,30,31,31,30,31,30,31];
Calendar.lDOMonth=[31,29,31,30,31,30,31,31,30,31,30,31];
Calendar.gInitText="Softricks.com Calendar";

var newOnClickHandler = function(e) {
	if($isIE) {
		lastMouseX = event.clientX + document.body.scrollLeft;
		lastMouseY = event.clientY + document.body.scrollTop;
	} else {
		lastMouseX = e.clientX + document.body.scrollLeft;
		lastMouseY = e.clientY + document.body.scrollTop;
	}
}

if(typeof document.onclick != 'function') {
	document.onclick = newOnClickHandler;
} else {
	var oldOnClick = document.onclick;
	document.onclick = function(e) {
		oldOnClick(e);
		newOnClickHandler(e);
	}
}

function findObject(n, d) {
	var p,i,x;
	if(!d)
		d=document;

	if((p=n.indexOf("?"))>0&&parent.frames.length){
		d=parent.frames[n.substring(p+1)].document;
		n=n.substring(0,p);
	}
	if(!(x=d[n])&&d.all)
		x=d.all[n];
	for (i=0;!x&&i<d.forms.length;i++)
		x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++)
		x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById)
		x=d.getElementById(n);
	if(!x && d.getElementsByName && d.getElementsByName(n).length > 0)
		x=d.getElementsByName(n)[0];
	return x;
}


function name_values($a)
{
	var $b=new Array();
	var rc="\235";
	var $a=$a.replace(/\\\;/g,rc);
	var $z=new RegExp("[a-zA-Z0-9]+\=[\<\>\/:#a-zA-Z0-9\-\+\., \235]+","gi");
	var y=$a.match($z);
	for(i=0;i<y.length;i++)
	{
		var s=y[i].split("=");
		s[1]=s[1].replace(rc,";");
		$b[i]="v_"+s[0];
		eval($b[i]+" = '"+s[1]+"'");
	};
	return $b;
};

function setBackgroundColor(id) {

	var el = document.getElementsByTagName('TD');

	//first reset the background color of all table columns that
	//have an id between 1 and 31
	for(var i=0; i < el.length; i++) {
		if(el[i] != null && el[i].id > 0 && el[i].id <= 31)
	 		el[i].style.backgroundColor ="white";
	};

	//set the new background color of the selected item
	if( id.style.backgroundColor == this.selectedDateColor)
		id.style.backgroundColor="white";
	else
		id.style.backgroundColor=this.selectedDateColor;
}

function submitCal() {
	if(p_form != null && typeof p_form == "string" && p_field != null && p_target != null)
		window.document.forms[p_form].elements[p_field].value=p_target;

	if(p_form != null) {
		// dirty hack for supporting overlay-date-lookup: if p_form (i.e. the 5th parameter, starting with 0) is specified but not a string
		// it is taken to be a function that should be called instead of submitting a form
		if (typeof p_form != "string") {
			p_form();
		} else {
			window.document.forms[p_form].submit();
		}
	}
}

function chkVar($d)
{
	if(typeof(eval($d))=="number")
		return true;
	if(eval($d)&&eval($d)!="")
		return true;
	else
		return false;
};

function chkArg($e)
{
	if($e=="undefined"||$e==null||$e=="")
		return false;
	else
		return true;
};

function arrayElt($f,$g)
{
	var j=0;
	for(j=0;j<$f.length;j++)
	{
		if($f[j].toUpperCase()==$g.toUpperCase())
			return j;
	};

	return "-1";
};

function pad2($e)
{
	if(typeof $e=="number")
		return($e.toString().length<2)?"0"+$e:$e;
	else if(typeof $e=="string")
		return($e.length<2)?("0"+$e):(""+$e);
	else
		return($e.toString().length<2)?"0"+$e:$e;
};

function onClickFn($j)
{
	var re=/pday/;
	$globalClickH=$globalClickI;
	$globalClickH=$globalClickH.replace(re,"'"+$j+"'");
	eval($globalClickH);
};

function kdwn($k)
{
	if(event.keyCode==13)
		$k.onchange();
	else
		return false;
};

function Today()
{
	var d=new Date();
	return((d.getMonth()+1)+"/"+d.getDate()+"/"+d.getFullYear());
};

function dateAdd($l,$m,$n)
{
	var d=new Date($l);
	var dv=d.valueOf();
	var $o;

	if($n=="+")
		$o=dv+($m*(1000*60*60*24));
	else
		$o=dv-($m*(1000*60*60*24));

	var nd=new Date($o);
	return((nd.getMonth()+1)+"/"+nd.getDate()+"/"+nd.getFullYear());
};

function IESplit(re,st)
{
	var $p;
	var $q=new Array();
	var $r;

	while((arrayX=re.exec(st))!=null)
	{
		$q.push(st.substring(0,st.indexOf(arrayX[1])));
		$q.push(arrayX[1]);
		st=st.substr(st.indexOf(arrayX[1])+arrayX[1].length);
	};

	return $q;
};

function Calendar($G,$H,$I,$J,$K)
{
	if(($H==null)&&($I==null))
		return;
	if($H==null)
	{
		this.gMonthName=null;
		this.gMonth=null;
		this.gYearly=true;
	}
	else
	{
		this.gMonthName=Calendar.getMonthArray()[$H];
		this.gMonth=new Number($H);
		this.gYearly=false;
	};

	if($K==null)
		this.gType="POPUP";
	else
		this.gType=$K;

	this.CODE="";

	if(this.gType=="INLINE")
	{

		this.WHO="";
		this.INLINE="Calendar";
	}
	else
		this.WHO="window.opener.";

	this.gYear=$I;
	this.gFormat=$J;
	this.gReturnItem=$G;
	this.gTitle="Softricks.com Calendar";
};

Calendar.getMonthArray=Calendar_getMonthArray;
Calendar.getSMonthArray=Calendar_getSMonthArray;
Calendar.getDOWArray=Calendar_getDOWArray;
Calendar.get_daysofmonth=Calendar_get_daysofmonth;
Calendar.calc_month_year=Calendar_calc_month_year;
Calendar.print=Calendar_print;
Calendar.CreateCalendarLayer=Calendar_CreateCalendarLayer;
Calendar.Close=Calendar_Close;
Calendar.Lwwrite=Calendar_Lwwrite;
Calendar.MoveTo=Calendar_MoveTo;
Calendar.isWeekend=Calendar_isWeekend;
Calendar.isHoliday=Calendar_isHoliday;
Calendar.processDateData=Calendar_processDateData;
Calendar.readDate=Calendar_readDate;

function Calendar_getMonthArray()
{
	if(!v_Language||v_Language=='E')
		return Calendar.EMonths;
	else
		return Calendar.Months;
};


function Calendar_getSMonthArray()
{
	if(!v_Language||v_Language=='E')
		return Calendar.SEMonths;
	else
		return Calendar.SMonths;
};


function Calendar_getDOWArray()
{
	if(!v_Language||v_Language=='E')
		return Calendar.EDOW;
	else
		return Calendar.DOW;
};


function Calendar_get_daysofmonth($L,$I)
{
	if(($I%4)==0)
	{
		if(($I%100)==0&&($I%400)!=0)
			return Calendar.DOMonth[$L];
		return Calendar.lDOMonth[$L];
	}
	else
		return Calendar.DOMonth[$L];
};


function Calendar_calc_month_year($M,$N,$O)
{
	var $P=new Array();
	if($O==-1)
	{
		if($M==0)
		{
			$P[0]=11;
			$P[1]=parseInt($N,10)-1;
		}
		else
		{
			$P[0]=parseInt($M,10)-1;
			$P[1]=parseInt($N,10);
		}
	}
	else if($O==1)
	{
		if($M==11)
		{
			$P[0]=0;
			$P[1]=parseInt($N,10)+1;
		}
		else
		{
			$P[0]=parseInt($M,10)+1;
			$P[1]=parseInt($N,10);
		}
	};

	return $P;
};


function Calendar_print()
{
	$globalCal.print();
};


function Calendar_isWeekend($j)
{
	var i;
	for(i=0;i<$globalS.length;i++)
	{
		if(parseInt($j)==parseInt($globalS[i]))
			return true;
	};

	return false;
};


function Calendar_isHoliday($j)
{
	var i=arrayElt(va_Holidays,$j);
	if(parseInt(i)>-1)
		return true;
	return false;
};


function Calendar_processDateData($Q,$R)
{
	var m;
	var td=Today();
	var $S=new RegExp("(Today)(([\\+\\-])([0-9]+))?","i");
	if((m=$Q.match($S))!=null)
	{
		if(m[1].toUpperCase()=="TODAY"&&m[0].length>5)
			return dateAdd(td,m[4],m[3]);
		else if(m[1].toUpperCase()=="TODAY")
			return td;
	}
	else
	{
		return Calendar.readDate($Q,$R);
	}
};


function Calendar_readDate($l,$T)
{
	var re="";
	var $U=new Array();
	$U.push("Dummy");
	var $V="";
	var $W="";
	var $X="";
	for(i=0;i<12;i++)
	{
		$X+=Calendar.getMonthArray()[i]+((i<11)?"|":"");
		$W+=Calendar.getSMonthArray()[i]+((i<11)?"|":"");};
		for(i=0;i<7;i++)
			$V+=Calendar.getDOWArray()[i]+((i<7)?"|":"");
		var $Y=IESplit(new RegExp("(DD|MM|MONTH|MON|YYYY|YY|DOW)"),$T.toUpperCase());

		for(i=0;i<$Y.length;i++)
		{
			switch($Y[i].toUpperCase())
			{
				case "DD":
					re+="(\\d{1,2})";
					$U.push($Y[i]);
					break;
				case "DOW":
					re+="("+$V+")";
					$U.push($Y[i]);
					break;
				case "MM":
					re+="(\\d{1,2})";
					$U.push($Y[i]);
					break;
				case "MON":
					re+="("+$W+")";
					$U.push($Y[i]);
					break;
				case "MONTH":
					re+="("+$X+")";
					$U.push($Y[i]);
					break;
				case "YY":
					re+="(\\d{1,2})";
					$U.push($Y[i]);
					break;
				case "YYYY":
					re+="(\\d{4})";
					$U.push($Y[i]);
					break;
				default:
					re+=$Y[i];
			}
		};
		var $Z,$00,$01;
		var $02=new RegExp(re,"i");
		if($02.test($l))
		{
			var ma=$l.match($02);
			for(i=0;i<ma.length;i++)
			{
				switch($U[i])
				{
					case "DD":
						$Z=parseInt(ma[i],10);
						break;
					case "MM":
						$00=parseInt(ma[i],10);
						break;
					case "MON":
						$00=parseInt(arrayElt(Calendar.getSMonthArray(),ma[i]),10)+1;
						break;
					case "MONTH":
						$00=parseInt(arrayElt(Calendar.getMonthArray(),ma[i]),10)+1;
						break;
					case "YY":
						$03=parseInt(ma[i],10);
						$01=(($03>50)?($03+1900):($03+2000));
						break;
					case "YYYY":
						$01=parseInt(ma[i],10);
						break;
				}
			}
		};

		if(!($Z||$00||$01))
			return null;
		else return(new Date($00+"/"+$Z+"/"+$01));
};

function Calendar_Close($04,$05)
{
	if($04=="POPUP")
		$globalCal.close();
	if($04=="INLINE")
		Calendar.Lwwrite(Calendar.gInitText,$05);
	$globalCal=null;
};

new Calendar();
Calendar.prototype.getMonthlyCalendarCode=function()
{
	var $06="";
	var $07="";
	var $08="";
	$06=$06+"<TABLE WIDTH='"+(v_Width-30)+"' BORDER=1>";
	$07=this.cal_header();
	$08=this.cal_data();
	$06=$06+$07+$08;
	$06=$06+"</TABLE>";
	return $06;
};

Calendar.prototype.getMonthlyCalendarCodeEmbedded = function() {
	var vCode = "";
	var vHeader_Code = "";
	var vData_Code = "";
	this.CODE = "";

	// Navigation buttons
	var prevMMYYYY = Calendar.calc_month_year(this.gMonth, this.gYear, -1);
	var prevMM = prevMMYYYY[0];
	var prevYYYY = prevMMYYYY[1];

	var nextMMYYYY = Calendar.calc_month_year(this.gMonth, this.gYear, 1);
	var nextMM = nextMMYYYY[0];
	var nextYYYY = nextMMYYYY[1];


	this.wwrite("<TABLE WIDTH='100%' BORDER='0'>");

	//Navigation buttons
	this.wwrite("<TR>");

	var p_enableThreeMonth = "false";
	if (displayMonth == 3) {
		p_enableThreeMonth = "true";
	}

	// p_form can either be a String or a function
	var p_form_parameter;
	if (typeof p_form != "string") {
		p_form_parameter = p_form;
	} else {
		p_form_parameter = "'"+p_form+"'";
	}
	this.wwrite("<TD ALIGN=center><A HREF=\"" +
		"javascript:show_calendar(" +
		"'" + this.gReturnItem + "', '" + this.gMonth + "', '" + (parseInt(this.gYear)-1) + "', '" + this.gFormat + "', '" +
		p_embeddedIn +"', " + p_form_parameter +", '" +p_field +"', '" +p_target + "', '" + p_enableThreeMonth + "');" +
		"\"><img border='0' alt='<<' src='static/images/icons/btnArrowDoubleLeftEnabled.gif'><\/A></TD>");
	this.wwrite("<TD ALIGN=center><A HREF=\"" +
		"javascript:show_calendar(" +
		"'" + this.gReturnItem + "', '" + prevMM + "', '" + prevYYYY + "', '" + this.gFormat + "', '" +
		p_embeddedIn +"', " + p_form_parameter +", '" +p_field +"', '" +p_target + "', '" + p_enableThreeMonth + "');" +
		"\"><img border='0' alt='<' src='static/images/icons/btnArrowSingleLeftEnabled.gif'><\/A></TD>");
	this.wwrite("<TD ALIGN=center><A HREF=\"" +
		"javascript:show_calendar(" +
		"'" + this.gReturnItem + "', '" + nextMM + "', '" + nextYYYY + "', '" + this.gFormat + "', '" +
		p_embeddedIn +"', " + p_form_parameter +", '" +p_field +"', '" +p_target + "', '" + p_enableThreeMonth + "');" +
		"\"><img border='0' alt='>' src='static/images/icons/btnArrowSingleRightEnabled.gif'><\/A></TD>");
	this.wwrite("<TD ALIGN=center><A HREF=\"" +
		"javascript:show_calendar(" +
		"'" + this.gReturnItem + "', '" + this.gMonth + "', '" + (parseInt(this.gYear)+1) + "', '" + this.gFormat + "', '" +
		p_embeddedIn +"', " + p_form_parameter +", '" +p_field +"', '" +p_target + "', '" + p_enableThreeMonth + "');" +
		"\"><img border='0' alt='>>' src='static/images/icons/btnArrowDoubleRightEnabled.gif'><\/A></TD>");

	this.wwrite("</TR>");

	this.wwrite("</TABLE>");

	if (displayMonth == 3) {
		// previous month
		if(this.gMonth == 0) {
			this.gMonth = 11;
			var year = parseInt(this.gYear) - 1;
			this.gYear = year.toString();
		} else {
			this.gMonth = parseInt(this.gMonth) - 1;
		}
		this.gMonthName = Calendar.get_month(this.gMonth);

		vCode = vCode + "<TABLE class=\"knwebstd_result_table\">";

		//Title: Month + Year
		vCode = vCode + "<TR class=\"knwebstd_result_table_mainheader\" ><TD colspan=7>" +this.gMonthName + " " + this.gYear +"</TD></TR>";

		vHeader_Code = this.cal_headerEmbedded();
		vData_Code = this.cal_dataEmbedded();
		vCode = vCode + vHeader_Code + vData_Code;

		vCode = vCode + "</TABLE>";
		if(this.gMonth == 11) {
			this.gMonth = 0;
			var year = parseInt(this.gYear) + 1;
			this.gYear = year.toString();
		} else {
			this.gMonth = parseInt(this.gMonth) + 1;
		}
		this.gMonthName = Calendar.get_month(this.gMonth);
		// end "previous month"
	}

	vCode = vCode + "<TABLE class=\"knwebstd_result_table\">";

	//Title: Month + Year
	vCode = vCode + "<TR class=\"knwebstd_result_table_mainheader\" ><TD colspan=7>" +this.gMonthName + " " + this.gYear +"</TD></TR>";

	vHeader_Code = this.cal_headerEmbedded();
	vData_Code = this.cal_dataEmbedded();
	vCode = vCode + vHeader_Code + vData_Code;

	vCode = vCode + "</TABLE>";

	this.wwrite(vCode);

	vCode = "";

	//next month
	if(this.gMonth == 11) {
		this.gMonth = 0;
		var year = parseInt(this.gYear) + 1;
		this.gYear = year.toString();
	} else {
		this.gMonth = parseInt(this.gMonth) + 1;
	}
	this.gMonthName = Calendar.get_month(this.gMonth);

	this.wwrite("<TABLE class=\"knwebstd_result_table\">");

	//Title: Month + Year
	this.wwrite("<TR class=\"knwebstd_result_table_mainheader\" ><TD colspan=7>" +this.gMonthName + " " + this.gYear +"</TD></TR>");

	vHeader_Code = this.cal_headerEmbedded();
	vData_Code = this.cal_dataEmbedded();
	vCode = vCode + vHeader_Code + vData_Code;

	vCode = vCode + "</TABLE>";

	this.wwrite(vCode);

}

Calendar.get_month = Calendar_get_month;
function Calendar_get_month(monthNo) {
	return Calendar.Months[monthNo];
}

Calendar.prototype.onclickfn=function()
{
	var $09=this.WHO+((this.gType=="POPUP")?"document."+v_NSHierarchy:"window.document."+v_NSHierarchy)+"all['"+this.gReturnItem+"'].value";
	var $0a=(this.returnMode=="Replace")?" = ":" += ";
	var $0b="apchar = ''"+((this.returnMode=="Replace")?";":" + ")+"(("+$09+" == '') ? '' : '"+this.appendChar+"');\n"+$09+$0a+"apchar + pday;\n";
	return $0b;
};

Calendar.prototype.showSmartNavBar=function()
{
	var $0z="<table border=0 class='" + v_StylePrefix + "innerColor'><tr><td rowspan=2>";
	$0z+="<select name='selMonth' class='monthEntryStyle' onchange=\""+this.WHO+"Build("+"'"+this.gReturnItem+"', document.frmCal.selMonth.selectedIndex, '"+this.gYear+"', '"+this.gFormat+"', '"+this.gType+"');\">\n";
	for(i=0;i<12;i++)
	{
		$0z+="<option value=\"" + i + "\" ";
		if(parseInt(this.gMonth)==i)
			$0z+="selected";
		$0z+=" CLASS='monthEntryStyle'>"+Calendar.getMonthArray()[i]+"</option>\n";};
		$0z+="<\/select>\n</td><td rowspan=2>";
		$0z+="<input name=\"cy\" size=4 maxlength=4 value=\""+this.gYear+"\" onchange=\""+"javascript:"+this.WHO+"Build("+"'"+this.gReturnItem+"', '"+this.gMonth+"', document.frmCal.cy.value, '"+this.gFormat+"', '"+this.gType+"');\" "+"onkeydown=\"javascript:kdwn(this);\" "+"class='yearEntryStyle'>\n";$0z+="</td><td>"+"<A HREF=\"javascript:void(0);\" onClick=\"document.frmCal.cy.value++;document.frmCal.cy.onchange();return false;\" "+"class='yearArrowStyle'>^</A>"+"</td></tr><tr><td>"+"<A HREF=\"javascript:void(0);\" onClick=\"document.frmCal.cy.value--;document.frmCal.cy.onchange();return false;\" "+"class='yearArrowStyle'>v</A>"+"</td></tr></table>";
		this.wwrite($0z);
	};

Calendar.prototype.showEmbedded = function() {

	this.getMonthlyCalendarCodeEmbedded();

	$G=(document.getElementById)?true:false;

	if($isIE){
		document.all[p_embeddedIn].innerHTML=this.CODE;
	}else if($G){
		$0U=document.createRange();
		el=document.getElementById(p_embeddedIn);
		$0U.setStartBefore(el);
		$0V=$0U.createContextualFragment(this.CODE);
		while(el.hasChildNodes())
			el.removeChild(el.lastChild);
		el.appendChild($0V);
	}else if($isNav){
		var $0W=document.layers[p_embeddedIn].document;
		$0W.open();
		$0W.write(this.CODE);
		$0W.close();
	}
}

Calendar.prototype.show=function()
{
	var $06="";
	this.wwrite("<html>");
	this.wwrite("<head><title>Calendar:"+this.gTitle+"</title>");
	if(this.gType=="POPUP")
	{
		this.wwrite("<LINK REL=stylesheet TYPE=\"text/css\" HREF=\""+v_Stylesheet+"\">");
		this.wwrite("<script language='javascript'>"+"function onClickFn(pday) {\n"+this.onclickfn()+"}\n<\/script>");
	}
	else
	{
		if(!document.getElementById('guidInlineCalendarCSS'))
		{
			var objHead = document.getElementsByTagName('head');
			if (objHead[0])
			{
    		var objCSS = objHead[0].appendChild(document.createElement('link'));
   		 	objCSS.id = 'guidInlineCalendarCSS';
				void(objCSS.rel = 'stylesheet');
				void(objCSS.href = v_Stylesheet);
				void(objCSS.type = 'text/css');
			}
		}

		$globalClickI=this.onclickfn();
	}

	if(v_SmartNav=="Yes"&&this.gType=="POPUP")
		this.wwrite("<script language='javascript1.2'>\n"+"function kdwn(pthis) {"+"if (event.keyCode == 13) pthis.onchange(); else return false;};\n"+"</script>");
	this.wwrite("</head>");
	this.wwrite("<body onload=\"window.focus();\">");
	this.wwrite("<form name=\"frmCal\" onsubmit=\"return false;\">");
	this.wwrite("<TABLE WIDTH='"+(v_Width-30)+"' BORDER=0 CELLPADDING=0 CELLSPACING=2 CLASS='" + v_StylePrefix + "borderColor'><TR><TD>"+"<TABLE BORDER=0 WIDTH='100%' CELLPADDING=1 CELLSPACING=0 CLASS='" + v_StylePrefix + "innerColor'>"+"<TR><TD CLASS='" + v_StylePrefix + "titleStyle'>"+this.gTitle+"</TD><TD CLASS='" + v_StylePrefix + "titleStyle' ALIGN=RIGHT>"+"<A HREF='javascript:"+this.WHO+"Calendar.Close(\"" + this.gType + "\", \"" + this.INLINE + "\");' "+" CLASS='" + v_StylePrefix + "titleStyle'>"+"x</A></TD></TR><TR>");
	this.wwrite("<TD CLASS='" + v_StylePrefix + "headerStyle'>"+this.gMonthName+" "+this.gYear+"</TD>");
	this.wwrite("<TD CLASS='" + v_StylePrefix + "headerStyle' ALIGN=RIGHT>"+((v_ShowFix=="No")?"":("Fix"+"<INPUT TYPE=CHECKBOX NAME=fixCheck "+((v_Fix=="Yes")?"CHECKED ":"")+"onClick=\""+((this.gType=="POPUP")?"alert('Fixing Window')":"fixCal(this.checked);")+"\">"))+"</TD></TR><TR><TD COLSPAN=2 CLASS='" + v_StylePrefix + "headerStyle'>");
	if(v_SmartNav=="Yes")
		this.showSmartNavBar();
	var $0d=Calendar.calc_month_year(this.gMonth,this.gYear,-1);
	var $0e=$0d[0];
	var $0f=$0d[1];
	var $0g=Calendar.calc_month_year(this.gMonth,this.gYear,1);
	var $0h=$0g[0];
	var $0i=$0g[1];
	if(v_Nav=="Yes")
	{
		this.wwrite("<TABLE WIDTH='"+(v_Width-30)+"' BORDER=1 CELLSPACING=0 CELLPADDING=0 CLASS='" + v_StylePrefix + "navStyle'><TR><TD ALIGN=center>");
		this.wwrite("[<A HREF=\""+"javascript:"+this.WHO+"BuildInlineCalendar("+"'"+this.gReturnItem+"', '"+this.gMonth+"', '"+(parseInt(this.gYear,10)-1)+"', '"+this.gFormat+"', '"+this.gType+"'"+");\"><<<\/A>]</TD><TD ALIGN=center>");
		this.wwrite("[<A HREF=\""+"javascript:"+this.WHO+"BuildInlineCalendar("+"'"+this.gReturnItem+"', '"+$0e+"', '"+$0f+"', '"+this.gFormat+"', '"+this.gType+"'"+");\"><<\/A>]</TD><TD ALIGN=center>");
		this.wwrite("[<A HREF=\"javascript:window.print();\">"+((v_ShortNames=="Yes")?"P":"Print")+"</A>]</TD><TD ALIGN=center>");
		this.wwrite("[<A HREF=\""+"javascript:"+this.WHO+"BuildInlineCalendar("+"'"+this.gReturnItem+"', '"+$today.getMonth()+"', '"+$today.getFullYear()+"', '"+this.gFormat+"', '"+this.gType+"'"+");\">"+((v_ShortNames=="Yes")?"*":"Today")+"<\/A>]</TD><TD ALIGN=center>");
		this.wwrite("[<A HREF=\""+"javascript:"+this.WHO+"BuildInlineCalendar("+"'"+this.gReturnItem+"', '"+$0h+"', '"+$0i+"', '"+this.gFormat+"', '"+this.gType+"'"+");\">><\/A>]</TD><TD ALIGN=center>");
		this.wwrite("[<A HREF=\""+"javascript:"+this.WHO+"BuildInlineCalendar("+"'"+this.gReturnItem+"', '"+this.gMonth+"', '"+(parseInt(this.gYear,10)+1)+"', '"+this.gFormat+"', '"+this.gType+"'"+");\">>><\/A>]</TD></TR></TABLE>");
	}
	$06=this.getMonthlyCalendarCode();
	this.wwrite($06);
	this.wwrite("</TD></TR></TABLE></TD></TR></TABLE>");
	this.wwrite("</form>");
	this.wwrite("</body></html>");

	if(this.gType=="POPUP")
	{
		$globalCal.document.open("text/html","replace");
		$globalCal.document.writeln(this.CODE);
		$globalCal.document.close();
	}

	if(this.gType=="INLINE")
		Calendar.Lwwrite(this.CODE,this.INLINE);
};

Calendar.prototype.cal_headerEmbedded = function() {
	var vCode = "";

	vCode = vCode + "<TR class=\"knwebstd_result_table_subheader\">";
	vCode = vCode + "<TD WIDTH='14%'>Mon</TD>";
	vCode = vCode + "<TD WIDTH='14%'>Tue</TD>";
	vCode = vCode + "<TD WIDTH='14%'>Wed</TD>";
	vCode = vCode + "<TD WIDTH='14%'>Thu</TD>";
	vCode = vCode + "<TD WIDTH='14%'>Fri</TD>";
	vCode = vCode + "<TD WIDTH='14%'>Sat</TD>";
	vCode = vCode + "<TD WIDTH='14%'>Sun</TD>";
	vCode = vCode + "</TR>";

	return vCode;
}

Calendar.prototype.cal_header=function()
{
	var $06="";
	var i=0,j=0;
	$06=$06+"<TR>";

	for(i=v_WeekStart,j=0;j<7;i++,j++,i=i%7)
		$06=$06+"<TD WIDTH='"+((i==6)?16:14)+"%' CLASS='"+v_StylePrefix+"weekdayHeaderStyle'>"+((v_ShortNames=="Yes")?Calendar.getDOWArray()[i].substring(0,1):Calendar.getDOWArray()[i].substring(0,3))+"</TD>";
	$06=$06+"</TR>";
	return $06;
};

Calendar.prototype.set_selectedDay = function(vday) {

	var selectedDay = eval("window.document." +this.gReturnItem + ".value");
    var fday = this.format_data(vday);

    if(selectedDay == fday) {
    	return " bgColor='#e0e0e0' ";
    }
    else
    	return "";
}

Calendar.prototype.format_day = function(weekday, vday) {
	var gNow = new Date();
	var vNowDay = gNow.getDate();
	var vNowMonth = gNow.getMonth();
	var vNowYear = gNow.getFullYear();


	if (vday == vNowDay && this.gMonth == vNowMonth && this.gYear == vNowYear)
		return ("<FONT COLOR=\"RED\"><B>" + vday + "</B></FONT>");
	else if(weekday == 6 || weekday == 7)
		return ("<B>" + vday + "</B>");
	else
		return (vday);
}

Calendar.prototype.cal_dataEmbedded = function() {
	var vDate = new Date();
	vDate.setDate(1);
	vDate.setMonth(this.gMonth);
	vDate.setFullYear(this.gYear);

	var vFirstDay=vDate.getDay();
	var vDay=1;
	var vLastDay=Calendar.get_daysofmonth(this.gMonth, this.gYear);
	var vOnLastDay=0;
	var vCode = "";

	/*
	Get day for the 1st of the requested month/year..
	Place as many blank cells before the 1st day of the month as necessary.
	*/

	if(vFirstDay == 0)
		vFirstDay = vFirstDay + 7;

	vCode = vCode + "<TR>";
	for (i=1; i<vFirstDay; i++) {
		vCode = vCode + "<TD></TD>";
	}


	// Write rest of the 1st week
	for (j=vFirstDay; j<8; j++) {

			vCode = vCode + "<TD STYLE=\"cursor:pointer\" ALIGN=center ID=\""+vDay +"\"" +
			        " onClick=\"setBackgroundColor(this);window.document." + this.gReturnItem + ".value='" +
					this.format_data(vDay) +"';disableElement('dateLookupForm','bt_accept',false)\" ondblClick=\"window.document." + this.gReturnItem + ".value='" +
					this.format_data(vDay) +"';submitCal(); " +this.set_selectedDay(vDay) +"\">" + this.format_day(j, vDay) + "</TD>";

		vDay=vDay + 1;

	}
	vCode = vCode + "</TR>";
	var bgColor = "";

	// Write the rest of the weeks
	for (k=2; k<7; k++) {
		vCode = vCode + "<TR>";

		for (j=1; j<8; j++) {

			vCode = vCode + "<TD STYLE=\"cursor:pointer\" ALIGN=center ID=\""+vDay +"\"" +
			        " onClick=\"setBackgroundColor(this);window.document." + this.gReturnItem + ".value='" +
					this.format_data(vDay) +"';disableElement('dateLookupForm','bt_accept',false)\" ondblclick=\"window.document." + this.gReturnItem + ".value='" +
					this.format_data(vDay) +"';submitCal(); " +this.set_selectedDay(vDay) +"\">" + this.format_day(j, vDay) + "</TD>";


			vDay=vDay + 1;

			if (vDay > vLastDay) {
				vOnLastDay = 1;
				break;
			}
		}

		if (j == 7)
			vCode = vCode + "</TR>";
		if (vOnLastDay == 1)
			break;
	}

	// Fill up the rest of last week with proper blanks, so that we get proper square blocks
	for (m=1; m<(8-j); m++) {
			vCode = vCode + "<TD></TD>";
	}

	while(k < 6) {
		vCode = vCode + "<TR><TD colspan=7>&nbsp;</TD></TR>";
		k++;
	}

	return vCode;
}

Calendar.prototype.cal_data=function()
{
	var $0j=new Date();
	$0j.setDate(1);
	$0j.setMonth(this.gMonth);
	$0j.setFullYear(this.gYear);
	var $0k=$0j.getDay();
	var $0l=1;
	var $0m=Calendar.get_daysofmonth(this.gMonth,this.gYear);
	var $0n=0,j=0;
	var $06="";
	if(this.closeable)
	{
		$0o=((this.gType=="POPUP")?"window.close();":"");
		$0p="Calendar.Close(\"" + this.gType + "\", \"" + this.INLINE + "\"); ";
	}
	else
	{
		$0o="";
		$0p="void(0);' ";
	}

	var $09=this.WHO+((this.gType=="POPUP")?"document.":"window.document.")+this.gReturnItem+".value";
	$06=$06+"<TR>";
	for(j=v_WeekStart,i=0;j!=$0k;j++,i++,j=j%7)
	{
		$06=$06+"<TD WIDTH='14%' "+this.applySpecialStyle(0,j,"9999")+">&nbsp;</TD>";
	}

	for(j=$0k;i<7;j++,i++,j=j%7)
	{
		$06=this.createDates($06,$0j,$0l,j);
		$0l=$0l+1;
	}

	$06=$06+"</TR>";
	for(k=2;k<7;k++)
	{
		$06=$06+"<TR>";
		for(j=v_WeekStart,i=0;i<7;j++,i++,j=j%7)
		{
			$06=this.createDates($06,$0j,$0l,j);
			$0l=$0l+1;
			if($0l>$0m)
			{
				$0n=1;
				break;
			}
		}
		if(i==6)
			$06=$06+"</TR>";
		if($0n==1)
			break;
	}

	for(m=1;m<(7-i);m++)
	{
		j=(j+1)%7;
		if(this.gYearly)
			$06=$06+"<TD WIDTH='14%'"+this.applySpecialStyle(0,j,"9999",1)+">&nbsp;</TD>";
		else
			$06=$06+"<TD WIDTH='14%' "+this.applySpecialStyle(0,j,"9999",1)+">"+m+"</TD>";
	}
	return $06;
};


Calendar.prototype.createDates=function($0q,$0r,$0s,pj)
{
	var $0t="";
	var $0u="";
	var $0v="";
	$0r.setDate($0s);
	$0v=String(pad2(this.gMonth+1))+String(pad2($0s));
	if((this.gAllowWeekends=="No"&&Calendar.isWeekend(pj))||($0r<v_SelectAfter||$0r>v_SelectBefore)||(this.gAllowHolidays=="No"&&Calendar.isHoliday($0v)))
	{
		$0t="";
		$0u="";
	}
	else
	{
		$0t="<A HREF='javascript:"+((this.CallFunction!="")?(this.WHO+this.CallFunction+"();"):"")+$0p+"' "+"onClick=\"onClickFn('"+((this.returnData=="Date")?this.format_data($0s):this.format_dow($0s))+"');"+((this.CallFunction!="")?(this.WHO+this.CallFunction+"();"):"")+$0o+"return true;"+"\" "+(Calendar.isHoliday($0v)?"CLASS='holidayLinkStyle'":"CLASS='" + v_StylePrefix + "linkStyle'")+">";
		$0u="<\/A>";
	}
	$0q=$0q+"<TD WIDTH='14%' "+this.applySpecialStyle($0s,pj,$0v)+">"+$0t+$0s+$0u+"</TD>";
	return $0q;
};


Calendar.prototype.applySpecialStyle=function($0w,$0x,$0y,$0z)
{
	var $0A;
	if(this.gCurrentDate!="NONE")
		$0A=this.gCurrentDate;
	else
		$0A=$today;

	var $0B=$0A.getDate();
	var $0Z=$0A.getMonth();
	var $0D=$0A.getFullYear();
	if($0y!="9999"&&Calendar.isHoliday($0y))
		return("CLASS='holidayStyle'");
	if(parseInt($0w)==$0B&&parseInt(this.gMonth)==$0Z&&parseInt(this.gYear)==$0D)
		return "CLASS='" + v_StylePrefix + "todayStyle'";
	if(Calendar.isWeekend($0x))
		return($0z==1?"CLASS='dimWeekendStyle'":"CLASS='weekendStyle'");
	if($0z==1)
		return "CLASS='dimStyle'";
	else
		return "CLASS='normalStyle'";
};


Calendar.prototype.format_data=function($0E)
{
	var $0F=this.gFormat;
	var $0G=1+this.gMonth;$0G=($0G.toString().length<2)?"0"+$0G:$0G;
	var $0H=Calendar.getMonthArray()[this.gMonth].substr(0,3).toUpperCase();
	var $0I=Calendar.getMonthArray()[this.gMonth].toUpperCase();
	var $0J=new String(this.gYear);
	var $0K=new String(this.gYear.substr(2,2));
	var $0L=($0E.toString().length<2)?"0"+$0E:$0E;
	var $0M=Calendar.getDOWArray()[new Date($0G+"/"+$0L+"/"+$0J).getDay()];
	if((new RegExp("YYYY","ig")).test($0F))
		$0F=$0F.replace(/YYYY/ig,$0J);
	else if((new RegExp("YY","ig")).test($0F))
		$0F=$0F.replace(/YY/ig,$0K);
	if((new RegExp("DD","ig")).test($0F))
		$0F=$0F.replace(/DD/ig,$0L);
	if((new RegExp("MM","ig")).test($0F))
		$0F=$0F.replace(/MM/ig,$0G);
	if((new RegExp("MONTH","ig")).test($0F))
		$0F=$0F.replace(/MONTH/ig,$0I);
	else if((new RegExp("MON","ig")).test($0F))
		$0F=$0F.replace(/MON/ig,$0H);
	if((new RegExp("DOW","ig")).test($0F))
		$0F=$0F.replace(/DOW/ig,$0M);
	return $0F;
};


Calendar.prototype.format_dow=function($0E)
{
	var $0F;
	var $0G=1+this.gMonth;
	$0G=($0G.toString().length<2)?"0"+$0G:$0G;
	var $0H=Calendar.getMonthArray()[this.gMonth].substr(0,3).toUpperCase();
	var $0I=Calendar.getMonthArray()[this.gMonth].toUpperCase();
	var $0J=new String(this.gYear);
	var $0L=($0E.toString().length<2)?"0"+$0E:$0E;
	var $0j=new Date($0G+"\/"+$0L+"\/"+$0J);
	$0F=Calendar.getDOWArray()[$0j.getDay()];
	return $0F;
};


Calendar.prototype.wwrite=function($0N)
{
	this.CODE+=$0N;
};


function Calendar_CreateCalendarLayer($0O,$0P,pInitText)
{
	if(pInitText==null)
		pInitText=Calendar.gInitText;
	else
		Calendar.gInitText=pInitText;
	v_InlineX=$0O;
	v_InlineY=$0P;
	var Calendar_ID="Calendar";
	if($isIE)
	{
		document.writeln("<DIV ID=\"" + Calendar_ID + "\" STYLE=\""+"position:absolute;top:"+$0P+"px;left:"+$0O+"px; z-index: 999"+"\">" + pInitText + "<\/DIV>");
	}
	else if($canGetById)
	{
		document.writeln("<DIV ID=\"" + Calendar_ID + "\" STYLE=\""+"position:absolute;top:"+$0P+"px;left:"+$0O+"px; z-index: 999"+"\">" + pInitText + "<\/DIV>");
	}
	else if($isNav)
	{
		document.writeln("<DIV ID=\"" + Calendar_ID + "\" STYLE=\""+"position:absolute;top:"+$0P+"px;left:"+$0O+"px; z-index: 999"+"\">" + pInitText + "<\/DIV>");
	}
}


function Calendar_Lwwrite($0Q,$05)
{
	if($isIE)
	{
		document.all[$05].innerHTML=$0Q;
	}
	else if($canGetById)
	{
		$0R=document.createRange();
		el=document.getElementById($05);
		$0R.setStartBefore(el);
		$0S=$0R.createContextualFragment($0Q);
		while(el.hasChildNodes())
			el.removeChild(el.lastChild);
		el.appendChild($0S);
	}
	else if($isNav)
	{
		var $0T=document.layers[$05].document;
		$0T.open();
		$0T.write($0Q);
		$0T.close();
	}
}


function Calendar_MoveTo(pX,pY,$05)
{
	if($isIE)
	{
		document.all[$05].style.top=pY;
		document.all[$05].style.left=pX;
	}
	else if($canGetById)
	{
		document.all[$05].style.top=pY;
		document.all[$05].style.left=pX;
	}
	else if($isNav)
	{
		document.layers[$05].top=pY;
		document.layers[$05].left=pX;
	}
}

$globalB=false;
$globalZ=false;


function fixCal($0U)
{
	if($0U)
		initEvents(0);
	else
		initEvents(1);
}


function click(e)
{
	eventX=($isIE)?(event.x+document.body.scrollLeft):e.pageX;
	eventY=($isIE)?(event.y+document.body.scrollTop):e.pageY;
	cx=($isIE)?(eventX-parseInt($0V.left)):(($canGetById)?(eventX-parseInt($0V.left)):(eventX-$globalV.x));
	cy=($isIE)?(eventY-parseInt($0V.top)):(($canGetById)?(eventY-parseInt($0V.top)):(eventY-$globalV.y));
	$globalZ=false;
	$globalB=true;
}


function unclick(e)
{
	$globalZ=true;
	$globalB=false;
}


function handleMove(e)
{
	$lockX=($isIE)?(event.x+document.body.scrollLeft):e.pageX;
	$lockY=($isIE)?(event.y+document.body.scrollTop):e.pageY;
	if($globalB)
	{
		v_InlineX=$lockX-cx;
		v_InlineY=$lockY-cy;
		MoveLayer($lockX-cx,$lockY-cy,"myLayer");
	}
}


function initEvents($0W)
{
	if($0W==1)
	{
		if($isNav&&!$canGetById)
			$globalV.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP|Event.MOUSEMOVE);
		if($canGetById&&$isNav)
		{
			$globalV.addEventListener("mousemove",handleMove,true);
			$globalV.addEventListener("mousedown",click,true);
			$globalV.addEventListener("mouseup",unclick,true);
		}
		else
		{
			$globalV.onmousemove=handleMove;
			$globalV.onmousedown=click;
			$globalV.onmouseup=unclick;
		}
	}
	else
	{
		if($isNav&&!$canGetById)
			$globalV.releaseEvents(Event.MOUSEDOWN|Event.MOUSEUP|Event.MOUSEMOVE);
		if($canGetById&&$isNav)
		{
			$globalV.removeEventListener("mousemove",handleMove,true);
			$globalV.removeEventListener("mousedown",click,true);
			$globalV.removeEventListener("mouseup",unclick,true);
		}
		else
		{
			$globalV.onmousemove="";
			$globalV.onmousedown="";
			$globalV.onmouseup="";
		}
	}
}


function MoveLayer(pX,pY)
{
	$0V.top=pY;
	$0V.left=pX;
}


function drag_init($0X)
{
	if($isIE)
	{
		$0V=document.all[$0X].style;
		$globalV=document.all[$0X];
	}
	else if($canGetById)
	{
		$0V=document.getElementById($0X).style;
		$globalV=document.getElementById($0X);
	}
	else if($isNav)
	{
		$0V=document.layers[$0X];
		$globalV=document.layers[$0X];
	}

	if(v_ShowFix=="Yes"&&v_Fix=="Yes")
		initEvents(0);
	else
		initEvents(1);
}


function CalResize()
{
	v_Height=$globalCal.innerHeight;
	v_Width=$globalCal.innerWidth;
}

function BuildEmbeddedCalendar(p_item, p_month, p_year, p_format) {
	gCal = new Calendar(p_item, p_month, p_year, p_format);

	// Customize your Calendar here..
	gCal.gBGColor="white";
	gCal.gLinkColor="black";
	gCal.gTextColor="black";
	gCal.gHeaderColor="black";

	gCal.showEmbedded();

}

function BuildInlineCalendar($G,$H,$I,$J,$K,$0Y,$0Z)
{
	if($0Z&&$0Z!="")
	{
		v_Resizable=undefined;
		v_SelectAfter=undefined;
		v_SelectBefore=undefined;
		v_NSHierarchy=undefined;
		v_CallFunction=undefined;
		v_Nav=undefined;
		v_ShowFix=undefined;
		v_SmartNav=undefined;
		v_Fix=undefined;
		v_WeekStart=undefined;
		v_Width=undefined;
		v_Height=undefined;
		v_ShortNames=undefined;
		v_Holidays=undefined;
		v_Language=undefined;
		v_Stylesheet=undefined;
	}

	if($I==""||($I!=""&&isNaN($I)))
	{
		window.status="Invalid Year";
		return true;
	}
	else
		window.status="";

	if($0Y&&$0Y!="")
	{
		v_CurrentDate="";
		var $10=name_values($0Y);

		//var $t1 = "findObject('"+$G+"', null).value";
		//var $09 = "findObject('"+$G+"', null).value";

		var $09="document.all['"+$G+"'].value";

		var $11 = eval($09);

		if($11!="")
			v_CurrentDate=$11;
		v_Weekends=chkVar("v_Weekends")?v_Weekends:"06";

		for(i=0;i<v_Weekends.length;i++)
			$globalS.push(parseInt(v_Weekends.charAt(i)));
	}
	else
		v_CurrentDate="";

	var $12;
	if(chkVar("v_CurrentDate"))
	{
		if(v_CurrentDate.charAt(0)=='<'&&v_CurrentDate.charAt(v_CurrentDate.length-1)=='>')
		{
			var $13="document."+v_CurrentDate.substring(1,v_CurrentDate.length-1)+".value";
			v_CurrentDate=eval($13);
		}

		if(Calendar.processDateData(v_CurrentDate,$J)==null)
			$12=new Date();
		else
			$12=new Date(Calendar.processDateData(v_CurrentDate,$J));

		$H=$12.getMonth();
		$I=$12.getFullYear().toString();
	}
	else
		$12="NONE";

	v_Resizable=chkVar("v_Resizable")?v_Resizable:"No";
	v_SelectAfter=(typeof v_SelectAfter=="string")?new Date(Calendar.processDateData(v_SelectAfter,$J)):v_SelectAfter;
	v_SelectBefore=(typeof v_SelectBefore=="string")?new Date(Calendar.processDateData(v_SelectBefore,$J)):v_SelectBefore;
	v_NSHierarchy=$isNav?(chkVar("v_NSHierarchy")?(v_NSHierarchy+".document."):""):"";
	v_CallFunction=chkVar("v_CallFunction")?v_CallFunction:"";
	v_Nav=chkVar("v_Nav")?v_Nav:"Yes";
	v_SmartNav=chkVar("v_SmartNav")?v_SmartNav:"No";
	v_Fix=chkVar("v_Fix")?v_Fix:"Yes";
	v_ShowFix=chkVar("v_ShowFix")?v_ShowFix:"No";
	v_ShortNames=chkVar("v_ShortNames")?v_ShortNames:"No";
	v_WeekStart=chkVar("v_WeekStart")?parseInt(v_WeekStart):1;
	va_Holidays=chkVar("v_Holidays")?v_Holidays.split(","):"";
	v_Language=chkVar("v_Language")?v_Language:'E';
	v_Stylesheet=chkVar("v_Stylesheet")?v_Stylesheet:'static/css/Calendar.css';
	var $14,$15;
	v_Width=chkVar("v_Width")?v_Width:260;
	v_Height=chkVar("v_Height")?v_Height:250;
	if($K=="POPUP")
	{
		$15=chkVar("v_Width")?v_Width:260;
		if($isIE)
			$14=chkVar("v_Height")?v_Height:250;
		else if($isNav)
			$14=chkVar("v_Height")?v_Height:250;
		if(v_SmartNav=="Yes")$14+=30;
		v_PopupX=chkVar("v_PopupX")?v_PopupX:-1;
		v_PopupY=chkVar("v_PopupY")?v_PopupY:-1;
		if(v_PopupX>=0&&v_PopupY>=0)
		{
			if(!$globalCal||$globalCal.closed)
				$globalCal=window.open("","Calendar","width="+$15+",height="+$14+",status=no,dependent=yes,resizable="+v_Resizable+",screenX="+v_PopupX+",screenY="+v_PopupY+",left="+v_PopupX+",top="+v_PopupY);
		}
		else
		{
			if(!$globalCal||$globalCal.closed)
				$globalCal=window.open("","Calendar","width="+$15+",height="+$14+",status=no,dependent=yes,resizable="+v_Resizable);
		}
		$globalCal.opener=self;

		if($isNav&&!$canGetById)
		{
			$globalCal.captureEvents(Event.RESIZE);
		}

		$globalCal.onResize=CalResize;
	}

	$16=new Calendar($G,$H,$I,$J,$K);
	$16.gCurrentDate=$12;
	$16.gAllowWeekends=(chkVar("v_AllowWeekends")&&v_AllowWeekends=="Yes")?"Yes":"No";
	$16.gAllowHolidays=(chkVar("v_AllowHolidays")&&v_AllowHolidays=="No")?"No":"Yes";
	$16.closeable=chkVar("v_CloseOnSelect")?((v_CloseOnSelect=="Yes")?true:false):true;
	$16.returnMode=chkVar("v_AppendOrReplace")?v_AppendOrReplace:"Replace";
	$16.returnData=chkVar("v_ReturnData")?v_ReturnData:"Date";
	$16.appendChar=($16.returnMode=="Append")?chkVar("v_AppendChar")?v_AppendChar:";":"";
	$16.CallFunction=chkVar("v_CallFunction")?v_CallFunction:"";
	//$16.InlineX=chkVar("v_InlineX")?v_InlineX:100;
	//$16.InlineY=chkVar("v_InlineY")?v_InlineY:100;
	$16.InlineY = lastMouseY;
	$16.InlineX = lastMouseX;
	if($16.gType=="INLINE")
	{
		Calendar.MoveTo($16.InlineX,$16.InlineY,$16.INLINE);
	}
	$16.gTitle=v_Title?v_Title:$16.gMonthName+"/"+$16.gYear;
	$16.fontface="Arial";

	if($16.gYearly)
		$16.showY();
	else
		$16.show();

	if($16.gType=="INLINE")
	{
		drag_init($16.INLINE);
	}
}


function show_calendar()
{
	var $G=arguments[0];
	var $H, $I, $J, $K, $0Y;

	if(!chkArg(arguments[1]))
		$H=new String($today.getMonth());
	else
		$H=(typeof(arguments[1])=="number")?arguments[1].toString():((arguments[1]=="")?new String($today.getMonth()):arguments[1]);

	if(!chkArg(arguments[2]))
		$I=new String($today.getFullYear().toString());
	else
		$I=(typeof(arguments[2])=="number")?arguments[2].toString():arguments[2];

	if(!chkArg(arguments[3]))
		$J="MM/DD/YYYY";
	else
		$J=(typeof(arguments[3])=="string")?arguments[3].replace("MMM", "MON"):"MM/DD/YYYY";

	if(!chkArg(arguments[4]))
		$K="POPUP";
	else
		$K=(typeof(arguments[4])=="string"&&(arguments[4]=="POPUP"||arguments[4]=="INLINE"))?arguments[4]:"POPUP";

	if(!chkArg(arguments[5]))
		$0Y="CloseOnSelect=Yes;AppendOrReplace=Replace;AppendChar=';';ReturnData=Date;Title=Popup Date Picker;AllowWeekends=Yes;Resizable=No;Language=E;Stylesheet=static/css/Calendar.css;";
	else
		$0Y=((typeof(arguments[5])=="string")?arguments[5]:"CloseOnSelect=Yes;AppendOrReplace=Replace;AppendChar=';';ReturnData=Date;Title=Popup Date Picker;AllowWeekends=Yes;Resizable=No;Language=E;Stylesheet=css/Calendar.css;");

	//Added old lookup attributes:
	if(arguments[5] != null)
		p_form = arguments[5];

	if(arguments[6] != null)
		p_field = arguments[6];

	if(arguments[7] != null)
		p_target = arguments[7];

	if(chkArg(arguments[8])) {
		if (arguments[8] == "true" || arguments[8] == "TRUE") {
		    displayMonth = 3;
		} else {
			displayMonth = 2;
		}
	} else {
		displayMonth = 2;
	}

	if($K=="INLINE"){
		v_StylePrefix = "inline";
		BuildInlineCalendar($G,$H,$I,$J,$K,$0Y,1);
	}
	else{
		p_embeddedIn = arguments[4];
		v_StylePrefix = "";
		BuildEmbeddedCalendar($G, $H, $I, $J, arguments[4], p_form, p_field, p_target);
	}

}

Calendar.prototype.showY=function()
{
	var $06="";
	var i;
	var vr,vc,vx,vy;
	var $17=285;
	var $18=200;
	var $19=10;
	var $1a;
	if($isIE)
		$1a=75;
	else if($canGetById)
		$1a=25;
	else if($isNav)
		$1a=25;
	this.wwrite("<html>");
	this.wwrite("<head><title>Calendar</title>");
	this.wwrite("<style type='text/css'>\n<!--");

	for(i=0;i<12;i++)
	{
		vc=i%3;
		if(i>=0&&i<=2)
			vr=0;
		if(i>=3&&i<=5)
			vr=1;
		if(i>=6&&i<=8)
			vr=2;
		if(i>=9&&i<=11)
			vr=3;
		vx=parseInt($17*vc)+$19;
		vy=parseInt($18*vr)+$1a;
		this.wwrite(".lclass"+i+" {position:absolute;top:"+vy+";left:"+vx+";}");
	}
	this.wwrite("-->\n</style>");

	if(this.gType=="POPUP")
		this.wwrite("<script language='javascript'>"+"function onClickFn(pday) {\n"+this.onclickfn()+"}\n<\/script>");
	else
		$globalClickI=this.onclickfn();

	this.wwrite("</head>");
	this.wwrite("<FONT FACE='"+this.fontface+"' SIZE=2><B>");
	this.wwrite("Year : "+this.gYear);
	this.wwrite("</B><BR>");

	var $0f=parseInt(this.gYear,10)-1;
	var $0i=parseInt(this.gYear,10)+1;

	this.wwrite("<TABLE WIDTH='"+(v_Width-30)+"' BORDER=1 CELLSPACING=0 CELLPADDING=0 BGCOLOR='#e0e0e0'><TR><TD ALIGN=center>");
	this.wwrite("[<A HREF=\""+"javascript:window.opener.Build("+"'"+this.gReturnItem+"', null, '"+$0f+"', '"+this.gFormat+"'"+");"+"\" alt='Prev Year'><<<\/A>]</TD><TD ALIGN=center>");
	this.wwrite("[<A HREF=\"javascript:window.print();\">Print</A>]</TD><TD ALIGN=center>");
	this.wwrite("[<A HREF=\""+"javascript:window.opener.Build("+"'"+this.gReturnItem+"', null, '"+$0i+"', '"+this.gFormat+"'"+");"+"\">>><\/A>]</TD></TR></TABLE><BR>");

	var j;
	for(i=11;i>=0;i--)
	{
		if($isIE)
			this.wwrite("<DIV ID=\"layer" + i + "\" CLASS=\"lclass" + i + "\">");
		else if($canGetById)
			this.wwrite("<DIV ID=\"layer" + i + "\" CLASS=\"lclass" + i + "\">");
		else if($isNav)
			this.wwrite("<LAYER ID=\"layer" + i + "\" CLASS=\"lclass" + i + "\">");

		this.gMonth=i;
		this.gMonthName=Calendar.getMonthArray()[this.gMonth];
		$06=this.getMonthlyCalendarCode();
		this.wwrite(this.gMonthName+"/"+this.gYear+"<BR>");
		this.wwrite($06);
		if($isIE)
			this.wwrite("</DIV>");
		else if($canGetById)
			this.wwrite("</DIV>");
		else if($isNav)
			this.wwrite("</LAYER>");
	};
	this.wwrite("</font><BR></body></html>");

	$globalCal.document.open();
	$globalCal.document.writeln(this.CODE);
	$globalCal.document.close();
};


function show_yearly_calendar($G,$I,$J)
{
	if($I==null||$I=="")
		$I=new String($today.getFullYear().toString());
	else
		$I=(typeof($I)=="number")?$I.toString():$I;
	if($J==null||$J=="")
		$J="MM/DD/YYYY";
	var $globalCal=window.open("","Calendar","scrollbars=yes");
	$globalCal.opener=self;
	Build($G,null,$I,$J,"POPUP");
}

	//CREATE THE CALENDAR LAYER HERE!
	Calendar.CreateCalendarLayer(250, 250, "");