function indOf() {
	if (typeof Array.prototype.indexOf == "undefined") {
	  Array.prototype.indexOf = function(value) {
		for (var i = 0; i < this.length; i++)
		  if (this[i] == value)
			return i;
	
		return -1;
	  }
	}
}

var isGecko = navigator.userAgent.toLowerCase().indexOf("gecko") != -1;
var isOpera = navigator.userAgent.toLowerCase().indexOf("opera") != -1;
var isIE = navigator.userAgent.toLowerCase().indexOf("msie") != -1;
var isIE6 = navigator.userAgent.toLowerCase().indexOf("msie 6") != -1;

/*popup*/
function simple_tooltip(target_items, name){
/*	var amas = document.getElementsByTagName("A");
	var len = amas.length;
	for (var i=0; i<len; i++) {
		if (amas[i].className == 'popUp') {
			$("body").append("<div class='"+name+"' id='"+name+i+"'><h4></h4><p></p></div>");
		}
	}*/
 $(target_items).each(function(i){
	 if (($(this).attr('class') == 'popUp') && ($(this).attr('title'))) {
		 $("body").append("<div class='"+name+"' id='"+name+i+"'><h4></h4><p>"+$(this).attr('title')+"</p></div>");
		 var my_tooltip = $("#"+name+i);
		
		 $(this).removeAttr("title").mouseover(function(){
		 my_tooltip.css({opacity:0.8, display:"none"}).fadeIn(400);
		 }).mousemove(function(kmouse){
		 my_tooltip.css({left:kmouse.pageX+15, top:kmouse.pageY+15});
		 }).mouseout(function(){
		 my_tooltip.fadeOut(400);
	 	});
	}
 });
}

function ativaOptionsDisabled(){
	if (document.getElementsByTagName) {
		var s = document.getElementsByTagName("select");
		
		if (s.length > 0) {
			window.select_current = new Array();
			
			for (var i=0, select; select = s[i]; i++) {
				select.onfocus = function(){ window.select_current[this.id] = this.selectedIndex; }
				select.onchange = function(){ restore(this); }
				emulate(select);
			}
		}
	}
}

function restore(e) {
	if (e.options[e.selectedIndex].disabled) {
		e.selectedIndex = window.select_current[e.id];
	}
}

function emulate(e) {
	for (var i=0, option; option = e.options[i]; i++) {
	
		if (option.disabled) {
		option.style.color = "graytext";
		}
		else {
		option.style.color = "menutext";
		}
	}
}

function setCookie(name, value, flag, expire)	{
	
if (!expire) expire = 30;
var todayDate = new Date();
todayDate.setDate(todayDate.getDate() + expire);
	
if (name == 'g_id')
{
	str=getCookie ('g_id');
	if (str)
	str = str + '#' + value + ";";
	else 
	str = value + ";";
	COOKIE = name + "=" + str + " expires=Mon, 02-Mar-2009 00:00:00 GMT";
	//alert (COOKIE);
	document.cookie=COOKIE;
}
else
{

	var COOKIE;
  	if (flag) {

  		COOKIE = name + "=" + value + "; domain=" + location.protocol + "//" + location.hostname + "; expires=Mon, 02-Mar-2009 00:00:00 GMT";
  	} else {
  		COOKIE = name + "=" + value + "; expires=Mon, 02-Mar-2009 00:00:00 GMT";  
				
  	}
  	document.cookie = COOKIE;
}
return false;
}

function delCookie(name, value, flag, expire)	{
	
if (!expire) expire = 30;
var todayDate = new Date();
todayDate.setDate(todayDate.getDate() + expire);
	
if (name == 'g_id')
{
	str=getCookie ('g_id');
	if (str) {
		if (str.search (value+'#') == -1)
			{
			if (str.search ('#'+value) == -1) str=str.replace (value, '');
			else str=str.replace ('#'+value, '');
			}
		else str=str.replace (value+'#', '');
	}

	COOKIE = name + "=" + str + "; expires=Mon, 02-Mar-2009 00:00:00 GMT";
	document.cookie=COOKIE;
}
}
function toBasket (id, price) {
//		alert (price);
	setCookie ('g_id' ,id, null);
	if (getCookie ('kol') && getCookie ('summa'))
	{
	kol= getCookie ('kol') * 1;
	summa = getCookie ('summa') * 1;
	}
	else
	{
		var kol=0;
		var summa=0;
	}
	kol++;
	summa+=price*1;
	setCookie ('kol', kol);
	setCookie ('summa', summa);
	
	

	document.getElementById('kol').innerHTML = ((document.getElementById('kol').innerHTML) * 1) + 1;
	var summa_grn=((document.getElementById('summa').innerHTML) * 1) + (price*1);
	document.getElementById('summa').innerHTML = summa_grn;
	var summa_dol= summa_grn / document.getElementById('dol').innerHTML;
	document.getElementById('summa_dol').innerHTML = summa_dol.toFixed(2);
	document.getElementById('basket_link'+id).innerHTML = "<a style='color:#fb7405;' href='javascript: void(0);' OnClick='fromBasket("+id+", "+price+");'>Удалить</a>";
	





}

