var resol=(window.screen.width<=800)?0:1;
var BW;
if (navigator.appName.indexOf('Netscape')!=-1) {
	if (navigator.appVersion.indexOf('5.0')!=-1) BW='MO';
	else BW='NC';
}
if (navigator.userAgent.indexOf('Opera')!=-1) BW='OP';
if (!BW) BW="IE";
//------------------------------------------------------------------------------------------------------------------------------------
function getabscoords(){
	var addleft, addtop;
	if ((BW=='MO')||(BW=='IE')||(BW=='OP')) {
		var mt=document.getElementById("maintable");
		addleft=getOffset(mt)[0];
		addtop=getOffset(mt)[1];
	}
	if (BW=='NC') {
		hwidth=(resol==1)?1004:780; 
		hheight=(resol==1)?648:480;
		addleft=(window.innerWidth-16-hwidth)/2;
		addtop=(window.innerHeight-16-hheight)/2;
		if (addleft<0) addleft=0;
		if (addtop<0) addtop=0;
	}
	return [addleft,addtop]
}
//------------------------------------------------------------------------------------------------------------------------------------
function show_dl(dlname, left, top){ //htmlfuncs.php
	if ((BW=='MO')||(BW=='OP')) {
		document.getElementById(dlname).style.left=left;
		document.getElementById(dlname).style.top=top;
		document.getElementById(dlname).style.visibility='visible';
	}
	if (BW=='NC') {
		eval('document.'+dlname).left=left;
		eval('document.'+dlname).top=top;
		eval('document.'+dlname).visibility="show";
	}
	if (BW=='IE') {
		eval("document.all."+dlname).style.left=left;
		eval("document.all."+dlname).style.top=top;
		eval(dlname).style.visibility='visible';
	}
}
//------------------------------------------------------------------------------------------------------------------------------------
function hide_dl(dlname){ //htmlfuncs.php
	if ((BW=='MO')||(BW=='OP')) {
		document.getElementById(dlname).style.left=0;
		document.getElementById(dlname).style.top=0;
		document.getElementById(dlname).style.visibility='hidden';
	}
	if (BW=='NC') {
		eval('document.'+dlname).left=0;
		eval('document.'+dlname).top=0;
		eval('document.'+dlname).visibility="hide";
	}
	if (BW=='IE') {
		eval("document.all."+dlname).style.left=0;
		eval("document.all."+dlname).style.top=0;
		eval(dlname).style.visibility='hidden';
	}
}
//------------------------------------------------------------------------------------------------------------------------------------
function opendl(dlname){ //htmlfuncs.php
	var str="";
  if ((BW=='MO')||(BW=='IE')||(BW=='OP')) str="<div id=\""+dlname+"\" style=\"visibility:hidden; position:absolute;\">";
	if (BW=='NC') str="<layer name=\""+dlname+"\" visibility=\"hide\">";
	return str;
}
//------------------------------------------------------------------------------------------------------------------------------------
function closedl(){ //htmlfuncs.php
	var str="";
  if ((BW=='MO')||(BW=='IE')||(BW=='OP')) str="</div>";
	if (BW=='NC') str="</layer>";
	return str;
}
//------------------------------------------------------------------------------------------------------------------------------------
function getOffset(Obj) {
	var x, y;
	x = Obj.offsetLeft;
	y = Obj.offsetTop;
	ce =Obj.offsetParent;
	while (ce!=null)	{
		y += ce.offsetTop;
		x += ce.offsetLeft;
		ce = ce.offsetParent;
	}
	return [x,y];
}
//------------------------------------------------------------------------------------------------------------------------------------
function openWindow(theurl,features) 
{myWin=window.open("","",features);
 myWin.document.open();
 myWin.document.clear(); 
 myWin.document.write("<html><body leftmargin=\"0\" topmargin=\"0\"><img src="+theurl+"></body></html>");
 myWin.document.close();
}
//========================================Main Page Funcs=================================================================
function simpledl(left,top,right,bottom, name, href, posleft, postop){ //htmlfuncs.php
	var str="";
	abscoords=getabscoords();
	ileft=left+abscoords[0];
	itop=top+abscoords[1];
	iwidth=right-left;
	iheight=bottom-top;
	if ((BW=='MO')||(BW=='IE')||(BW=='OP')) str="<div id=\"s"+name+"\" style=\"position:absolute; top:"+itop+"px; left:"+ileft+"px\">";
	if (BW=='NC') str="<layer name=\"s"+name+"\" top=\""+itop+"\" left=\""+ileft+"\" onMouseOut=\"hide_dl(\'"+name+"\')\">";
	str+="<a href=\""+href+"\" onMouseOver=\"light_show('"+name+"', "+posleft+", "+postop+");\"  onMouseOut=\"hide_dl('"+name+"')\"><img src=\"images/spacer.gif\" width=\""+iwidth+"\" height=\""+iheight+"\" border=\"0\"></a>"
	if ((BW=='MO')||(BW=='IE')||(BW=='OP')) str+="</div>";
	if (BW=='NC') str+="</layer>";
	return str;
}
//------------------------------------------------------------------------------------------------------------------------------------
function textdl(left,top, wt, ht,text){ //htmlfuncs.php
	var str="";
	abscoords=getabscoords();
	ileft=left+abscoords[0];
	itop=top+abscoords[1];
	if ((BW=='MO')||(BW=='IE')||(BW=='OP')) str="<div id=\"stext\" style=\"position:absolute; top:"+itop+"px; left:"+ileft+"px;width:"+wt+";height:"+ht+"\">";
	if (BW=='NC') str="<layer name=\"stext\" top=\""+itop+"\" left=\""+ileft+"\" width=\""+wt+"\" height=\""+ht+"\">";
	str+="<font color=\"#FFFFFF\"><b>"+text+"</b></font>";
	if ((BW=='MO')||(BW=='IE')||(BW=='OP')) str+="</div>";
	if (BW=='NC') str+="</layer>";
	return str;
}
//------------------------------------------------------------------------------------------------------------------------------------
function reset_simpledl(left,top,name){ //htmlfuncs.php
	var str="";
	abscoords=getabscoords();
	ileft=left+abscoords[0];
	itop=top+abscoords[1];
	if (BW=='MO') {
		document.getElementById("s"+name).style.left=ileft;
		document.getElementById("s"+name).style.top=itop;
	}
	if (BW=='NC') {
		eval('document.s'+name).left=ileft;
		eval('document.s'+name).top=itop;
	}
	if (BW=='IE') {
		eval("document.all.s"+name).style.left=ileft;
		eval("document.all.s"+name).style.top=itop;
	}
}
//------------------------------------------------------------------------------------------------------------------------------------
function light_show(name, left, top){ //htmlfuncs.php
	abscoords=getabscoords();
	left=left+abscoords[0];
	top=top+abscoords[1];
	show_dl(name, left, top);
}
//========================================Menu Funcs=================================================================
var openMenu;
var activeImg = new Image();
function dmenu_up(name){
	var str=""; 
	str=opendl(name);
	str+='<table cellpadding="0" cellspacing="0"><tr>';
	str+='<td width="11" height="15"><img src="images/dmenu_lu.gif" width="11" height="15"></td>';
	str+='<td height="15" background="images/dmenu_u.gif"><img src="images/spacer.gif" height="15"></td>';
	str+='<td width="11" height="15"><img src="images/dmenu_ru.gif" width="11" height="15"></td></tr><tr>';
	str+='<td width="11" bgcolor="#229CCE"><img src="images/spacer.gif" width="11" height="1"></td><td bgcolor="#229CCE">';
	return str;
}
//------------------------------------------------------------------------------------------------------------------------------------
function dmenu_down(){ //htmlfuncs.php
	var str="";
	str='</td><td width="11" bgcolor="#229CCE"><img src="images/spacer.gif" width="11" height="1"></td>';
	str+='</tr><tr><td width="11" height="19"><img src="images/dmenu_ld.gif" width="11" height="19"></td>';
	str+='<td height="19" background="images/dmenu_d.gif"><img src="images/spacer.gif" height="19"></td>';
	str+='<td width="11" height="19"><img src="images/dmenu_rd.gif" width="11" height="19"></td></tr></table>';
	str+=closedl();
	return str;
}
//------------------------------------------------------------------------------------------------------------------------------------
function show_menu(imgO ,dlname) {
	if (!openMenu) {
		activeImg=imgO;
		if ((BW=='MO')||(BW=='IE')||(BW=='OP')) var dl=document.getElementById(dlname);
		if (BW=='NC') var dl=document.layers[dlname];
		w=dl.offsetWidth;
		h=dl.offsetHeight;
		t=getOffset(activeImg)[1]+activeImg.offsetHeight;
		l=getOffset(activeImg)[0]-Math.round((dl.offsetWidth-activeImg.offsetWidth)/2);
		openMenu=new MenuItem(dlname, w, h, l, t);
		show_dl(openMenu.name, openMenu.left, openMenu.top);
	}
}
//------------------------------------------------------------------------------------------------------------------------------------
function hide_menu(e){
	if ((BW=='IE')||(BW=='OP')) {
		mX=window.event.clientX+document.body.scrollLeft;
		mY=window.event.clientY+document.body.scrollTop;
	}
	if ((BW=='NC')||(BW=='MO')) {
		mX=e.pageX;	
		mY=e.pageY;
	}
	isHide=1;
	if (openMenu) {
		iLeft=getOffset(activeImg)[0];
		iTop=getOffset(activeImg)[1];
		iRight=iLeft+activeImg.offsetWidth;
		iBot=iTop+activeImg.offsetHeight;
		if ((mX>=iLeft)&&(mY>=iTop)&&(mX<=iRight)&&(mY<=iBot)) isHide=0;
		dlLeft=openMenu.left;
		dlTop=openMenu.top;
		dlRight=dlLeft+openMenu.w;
		dlBot=dlTop+openMenu.h;
		if ((mX>=dlLeft)&&(mY>=dlTop)&&(mX<=dlRight)&&(mY<=dlBot)) isHide=0;
		if (isHide) {
			hide_dl(openMenu.name);
			openMenu=null;
		}
	}
}
//------------------------------------------------------------------------------------------------------------------------------------
function MenuItem (mname,w, h, l, t) {
	this.name=mname;
	this.w=w;
	this.h=h;
	this.left=l;
	this.top=t;
}

function del(val){
	if (window.confirm('Вы действительно хотите это удалить?')) document.location.href(val);
}