if (document.images) {

 function turnOn(imageName) {
   if (document.images) {
     document[imageName].src = "img/"+imageName+"_2.gif";
   }
 }

 function turnOff(imageName) {
   if (document.images) {
     document[imageName].src = "img/"+imageName+".gif";
   }
 }
}

function wopen(wurl,h,w,name)
        {window.open(wurl,'Map','height='+h+',width='+w+',resizable=no,scrollbars=yes,menubar=no,status=no');}


function ChangeKol(id)
	{
	Price1="1Price"+id;
	Price2="2Price"+id;
	Price3="3Price"+id;
	Price4="4Price"+id;

	Vol="Vol"+id;
	Kol="Kol"+id;
	
	Cost="Cost"+id;
	User="User";
	Total="Total";
	Total2="Total2";
	
    expires='; expires="Thu, 01-Jan-70 00:00:01 GMT"';


    value="";
        if (isNaN(document.Zakaz.elements[Kol].value))
        	{document.Zakaz.elements[Kol].value = "";}
        if ((document.Zakaz.elements[Kol].value) < 0)
        	{document.Zakaz.elements[Kol].value = "";}
        else if ((document.Zakaz.elements[Kol].value == "") || (document.Zakaz.elements[Kol].value == 0))
            {
            value="";
            OldCost=parseFloat(document.Zakaz.elements[Cost].value);
            TotalValue=parseFloat(document.Zakaz.elements[Total].value);
            TotalValue=TotalValue-OldCost;
            document.Zakaz.elements[Kol].value = "";
            document.Zakaz.elements[Cost].value = "";
            }
        else
            {
            VolValue=parseFloat(document.Zakaz.elements[Vol].value);
            UserValue=document.Partner.elements[User].value;
            KolValue=parseInt(document.Zakaz.elements[Kol].value);
            value=KolValue;

            OldCost=parseFloat(document.Zakaz.elements[Cost].value);
            if(isNaN(OldCost))
            	{
            	OldCost=0;
            	}	

            Price1=document.Zakaz.elements[Price1].value;
            Price2=document.Zakaz.elements[Price2].value;
            Price3=document.Zakaz.elements[Price3].value;
            Price4=document.Zakaz.elements[Price4].value;

            NewCost=Math.floor((Price1*KolValue)*100)/100;
            if (KolValue >= (5000/VolValue))
            	{NewCost=Math.floor((Price2*KolValue)*100)/100;}
            if (KolValue >= (10000/VolValue))
            	{NewCost=Math.floor((Price3*KolValue)*100)/100;}
            if (UserValue != "")
            	{NewCost=Math.floor((Price4*KolValue)*100)/100;}
            
            document.Zakaz.elements[Cost].value=NewCost;
            // document.Zakaz.elements[Cost].value=UserValue;

            TotalValue=parseFloat(document.Zakaz.elements[Total].value);
            TotalValue=TotalValue - OldCost + NewCost;
           }
    
    TotalValue=Math.floor(TotalValue*100)/100;
    document.Zakaz.elements[Total].value = TotalValue;
    document.Zakaz.elements[Total2].value = TotalValue;
	
	document.cookie='zakaz'+id+'='+value+expires+';path=/;';
}

