
	var guideCount = 1;

	function myhtmlspecialchars( text )
	{
		//text = text.replace( /&/g, '&amp;' );
		text = text.replace( /\'/g, '\\\'' );
		text = text.replace( /\"/g, '\\\"' );
		//text = text.replace( /</g, '&lt;' );
		//text = text.replace( />/g, '&gt;' );
		return text;
	}

	/**
	*	Opis: dodaje grupe, lub produkt do koszyka
	*/
	function addToCityGuide( gType, gId, gGroupName, gName, gUrl )
	{
		//gGroupName = myhtmlspecialchars( gGroupName );
		//gName = myhtmlspecialchars( gName );
		//gGroupName = escape( gGroupName );
		//gName = escape( gName );
		var str = gType+"##"+gId+"##"+gGroupName+"##"+gName+"##"+gUrl+"####";
		//alert( str );
		var cook = Cookie.get( "cityGuide" );
		var ok = 0;
		if( cook != false )
		{
			//alert("cook="+cook+"; str="+str+"; index="+cook.indexOf( str )+";" );
			if( cook.indexOf( str ) < 0 )
			{
				cook += str;
				Cookie.set( "cityGuide", cook, {path: "/"} );
				ok = 1;
			}
		}
		else
		{
			Cookie.set( "cityGuide", str, {path: "/"} );
			ok = 1;
		}
		if( ok == 1 )
		{
			var bgColor = Array( "#f1f1f1", "#ffffff" );
			$( "cityGuideDivEmpty" ).style.display = 'none';
			$( "cityGuideDiv" ).style.display = 'block';
			var klon = $( "cloneMe" ).clone(true);
			klon.id = "cityGuide_"+gType+"_"+gId;
			klon.style.display = 'block';
			klon.style.backgroundColor = bgColor[guideCount];
			var children = klon.getChildren();
			var link = children[0].innerHTML;
			link = link.replace( /nameMe/g, "guide_"+gType+"_"+gId );
			link = link.replace( /linkTitle/g, gName );
			if( gUrl != 'empty' )
			{
				link = link.replace( /#linkMe/g, gUrl );
			}
			else
			{
				link = link.replace( /#linkMe/g, "#guide_"+gType+"_"+gId );
				link = link.replace( /class="l9"/g, 'class="l19"' );
			}
			children[0].innerHTML = link
			del = children[1].innerHTML;
			del = del.replace( /onclick=""/g, 'onclick="javascript: removeCityGuide( '+gType+', '+gId+', \''+myhtmlspecialchars( gGroupName )+'\', \''+myhtmlspecialchars( gName )+'\', \''+gUrl+'\' );"' );
			children[1].innerHTML = del;
			$( "cityGuideContainer" ).appendChild( klon );
			/*if( guideCount == 0 )
			{
				guideCount = 1;
			}
			else
			{
				guideCount = 0;
			}*/
		}
	}

	/**
	*	Opis: usowa grupe, lub produkt z koszyka
	*/
	function removeCityGuide( gType, gId, gGroupName, gName, gUrl )
	{
		//gGroupName = myhtmlspecialchars( gGroupName );
		//gName = myhtmlspecialchars( gName );
		var str = gType+"##"+gId+"##"+gGroupName+"##"+gName+"##"+gUrl+"####";
		//alert( str );
		var cook = Cookie.get( "cityGuide" );
		if( cook != false )
		{
			//alert( cook );
			cook = cook.replace( str, "" );
			//alert( cook );
			Cookie.set( "cityGuide", cook, {path: "/"} );
			$( "cityGuide_"+gType+"_"+gId ).remove();
			/*if( guideCount == 0 )
			{
				guideCount = 1;
			}
			else
			{
				guideCount = 0;
			}*/
		}
		var children = $( "cityGuideContainer" ).getChildren();
		if( children.length == 0 )
		{
			$( "cityGuideDiv" ).style.display = 'none';
			$( "cityGuideDivEmpty" ).style.display = 'block';
		}
		//Cookie.set( "cityGuide", "", {path: "/"} );
	}

	/**
	*	Opis: usowa wszystkie grupy i produkty z koszyka
	*/
	function removeAllGuide()
	{
		Cookie.set( "cityGuide", "", {path: "/"} );
		$( "cityGuideContainer" ).innerHTML = '';
		$( "cityGuideDiv" ).style.display = 'none';
		$( "cityGuideDivEmpty" ).style.display = 'block';
		//Cookie.set( "cityGuide", "", {path: "/"} );
	}


