<!--
//define browser
var isIE, isNS, isNS6, isDOM, lR, sR, vis, invis, myTimeOut, goName;
	if (document.all) {isIE= true;lR="document.all.";rR="";sR=".style";vis="visible";invis="hidden";}
	if (document.layers){isNS = true;lR="document.layers.";rR="";sR="";vis="show";invis="hide";}
	if (document.getElementById &&!isIE) {isDOM=true;lR = "document.getElementById('";rR="')";sR = "').style";invis ="hidden";vis = "visible"}
	if (isDOM == true && navigator.appName =="Netscape") isNS6 = true;

function display(nam,val)
{
if (val>0) {eval(""+lR+nam+sR+".visibility='"+vis+"';");} else {eval(""+lR+nam+sR+".visibility='"+invis+"';");}
if (!isNS) if (val>0) {eval(""+lR+nam+sR+".display='block';");} else {eval(""+lR+nam+sR+".display='none';");}
return;
}

function checkform()
{
if (arguments.length>0)
{
if (arguments.length>1)
 { 
 for (var i=1;i<arguments.length;i++)
  {
  if (document.forms[arguments[0]].elements[arguments[i]].value=="") 
     {
	 alert("Вы не заполнили обязательное поле!");
	 document.forms[arguments[0]].elements[arguments[i]].focus();
	 return false;
	 }
  }
 } else 
 {
 for (var i=0;i<document.forms[arguments[0]].elements.length;i++)
  {
  if (document.forms[arguments[0]].elements[i].value=="") 
     {
	 alert("Вы не заполнили обязательное поле!");
	 document.forms[arguments[0]].elements[i].focus();
	 return false;
	 }
   } 
 }//>1
}//>0
return true;
}

function showpic(nam,w,h,alt,val)
{
var rand=Math.floor(Math.random()*1000);
if (nam!="")
 {
myWin= open("", "win"+rand,"width="+w+",height="+h+",status=no,toolbar=no,menubar=no");

  // открыть объект document для последующей печати 
  myWin.document.open();
  
  // генерировать новый документ 
  myWin.document.write("<html><head><title>"+alt+"</title></head>");
  myWin.document.write("<body bgcolor=#FFFFFF text=#000000 leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>");
  if (val>=4) {
  myWin.document.write("<OBJECT classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" WIDTH=\""+w+"\" HEIGHT=\""+h+"\" id=\"fla"+rand+"\" ALIGN=\"\">");
  myWin.document.write("<PARAM NAME=movie VALUE=\""+nam+"\">"); 
  myWin.document.write("<PARAM NAME=quality VALUE=high>");
  myWin.document.write("<PARAM NAME=bgcolor VALUE=#FFFFFF>");
  myWin.document.write("<EMBED src=\""+nam+"\" quality=high bgcolor=#FFFFFF  WIDTH=\""+w+"\" HEIGHT=\""+h+"\" NAME=\"fla"+rand+"\" ALIGN=\"\" TYPE=\"application/x-shockwave-flash\" PLUGINSPAGE=\"http://www.macromedia.com/go/getflashplayer\"></EMBED></OBJECT>");
  } else
  {
  myWin.document.write("<img src='"+nam+"' width='"+w+"' height='"+h+"' alt='"+alt+"'>");
  }
  myWin.document.write("</body></html>");
  // закрыть документ - (но не окно!)
  myWin.document.close();
 
 }
}

function setCookie(name, value, expires, path, domain, secure)
{
	var curCookie = name + "=" + escape(value) +
		((expires) ? "; expires=" + expires.toGMTString() : "") +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		((secure) ? "; secure" : "");
	if ((name + "=" + escape(value)).length <= 4000)
		document.cookie = curCookie;
	else
		if (confirm("Cookie превышает 4KB и будет вырезан !"))
				document.cookie = curCookie;
}

function getCookie(name)
{
	var prefix = name + "=";
	var cookieStartIndex = document.cookie.indexOf(prefix);
	if (cookieStartIndex == -1)
		return null;
	var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length);
	if (cookieEndIndex == -1)
		cookieEndIndex = document.cookie.length;
	return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex));
}

