<!--
	var monthDays = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
	var dayArray = new Array("Ïí", "Âò", "Ñð", "×ò", "Ïò", "Ñá", "Âñ");
	var monthNames = new Array("ßíâàðü", "Ôåâðàëü", "Ìàðò",	"Àïðåëü", "Ìàé", "Èþíü", "Èþëü", "Àâãóñò", "Ñåíòÿáðü", "Îêòÿáðü", "Íîÿáðü", "Äåêàáðü");
	var today = new Date();

	function doSelect(obj){
		if (obj.prevIndex != -1){
			var curTab = document.getElementById("t" + obj.id + obj.prevIndex);
			if (curTab.bgColor != obj.backgroundColor){
				curTab.bgColor = obj.inactiveColor;
			}
		}

		var curTab = document.getElementById("t" + obj.id + obj.curIndex);
		if (curTab.bgColor != obj.backgroundColor){
			curTab.bgColor = obj.activeColor;
		}

		if (curTab.innerHTML != "&nbsp;") obj.day = curTab.innerHTML;
		var stTab = document.getElementById(obj.id + "tstatus");
		stTab.innerHTML= obj.day + " " + monthNames[obj.month] + ", " + obj.year;
	}


	function buttonOnClick(){
		var obj = this.object;
		substIndex = 1 + obj.id.length;
		obj.curIndex = window.event.srcElement.id.substr(substIndex);
		if (window.event.srcElement.tagName == "TD"){
			doSelect(obj);
			obj.prevIndex = obj.curIndex;
		}
		obj.curDay = obj.day;
		obj.curMonth = obj.month;
		obj.curYear = obj.year;
	}

	function clearCalendar(){
		for (i=1; i<43; i++){
			var curTab = document.getElementById("t" + this.id + i);
			curTab.innerHTML = "&nbsp;";
			curTab.bgColor = this.backgroundColor;
			curTab.onclick = null;
			curTab.style.cursor = "default";
		}
	}

	function initializeCalendar(){
		if (((this.year % 4 == 0) && (this.yearear % 100 != 0)) || (this.year % 400 == 0)) monthDays[1] = 29; else monthDays[1] = 28;
		nDays = monthDays[this.month];
		firstDay = new Date();
		firstDay.setDate(1);
		startDay = firstDay.getDay();

		dayCounter = startDay;
		if (startDay == 0) dayCounter = 7;
		startDay = dayCounter;

		for (i=1; i<=nDays; i++, dayCounter++){
			var curTab = document.getElementById("t" + this.id + dayCounter);
			curTab.innerText = i;
			curTab.bgColor = this.inactiveColor;
		   	curTab.style.cursor = "hand";
		   	curTab.onclick = buttonOnClick;
		   	curTab.object = this;
		   	curTab.style.color = "white";
		}

		this.curIndex = startDay + this.day - 1;
		doSelect(this);
		this.prevIndex = this.curIndex;

		var stTab = document.getElementById(this.id + "tstatus");
		stTab.innerHTML= this.day + " " + monthNames[this.month] + ", " + this.year;

		var curObj = document.all.item(this.id + "years");
		curObj.onchange = selectOnChange;
		curObj.object = this;
		for (i=0; i<curObj.options.length; i++)
			if (this.year == curObj.options(i).value) curObj.options(i).selected = 1;

		var curObj=document.getElementById(this.id + "months");
		curObj.onchange = selectOnChange;
		curObj.object = this;
		for (i=0; i<curObj.options.length; i++)
			if (this.month == curObj.options(i).value) curObj.options(i).selected = 1;

	}

	function selectOnChange(){
		var obj = this.object;
		obj.clear();
		obj.curIndex = 1;
		newDay = new Date();
		var stTab = document.getElementById(obj.id + "years");
		newDay.setFullYear(stTab.value);
		obj.year = stTab.value;
		var stTab = document.getElementById(obj.id + "months");
		newDay.setMonth(stTab.value);
		obj.month = stTab.value;
		if (((obj.year % 4 == 0) && (obj.year % 100 != 0)) || (obj.year % 400 == 0)) monthDays[1] = 29; else  monthDays[1] = 28;
		nDays = monthDays[newDay.getMonth()];
		firstDay = newDay;
		firstDay.setDate(1);
		startDay = firstDay.getDay();
		dayCounter = startDay;
		if (startDay == 0) dayCounter=7;
		startDay = dayCounter;

		for (i=1; i<=nDays; i++, dayCounter++){
			var curTab = document.getElementById("t" + obj.id + dayCounter);
			curTab.innerHTML = i;
		   	curTab.bgColor = obj.inactiveColor;
		   	curTab.style.cursor = "hand";
			curTab.onclick = buttonOnClick;
			curTab.object = obj;
			curTab.style.color = "white";
		}

		if (obj.year == obj.curYear && obj.month == obj.curMonth){
		   obj.curIndex = startDay + 1*obj.day - 1;
		   doSelect(obj);
		   obj.prevIndex = obj.curIndex;
		}
	}

	function addOptions(){
		var stTab = document.getElementById(this.id + "years");
		ySel = stTab;
		for (i=-10; i<=10; i++){
			var option = document.createElement("<OPTION>");
			tYear = this.year + i;
			ySel.options.add(option);
			ySel.options(i+10).value = tYear;
			ySel.options(i+10).innerHTML = tYear;
		}

		var stTab = document.getElementById(this.id + "months");
		mSel = stTab;
		for (i=0; i<12; i++){
			var option = document.createElement("<OPTION>");
			mSel.options.add(option);
			mSel.options(i).value = i;
			mSel.options(i).innerHTML = monthNames[i];
		}
	}

	function drawCalendar(pBackgroundColor){
		document.write("<table id=\"" + this.id + "main\" name=\"" + this.id + "main\" width=\"" + this.width + "\" height=\"" + this.height + "\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" align=\"center\">");
		document.write("<tr><td class=\"calendarCell\" style=\"border-color:" + pBackgroundColor + "\" colspan=\"4\"><select class=\"inputline\" style=\"width:100%\" id=\"" + this.id + "months\" name=\"" + this.id + "months\" onchange=\"\"></select></td>");
		document.write("<td class=\"calendarCell\" style=\"border-color:" + pBackgroundColor + "\" colspan=\"3\"><select class=\"inputline\" style=\"width:100%\" id=\"" + this.id + "years\" name=\"" + this.id + "years\" onchange=\"\"></select></td></tr>");
		document.write("<tr>");
		for (i=1; i<=7; i++) document.write("<td class=\"calendarCell\" style=\"border-color:" + pBackgroundColor + "\" bgcolor=\"" + this.backgroundColor + "\" id=\"s" + this.id + i +"\" style=\"color:white\">" + dayArray[i-1] + "</td>");
		document.write("</tr><tr>");
		for (i=1; i<=42; i++){
			document.write("<td class=\"calendarCell\" style=\"border-color:" + pBackgroundColor + "\" id=\"t" + this.id + i + "\">" + i + "</td>");
			if (i % 7 == 0) document.write("</tr><tr>");
		}
		document.write("<td class=\"calendarCell\" style=\"border-color:" + pBackgroundColor + "\" height=\"100%\" colspan=\"7\" id=\"" + this.id + "tstatus\" bgcolor=\"" + this.backgroundColor + "\" height=\"100%\" width=\"100%\" style=\"color:white\">:: status ::</td></tr></table>");
	}

	function calendar( pWidth, pHeight, pId, pDay, pMonth, pYear, pInactiveColor, pActiveColor, pBackgroundColor){

		// Properties

		this.curIndex = 1;
		this.prevIndex = -1;

		if (!pDay && !pMonth && !pYear) {
			this.day = today.getDate();
			this.month = today.getMonth();
			this.year = today.getFullYear();
		}
		else if (pDay && pMonth && pYear){
			this.day = pDay;
			this.month = pMonth;
			this.year = pYear;
		}
		else{
			document.write('Error in initialization parameters');
			return true;
		}

		this.initDay = this.day;
		this.initMonth = this.month;
		this.initYear = this.year;

		this.curDay = this.day;
		this.curMonth = this.month;
		this.curYear = this.year;

		if (!pId) {
			document.write('Error in initialization parameters');
			return true;
		}
		else {
			this.id = pId;
		}

		if (!pHeight && !pWidth){
			this.height = 200;
			this.width = 200;
		}
		else if (pHeight && pWidth){
			this.height = pHeight;
			this.width = pWidth;
		}
		else{
			document.write('Error in initialization parameters');
			return true;
		}

		if (!pInactiveColor) this.inactiveColor = "oldlace"; else this.inactiveColor = pInactiveColor;
		if (!pActiveColor) this.activeColor = "lightpink"; else this.activeColor = pActiveColor;
		if (!pBackgroundColor) this.backgroundColor = "lightgrey"; else this.backgroundColor = pBackgroundColor;

		// Methods

		this.clear = clearCalendar;
		this.initialize = initializeCalendar;
		this.addOptions = addOptions;
		this.draw = drawCalendar;

		// Constructor

		this.draw(pBackgroundColor);
		this.clear();
		this.addOptions();
		this.initialize();
	}
	
	function initializeArchiveCalendar(){
		if (((this.year % 4 == 0) && (this.yearear % 100 != 0)) || (this.year % 400 == 0)) monthDays[1] = 29; else monthDays[1] = 28;
		nDays = monthDays[this.month];
		firstDay = new Date();
		firstDay.setFullYear(this.year);
		firstDay.setMonth(this.month);
		firstDay.setDate(1);
		startDay = firstDay.getDay();

		dayCounter = startDay;
		if (startDay == 0) dayCounter = 7;
		startDay = dayCounter;
		
		var curTab;

		for (i=1; i<=nDays; i++, dayCounter++){
			curTab = document.getElementById("t" + this.id + dayCounter);
			if (this.signArray[i-1]>0){
				if (i != today.getDate()) 
					curTab.innerHTML = "<a style=\"color:" + this.activeColor + "\" href=\"" + this.targetURL + "?d=" + i + "&m=" + this.month + "&y=" + this.year + "\" onmouseover=\"this.style.textDecoration='underline';\" onmouseout=\"this.style.textDecoration='none';\">" + i + "</a>";
				else
					curTab.innerHTML = "<a style=\"color:" + this.textColor + "\" href=\"" + this.targetURL + "?d=" + i + "&m=" + this.month + "&y=" + this.year + "\" onmouseover=\"this.style.textDecoration='underline';\" onmouseout=\"this.style.textDecoration='none';\">" + i + "</a>";
				curTab.bgColor = this.URLbgColor;
				curTab.style.cursor = "hand";
			}
			else{
				curTab.innerText = i;
				curTab.bgColor = this.inactiveColor;
				curTab.style.color = this.textColor;
			}					   			   	
		}

		curTab = document.getElementById(this.id + "prevmonth");
		if (this.month == 0){
			curTab.href = this.selfURL + "?m=11&y=" + (1*this.year - 1);
		}
		else{
			curTab.href = this.selfURL + "?m=" + (1*this.month - 1) + "&y=" + this.year;
		}

		curTab = document.getElementById(this.id + "nextmonth");
		if (this.month == 11){
			curTab.href = this.selfURL + "?m=0&y=" + (1*this.year + 1);
		}
		else{
			curTab.href = this.selfURL + "?m=" + (1*this.month + 1) + "&y=" + this.year;
		}

		this.curIndex = startDay + this.day - 1;
		if (this.month == this.initMonth && this.year == this.initYear)
			doSelect(this);
		this.prevIndex = this.curIndex;

		var stTab = document.getElementById(this.id + "tstatus");
		stTab.innerHTML= monthNames[this.month] + ", " + this.year;
	}	
	
	function drawArchiveCalendar(pBackgroundColor){
		document.write("<table id=\"" + this.id + "main\" name=\"" + this.id + "main\" width=\"" + this.width + "\" height=\"" + this.height + "\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" align=\"center\">");
		document.write("<tr>");
		for (i=1; i<=7; i++) document.write("<td class=\"calendarCell\" style=\"border-color:" + pBackgroundColor + "\" bgcolor=\"" + this.backgroundColor + "\" id=\"s" + this.id + i +"\" style=\"color:white\">" + dayArray[i-1] + "</td>");
		document.write("</tr><tr>");
		for (i=1; i<=42; i++){
			document.write("<td class=\"calendarCell\" style=\"border-color:" + pBackgroundColor + "\" id=\"t" + this.id + i + "\">" + i + "</td>");
			if (i % 7 == 0) document.write("</tr><tr>");
		}
		document.write("<td class=\"calendarCell\" style=\"border-color:" + pBackgroundColor + "\" height=\"100%\" bgcolor=\"" + this.inactiveColor + "\"><a href=\"\" id=\"" + this.id + "prevmonth\" name=\"" + this.id + "prevmonth\"><img src=\"images/leftarrow.gif\" width=\"16\" height=\"17\" border=\"0\"></a></td><td class=\"calendarCell\" style=\"border-color:" + pBackgroundColor + "\" height=\"100%\" colspan=\"5\" id=\"" + this.id + "tstatus\" bgcolor=\"" + this.backgroundColor + "\" height=\"100%\" width=\"100%\" style=\"color:white\">:: status ::</td><td class=\"calendarCell\" style=\"border-color:" + pBackgroundColor + "\" height=\"100%\" bgcolor=\"" + this.inactiveColor + "\"><a href=\"\" id=\"" + this.id + "nextmonth\" name=\"" + this.id + "nextmonth\"><img src=\"images/rightarrow.gif\" width=\"16\" height=\"17\" border=\"0\"></a></td></tr></table>");
	}

	function archiveCalendar( pWidth, pHeight, pId, pDay, pMonth, pYear, pInactiveColor, pActiveColor, pBackgroundColor, pSignArray, pSelfURL, pTargetURL, pURLbgColor, pTextColor){

		// Properties

		this.signArray = pSignArray;
		this.selfURL = pSelfURL;
		this.targetURL = pTargetURL;
		
		this.curIndex = 1;
		this.prevIndex = -1;

		if (!(pMonth+1) && !pYear) {
			this.day = today.getDate();
			this.month = today.getMonth();
			this.year = today.getFullYear();
		}
		else if ((pMonth+1) && pYear){
			this.day = today.getDate();
			this.month = pMonth;
			this.year = pYear;
		}
		else{
			document.write('Error in initialization parameters');
			return true;
		}

		this.initDay = today.getDate();
		this.initMonth = today.getMonth();
		this.initYear = today.getFullYear();

		this.curDay = this.day;
		this.curMonth = this.month;
		this.curYear = this.year;		

		if (!pId) {
			document.write('Error in initialization parameters');
			return true;
		}
		else {
			this.id = pId;
		}

		if (!pHeight && !pWidth){
			this.height = 200;
			this.width = 200;
		}
		else if (pHeight && pWidth){
			this.height = pHeight;
			this.width = pWidth;
		}
		else{
			document.write('Error in initialization parameters');
			return true;
		}

		if (!pInactiveColor) this.inactiveColor = "oldlace"; else this.inactiveColor = pInactiveColor;
		if (!pActiveColor) this.activeColor = "lightpink"; else this.activeColor = pActiveColor;
		if (!pBackgroundColor) this.backgroundColor = "lightgrey"; else this.backgroundColor = pBackgroundColor;
		if (!pURLbgColor) this.URLbgColor = "bisque"; else this.URLbgColor = pURLbgColor;
		if (!pTextColor) this.textColor = "black"; else this.textColor = pTextColor;

		// Methods

		this.clear = clearCalendar;
		this.initialize = initializeArchiveCalendar;
		this.draw = drawArchiveCalendar;

		// Constructor

		this.draw(pBackgroundColor);
		this.clear();
		this.initialize();
	}
	
	
//-->