function fromBasket (id, price) {

	delCookie ('g_id' ,id, null);
	var kol= getCookie ('kol') * 1 - 1;
	var summa = getCookie ('summa') * 1 - price*1; 
	var kurs_dol = document.getElementById('dol').innerHTML * 1;

	setCookie ('kol', kol);
	setCookie ('summa', summa);
	document.getElementById('kol').innerHTML = ((document.getElementById('kol').innerHTML) * 1) - 1;
	document.getElementById('summa').innerHTML = summa;
	var summa_dol=summa / kurs_dol;
	document.getElementById('summa_dol').innerHTML = summa_dol.toFixed(2);
	document.getElementById('basket_link'+id).innerHTML = "<a href='javascript: void(0);' OnClick='toBasket("+id+", "+price+");'>В корзину</a>";

}


function basketDelete (form) {
	
//getCookie('price')*1;
var summa=document.getElementById('summa').innerHTML;
var kol=document.getElementById('summa').innerHTML;
//getCookie('kol')*1;
//var kurs_dol = document.getElementById('dol').innerHTML * 1;
      for (var i = 0; i < form.elements.length; i++) {
            el = form.elements[i];
            elName = el.nodeName.toLowerCase();
            value = el.value;
			type= el.type;
			name=el.name;
			if ((type == "checkbox") && (el.checked == true) )
			{
			var id=name.substring(3);
			var price=document.getElementById ('price' + id).innerHTML*1;
		
			summa=summa - document.getElementById ('price' + id).innerHTML*1;
			kol = kol - 1;
			}
			}
			


			
			//alert ('bylo: ' + document.getElementById('summa').innerHTML +'stalo: '+ summa);
			document.getElementById('summa').innerHTML=summa;
			document.getElementById('summa_dol').innerHTML=(summa/kurs_dol).toFixed(2);
			document.getElementById('kol').innerHTML=kol;

form.submit();
}




function basket_check (total, flag)
{
	//alert (total);
	if (flag==1)
	{
	document.getElementById('kol').innerHTML = ((document.getElementById('kol').innerHTML) * 1) - 1;
	var summa=((document.getElementById('summa').innerHTML) * 1) - (total*1);
	document.getElementById('summa').innerHTML = summa;
	var summa_dol= summa / document.getElementById ('dol').innerHTML;
	document.getElementById('summa_dol').innerHTML = summa_dol.toFixed(2);
	}
	else
	{
	document.getElementById('kol').innerHTML = ((document.getElementById('kol').innerHTML) * 1) - 1;
	var summa=((document.getElementById('summa').innerHTML) * 1) - (total*1);
	document.getElementById('summa').innerHTML = summa;
	var summa_dol = summa / document.getElementById('dol').innerHTML;
	document.getElementById('summa_dol').innerHTML = summa_dol.toFixed(2);
	}
}


	function strpos( haystack, needle, offset){
 
    var i = (haystack+'').indexOf( needle, offset ); 
    return i===-1 ? false : i;
}


function getCookie(name) {
//	alert (document.cookie);
	var cookie = " " + document.cookie;
	var search = " " + name + "=";
	var setStr = null;
	var offset = 0;
	var end = 0;
	if (cookie.length > 0) {
		offset = cookie.indexOf(search);
		if (offset != -1) {
			offset += search.length;
			end = cookie.indexOf(";", offset)
			if (end == -1) {
				end = cookie.length;
			}
			setStr = unescape(cookie.substring(offset, end));
		}
	}

	
	return (setStr);
}


var isDHTML = 0;
var isLayers = 0;
var isAll = 0;
var isID = 0;
if (document.getElementByID) {isID=1; isDHTML=1;}
else {
        if (document.all) {isAll=1; isDHTML=1;}
        else { browserVersion = parseInt(navigator.appVersion);
              if ((navigator.appName.indexOf('Netscape') !=-1) && (browserVersion == 4)) {isLayers = 1; isDHTML = 1;}
}}

function findDOM(objectID,withStyle) {
	if (withStyle == 1) return(document.getElementById(objectID).style);
	else return(document.getElementById(objectID));
}

function findDOMobj(objectID) {
if (isID)  {return(document.getElementById(objectID)); }
                 else { if (isAll) {return (document.all[objectID]); }
                 else { if (isLayers) {return(document.layers[objectID]); }
};}

}


function toggleClamShellSec(objectID) {
     if (isAll || isID) {
          domStyle = findDOM(objectID, 1);
          if (domStyle.display=='block') domStyle.display='none';
          else domStyle.display='block';
     }
     else {
          destination = objectID + '.html';
          self.location = destination;
     }
     return;
}

function RemovePage(filename) {
  		if (confirm('Вы уверены, что желаете удалить страницу?'))
			location.replace(filename); 
		}

function MessageWin(str) {
  			alert(str);
}