function deleteCookie(name, path, domain)
{
	if (getCookie(name))
	{
		document.cookie = name + "=" +
			((path) ? "; path=" + path : "") +
			((domain) ? "; domain=" + domain : "") +
			"; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}

var vc,vb,vn,vf;
if(navigator.appName=="Netscape")
	if(parseFloat(navigator.vendorSub)==6.01)vn=true;
function scc(gi){
	vc="";
	setTimeout("cc(\""+gi+"\")",300)
}
function cc(gi){
	if(vc==gi||vc.indexOf(gi)!=-1)return;
	var ti=gtmi(gi);
	if(gtmi(vc)!=ti)gi=ti+"_1";
	var m=document.getElementById("menu");
	var ms=m.getElementsByTagName("div");
	for(i=ms.length-1;i>=0;i--)
		if(ms[i].id.indexOf(gi)!=-1&&ms[i].id.length>=gi.length)ms[i].style.visibility="hidden";
}
function so(p,oi){
	var o=document.getElementById(oi);
	if(o.style.visibility=="visible")return;
	var t=0,l=0,op,ti=gtmi(oi);
	if(p.id!=ti){
		t+=p.offsetTop;
		op=document.getElementById(gpsmi(oi));
		if(!vn)t+=op.offsetTop;
		if(p.previousSibling)t+=1;
		l+=op.offsetLeft+op.offsetWidth+1
	}else{
		op=document.getElementById(ti);
		t+=op.offsetHeight;
		do{
			t+=op.offsetTop;l+=op.offsetLeft;
		}while(op=op.offsetParent)
	}
	if(vn)t-=1;
	o.style.top=t+5;
	o.style.left=l-5;
	o.style.visibility="visible";
	sfx(oi,0)
}
function sfx(mi,p){
	p+=10;var m=document.getElementById(mi);
	m.style.clip="rect(0px,auto,"+p+"px,0px)";
	if(p>=500)return;
	setTimeout("sfx(\""+mi+"\","+p+")",10)
}
function gpsmi(mi){
	return(mi.indexOf("_")==-1)?"":mi.substring(0,mi.lastIndexOf("_"))
}
function gtmi(mi){
	var p=mi.indexOf("_");
	return(p==-1)?mi:mi.substring(0,p)
}
function h(m){
	vb=m.style.backgroundColor;
	vf=m.style.color;
	m.style.backgroundColor="#E2E2E2";
	m.style.color="#CC0000";
}
function d(m){
	m.style.backgroundColor=vb;
	m.style.color=vf;
}
function omo(t,mi){
	h(t);
	vc=mi;
	so(t,mi)
}
function omot(t,mi){
	d(t);
	scc(mi)
}
//-->

function onmenu(image){
 var x=document.getElementById(image);
 var a=x.src;
 a=a.replace('.gif', '_.gif');
 a=a.replace('.jpg', '_.jpg');
 x.src=a;
 
}
 
function outmenu(image){
 var x=document.getElementById(image);
 var a=x.src;
 a=a.replace('_.gif', '.gif');
 a=a.replace('_.jpg', '.jpg');
 x.src=a;
 
}

/*****************************
           PopupWindow
******************************/

function getDims(winWidth, winHeight){
	var dims = new Object();
	dims.widthStr = '';
	dims.heightStr = '';
	dims.scrollbars = false;
	if (winWidth){
		dims.width = winWidth;
		if (screen.width < dims.width + 50){
			dims.width = screen.width - 50;
			dims.scrollbars = true;
		}
		dims.widthStr = ',width=' + dims.width;
	}
	
	if (winHeight){
		dims.height = winHeight;
		if (screen.height < dims.height + 100){
			dims.height = screen.height - 100;
			dims.scrollbars = true;
		}
		dims.heightStr = ',height=' + dims.height;
	}
	dims.scrollbarsStr = (dims.scrollbars)? ',scrollbars=yes' : ',scrollbars=no';
	dims.posX = Math.round((screen.width - dims.width) / 2);
	dims.posY = Math.round((screen.height - winHeight) / 2);
	dims.posCode = (document.all)? ',left=' + dims.posX + ',top=' + dims.posY : ',screenX=' + dims.posX + ',screenY=' + dims.posY;
	return dims;
}

function popupImg(imgSrc, winName, imgWidth, imgHeight, winTitle){
	winWidth = (imgWidth)? imgWidth + 20 : null;
	winHeight = (imgHeight)? imgHeight + 20 : null;
	var dims = getDims(winWidth, winHeight);
	var popupwin = window.open('', winName, 'menubar=no,toolbar=no,resizable=yes,status=yes' + dims.scrollbarsStr + dims.widthStr + dims.heightStr + dims.posCode);
	popupwin.resizeTo(dims.width + 12, dims.height + 62)

if (popupwin){
		popupwin.document.open();
		popupwin.document.write('<html><head><title>' + winTitle + '</title></head><body bgcolor="white" style="margin: 10px 10px; padding: 0px;">')
		popupwin.document.write('<img src="' + imgSrc + '" width="' + imgWidth + '" height="' + imgHeight + '" />')
		popupwin.document.write('</body></html>')
		popupwin.document.close();
		popupwin.focus();
	}
	return false;
}
