function menuMouseover(item, num)
{
	item.style.background="url(/images/menu"+num+"_a.jpg)";
}

function menuMouseout(item, num)
{
	item.style.background="url(/images/menu"+num+"_p.jpg)";
}

function menuOnclick(url)
{
	window.location.href=url;
}

function moreMouseEvent(item, evt)
{
	if(evt.type=="mouseover") 
		item.src="/images/button_more_p.jpg";
	else
		item.src="/images/button_more_a.jpg";
}

function search()
{
	document.getElementById("wordfind").submit();
}

function openWindow(width, height, caption, url)
{
	var iLeft = (self.screen.width  - width ) / 2;
    var iTop  = (self.screen.height - height ) / 2;
    var sOptions = "toolbar=no,status=no,resizable=no,dependent=yes,scrollbars=yes,";
    sOptions += ",width="+ width+",height="+height;
    sOptions += ",left="+iLeft+",top="+iTop;
    var oWindow = window.open(url, '', sOptions );
}

function nextDate(date)
{
    var mmyear = date.substr(0,4);
	var mmmonth = date.substr(5,2)-1;
	var mmday = date.substr(8,1)*10+parseInt(date.substr(9,1))+1;

    var newmdate = new Date(mmyear, mmmonth, mmday,0,0,0);
    var zero = (newmdate.getDate()<10)?'0':'';
	var zero1 = (newmdate.getMonth()<9)?'0':'';
	return zero + newmdate.getDate()+"."+zero1+
							(parseInt(newmdate.getMonth())+1)+"."+
							newmdate.getFullYear();

}

function expandRegion(id,addr,tels,dir)
{
	var reg=document.getElementById("reg"+id);
	if(reg.innerHTML=="")
		reg.innerHTML="<ul><li><b>Ünvan:</b> "+addr+"<li><b>Telefon:</b> "+tels+" <li><b>Müdir:</b> "+dir+"</ul>";
	else
		reg.innerHTML="";
}

function expandRegionEn(id,addr,tels)
{
	var reg=document.getElementById("reg"+id);
	if(reg.innerHTML=="")
		reg.innerHTML="<ul><li><b>Address:</b> "+addr+"<li><b>Phone:</b> "+tels+" </ul>";
	else
		reg.innerHTML="";
}

function expandRegionRu(id,addr,tels)
{
	var reg=document.getElementById("reg"+id);
	if(reg.innerHTML=="")
		reg.innerHTML="<ul><li><b>Адрес:</b> "+addr+"<li><b>Телефон:</b> "+tels+"</ul>";
	else
		reg.innerHTML="";
}

var iCountWnd = 32;
var iWnd = -1;
var wndImg = new Array(iCountWnd);

function ShowPhoto()
{
 if((this.imgPath != "undefined") && (this.imgTitle != "undefined")) {
    TImg.src = this.imgPath;
    MyId.innerHTML = this.imgTitle;
	clearInterval(this.time1);
	this.time2 = setInterval("ResizePhoto()", 100);
 }
}

function ResizePhoto()
{
 if((TImg.complete) && (TImg.width>4)) {	 
    TdMess.innerHTML = "";						  
    TdMess.style.height = 0;
    if((TImg.height + MyId.clientHeight+60) > 600) {
		this.moveTo((screen.width - (TImg.width+12))/2, 20);
    }
	this.resizeTo(TImg.width+12, TImg.height + MyId.clientHeight+60);
	clearInterval(this.time2);
  }
}

function ImageLoad()
{
 this.time1 = setInterval("ShowPhoto()", 100);
}

function OpenImage(Phath, PTitle, PathPrefix, urlEmptyHTML)
{
 iWnd++;
 if(iWnd >= iCountWnd) iWnd = 0;
 var left = (screen.width-612)/2;
 var top = (screen.height-432)/2 - 60;
 var str = "toolbar=no, scrollbars=auto, resizable=no, status=yes, location=no, width=600, height=420 , left=" +
		    left + ", top=" + top;
			
 var strWndName = "Name_"+iWnd;
 var FullPath, PathEmptyHTML;

 FullPath = PathPrefix + Phath;

 PathEmptyHTML = urlEmptyHTML;
 wndImg[iWnd] = open(PathEmptyHTML, strWndName, str);
 wndImg[iWnd].imgPath = FullPath;
 wndImg[iWnd].imgTitle = PTitle;
}