function SubRegForm(login, pass1, pass2, email)
{
var re, msg='', sub=1;
re = /([0-9a-zA-Z\.-_]+)@([0-9a-zA-Z\.-_]+)/;

if (login.length == 0) {msg=msg+"Введите логин!\r\n"; sub = 0;}
if (pass1.length == 0) {msg=msg+"Введите пароль!\r\n"; sub = 0;}
if (pass1 != pass2) {msg=msg+"Несовадающие пароли!\r\n"; sub = 0;}
if (email.match(re) == null) {msg=msg+"Неверен или отсутствует e-mail!\r\n"; sub = 0;}

if (sub == 0) window.alert(msg);
if (sub == 1) document.reguser.submit();
}

function MM_popupMsg(msg, filename) {
	if (msg != '') {
  	if (confirm(msg))
		location.replace(filename); 
	}
	else location.replace(filename);
}


function PopupMsgForm(msg, formname) {
  	if (confirm(msg))
		 document.forms[formname].submit();	
}

function SubAction (select_content, pageid, pagename, location, pagechild) {
	if (select_content == 'delete') {
		if (pagechild == 1) alert ('Нельзя удалить страницу «'+pagename+'».\r\nСначала удалите все вложенные страницы!');
		else MM_popupMsg('Удалить страницу?', location+'&del='+pageid); 
	}
	else if (select_content == 'move') {
		//if(pagechild == 1) alert ('Нельзя переместить страницу «'+pagename+'», пока она имеет вложенные страницы!');
		//else if(pagechild == 0) document.location.replace(location+'&move='+pageid);
		document.location.replace(location+'&move='+pageid);
	}
}

function SubmitSearchForm()
{
var searchwords, sub=1;
searchwords = document.sf.searchwords.value;

if (searchwords.length == 0) {sub = 0;}
if ((searchwords.length != 0) && (searchwords.length <3)) {window.alert('Длина поисковой фразы должна составлять не менее 3 символов'); sub = 0;}

if (sub == 1) document.sf.submit();
}

/*function getCookie(name) {
	var cookie = " " + document.cookie;
	var search = " " + name + "=";
	var setStr = null;
	var offset = 0;
	var end = 0;
	if (cookie.length > 0) {
		offset = cookie.indexOf(search);
		if (offset != -1) {
			offset += search.length;
			end = cookie.indexOf(";", offset)
			if (end == -1) {
				end = cookie.length;
			}
			setStr = unescape(cookie.substring(offset, end));
		}
	}
	return(setStr);
}*/
function printVer(css, obj, title_tag, title, http_url, copyrights, site, links, printl) {
	var previewWin = window.open(location.href, 'PrintVersion', 'dependent=1,status=0,scrollbars=yes,resizable=no,menubar=yes,location=no,titlebar=1');
	var prTop = '<html><head><title>'+title_tag+'</title><link href="'+css+'" rel="STYLESHEET" type="text/css" /><script type=\'text/javascript\' src=\''+http_url+'javascript/print.js\'></script></head><body>';
	var prTitle = '<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td class="title">'+title+'</td><td class="host"><a href="'+http_url+'">'+site+'</a> ['+http_url+']</td></tr></table><div style="height:7px; width:100%; background-color:#dadbde; font-size:0px;">&nbsp;</div>';
	var prCopyrights = '<div style="height:7px; width:100%; background-color:#dadbde; font-size:0px;">&nbsp;</div><div style="float:right; padding-top:10px; font-size:10px;"><a href=# onClick="window.print()">'+ printl +'</a></div><div style="padding-top:10px; font-size:10px;">'+copyrights+'</div>';
	var prBottom = '</body></html>';
	var col = findDOM(obj);
	var content = '<div id="content" style="padding:5px 0px 5px 0px;">'+col.innerHTML+'</div>';
	var links = '<div id="links" style="clear:both;"></div>';
	previewWin.document.open();
    previewWin.document.write(prTop+prTitle+content+links+prCopyrights+prBottom);
    previewWin.document.close();
}

	function PointOver(obj, fold, type) {
/*		var iml = document.createElement('IMG');
		iml.src	= fold+'menu_top_fon_hover_left.gif';
		iml.style.width = "7px";
		iml.style.height = "28px";
		iml.style.marginTop = "-6px";
		
		var divl = document.getElementById('left'+id);
		divl.appendChild(iml);*/
		
		//alert('555');
		obj.className+=" jshover";
		var id = obj.getAttribute("ID");
		//setChildMenu(id);
		
		var imgl = document.getElementById('iml'+id);
		var imgr = document.getElementById('imr'+id);
		
		var listA = obj.getElementsByTagName("A");
		var objA = listA[0];
		
		var isGecko = navigator.userAgent.toLowerCase().indexOf("gecko") != -1;
		var isOpera = navigator.userAgent.toLowerCase().indexOf("opera") != -1;
		var isIE = navigator.userAgent.toLowerCase().indexOf("msie") != -1;
		
		if ((type) && (type == 2)) var bgimg = 'menu_a_center.gif';
		else var bgimg = 'menu_top_fon_hover_2.gif';
		
		//if (isIE) {
			obj.style.backgroundImage = "url("+fold+bgimg+")";
			obj.style.backgroundRepeat = "repeat-x";
			obj.style.backgroundPosition = "0 0";
			nextWide(obj).style.background = "none";
			//alert(nextWide(obj).getAttribute("id"));
		//}
/*		else {
			objA.style.backgroundImage = "url("+fold+bgimg+")";
			objA.style.backgroundRepeat = "repeat-x";
		}*/
		objA.style.color = "#000000";
		
		if (imgl) imgl.style.visibility = 'visible';
		if (imgr) imgr.style.visibility = 'visible';
		
		//var liNext = nextNode(obj);
		//alert(liNext.innerHTML);
		//alert(obj.nextSibling.nodeValue);
	}
	
