function selectAll(theField) {
var tempval=eval("document."+theField)
tempval.focus()
tempval.select()
}
function checkBrowser(){
this.ver=navigator.appVersion
this.dom=document.getElementById?1:0
this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
this.ie4=(document.all && !this.dom)?1:0;
this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
this.ns4=(document.layers && !this.dom)?1:0;
this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
return this
}
bw=new checkBrowser()
function show(div,nest){
obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0; 
obj.display='block'
}
function hide(div,nest){
obj=bw.dom?document.getElementById(div).style:bw.ie4?document.all[div].style:bw.ns4?nest?document[nest].document[div]:document[div]:0; 
obj.display='none'
}

//календар


function getFirstDay(theYear, theMonth)
{	var firstDate = new Date(theYear,theMonth,1);	return firstDate.getDay();}
function getMonthLen(theYear, theMonth) 
{	var oneDay = 1000 * 60 * 60 * 24;	var thisMonth = new Date(theYear, theMonth, 1);	var nextMonth = new Date(theYear, theMonth + 1, 1);
	var len = Math.ceil((nextMonth.getTime() - thisMonth.getTime())/oneDay);return len;}
function getObject(obj) 
{
	var theObj;
	if (document.all) if (typeof obj == "string")return document.all(obj);else return obj.style;
	if (document.getElementById) if (typeof obj == "string") return document.getElementById(obj);	else return obj.style;
	return null;
}
function populateTable(form) 
{
	var theMonth = form.chooseMonth.selectedIndex;
	var theYear = parseInt(form.chooseYear.options[form.chooseYear.selectedIndex].text);
	var firstDay = getFirstDay(theYear, theMonth);
	var howMany = getMonthLen(theYear, theMonth);
	var dayCounter = 1;
	var TBody = getObject("tableBody");
	while (TBody.rows.length > 0)	TBody.deleteRow(0);
	var newR, newC;
	var done=false;
	while (!done) 
	{
		newR = TBody.insertRow(TBody.rows.length);
		for (var i = 0; i < 7; i++) 
		{
			newC = newR.insertCell(newR.cells.length);
			if (TBody.rows.length == 1 && i < firstDay) {newC.innerHTML = "";continue;}
			if (dayCounter == howMany) done = true;
			newC.innerHTML = (dayCounter <= howMany) ? "<input type=submit value='"+dayCounter+"' class=clndr_date name=day>" : "";
			++dayCounter;
		}
	}
}


function confirmAction()
{
	return confirm("Ви дійсно хочете провести операцію знищення?");
}

function selectall(form)
{
	for (var i=0;i<form.elements.length;i++)
		if (form.elements[i].type == 'checkbox') form.elements[i].checked=true;
}
function deselectall(form)
{
	for (var i=0;i<form.elements.length;i++)
		if (form.elements[i].type == 'checkbox') form.elements[i].checked=false;
}