
var gCCompIDs = '';
var gCCompnTree = 1; //specialita elektrosveta

//
// Musel jsem to trosku opravit, jelikoz mit nekolik INPUTU se stejnym ID neni validni, taxem to ID u inputu zrusil.
// Komparator stale funguje, ale nebudou asi fungovat specialni ficurky jako CCompChOn/Off, ale to by slo taky nejak dodelat.
// stiff
//

function CCompChCli(o) {

	if (o)
	if (o.checked==true)
	{
		if (gCCompIDs.indexOf('|'+o.value+'|') < 0)	gCCompIDs += '|'+o.value+'|';
		if (gCCompIDs != '') CCompOn();
	}
	else
	{
		gCCompIDs = gCCompIDs.replace('|'+o.value+'|', '');
		if (gCCompIDs == '') CCompOff();
	}
	
	InsertCookies('CComp'+gCCompnTree,gCCompIDs);
}

function CCompChOn()
{
	var ch = document.getElementById('idCComp');

	for (var i=0; i<ch.length; i++)
		if (gCCompIDs.indexOf('|'+ch[i].value+'|') > -1)
			ch[i].checked = true;
}

function CCompChOff()
{
	var ch = document.getElementById('idCComp');

	for (var i=0; i<ch.length; i++)
		ch[i].checked = false;
}

function CCompGo()
{
	var q = gCCompIDs;
	
	while(q.indexOf('||') > -1) q = q.replace('||', ',');
	while(q.indexOf('|') > -1) q = q.replace('|', '');
	
	if (gCCompIDs=='')	
	{
	    alert('Zvolte zboží k porovnání');
	    return false; 
	 } 
	else
	{
	 window.open('/Compare.asp?DPGS='+q,"Porovnávání");
	//showModalDialog("/Compare.asp?DPGS="+q,"","status:no; center:yes; help:no; minimize:no;dialogWidth=250pt;dialogHeight=200pt");

       return true; 
		document.location = '/Compare.asp?DPGS='+q;
		//document.location = '/Compare.asp?DPGS='+q;
    }
}


function CCompOn()
{
	var im = document.getElementById('idCCompGo');
	var de = document.getElementById('idCCompDel');


}


function CCompOff()
{
	var im = document.getElementById('idCCompGo');
	var de = document.getElementById('idCCompDel');
}


function CCompStartup(nTree)
{
	gCCompnTree = nTree.toString();
	gCCompIDs = ExtractCookies('CComp'+gCCompnTree).replace('none','');

	
	if (gCCompIDs != '')
	{
		CCompOn();
		CCompChOn();
	}
}


function CCompDel()
{
	gCCompIDs = '';
	InsertCookies('CComp'+gCCompnTree,gCCompIDs);
	CCompOff();
	CCompChOff();
}