// return next node in document order
function nextNode(node) {
    if (!node) return null;
    if (node.firstChild){
        return node.firstChild;
    } else {
        return nextWide(node);
    }
}
// helper function for nextNode()
function nextWide(node) {
    if (!node) return null;
    if (node.nextSibling) {
        return node.nextSibling;
    } else {
        return nextWide(node.parentNode);
    }
}
	
	function PointOut(obj, fold, type) {
		obj.className=obj.className.replace(" jshover", "");
		var id = obj.getAttribute("ID");
		var imgl = document.getElementById('iml'+id);
		var imgr = document.getElementById('imr'+id);
		
		var listA = obj.getElementsByTagName("A");
		var objA = listA[0];
		objA.style.background = "none";
		if (obj.className != "first") {
			if (type) {var bgimg = 'menu_bottom_line.gif'; var pad = 8;}
			else {var bgimg = 'menu_top_line.gif'; var pad = 5;}
			obj.style.backgroundImage = "url("+fold+bgimg+")";
			obj.style.backgroundRepeat = "no-repeat";
			obj.style.backgroundPosition = "0 "+pad+"px";
			
			var nextObj = nextWide(obj);
			nextObj.style.backgroundImage = "url("+fold+bgimg+")";
			nextObj.style.backgroundRepeat = "no-repeat";
			nextObj.style.backgroundPosition = "0 "+pad+"px";
		}
		else obj.style.background = "none";
		if (!type) objA.style.color = "#FFFFFF";
		
		if (imgl) imgl.style.visibility = 'hidden';
		if (imgr) imgr.style.visibility = 'hidden';
		
/*		if (obj.nextSibling) {
			var liNext = obj.nextSibling;
			liNext.backgroundImage = "url("+fold+"menu_top_line.gif)";
			liNext.backgroundPosition = "0 4px";
		}*/

/*		var imgl = document.getElementById('iml_'+id);
		var imgr = document.getElementById('imr_'+id);
		
		if (imgl) imgl.style.visibility = 'hidden';
		if (imgr) imgr.style.visibility = 'hidden';*/
	
	}

/*          function ShowMenuItems(div, array, fold, pg)
          {
			   for (var i = 0; i < array.length; i++)
			   {
			      var img = document.getElementById(array[i]);
				  img.style.visibility = "hidden";
			   }
               var controls = div.parentNode.childNodes;
               for (var i=0; i < controls.length; i++)
               {
                    if (controls[i].tagName == "IMG")
                    {
                         controls[i].style.visibility = 'visible';
                    }
                         
                    else if (controls[i].tagName == "DIV")
                    {
                                   controls[i].style.backgroundImage = "url("+fold+"menu_top_fon_hover_2.gif)";
                                   controls[i].style.backgroundRepeat = "repeat-x";
                            var subControl = controls[i].childNodes;
                            for (var j = 0; j < subControl.length; j++)
                            {
                                 if (subControl[j].tagName == "A")
                                 {
                                      var link = subControl[j];
                                      link.style.color = "#000000";
                                      link.style.textDecoration = "none";
									  link.style.textAlign = "center";
                                 }
                            }                         
                    }
               }
				//setChildMenu(pg)   
          }
		  
		  function HideMenuItems1(div, array, pg) {
			  var header_menu_bottom = document.getElementById('id'+pg);
			  var y = window.event.pageY;
			  if (y );
		  }
		  
		function mousePageXY(e)
		{
		 var x = 0, y = 0;
		
		 if (!e) e = window.event;
		
		 if (e.pageX || e.pageY)
		 {
		  x = e.pageX;
		  y = e.pageY;
		 }
		 else if (e.clientX || e.clientY)
		 {
		  x = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft;
		  y = e.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop;
		 }
		
		 return {"x":x, "y":y};
		}
		
		function clearMenu(pg) {
			   // очищаем нижнее меню
			   var sel = document.getElementById("header_menu_bottom");
			   while (sel.childNodes.length) {
    			sel.removeChild(sel.firstChild);
				alert('5');
				}
				sel.innerHTML = "";
		}
          
          function HideMenuItems(div, array, pg)
          {		   
			   for (var i = 0; i < array.length; i++)
			   {
			      var img = document.getElementById(array[i]);
				  img.style.visibility = "visible";
			   }
               var controls = div.parentNode.childNodes;
               for (var i=0; i < controls.length; i++)
               {
                    if (controls[i].tagName == "IMG")
                    {
                         controls[i].style.visibility = 'hidden';
                    }
                    else if (controls[i].tagName == "DIV")
                    {
                                   controls[i].style.backgroundImage = "";
                                   controls[i].style.backgroundRepeat = ""; 
                                 var subControl = controls[i].childNodes;
                                 for (var j = 0; j < subControl.length; j++)
                                 {
                                      if (subControl[j].tagName == "A")
                                      {
                                     var link = subControl[j];
                                     link.style.color = "#ffffff";
                                     link.style.textDecoration = "none";
									 link.style.textAlign = "center";
                                      }
                                 }
                    }
               }
          }*/
		  
		var isIE = navigator.userAgent.indexOf("MSIE") > -1;
		var isGecko = navigator.userAgent.indexOf("Gecko") > -1;
		var isIE6 = navigator.userAgent.indexOf("MSIE 6.") > -1;
        
