<!--
var cookie_str="";

function setcookie(name,value,expire)
{  var exp=new Date();
   var cookieexpire=exp.getTime()+expire;
   exp.setTime(cookieexpire);
//   document.cookie=name+"="+value+";expires="+exp.toGMTString();


	document.cookie=name+"="+value+";expires="+exp.toGMTString()+";path=/";
//	alert(name+"="+value+";expires="+exp.toGMTString()+";path=/");



}
function GetCookieValueByName(name)
{
//alert('x');
//return 0;
//alert(document.cookie);
var beg=document.cookie.indexOf(name+"=");
if(beg==-1) return 0;

var end=document.cookie.indexOf(";",beg+name.length);
if(end==-1) end=document.cookie.length;

//alert('FFF'+document.cookie.substring(beg+name.length+1,end));
return unescape(document.cookie.substring(beg+name.length+1,end));
}




function ShowBasket()
{
	if(cookie_str!="")
	{
		document.getElementById("basket").style.visibility = "visible";
		document.getElementById("basket").style.display = "block";
	}
	else
	{
		document.getElementById("basket").style.visibility = "hidden";
		document.getElementById("basket").style.display = "none";
	}
		
//alert(document.getElementById("basket").style.visibility);
}
function Uncheck(id)
{	
}

function ChkBox(id)
{
	if (!IdVars[id]) return;
	put=document.getElementById("put"+id);
	if(put)
	{	if(put.checked) put.checked=0;
		else 	put.checked=1;
	}
	

}

function DelEq(id)
{
	val = cookie_str.split("///");
	
	tmp_cookie='';


	for(i=0; i<val.length;i++)
	{	
		tmp=val[i].split(":-:")[0];
		name=val[i].split(":-:")[1];

		if(id!=tmp) 
		{	tmp_cookie=tmp_cookie;
			if(tmp_cookie!='') tmp_cookie+="///";
			else    tmp_cookie+=tmp+":-:"+name;

			//ChkBox(id);
			//put=document.getElementById("put"+id);
			//if(put) put.checked=0;		

		}
		else
		{
			put=document.getElementById("put"+id);
			if(put) put.checked=0;		
		}


	}
cookie_str=tmp_cookie;
//alert(cookie_str);

}


function AddEq(id)
{	if (!IdVars[id]) return;

	name=IdVars[id];
	
	ShowBasket();

	if(cookie_str=="") 
	{ 	  cookie_str=id+":-:"+name; 
 		  setcookie("pakkermash1", cookie_str, 3600*1000*12); 
		  PreviewBasket();
	}	
	else 
	{	val = cookie_str.split("///");

		count=0;del=0;
//alert(val.length);

		for(i=0; i<val.length;i++)
		{	tmp=val[i].split(":-:")[0];
			
			//if(id==tmp) break;

			if(id==tmp) {//alert(id+'|'+tmp);
del=1; break;}

			count++;
		}
		

		if(count==val.length && count!=0) cookie_str=cookie_str+"///"+id+":-:"+name;

		if(del==1) DelEq(id);
	
		setcookie("pakkermash1", cookie_str, 3600*1000*12);
		//alert(del+' / '+cookie_str);

		PreviewBasket();
	}
}


function GetCookie()
{	//alert('GC:'+document.cookie);
	//alert('111');
	if(document.cookie!="")
	{
		//thisCookie=document.cookie.split(";")[0];
		//thisCookieName=thisCookie.split("=")[0];		
		
		//if(thisCookieName=="pakkermash1")		

		if(GetCookieValueByName('pakkermash1'))		
		{    cookie_str=GetCookieValueByName('pakkermash1');
			 //alert('thisCooki'+thisCookie);
		     //cookie_str=thisCookie.split("=")[1];
			 //alert('CSTR1'+cookie_str);
		     if(cookie_str!="") { ShowBasket();PreviewBasket(); }	
		}
		//else alert('hz');
	}
	
	//PreviewBasket();
}





function ClearBasket()
{		
	var name="pakkermash1";
	var expire=3600*1000*24*30;

	if(document.cookie!="")
	{	var exp=new Date();
		var cookieexpire=exp.getTime()-expire;
		exp.setTime(cookieexpire);
		//document.cookie=name+"="+cookie_str+";expires="+exp.toGMTString();
		setcookie("pakkermash1", cookie_str, -3600*1000*12); 
		
		

		//window.location.reload(1);
		//alert(document.cookie);

		val = cookie_str.split("///");
		for(i=0; i<val.length;i++)
		{	
			tmp=val[i].split(":-:")[0];
			put=document.getElementById("put"+tmp);
			//		alert("put"+tmp);
			
			if(put) put.checked=0;				
		}

		cookie_str="";
		//document.cookiename+"="+cookie_str+";expires="+exp.toGMTString();
		//alert(document.cookie);

		
	}//else alert('zzzz');


	document.getElementById("basket").style.visibility = "hidden";
	document.getElementById("basket").style.display = "none";





}

function OpenBasket()
{	newBasket=window.open("view.php","basket","toolbar=yes,location=yes,resizable=yes,menubar=yes,status=yes,scrollbars=yes,width=1024,height=768");
	newBasket.focus();
}

function PreviewBasket()
{
	var text="";
	var oList=document.getElementById("seleq");

	if(!oList) return;

	if(document.cookie!="")
	{	//alert("cookiestr:"+cookie_str);	
		val = cookie_str.split("///");
		
		//text='<ul>';
		for(i=0; i<val.length;i++)
		{	
			tmp=val[i].split(":-:")[1];
			//alert(tmp);
			//text+='<li>'+tmp;
			id=val[i].split(":-:")[0];
			put=document.getElementById("put"+id);
			if(put)	{put.checked=1;}

			text+='<img src="pictures/arrow1.gif"border="0">&nbsp;'+tmp+'<br>';							
		}
		//text+='</ul>';
		
		oList.innerHTML=text;
		ShowBasket();
	}

}

function maycompare()
{	//alert(document.compForm.id.length);
	v=document.forms.compForm["id[]"].length;

	var ch=0;	
	
	if(v)
	{	for(i=0;i<v;i++)
		{if(document.forms.compForm["id[]"][i].checked){ch++;}}
	}

	if(ch<2) {alert('Вы должны отметить не менее 2 единиц оборудования'); return false;}
	
	return 1;


}
//-->