function openDescr(html,event2){
	document.getElementById('td_product').innerHTML = html;
	div = document.getElementById('descr_product');
	try{
		div.style.left = event2.pageX+20;
		div.style.top = event2.pageY+document.body.scrollTop;
	} catch(e){
		try {
			div.style.left = event.x+20;
			div.style.top = event.y+document.body.scrollTop;
		}
		catch(e) {
			div.style.left = Event.pointerX+20;
			div.style.top = Event.pointerY+document.body.scrollTop;
		}
	}
	div.style.display = 'block';
}
function showDescr(event2){
	var	div = document.getElementById('descr_product');
	try{
		div.style.left = event2.pageX+20;
		div.style.top = event2.pageY+document.body.scrollTop;
	} catch(e){
		try {
			div.style.left = event.x+20;
			div.style.top = event.y+document.body.scrollTop;
		}
		catch(e) {
			div.style.left = Event.pointerX+20;
			div.style.top = Event.pointerY+document.body.scrollTop;
		}
	}
}


function getCoordinates(elementeg) {
	var coordinateLeft = 0;
	var coordinateTop = 0;
	while(elementeg.offsetParent) {
		coordinateLeft += elementeg.offsetLeft;
		coordinateTop += elementeg.offsetTop;
		elementeg = elementeg.offsetParent;
	}
	return {x: coordinateLeft, y: coordinateTop}	
}

function showImage(e, src, el) {
	var coordinates =  getCoordinates(el);
	var img_cont = document.getElementById('img_cont');
	img_cont.style.border = '1px solid #ababab'
	img_cont.style.position = 'absolute';
	img_cont.style.zIndex = 5000;	 
	
	var img = document.getElementById('image').firstChild;
	Element.show('image_loading');
	img.src = src;
	loaded = false;
	img_cont.style.top =  coordinates.y + "px";
	Event.observe(img, 'load', function() {
			img_cont.style.left = coordinates.x - img.width - 1 + "px";
			Element.hide('image_loading');
			Element.show('image');
			loaded = true;
	}
	)
}


function hideImage() {
	Element.hide('image');
	document.getElementById('img_cont').style.border = '0px';
}


function closeDescr(){
	document.getElementById('descr_product').style.display = 'none';
}
window.onresize = function(){
	resize();
}
window.onload = function(){
	resize();
	
	basket_moving=0;
	basket_count=0;
	if (this['auth'] == undefined){auth = false;}
	if (auth){
		document.getElementById('message').style.display = 'none';
	}
}

document.onmouseup = function(e){
	//resize();
	basket_moving=0;
	basket_count=0;
}

document.onmousedown = function(e){
	//resize();
	mCur = mouseCoords(e);
	
	//alert("X:"+mCur.x+" - Y:"+mCur.y);
}

 function ShowMail(user, domain1, domain2) {
	var email = user+'&#64;'+domain1+'&#46;'+domain2;
	if (ShowMail.arguments[3]) name = ShowMail.arguments[3];
	else name = email;
	document.writeln('<a href="mailto:'+email+'">'+name+'</a>');
}
function hideSelect(){
	var elements = document.getElementsByTagName('select');
	for (var i in elements){
		if (elements[i].style == undefined) continue;
		elements[i].style.visibility = 'hidden';
	}	
}
function showSelect(){
	var elements = document.getElementsByTagName('select');
	for (var i in elements){
		if (elements[i].style == undefined) continue;
		elements[i].style.visibility = 'visible';
	}	
}
function resize(){
	size = (document.body.offsetWidth - 380)*209/625;
	if (size < 209) {size=209;}
	try{	
	    if (document.getElementById('banner_logo_center'))		
	    document.getElementById('banner_logo_center').style.height = size+'px';
	} catch(e){}
}

function paramsNode(id, last){
	if (document.getElementById('param_'+id).style.display == "none"){
		document.getElementById('param_'+id).style.display = "block";
		if (last) document.getElementById('img_'+id).src = '/images/toc_opened_' + last + '.gif';
	} else {
		document.getElementById('param_'+id).style.display="none";
		if (last) document.getElementById('img_'+id).src = '/images/toc_closed_' + last + '.gif';
	}
}

