//<script>
var catCurrentRoot = null;

function addToBasket(idi,ids,typei)
{
	var goUrl='';
	var valprod = document.getElementById('prod_'+idi+'_'+ids+'_'+typei);
	var pricePanel = document.getElementById('price');
	try
	{
		var tVal=parseInt(valprod.value);
		if(isNaN(tVal)==false)
		{
		   if ((valprod.value=tVal)&&(tVal>0))
		   {
			goUrl='/content/basket/addToBasket.asp?amount='+tVal+'&idi='+idi+'&ids='+ids+'&type='+typei;
			pricePanel.src=goUrl;
		   }

		}

	}
	catch(e)
	{}
	if(goUrl=='')
	{
		alert('Введите корректно колличество!');
	}
  
}

function setMode(idmode)
{
    document.getElementById("operation").value = idmode;
    
    var basketForm = document.getElementById("basketForm");
    
    if (basketForm != null)
    {
        basketForm.submit();
    }
}

function gallerySetTop()
{
    src = document.getElementById("inlineGalleryList");
    
    if (src != null)
    {
        srcLink = src.firstChild;

        if (srcLink != null)
        {
            imageLargeURL = srcLink.getAttribute("imageLargeURL");
            imageTitle = srcLink.getAttribute("imageTitle");
            imageDescription = srcLink.getAttribute("imageDescription");
            galleryShowLarge(srcLink, imageLargeURL, imageTitle, imageDescription);
        }
    }
}

function galleryShowLarge(srcLink, url, title, description)
{
    targetImage = document.getElementById("inlineGalleryLargeImage");
    targetTitle = document.getElementById("inlineGalleryLargeImageTitle");
    targetDescription = document.getElementById("inlineGalleryLargeImageDescription");
    targetImage.style.backgroundImage = "url(" + url + ")";
}

function catShowRoot(obj)
{
    children = obj.parentNode.nextSibling;
    
    if (catCurrentRoot != null && catCurrentRoot != obj)
    {
        catCurrentRoot.parentNode.nextSibling.style.display = "none";
        catCurrentRoot.parentNode.className = "catRoot";
    }
    
    if (children.style.display == "" || children.style.display == "none")
    {
        children.style.display = "block";
        obj.parentNode.className = "catRootActive";
    }
    else
    {
        children.style.display = "none";
        obj.parentNode.className = "catRoot";
    }
    catCurrentRoot = obj;
}

function showProductProperties(obj)
{
    target = obj.nextSibling;

    if (target.style.display == "" || target.style.display == "none")
    {
        target.style.display = "block";
    }
    else
    {
        target.style.display = "none";
    }
}

function runSearch()
{
	var searchUrl = '';
	var alertMessage = '';
	var param2 = '';
    var alertMessage = 'Необходимо заполнить строку поиска';
    
	var prodfilter = document.getElementById("ftovar").value;	
	
	if (prodfilter != '')
	{
	    param2 = '&prodfilter=' + escape(prodfilter);
	    searchUrl = '/content/catalog/default.asp?shmode=catalogsearch' + param2;
	}
 	
 	if (searchUrl != '')
	{
		window.location.href = searchUrl;
	}
	else
	{
		alert(alertMessage);
	}
}

function submitOnKeyDown()
{
    var enterKeyCode = 13;
    
    if (window.event.keyCode == enterKeyCode)
    {
        runSearch();
    }
}

function expandArea(obj)
{
    area = obj.nextSibling;
    if (area.style.display == "" || area.style.display == "none")
    {
        area.style.display = "block";
    }
    else
    {
        area.style.display = "none";
    }
}