﻿function btn_Click(e)
{
	if (e.style.display != "inline")
	{
		e.style.display = "inline";
	}
	else
	{
		e.style.display = "none";
	}
}
function imageError(e)
{
	e.src="nofoto.jpg";
}

function imageResize()
{
    if (document.getElementById("table10") != null)
    {
    	i=0;
        myImgCollection = document.getElementById("table10").getElementsByTagName("img");
        while (i<myImgCollection.length)
        {
	        myWidth = myImgCollection[i].width;
	        myHeight = 120;
	        imageWidth = myImgCollection[i].width;
	        imageHeight = myImgCollection[i].height;
	        if (imageWidth<myWidth && imageHeight<=myHeight)
	        {
		        myImgCollection[i].style.width = "auto";
		        myImgCollection[i].style.height = "auto";
	        }
	        if (imageHeight>myHeight)
	        {
		        k = imageHeight/myHeight;
		        myImgCollection[i].style.height = myHeight;
		        myImgCollection[i].style.width = myWidth/k;
	        }
	        i++;
        }
	}
}
function offerImageResize()
{
    if (document.getElementById("table10") != null)
    {
    	i=0;
        myImgCollection = document.getElementById("table10").getElementsByTagName("img");
        while (i<myImgCollection.length)
        {
	        myWidth = 250;
	        myHeight = 250;
	        imageWidth = myImgCollection[i].width;
	        imageHeight = myImgCollection[i].height;
	        if (imageWidth<myWidth && imageHeight<=myHeight)
	        {
		        myImgCollection[i].style.width = "auto";
		        myImgCollection[i].style.height = "auto";
	        }
	        if (imageHeight>myHeight)
	        {
		        k = imageHeight/myHeight;
		        myImgCollection[i].style.height = myHeight;
		        myImgCollection[i].style.width = myWidth/k;
	        }
	        i++;
        }
	}
}
function checkForm(e,priceFrom,priceTo)
{
    if (isNaN(priceFrom.value)==true)
	{
		alert("Вы ввели некорректно $C [ "+priceFrom.value+" ] ");
		return false;
	}
	else
	{
	    priceFrom.value = Math.round(priceFrom.value);
	    if (priceFrom.value<0){priceFrom.value = priceFrom.value * (-1)}
	    if (isNaN(priceTo.value)==true)
	    {
		    alert("Вы ввели некорректно $По [ "+priceTo.value+" ] ");
    		return false;
	    }
	    else
	    {

	        priceTo.value = Math.round(priceTo.value);
    	    if (priceTo.value<0){priceTo.value = priceTo.value * (-1)}
            e.submit();
	    }
    }
}
function alphabet()
{
    if (document.getElementById("myAlphabet").style.display != "inline")
    {
	    document.getElementById("myAlphabet").style.display = "inline";
	}
    else
    {
	    document.getElementById("myAlphabet").style.display = "none";
    }
}
function alphabetButton_mouseClick()
{
	document.getElementById("myAlphabet").style.display = "none";
}
function noteSearchByVendorSubmit(e)
{
    e.parentNode.submit();
}
function offerInCatalog_returnLink(type,offerId)
{
    document.write("<a href=\"http://www.pricemarket.ru/" + type + "." + offerId + ".html\" target=\"_blank\">");
}