function openCatalogNode(id){
	document.getElementById('catalog_'+id).style.display = 'block';
	document.getElementById('url_'+id).onclick = function(){
		closeCatalogNode(this.IDN);
		return false;
	}
	for (i in catIDs){
		if (catIDs[i] != id){
			closeCatalogNode(catIDs[i])
		}
	}
}
function closeCatalogNode(id){
	if (document.getElementById('catalog_'+id)) document.getElementById('catalog_'+id).style.display = 'none';
	if (document.getElementById('url_'+id)) {
		document.getElementById('url_'+id).onclick = function(){
			openCatalogNode(this.IDN);
			return false;
		}
	}
}


function openNode(id){
	document.getElementById('node_'+id).style.display = 'block';
	var img = document.getElementById('img_'+id);
	r = img.src.lastIndexOf('closed');
	img.src = img.src.substring(0,r)+'opened'+img.src.substring(r+6);
	img.parentElement.onclick = function(){
		closeNode(img.id.substring(img.id.lastIndexOf('_')+1));
	}
}

function closeNode(id){
	document.getElementById('node_'+id).style.display = 'none';
	var img = document.getElementById('img_'+id);
	r = img.src.lastIndexOf('opened');
	img.src = img.src.substring(0,r)+'closed'+img.src.substring(r+6);
	img.parentElement.onclick = function(){
		openNode(img.id.substring(img.id.lastIndexOf('_')+1));
	}
}

function openProduct(id){
	//SetCookie('PHPSESSID',this.sid);
	document.location = "/product?id=" + id, "edit" +id, "resizable=1, scrollbars = yes, status=0";
}

function acceptBasket(id,count){
	document.getElementById('basket').innerHTML="<table width=100% height=100><tr><td valigh=middle align=center><img src='/images/indicator.gif'><br>Заказываем...</td></tr></table>";
	document.getElementById('basket').style.display='none';
	jQuery.get("/cabinet/add", 'id='+id+'&count='+count, function(){ document.getElementById('basket').innerHTML="<table height=100 width=100%><tr><td align=center><b>ЗАКАЗ СДЕЛАН</b></td></tr></table>"; setTimeout("try{document.getElementById('pages').style.visibility='visible';}catch(e){}finally{};document.getElementById('basket').style.display='none';showSelect();",1000); }, 'html');
}

// --- Добавление рекомендуемого товара в корзину со страницы "Корзина"
function addToBasketFromRecommendedProducts(id, price) {
    var count = document.getElementById('count');
	if (isNaN(count.value) || count.value == '' || count.value < 1) {
		count.value = 1;
		document.getElementById('price').innerHTML = number_format(count.value*price, 2, ',', ' ') + ' руб.';
	}
	jQuery.get("/cabinet/add", 'id='+id+'&count='+count.value, function(){ completeAddToBasketFromRecommendedProducts(); });
}
function completeAddToBasketFromRecommendedProducts(){
    document.getElementById('basket').innerHTML = "<div class='tb'><div class='cn l'></div><div class='cn r'></div></div><div class='content'><p><strong>ЗАКАЗ СДЕЛАН</strong></p></div><div class='bb'><div class='cn l'></div><div class='cn r'></div></div>";
    setTimeout("document.getElementById('basket').style.display='none';", 1000);
    location.href = '/cabinet/basket';
}
// ---------------------------------------------------------------------

function addToBasket(id,count){
	alert('OK');
}

var myTimer = 0;

function isNumKeyPressedTrue(_event) {
	if (!_event) _event = event;
	var keynum = _event.keyCode || _event.charCode;
	if ((keynum < 48 || keynum > 57) & (keynum != 8)) return false;
}

function check_enter(e,obj,price,id){
	if(e.keyCode!=13){
		changeCountCart(obj,price);
	}else{
		var count = document.getElementById('count');
		if (isNaN(count.value) || count.value == '' || count.value < 1) {
			count.value = 1;
			document.getElementById('price').innerHTML = number_format(count.value*price, 2, ',', ' ') + ' руб.';
		}
		e.returnValue=false;
		acceptBasket(id,count.value);
	}
}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
	    do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
	    } while (obj = obj.offsetParent);
	}
	return [curleft,curtop];
}

