
	function AddFavorite(linkObj, addUrl, addTitle)
    	{
      		if(document.all && !window.opera)
      		{
        		window.external.AddFavorite(addUrl, addTitle);
        		return false;
      		}
      		else if(window.opera && window.print)
      		{
        		linkObj.title=addTitle;
        		return true;
      		}
      		else if((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function'))
      		{
        		if(window.confirm('Přidat oblíbenou stránku jako nový panel?'))
        		{
          			window.sidebar.addPanel(addTitle, addUrl, '');
          			return false;
        		}
      		}

      		window.alert('Po potvrzení stiskněte CTRL-D,\nstránka bude přidána k vašim oblíbeným odkazům.');
      		return false;
    	}



	function Search()
	{
		var elem;

		elem=GO('search');

		if(elem.value == 'hledejte...')
		{
			elem.value='';
		}
	}



	function Cart(input, mode)
	{
		var elem, val;

		elem=GO(input);

		val=Math.abs(elem.value);

		if(mode == 2)
		{
			val-=1;
		}
		else
		{
			val+=1;
		}

		if(val < 0) val=0;

		elem.value=val;
	}



	function JN(id, yesno)
	{
		if(yesno)
		{
			CCS('jni-' + id, 'display', 'block');
		}
		else
		{
			CCS('jni-' + id, 'display', 'none');
		}
	}



	function Cart_Descr()
	{
		var v=GO('cart-descr').value;

		v=v.replace(/&/g, '**am**');
		v=v.replace(/=/g, '**eq**');
		v=v.replace(/\+/g, '**pl**');

		head=document.getElementsByTagName('head')[0];
	    	loader=document.getElementById('loader');

	    	if(loader)
	    	{
	    		head.removeChild(loader);
	    	}

		script=document.createElement('script');
	    	script.id='loader';

	    	script.src='/cart/descr/?random=' + Math.random() + '&cdescr=' + v;

	    	//alert(script.src);
		//window.open(script.src);

		cache=document.getElementsByTagName('head')[0];
	    	cache.appendChild(script);

	    	return false;
	}



	function CartUC(msg)
	{
		msg=msg.replace('*', "\n\n");
		alert(msg);

		location.reload();
	}



	var TocA;

	function Toc(id, max)
	{
		if(TocA == id) return;

		for(i=1; i<=max; i++)
		{
			if(i == id)
			{
				TocA=id;
				CCS('toc-' + i, 'background', 'rgb(255,214,133)');
				GO('toci-' + i).checked='checked';
				setTimeout("GO('toci-" + i + "').blur();", 1);
			}
			else
			{
				CCS('toc-' + i, 'background', 'none');
			}
		}
	}


	function TocB(id, out)
	{
		if(!TocA && (id == 1)) return;
		if(TocA && (TocA == id)) return;

		if(out)
		{
			CCS('toc-' + id, 'background', 'none');
		}
		else
		{
			CCS('toc-' + id, 'background', '#FFEBC1');
		}
	}

	function VlozOdpoved(IDnumber){
		document.getElementById('cm[text_dotazu]').value='['+IDnumber+']';
		if(IDnumber){
			document.getElementById('VymazReakci').disabled = false;
			document.getElementById("input_reakce").style.display = 1;
		}else{
			document.getElementById('VymazReakci').disabled = true;

		}

	}

    //zobrazi informaci o vlozeni komentare
		$(document).ready(function()
		{
      setTimeout(function() {
          $('#successMessage').fadeOut('fast');
      }, 2500);
		});


	window.onload=Init();

	function Init()
	{
		if(!location.href.match('admin'))
		{
			Heureka_Banner();
		}
		Counter();
	}


	var _hwq;

	function Heureka_Banner()
	{
		_hwq = _hwq || [];

		_hwq.push(['setKey', '8481120E9786E1DCAC5E3D32F17DD337']);
		_hwq.push(['setTopPos', '50']);
		_hwq.push(['showWidget', '22']);

		var ho=document.createElement('script');
		ho.type='text/javascript';
		ho.async=true;
		ho.src='http://www.heureka.cz/direct/i/gjs.php?n=wdgt&sak=8481120E9786E1DCAC5E3D32F17DD337';
    		var s=document.getElementsByTagName('script')[0];
    		s.parentNode.insertBefore(ho, s);
    	}



	function Fatcha()
	{
		var mode, first, second, result;

		mode=Number(GO('fatcha-mode').value);
		first=Number(GO('fatcha-first').value);
		second=Number(GO('fatcha-second').value);

		if(!(mode % 8))
		{
			result=first / second;
		}
		else if(!(mode % 4))
		{
			result=first + second;
		}
		else if(!(mode % 2))
		{
			result=first - second;
		}
		else
		{
			result=first * second;
		}

		GO('fatcha-result').value=Math.ceil(result);
		GO('fatcha-form').submit();
	}