/*        function init()
        {
            SetBlocksHeight();
        }
		
		function init1() {
			if (isIE6) pause(1); 
			SetBlocksHeight();
		}*/
	    
		function pause(ms){   
			var date = new Date();   
			var curDate = null;   
			do { curDate = new Date(); }   
			while(curDate-date < ms);   
		}
  
        function SetBlocksHeight()
        {
			mmwidth();
/*				var left = document.getElementById("left");
            	var right = document.getElementById("right");
               
               var left_h = left.offsetHeight;
               if (right) var right_h = right.offsetHeight;
			   
			   var window_h = document.body.offsetHeight - 600;
				var height = window_h;
				if (left_h > height) var height = left_h;
				if ((right) && (right_h > height)) var height = right_h;
				
				left.style.height = (height).toString() + "px";
				if (right) right.style.height = (height).toString() + "px";*/
        }
		
function checkValidForm(f, subm) {
	indOf();
	var types = new Array('text', 'password', 'checkbox', 'radio', 'file');
	var tags = new Array('INPUT', 'SELECT', 'TEXTAREA');
	var s = true;
		
	// Цикл по всем элементам текущей формы
       for(j = 0; j < f.elements.length; j++) {
           var e = f.elements[j];  //текущий элемент
		if (e.disabled == true) continue;
		if ((tags.indexOf(e.tagName) != -1) || (types.indexOf(e.type) != -1)) {
			var valid = true;
			e.style.borderColor = "#64aee6";
			var patt = e.getAttribute("patt");
			var req = e.getAttribute("req");
			if ((patt) && (e.value.length != 0)) {
				switch(patt) {
					case "mail":{ 
						valid = validateEmail(e.value);
						break;             
					}
					case "int":{
						valid = validateRegExp(e.value, '^[0-9]+$');
						var err_str="Введите цифры";
						break;
					}
					case "float":{
						valid = validateRegExp(e.value, '^[0-9]+\.[0-9]+$');
						break;
					}
					case "date(d.m.Y)":{
						valid = validateRegExp(e.value, '^[0-9]{2}\.[0-9]{2}\.[0-9]{4}$');
						break;
					}
				}
			}
			if (req) {
				if (e.value.length == 0) valid = false;
			}
			if (valid == false) {
				s = false;
				e.style.borderColor = "#cc0000";
				
			}
		}
	}
	if (s == false) {
		if (location.pathname.indexOf("/en/") != -1)
			window.alert ("Fields are filled incorrectly!");
		else if (location.pathname.indexOf("/ua/") != -1)
			window.alert ("Некоректно заповнені поля!");
		else
			window.alert ("Некорректно заполнены поля!");
	}
	return s;
}
	
	function validateEmail(email)
	{
		var splitted = email.match("^(.+)@(.+)$");
		if(splitted == null) return false;
		if(splitted[1] != null )
		{
		  var regexp_user=/^\"?[\w-_\.]*\"?$/;
		  if(splitted[1].match(regexp_user) == null) return false;
		}
		if(splitted[2] != null)
		{
		  var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
		  if(splitted[2].match(regexp_domain) == null) 
		  {
			var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
			if(splitted[2].match(regexp_ip) == null) return false;
		  }// if
		  return true;
		}
	return false;
	}
	
	function validateRegExp(val, regexp) {
		if (val.match(regexp) == null) return false;
		else return true;
	}

function SubmitFormSearch(form)
{
var searchwords, sub=1;
var sf = document.getElementById(form);
searchwords = sf.searchwords.value;

if (searchwords.length == 0) {sub = 0;}
if ((searchwords.length != 0) && (searchwords.length <2)) {window.alert('Длина поисковой фразы должна составлять не менее 2 символов'); sub = 0;}

if (sub == 1) sf.submit();
}

var bShow = false;