function changePologenie(id){	
	//var dim_move_basket = Position.cumulativeOffset(this.move_basket);
	var dim_move_basket = findPos(this.move_basket);
	
	if (Math.abs( Math.abs(dim_move_basket[0]) - Math.abs(this.dim_main_basket[0]) ) < 10) 
	{
		// Если расстояние между точкой назначения и блоком < 10 останавливаем движение
		dim_move_basket[0] = this.dim_main_basket[0];
	}
	
	if (Math.abs( Math.abs(dim_move_basket[1]) - Math.abs(this.dim_main_basket[1]) ) < 10) 
	{
		// Если расстояние между точкой назначения и блоком < 10 останавливаем движение
		dim_move_basket[1] = this.dim_main_basket[1];
	}
	

	// Движение
	if (dim_move_basket[0] != this.dim_main_basket[0]){
		this.move_basket.style.left = dim_move_basket[0] + (dim_move_basket[0] > this.dim_main_basket[0] ? -1 : 1) * 10 + 'px';
	}
	if (dim_move_basket[1] != this.dim_main_basket[1]){
		this.move_basket.style.top = dim_move_basket[1] + (dim_move_basket[1] > this.dim_main_basket[1] ? -1 : 1) * 10 + 'px';
	}	
	
	if (dim_move_basket[0] == this.dim_main_basket[0] && dim_move_basket[1] == this.dim_main_basket[1]){
		clearTimeout(myTimer);
		acceptBasket(id, document.getElementById('count').value);
	} else {
		myTimer = setTimeout('changePologenie('+id+')', 1);
	}
}

function goBasket(id, price){
    var count = document.getElementById('count');
	if (isNaN(count.value) || count.value == '' || count.value < 1) {
		count.value = 1;
		document.getElementById('price').innerHTML = number_format(count.value*price, 2, ',', ' ') + ' руб.';
	}
	document.getElementById('main_basket').style.display = "block";

	this.move_basket = document.getElementById('basket');
	this.main_basket = document.getElementById('main_basket');
//	this.dim_main_basket = new Array(this.main_basket.offsetLeft, this.main_basket.offsetTop);	
	this.dim_main_basket = findPos(this.main_basket);	
	
	myTimer =  setTimeout('changePologenie('+id+')', 100);
}

// Всплывающее окошко, в котором вводим кол-во товаров и жмем кнопку "Добавить"
function openAddToCart(id,name,art,price){
	//SetCookie('PHPSESSID',this.sid);
	//console.log(mCur);
	str = '';
	str += '<span class="close" onmousedown="basket_count=1" onclick="showSelect();try{document.getElementById(\'pages\').style.visibility=\'visible\';}catch(e){}finally{};document.getElementById(\'basket\').style.display=\'none\';" >Закрыть</span>';
	str += '<input type="hidden" id="id" name="id" value="'+id+'">';
	str += '<div class="tb"><div class="cn l"></div><div class="cn r"></div></div>';
	str += '<div class="content">';
	str += '   <p><span class="color">Артикул:</span> '+art+'</p>';
	str += '   <p><span class="color">Название:</span> <strong>'+name+'</strong></p>';
	str += '   <p><span class="color">Цена:</span> <span id="price">'+number_format(price, 2, ',', ' ')+' руб.</span></p>';
	str += '   <a class="button" href="#" onclick="goBasket('+id+', '+price+'); return false" id="cartadd"><span>Добавить</span></a>';
	str += '   <span class="color">Кол-во:</span>';
	str += '   <input onmousedown="basket_count=1" type="text" maxlength="3" name="count" id="count" onkeypress="return isNumKeyPressedTrue(event);" onkeyup="check_enter(event,this,'+price+','+id+');" value="1">';	
	str += '</div>';
	str += '<div class="bb"><div class="cn l"></div><div class="cn r"></div></div>';
	str += '<iframe id="tmpaddcart" name="tmpaddcart" src="about:blank" width="0" height="0" border="0" style="visibility:hidden"></iframe>';
	
	var basket = document.getElementById('basket');
	basket.innerHTML = str;
	
	basket.style.display = "block";
	basket.style.left=(mCur.x-200 > 10 ? mCur.x-200 : 10)  + "px";
	basket.style.top=(mCur.y-20 > 10 ? mCur.y-20 : 10 ) + "px";

	if (document.getElementById('pages')) {
    	try{
    		if (document.getElementById('pages').offsetTop < basket.style.top){
    			document.getElementById('pages').style.visibility="hidden";
    		} else {
    			document.getElementById('pages').style.visibility="visible";
    		}
    	} catch(e){}
    	finally{}
	}
}

