total=61;

function thru_fr(texto)
{
	boo=parent.document.getElementById("4_resend").value;
	parent.document.getElementById(boo).value=texto;
}

function opclose(messagaN, imgN)
{
 if(messagaN.style.display=='none')
 {
	messagaN.style.display="";
	document.images[imgN].src='./ico/minus.gif';
 }
 else 
 {
	messagaN.style.display='none';
	document.images[imgN].src='./ico/plus.gif';
 }
}

function OpenWin(table, column, what) 
{
	myWin = open("new.php?table="+table+"&column="+column+"&what="+what,"displayWindow","width=400,height=300,status=no,toolbar=no,menubar=no");
}

function newpa(table, column, what)
{
	if(tvalue = prompt('Добавить новый '+what+' в таблицу '+table,'new'))
	{
//		document.unonomo363.submit();
		document.addform.table_name.value=table;
		document.addform.column_name.value=column;
		document.addform.t_value.value=tvalue;
		document.addform.submit();
	}
}

function lamat(form,text) {
divia = document.getElementById("yo12");
	if(form=='durak')
	{
    	document.forms[formalion]['naim'].value = text;
		divia.style.display="none";		
	}
	else
	{
		formalion=0;
		formalion="unonomo"+form;
		divia.style.display="";		
	}
   	return false;
}

Popdown = function() {}
Popdown.timer = null;
Popdown.ptimeout = 200;
Popdown.pcancel = function() { clearTimeout(Popdown.timer) }
Popdown.pd = function(tgt, id, place) {
if(!place) place = 'br';
Popdown.pcancel();
lt = new KLayer(null,null);
lt.object = tgt;
lt.style=lt.css=lt.object[KL_styleSwitch];
lp = layer(id);
lp.style.display = 'block';
if(place == 'br')
lp.move(lt.getAbsoluteLeft(),lt.getAbsoluteTop()+lt.getHeight());
else if(place == 'bl')
lp.move(lt.getAbsoluteLeft()+lt.getWidth()-lp.getWidth(),lt.getAbsoluteTop()+lt.getHeight());
else if(place == 'tl')
lp.move(lt.getAbsoluteLeft()+lt.getWidth()-lp.getWidth(),lt.getAbsoluteTop()-lp.getHeight());
else if(place == 'tr')
lp.move(lt.getAbsoluteLeft(),lt.getAbsoluteTop()-lp.getHeight());

}
Popdown.px = function(id) {
Popdown.pcancel();
Popdown.timer = setTimeout('Popdown.phide("'+id+'")', Popdown.ptimeout);
}
Popdown.phide = function(id) {
layer(id).style.display = 'none';
}


function SelAll(valtz,formname)
{
 var len = document.forms.length;
  for(var i=0; i<len; i++)
  {
	var zasunut = document.forms[i].todo;
//	alert( document.forms[i].name.substring(0,5))
	if(document.forms[i].name.substring(0,5)==formname.substring(0,5))
	{
		 zasunut.value = valtz;
//		 alert("message " + zasunut.value)
	}
  }
}


<!-- календарище!! -->

var oldLink = null;
// code to change the active stylesheet
function setActiveStyleSheet(link, title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
//  if (oldLink) oldLink.style.fontWeight = 'normal';
// oldLink = link;
//  link.style.fontWeight = 'bold';
  return false;
}

// This function gets called when the end-user clicks on some date.
function selected(cal, date) {
  cal.sel.value = date; // just update the date in the input field.
//  if (cal.dateClicked && (cal.sel.id == "sel1" || cal.sel.id == "sel3"))
    // if we add this call we close the calendar on single-click.
    // just to exemplify both cases, we are using this only for the 1st
    // and the 3rd field, while 2nd and 4th will still require double-click.
    cal.callCloseHandler();
}

// And this gets called when the end-user clicks on the _selected_ date,
// or clicks on the "Close" button.  It just hides the calendar without
// destroying it.
function closeHandler(cal) {
  cal.hide();                        // hide the calendar
//  cal.destroy();
  _dynarch_popupCalendar = null;
}

// This function shows the calendar under the element having the given id.
// It takes care of catching "mousedown" signals on document and hiding the
// calendar if the click was outside.
function showCalendar(id, format, showsTime, showsOtherMonths) {
  var el = document.getElementById(id);
  if (_dynarch_popupCalendar != null) {
    // we already have some calendar created
    _dynarch_popupCalendar.hide();                 // so we hide it first.
  } else {
    // first-time call, create the calendar.
    var cal = new Calendar(1, null, selected, closeHandler);
    // uncomment the following line to hide the week numbers
    // cal.weekNumbers = false;
    if (typeof showsTime == "string") {
      cal.showsTime = true;
      cal.time24 = (showsTime == "24");
    }
    if (showsOtherMonths) {
      cal.showsOtherMonths = true;
    }
    _dynarch_popupCalendar = cal;                  // remember it in the global var
    cal.setRange(1900, 2070);        // min/max year allowed.
    cal.create();
  }
  _dynarch_popupCalendar.setDateFormat(format);    // set the specified date format
  _dynarch_popupCalendar.parseDate(el.value);      // try to parse the text in field
  _dynarch_popupCalendar.sel = el;                 // inform it what input field we use

  // the reference element that we pass to showAtElement is the button that
  // triggers the calendar.  In this example we align the calendar bottom-right
  // to the button.
  _dynarch_popupCalendar.showAtElement(el.nextSibling, "Br");        // show the calendar

  return false;
}

var MINUTE = 60 * 1000;
var HOUR = 60 * MINUTE;
var DAY = 24 * HOUR;
var WEEK = 7 * DAY;

// If this handler returns true then the "date" given as
// parameter will be disabled.  In this example we enable
// only days within a range of 10 days from the current
// date.
// You can use the functions date.getFullYear() -- returns the year
// as 4 digit number, date.getMonth() -- returns the month as 0..11,
// and date.getDate() -- returns the date of the month as 1..31, to
// make heavy calculations here.  However, beware that this function
// should be very fast, as it is called for each day in a month when
// the calendar is (re)constructed.
function isDisabled(date) {
  var today = new Date();
  return (Math.abs(date.getTime() - today.getTime()) / DAY) > 10;
}