function ShowHideSearch (poisk_table)
{
	poisk_table = document.getElementById(poisk_table);
	if (poisk_table.style.display == "block") {
		poisk_table.style.display = "none";
		bShow = false;
	}
	else {
		document.onclick = function hideCalender_Trap2()
		  {
			  if (!bShow)
			  {
				  poisk_table.style.display = "none";
			  }
			  bShow = false;
		  }
	
		poisk_table.style.display = "block";
		bShow = true;
	}
}

/*function DocumentRegisterEvents(poisk_table)
{
	alert('9866');
  document.onclick = function hideCalender_Trap2()
  {
	  if (bShow == true)
	  {
      	poisk_table.style.display='none';
	  }
	  bShow = false;
  }
}*/

/*TextAnimation*/


/*function titrUp() {
	var titr = document.getElementById('titr');
	var currentY = parseInt(titr.style.top);
	if ((currentY + titr.offsetHeight) > maxtop) {
		//currentY-=step;
	}
	else {
		currentY = 139;
	}
	currentY-=step;
	titr.style.top = currentY;
	move = setTimeout("titrUp()", framespeed);
}*/

function titrUp() {
	var titr = document.getElementById('titr');
	var moveBg0 = {type: 'top', to: (-10-titr.offsetHeight), step: -1, delay: 70}
 
	$fx(titr).fxAdd(moveBg0).fxRun(null, -1);
}




function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function OpenImage(src, title, width, height, url) {
		//window.alert('test');
		if (width < 400) width = 400;
		if (height < 400) height = 400;
		
		if (width > (screen.availWidth-20)) width = screen.availWidth-20;
		if (height > (screen.availHeight-50)) height = screen.availHeight-50;
		//window.alert(height);
		
		var Form = "<html>" +
			"<head>" +
			"<title>"+title+"</title>" +
			"</head>\n" +
			"<body style='margin: 0px; padding:0px; background:#ffffff;'>\n" +
			"<table cellspacing='0' cellpadding='0' width='100%' height='100%' border='0'>" +
			"<tr><td style='text-align:center; vertical-align:middle;'>" +
			"<img src='"+src+"' border=0>" +
			"</td></tr>" +
			"</table>" +
			"</body>" +
			"</html>";
		var TabPanel = window.open(url,"TabPanel","dependent=1,width="+width+",height="+height+",status=yes");
		TabPanel.document.open();
        TabPanel.document.write(Form);
        TabPanel.document.close();
}

function m3Over(fold, ob, li) {
	li.style.backgroundColor = "#3782d3";
	li.style.backgroundImage = "none";
	var obj = document.getElementById(ob);
	var obj_hover = document.getElementById(ob+'_hover');
	
	obj_hover.style.display = 'block';
	obj.style.display = 'none';
}

function m3Out(fold, ob, li) {
	if ((ob == 's1') || (ob == 's2'))
		li.style.backgroundImage = "url("+fold+"smenu_bg.gif)";
	else
		li.style.backgroundImage = "url("+fold+"menu_bg.gif)";
	li.style.backgroundColor = "#023DA7";
	var obj = document.getElementById(ob);
	var obj_hover = document.getElementById(ob+'_hover');
	
	obj.style.display = 'block';
	obj_hover.style.display = 'none';
}

function unsetParentOnClick(obj) {
	var p = obj.parentNode;
	var myonclick = "";
	if (isIE) eval("p.onclick =  function(){"+myonclick+"};");
	else p.setAttribute("onclick", myonclick);
}

function changePict(obj, ph3)
{
	var im=document.images['parent'];
	im.src = obj.src;

	var par = parentf(im);
	par.href = ph3;
	par.title = obj.alt;
	}
	
function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		document.getElementById(limitCount).innerHTML = (limitNum - limitField.value.length);
	}
}

// получение родительского элемента
function parentf(elem, num) {
       num = num || 1;
       for ( var i = 0; i < num; i++ )
               if ( elem != null ) elem = elem.parentNode;
       return elem;
}

function findClass(tag, str){
	var list = new Array();
	var nodes = document.getElementsByTagName('UL');
	for (i = 0; i<nodes.length; i++){
  		if (nodes[i].className == str )
   			list.push(nodes[i]);
	}
	return list;
}

/*function init() {
		var so1 = new SWFObject("{CURRENT_TEMPLATE}flash/header.swf","mymovie1","328","115","7","transparent");
		so1.addParam("wmode", "transparent");
		so1.addParam("quality", "high");
		so1.addParam("useExpressInstall", "true");
		so1.write("flashcontent12");
		
		if (document.getElementById('flashcontent1')) {
			var so = new SWFObject("{CURRENT_TEMPLATE}flash/main_ru.swf","mymovie1","220","140","7","transparent");
			so.addParam("wmode", "transparent");
			so.addParam("quality", "high");
			so.addParam("useExpressInstall", "true");
			so.write("flashcontent1");
		}
		
		if (document.getElementById('kol')) {
			getAjaxCookies();
		}
}*/