// Всплывающее окошко, в котором вводим кол-во товаров и жмем кнопку "Добавить" (на странице "Корзина")
function openAddToCart2(id,name,art,price){
	str = '';
	str += '<span class="close" onmousedown="basket_count=1" onclick="showSelect();try{document.getElementById(\'pages\').style.visibility=\'visible\';}catch(e){}finally{};document.getElementById(\'basket\').style.display=\'none\';" >Закрыть</span>';
	str += '<input type="hidden" id="id" name="id" value="'+id+'">';
	str += '<div class="tb"><div class="cn l"></div><div class="cn r"></div></div>';
	str += '<div class="content">';
	str += '   <p><span class="color">Артикул:</span> '+art+'</p>';
	str += '   <p><span class="color">Название:</span> <strong>'+name+'</strong></p>';
	str += '   <p><span class="color">Цена:</span> <span id="price">'+number_format(price, 2, ',', ' ')+' руб.</span></p>';
	str += '   <a class="button" href="#" onclick="addToBasketFromRecommendedProducts('+id+', '+price+'); return false" id="cartadd"><span>Добавить</span></a>';
	str += '   <span class="color">Кол-во:</span>';
	str += '   <input onmousedown="basket_count=1" type="text" maxlength="3" name="count" id="count" onkeypress="return isNumKeyPressedTrue(event);" onkeyup="check_enter(event,this,'+price+','+id+');" value="1">';	
	str += '</div>';
	str += '<div class="bb"><div class="cn l"></div><div class="cn r"></div></div>';
	str += '<iframe id="tmpaddcart" name="tmpaddcart" src="about:blank" width="0" height="0" border="0" style="visibility:hidden"></iframe>';
	
	var basket = document.getElementById('basket');
	basket.innerHTML = str;
	
	basket.style.display = "block";
	basket.style.left=(mCur.x-200 > 10 ? mCur.x-200 : 10)  + "px";
	basket.style.top=(mCur.y-20 > 10 ? mCur.y-20 : 10 ) + "px";
}

