  var lv2shown = new Array();

  function myShow2(name) {

	while(lv2shown.length > 0){
		tempname=lv2shown.pop();
		if(name != tempname){
		  temp1 = document.getElementById( tempname );
//		  if(temp1) temp1.style.display = "none";
		}
	}

	el = document.getElementById( name );
	elpic = document.getElementById( name + 'pic' );
	if(el) {
		if(el.style.display == 'block'){
			el.style.display = 'none';
			elpic.src = '/p/ico-plus-grey.gif';
		}else{
			el.style.display = 'block';
			elpic.src = '/p/ico-minus-grey.gif';
		}
	}

	lv2shown.push(name);

  }

  function loadpc(s){

	JsHttpRequest.query(
			s + '.html',
//            '/index.php?type=4div&path=' + s, // backend
            {
                // pass a text value
                'path': s
            },
            // Function is called when an answer arrives.
            function(result, errors) {
                // Write errors to the debug div.
//              document.getElementById("debug").innerHTML = errors;
                // Write the answer.
                if (result) {
					document.getElementById("icontz").innerHTML = '';
                    document.getElementById("icontz").innerHTML =
                        result["content"];
                }
            },
            true  // do not disable caching
        );

    processCart();
  	return false;
  }
  
  function loadpc_querystring(s, queryParam){
	var tmp_path;
	if ((queryParam) && (queryParam != '')) {
		tmp_path = s + '.html?' + queryParam;
	}
	else {
		tmp_path = s + '.html';
	}

	JsHttpRequest.query(
			tmp_path,
//            '/index.php?type=4div&path=' + s, // backend
            {
                // pass a text value
                'path': s
            },
            // Function is called when an answer arrives.
            function(result, errors) {
                // Write errors to the debug div.
//              document.getElementById("debug").innerHTML = errors;
                // Write the answer.
                if (result) {
                    document.getElementById("icontz").innerHTML =
                        result["content"];
                }
            },
            true  // do not disable caching
        );

    processCart();
  	return false;
  }

  function putToCart(itemid){

	JsHttpRequest.query(
			'/puttocart.php',
//            '/index.php?type=4div&path=' + s, // backend
            {
                // pass a text value
                'itemid': itemid
            },
            // Function is called when an answer arrives.
            function(result, errors) {
                // Write errors to the debug div.
//              document.getElementById("debug").innerHTML = errors;
                // Write the answer.
                if (result) {
                    //document.getElementById("goodsnum").innerHTML = result["number"];
					var krz = document.getElementById("korzinka");
					if (result["number"] > 0) {
						if (krz) {
							krz.innerHTML = '<b>Корзина</b> ( ' + result["number"] + ' )';
						}
					}
					else {
						if (krz) {
							krz.innerHTML = '';
						}
					}
                }
            },
            true  // do not disable caching
        );

//	document.getElementById("plus" + itemid).src='/p/ico-plus-red.gif';

	//cart[itemid] = 1;
	Cart[itemid] = 1;

  	return false;
  }

  function rd(a){
	document.getElementById("plus" + a).src='/p/ico-plus-red.gif';
  }

  function gr(a){
  	if (( ! Cart[a]) || (Cart[a]!=1))
		{
		document.getElementById("plus" + a).src='/p/ico-plus-grey.gif';
	}
  }
  
  function rd_new(a){
	document.getElementById("plus" + a).src='/p/icon-korzina-on.gif';
  }

  function gr_new(a){
  	if (( ! Cart[a]) || (Cart[a]!=1))
		{
		document.getElementById("plus" + a).src='/p/icon-korzina-off.gif';
	}
  }
  
	// сброс стрелок
	function resetStrelka( elem )
	{
		ar = document.getElementsByTagName( 'a' );
		for ( i = 0; i < ar.length; ++i ) {
			if (ar[ i ].className.indexOf( 'lm2' ) != -1) {
				ar[ i ].className = 'lm2';
			}
		}
		if (elem) {
			elem.blur();
		}
		return false;
	}

	// установка стрелки
	function setStrelka( elem )
	{
		elem.className += ' menu_arrow';
		elem.blur();
		return false;
	}