function initIE() {
	var wid = ((document.documentElement.clientWidth || document.body.clientWidth) < 1000) ? '1000px' : ((document.body.clientWidth > 1280) ? '1280px' : '100%');
      
/*	if (wid != '100%') 
		wid = wid.toString() + "px";*/
		//alert(wid);
    document.getElementById('main').style.width = wid.toString();
    document.getElementById('footer').style.width = wid.toString();
/*      var nav2 = document.getElementById("nav2");
      if (nav2) {
           var l = 0;
           while(nav2.offsetHeight > 33) {
               nav2.style.width = (nav2.offsetWidth + 10).toString() + "px";
               l++;
           }
           if ((l != 0) && (wid != '100%') && (wid < nav2.style.width)) {
                document.getElementById('main').style.width = nav2.style.width;
                document.getElementById('footer').style.width = nav2.style.width;
           }
		   else {
		   		if (wid != '100%') 
					wid = wid.toString() + "px";
                document.getElementById('main').style.width = wid;
                document.getElementById('footer').style.width = wid;
		   }
       }
	   else {
		   if ((document.getElementById("titr")) && (wid < 1200))
		   		wid = "1200px";
           document.getElementById('main').style.width = wid;
           document.getElementById('footer').style.width = wid;
	   }*/
/*	   else {
		   	var elm = findClass(document.getElementById("nav"), 'nav2');
			var len = elm.length;
			
			maxWidth = 1000;
			
			for (var k=0; k<len; k++) {
				//elm[k].style.width = (1400).toString() + "px";
				alert(elm[k].offsetWidth);
				//elm[k].style.width = (1200).toString() + "px";
				if (elm[k].offsetHeight) {
				   while(elm[k].offsetHeight > 33) {
					   newWidth = (elm[k].offsetWidth + 10);
					   elm[k].style.width = newWidth.toString() + "px";
					   if (newWidth > maxWidth) maxWidth = newWidth;
				   }
				}
			}
			
			//alert(maxWidth);
			
	   }*/
	   if (isIE6) {
            var hEls1 = document.getElementById("nav").getElementsByTagName("LI");
            var hEls2 = document.getElementById("poisk_table").getElementsByTagName("LI");
            var hEls3 = (document.getElementById("poisk_table2")) ? document.getElementById("poisk_table2").getElementsByTagName("LI") : new Array();
            
            
            for (var k=1; k<=3; k++) { 
            	if (k == 1) var hEls = hEls1;
                else if (k == 2) var hEls = hEls2;
                else if (k == 3) var hEls = hEls3;
                var len = hEls.length;
				
                for (var i=0; i<len; i++) {
                    if ((hEls[i].className != 'last') || (!hEls[i].onmouseover)) {
                        if (hEls[i].className == 'chld') {
                            hEls[i].onmouseover=function() { this.className = "currchldie";}
                            hEls[i].onmouseout=function() { this.className = "chld";}
                        }
						else if (hEls[i].className == 'currchld') {
                            hEls[i].onmouseover=function() { this.className = "currchldie2";}
                            hEls[i].onmouseout=function() { this.className = "currchld";}
						}
                        else {
                            hEls[i].onmouseover=function() { this.className+=" jshover"; }
                            hEls[i].onmouseout=function() { this.className=this.className.replace(" jshover", ""); }
                        }
                    }
                }
            }
	   }
			
/*			var hEls = document.getElementById("nav").getElementsByTagName("UL");
			for (var i=0, len=hEls.length; i<len; i++) {
				hEls[i].offsetWidth = (1000).toString() + "px";
			   while(hEls[i].offsetHeight > 33) {
				   hEls[i].style.width = (hEls[i].offsetWidth + 10).toString() + "px";
				   l++;
			   }
			   alert(hEls[i].style.width);
			}*/
}

function navigSubmit(n, url, curr, col, suf) {
	var pg = document.getElementById('nv_pg').value;
	if ((pg.length != 0) && (pg <= n) && (pg > 0) && (pg != curr)) {
		url += ((pg-1) * col) + suf;
		document.location.replace(url);
	}
}

function iload()
{
    img = new Image();
	var domen = location.hostname;
    img.src = "http://"+location.hostname+"/genimg.php?" + Math.random();
    document.getElementById('antispam').src = img.src;
}

function setBlTitle(sel) {
	var opt = sel.options[sel.selectedIndex];
	var title = document.getElementById('title');
	var icon = document.getElementById('icon');
	
	title.value = opt.getAttribute("title");
	for (var i=0; i<icon.options.length; i++) {
		if (icon.options[i].value == opt.getAttribute("icon"))
		 	icon.options[i].selected = true;
	}
}
function numRows(num) {
/*    if (isGecko) EditField[num] = document.getElementById('message'+num).contentDocument; //для ff
	else EditField[num] = frames['message'+num].document; // ie и opera
	
	document.getElementById('Frm'+num).style.width = '316px';
	document.getElementById('Frm'+num).style.height = '20px';
	EditField[num].body.style.fontSize = '14px';
	EditField[num].body.style.fontFamily = 'Tahoma';
	
	document.getElementById('numrows').value = EditField[num].body.scrollHeight;*/
	
	var tx = document.getElementById('text1');
	document.getElementById('numrows').value = tx.scrollHeight;
}