function mouseCoords(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 getPageScroll() {
  var x,y;
  if (self.pageYOffset) {// all except Explorer
    x = self.pageXOffset;
    y = self.pageYOffset;
  } else if (document.documentElement && document.documentElement.scrollTop) {// Explorer 6 Strict
    x = document.documentElement.scrollLeft;
    y = document.documentElement.scrollTop;
  } else if (document.body) {// all other Explorers
    x = document.body.scrollLeft;
    y = document.body.scrollTop;
  }
  return {x: x, y: y};
}

function changeCountCart(input,price){
	/*if (isNaN(input.value)){
		input.value = 1;
	}*/
	if (input.value >100){
		input.value = 100;
	}
	/*if (input.value == "" || input.value < 1){
		input.value = 1;
	}*/
	try {
		document.getElementById('price').innerHTML = number_format(input.value*price, 2, ',', ' ') + ' руб.';
	} catch(e){}
}

function openCart(){
	//SetCookie('PHPSESSID',this.sid);
	SetCookie('back_url', document.location);
	document.location = "/cabinet/basket";
}

function clearCart(){
	//SetCookie('PHPSESSID',this.sid);
	document.frames.act.location = "/?module=cart&method=clear";
}

function SetCookie(sName, sValue){
	document.cookie = sName + "=" + escape(sValue) + "; expires=Fri, 31 Dec 2070 23:59:59 GMT; path=/;";
}
function GetCookie(sName)
{
  // cookies are separated by semicolons
  var aCookie = document.cookie.split("; ");
  for (var i=0; i < aCookie.length; i++)
  {
    // a name/value pair (a crumb) is separated by an equal sign
    var aCrumb = aCookie[i].split("=");
    if (sName == aCrumb[0]) 
      return unescape(aCrumb[1]);
  }

  // a cookie with the requested name does not exist
  
  return null;
}

function changeVisCartBut(){
	if (document.getElementById('reprice').style.display == 'none'){
		document.getElementById('basket_act').value = 'reprice';
		if (document.getElementById('oformit')) document.getElementById('oformit').style.display = 'none';
		if (document.getElementById('oformit2')) document.getElementById('oformit2').style.display = 'none';
		if (document.getElementById('oformit3')) document.getElementById('oformit3').style.display = 'none';
		document.getElementById('reprice').style.display = 'block';
	}
}

function changeTypeOplati(select){
	if (select.value == 'Bank'){
		//document.getElementById('stoimost_dostavki').style.display = 'block';
		/*
		var sl2 = document.getElementById('sposob_dostavki');
		opt = document.createElement('option');
		opt.value = "SelfDelivery";
		opt.innerText = "Самовывоз";
		sl2.insertBefore(opt);
		*/
	} else {
		document.getElementById('address_dostavki').style.display = 'block';
		//document.getElementById('stoimost_dostavki').style.display = 'none';
		//document.getElementById('sposob_dostavki').removeChild(document.getElementById('sposob_dostavki').children(1));
	}
}
function changeSposobDostavki(select){
	if (select.value == 'Courier'){
		document.getElementById('address_dostavki').style.display = 'block';
	} else {
		document.getElementById('address_dostavki').style.display = 'none';
	}
}

function openprintform(id){
	//SetCookie('PHPSESSID',this.sid);
	window.open("/cabinet/basket/print?order_id=" + id, "print" +id, "width=650, height=600, resizable=1, scrollbars = 1, status=0").focus();
}

function openUrl(url){
	//SetCookie('PHPSESSID',this.sid);
	window.open(url, "_blank", "").focus();	
}
function openGUrl(url){
	window.open("http://"+url, "_blank", "").focus();	
}
function openOrder(id){
	//SetCookie('PHPSESSID',this.sid);
	window.location = "/cabinet/orders?id="+id;
}
function openBill(id){
	//SetCookie('PHPSESSID',this.sid);
	
	window.location = "/cabinet/bills?id="+id;
}
function openSupport(id){
	//SetCookie('PHPSESSID',this.sid);
	window.location = "?id="+id;
}
function openDelCompare(id){
	window.location = "/compare?id="+id+"&action=del";
}

var products = new Array();

function changeGenerator(pid, id){	
	products[id] = prices[id][pid];
	document.getElementById('price['+id+']').innerHTML = products[id];
	document.getElementById('itogo['+id+']').innerHTML = this.count[id] * document.getElementById('price['+id+']').innerHTML;
	
}

function calcGenerator(){
	sum = 0;
	for (i in gen_sel){		
		num = products[gen_sel[i]]*count[gen_sel[i]];
		if (parseFloat(num)){
			sum += parseFloat(num);
		}
	}
	document.getElementById('gen_total').innerHTML = sum;
}


function dellOrder(){
	ret = window.confirm( 'Вы уверены, что хотите удалить заказ?');
	if (ret){
		return true;
	}
	return false;
}

function AddSupport(){
    var sup = document.getElementById('support_assquestion');
	if (sup.style.display == 'block'){
		sup.style.display = 'none';
	} else {
		sup.style.display = 'block';
	}
}

function checkSupForm(){
	if (document.getElementById("support[name]").value == ''){
		alert("Вы не заполнили краткое описание проблемы.");
		document.getElementById("support[name]").focus();
		return false;
	}
	if (document.getElementById("support[description]").innerHTML == ''){
		alert("Вы не заполнили описание проблемы.");
		document.getElementById("support[description]").focus();		
		return false;
	}
	return true;
}
function checkSupForm2(){
	if (document.getElementById("support[description]").innerHTML == ''){
		alert("Вы не заполнили вопрос.");
		document.getElementById("support[description]").focus();
		return false;
	}
	return true;
}

function compare(id){
	//SetCookie('PHPSESSID',this.sid);
	win = window.open("/compare?id="+id, "compare_window", "width=630, height=480, resizable=1, scrollbars = yes, status=0").focus();
	if (win){ win.focus();}
}

function compareAll(form){
	//SetCookie('PHPSESSID',this.sid);
	if (!form) return false;
	ids = '';
	for (var i in form.elements) {
		if (form.elements[i]) {
			if (form.elements[i].type == 'checkbox' && form.elements[i].checked) {
				ids += form.elements[i].name + ',';
			}
		}
	}
	win = window.open("/compare?ids="+ids, "compare_window", "width=630, height=480, resizable=1, scrollbars = yes, status=0").focus();
	if (win){ win.focus();}
}

function checkAllCompare(form, checked) {
	if (!form) return false;
	for (var i in form.elements) {
		if (form.elements[i]) {
			if (form.elements[i].type == 'checkbox') {
				form.elements[i].checked = checked;
			}
		}
	}
}

function checkLogin(){
	if (document.getElementById('loginform_login').value == "") {
		alert('Вы должны указать свой login.');
		document.getElementById('loginform_login').focus();
		return false;
	}
	//SetCookie('PHPSESSID',this.sid);
	
	window.location = "/cabinet/forget_password?login="+document.getElementById('loginform_login').value;
	return false;
}

function openImage(image, ev) {
    var ev = window.event || ev;
    var obj = ev.srcElement || ev.target;
    if (obj.tagName == 'IMG') obj = obj.parentNode;
	//if (image) window.open("/popup.php?img="+image, "popupimage", "scrollbars=0,resizable=0,width=100,height=100,location=0,menubar=0,status=0,toolbar=0").focus();
	//return false;
	return hs.expand(obj);
}

function number_format(number, decimals, dec_point, thousands_sep){
	var exponent = "";
	var numberstr = number.toString ();
	var eindex = numberstr.indexOf ("e");
	var i, z;
	if(eindex > -1){
		exponent = numberstr.substring (eindex);
		number = parseFloat (numberstr.substring (0, eindex));
	}
	
	if(decimals != null){
		var temp = Math.pow (10, decimals);
		number = Math.round (number * temp) / temp;
	}
	var sign = number < 0 ? "-" : "";
	var integer = (number > 0 ? 
	    Math.floor (number) : Math.abs (Math.ceil (number))).toString ();
	
	var fractional = number.toString ().substring (integer.length + sign.length);
	dec_point = dec_point != null ? dec_point : ".";
	fractional = decimals != null && decimals > 0 || fractional.length > 1 ? (dec_point + fractional.substring (1)) : "";
	if(decimals != null && decimals > 0){
	  for(i = fractional.length - 1, z = decimals; i < z; ++i)
	    fractional += "0";
	}
	
	thousands_sep = (thousands_sep != dec_point || fractional.length == 0) ? 
	                thousands_sep : null;
	if(thousands_sep != null && thousands_sep != ""){
	for (i = integer.length - 3; i > 0; i -= 3)
	 integer = integer.substring (0 , i) + thousands_sep + integer.substring (i);
	}
	return sign + integer + fractional + exponent;
}


function showMenuNew (id) {
	setTimeout("hideMenuNew("+id+")",1000);
}

function hideMenuNew (id) {
	document.getElementById(id).style.display='none';
}

// классы строкам таблицы каталога
function setClass() {
	this.className = 'hover';
}

function delClass() {
	this.className = '';
}

function trHoverColor() {
	var tabl = document.getElementById('priceList');
	if (tabl == null) return;
	var tr = tabl.getElementsByTagName('tr');
	for (var i = 0; i <= tr.length -1; i++) {
		if (tr[i].className != 'result') {
			tr[i].onmouseover = setClass;
			tr[i].onmouseout = delClass;
		}
	}
}

// классы инпутам с type="text"
function textInputClass() {
	var input = document.getElementsByTagName('input');
	for (var i = 0; i <= input.length - 1; i++) {
		if (input[i].type == 'text' & input[i].className == '') {
			input[i].className = 'text';
		}
	}
}

// открыть-зыкрыть блок добавления в корзину, и саму корзину
function openDrop(obj) {
	var cart = document.getElementById('main_basket');
	if (cart.style.display != 'block') {
		cart.style.display = 'block';
	}
	else { cart.style.display = 'none' }
}

function closeDrop(obj) {
	var cart = document.getElementById('main_basket');
	if (cart.style.display != 'none') {
		cart.style.display = 'none';
	}
	else { cart.style.display = 'block' }
}

// каталог первого уровня, показ 2 уровня
function showCat(objLi, id) {
	if (objLi.parentNode.className != 'active') {
		objLi.parentNode.className = 'active';
		
		document.getElementById('i_'+id).src = '/images/new_cat_minus.gif';
		document.getElementById('i_'+id).alt = 'закрыть';		
	}
	else {
		objLi.parentNode.className = '';
		
		document.getElementById('i_'+id).src = '/images/new_cat_plus.gif';
		document.getElementById('i_'+id).alt = 'открыть';		
	}
}

// каталог второго уровня
function showCatTr(id) {
	if (document.getElementById('m_'+id).style.display == 'none') {
		document.getElementById('m_'+id).style.display = 'block';
		document.getElementById('i_'+id).src = '/images/new_cat_minus.gif';
		document.getElementById('i_'+id).alt = 'закрыть';
	}		
	else {
		document.getElementById('m_'+id).style.display = 'none';
		document.getElementById('i_'+id).src = '/images/new_cat_plus.gif';
		document.getElementById('i_'+id).alt = 'открыть';		
	}
}