<!--
//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,flag)
{
if(!flag)flag = 0;
if(flag == 0){
	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';");}
}else{
	var v;
	if(eval(""+lR+nam+sR+".visibility;")==vis)
		v = invis;
	else
		v = vis;
	eval(""+lR+nam+sR+".visibility='"+v+"';");
	if (!isNS){
		v = eval(""+lR+nam+sR+".display;");
		if (v=='none')
			{eval(""+lR+nam+sR+".display='block';");}
		else
			{eval(""+lR+nam+sR+".display='none';");}}
	return false;
}
return;

}

function checkform()
{
	if (arguments.length>0)
	{
		var err = false
		var aler = false
		var form = document.forms[''+arguments[0]+'']
		if (arguments.length>1)
		 {
			 for (var i=1;i<arguments.length;i++)
			  {
				  elem = form.elements[arguments[i]]
				  if (elem.value=="")
					 {
						 if (!aler) {alert("Вы не заполнили обязательное поле!");aler=true;}
						 elem.style.border = "1px solid red";
						 err = true;
					 }
			  }
		 }
		 else
		 {
			 for (var i=0;i<document.forms[arguments[0]].elements.length;i++)
			  {
				  elem = form.elements[arguments[i]]
				  if (elem.value=="")
					 {
						 if (!aler) {alert("Вы не заполнили обязательное поле!");aler=true;}
						 elem.style.border = "1px solid red";
						 err = true;
					 }
			   }
		 }//>1
	}//>0
	
	if (err == true) return false;
	else 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";
	}
}

////////////////MAIL/////////////////
//m(name,subject,body,server)
function m(name)
{
var mi="to";
var host="";
var fi="mail";
var ri=":";
var sbj="";
var bdi="";
if (arguments[1]) sbj="?subject="+arguments[1];
if (arguments[2]) {if (sbj) bdi="&";bdi=bdi+"body="+arguments[2];}
if (arguments[3])
{
host=arguments[3];
} else
{
host=location.href;
host=host.substr(host.indexOf("//")+2,host.length);
host=host.substr(0,host.indexOf("/"));
if (host.indexOf("www.")!=-1) host=host.substr(host.indexOf("www.")+4,host.length);
}
location.href=fi+mi+ri+name+unescape("%40")+host+sbj+bdi;
}
//pm(name,server)
function pm(name)
{
var host="";
if (arguments[1])
{
host=arguments[1];
} else
{
host=location.href;
host=host.substr(host.indexOf("//")+2,host.length);
host=host.substr(0,host.indexOf("/"));
if (host.indexOf("www.")!=-1) host=host.substr(host.indexOf("www.")+4,host.length);
}
document.write(name+unescape("%40")+host);
}

function rm(name)
{
var mi="to";
var host="";
var fi="mail";
var ri=":";
var sbj="";
var bdi="";
if (arguments[1]) sbj="?subject="+arguments[1];
if (arguments[2]) {if (sbj) bdi="&";bdi=bdi+"body="+arguments[2];}
if (arguments[3])
{
host=arguments[3];
} else
{
host=location.href;
host=host.substr(host.indexOf("//")+2,host.length);
host=host.substr(0,host.indexOf("/"));
if (host.indexOf("www.")!=-1) host=host.substr(host.indexOf("www.")+4,host.length);
}
return fi+mi+ri+name+unescape("%40")+host+sbj+bdi;
}

function reference(link)
{
if (link) location.href=link;
}

function rewrite(idobj,mod,text,objs){
	if(!objs){
		if(mod == "innerHTML")
			document.getElementById(idobj).innerHTML = text;
		if(mod == "outerHTML")
			document.getElementById(idobj).outerHTML = text;
	}else{
		var myobjs = objs.split(",");
		if(myobjs.length==2){
			if(mod == "innerHTML"){
				var obj = document.getElementById(idobj).innerHTML;
				if(obj==objs[0]){
					document.getElementById(idobj).innerHTML = myobjs[1];
				}else{
					document.getElementById(idobj).innerHTML = myobjs[0];
				}
			}
			if(mod == "outerHTML"){
				var obj = document.getElementById(idobj).outerHTML;
			    if(obj==objs[0]){
					document.getElementById(idobj).outerHTML = myobjs[1];
				}
				else{
					document.getElementById(idobj).outerHTML = myobjs[0];
				}
			}
		}
	}
	return;
}
///////////////END MAIL/////////////////
//-->