function setPhoto(d) {
	for (i = 0; i<d.parentNode.childNodes.length; i++)
		d.parentNode.childNodes[i].style.borderColor = '#ffffff';
	d.style.borderColor = '#c0c0c0';
	if (document.getElementById('photo'))
		clearFileInput(document.getElementById('photo'));
}

function unsetPhoto(d) {
	for (i = 0; i<d.childNodes.length; i++)
		d.childNodes[i].style.borderColor = '#ffffff';
}

function clearFileInput(inp) {
  inp.outerHTML='<input name="'+ inp.name +'" type="file" id="'+ inp.name +'" class="form_file" style="width:82%;" onchange="unsetPhoto(document.getElementById(\'box_icons\'));">';
}

function DeleteFile(msg, url) {
  	if (confirm('Удалить [' + msg + '] без возможности восстановления?'))
		document.location.replace(url); 
}

function setVDescrip(obj, im1, im2) {
	var object = document.getElementById('v'+obj);
	var img = document.getElementById('im'+obj);
	var div = document.getElementById('div'+obj);
	if (object) {
		var disp = (object.style.display == 'none') ? 'block' : 'none';
		var src = (object.style.display == 'none') ? im2 : im1;
		var bg = (object.style.display == 'none') ? '#dce8ef' : '#ffffff';
		var border = (object.style.display == 'none') ? '1px solid #ffffff' : '1px dotted #cfced1';
		object.style.display = disp;
		img.src = src;
		div.style.borderBottom = border;
		div.style.backgroundColor = bg;
	}	
}

function setVacancy(v) {
	var vc = document.getElementById('vc');
	vc.value = v;
	anchorScroller(document.getElementById('vc_a'));
}

function anchorScroller(el, duration) {
    if (this.criticalSection) {
        return false;
    }
    
    if ((typeof el != 'object') || (typeof el.href != 'string'))
        return true;
    
    var address = el.href.split('#');
    if (address.length < 2)
        return true;
    
    address = address[address.length-1];
    el = 0;
    
    for (var i=0; i<document.anchors.length; i++) {
        if (document.anchors[i].name == address) {
            el = document.anchors[i];
            break;
        }
    }
    if (el === 0)
        return true;
        
    this.stopX = 0;
    this.stopY = 0;
    do {
        this.stopX += el.offsetLeft;
        this.stopY += el.offsetTop;
    } while (el = el.offsetParent);
    
    this.startX = document.documentElement.scrollLeft || window.pageXOffset || document.body.scrollLeft;
    this.startY = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop;
    
    this.stopX = this.stopX - this.startX;
    this.stopY = this.stopY - this.startY;
    
    if ( (this.stopX == 0) && (this.stopY == 0) )
        return false;
    
    this.criticalSection = true;
    if (typeof duration == 'undefined')
        this.duration = 500;
    else
        this.duration = duration;
            
    var date = new Date();
    this.start = date.getTime();
    this.timer = setInterval(function () {    
        var date = new Date();
        var X = (date.getTime() - this.start) / this.duration;
        if (X > 1)
            X = 1;
        var Y = ((-Math.cos(X*Math.PI)/2) + 0.5);
        
        cX = Math.round(this.startX + this.stopX*Y);
        cY = Math.round(this.startY + this.stopY*Y);
        
        document.documentElement.scrollLeft = cX;
        document.documentElement.scrollTop = cY;
        document.body.scrollLeft = cX;
        document.body.scrollTop = cY;
        
        if (X == 1) {
            clearInterval(this.timer);
            this.criticalSection = false;
        }
    }, 10);
    return false;
}

function setDelivery(n) {
	var deliv1 = document.getElementById('deliv1');
	var deliv2 = document.getElementById('deliv2');
	
	if (n == 1) {
		var inp1 = deliv1.getElementsByTagName('input');
		for (i=0; i<inp1.length; i++) {
			inp1[i].disabled = false;
			if (i == 0)
				inp1[i].checked = true;
		}
		var inp2 = deliv2.getElementsByTagName('input');
		for (i=0; i<inp2.length; i++) {
			inp2[i].disabled = true;
			inp2[i].checked = false;
		}
		deliv1.style.display = 'block';
		deliv2.style.display = 'none';
	}
	else {
		var inp1 = deliv1.getElementsByTagName('input');
		for (i=0; i<inp1.length; i++) {
			inp1[i].disabled = true;
			inp1[i].checked = false;
		}
		var inp2 = deliv2.getElementsByTagName('input');
		for (i=0; i<inp2.length; i++) {
			inp2[i].disabled = false;
			if (i == 0)
				inp2[i].checked = true;
		}
		deliv1.style.display = 'none';
		deliv2.style.display = 'block';
	}
}