var sportyclick=0;
var gal_poprve = 0;
var gal_akt = 0;
var vid_akt = 0;
var gal_show = false;
var load_count = 0; 
var avid_id = [];

var hodnoceni_array = new Array();
hodnoceni_array[0] = new Array();
hodnoceni_array[1] = new Array();
hodnoceni_array[0][0] = '&nbsp;';
hodnoceni_array[0][1] = '1 hvězda - nedostatečné';
hodnoceni_array[0][2] = '2 hvězdy - dostatečné';
hodnoceni_array[0][3] = '3 hvězdy - dobré';
hodnoceni_array[0][4] = '4 hvězdy - skvělé';
hodnoceni_array[0][5] = '5 hvězd - výborné';
hodnoceni_array[1][0] = '&nbsp;';
hodnoceni_array[1][1] = '1 hvezda - nedostato4né';
hodnoceni_array[1][2] = '2 hvezdy - dostatočné';
hodnoceni_array[1][3] = '3 hvezdy - dobré';
hodnoceni_array[1][4] = '4 hvezdy - skvelé';
hodnoceni_array[1][5] = '5 hvezd - výborné';

	  function stisknutaklavesa()
	  {
		if ((event.keyCode >= 48) && (event.keyCode <= 57)){ event.returnValue = true;}
		else { event.returnValue = false;}
	  }

	  function stisknutaklavesa1()
	  {
		if ((event.keyCode >= 48) && (event.keyCode <= 57) || (event.keyCode == 46)){ event.returnValue = true;}
		else { event.returnValue = false;}
	  }	  

	  function stisknutaklavesa2()
	  {
		if ((event.keyCode >= 48) && (event.keyCode <= 57) || (event.keyCode == 32)){ event.returnValue = true;}
		else { event.returnValue = false;}
	  }
	  
	  function ValidationNejvyhodnejsi(f)
	  {
	  	if (typeof document.forms[f].pocet == "object")
	  	{
	  		if (parseInt(document.forms[f].pocet.value)>0){return true;}
	  		else 
	  		{
		  		alert ((glang==0)?"Položka 'Počet kusů' musí být nenulová!":"Položka 'Počet kusov' nesmie byť nulová");
	  			return false;
	  		}
	  	}
	  	else 
	  	{ 
	  		return false;
	  	}
	  }
	  
	  function ValidationProdukt()
	  {
	  	if (ValidationNejvyhodnejsi('Form1'))
	  	{
	  		if ((typeof document.Form1.velikosti_pocet == "object") && (parseInt(document.Form1.velikosti_pocet.value)>0))
	  		{
	  			velikosti = true;
	  			for (i=1;i<=parseInt(document.Form1.velikosti_pocet.value);i++)
	  			{
	  				if ((typeof document.Form1.elements["velikost"+i] == "object") && (parseInt(document.Form1.elements["velikost"+i].value)>0))
	  				{
	  				}
	  				else
	  				{
	  					velikosti = false;
	  					break;
	  				}
	  			}
	  			if (velikosti)
	  			{
	  				if (typeof document.Form1.zdarma == "object")
	  				{
	  					if ((parseInt(document.Form1.zdarma.selectedIndex)>0)||(parseInt(document.Form1.zdarma.value)>0))	{return true;}
	  					else 
	  					{
	  						alert ((glang==0)?"Zvolte v nabídce, zda chcete či nikoliv objednat i podukt za 1 Kč!":"Zvoľte v ponuke, či chcete alebo nie objednať aj produkt za 0.04 €!"); 
	  						return false;
	  					}
	  				}
	  				else {return true;}
	  			}
	  			else 
	  			{	
	  				alert ((glang==0)?"Před přidáním do košíku je potřeba upřesnit všechny vlastnosti produktu (velikost, barva, ...)!":"Pred pridaním do košíka je nutné upresniť všetky vlastnosti produktu (veľkosť, farba, ...)!"); 
	  				return false;
	  			}
	  		}
	  		else 
	  		{
	  			if (typeof document.Form1.zdarma == "object")
	  			{
	  				if ((parseInt(document.Form1.zdarma.selectedIndex)>0)||(parseInt(document.Form1.zdarma.value)>0))	{return true;}
	  				else 
	  				{
	  					alert ((glang==0)?"Zvolte v nabídce, zda chcete či nikoliv objednat i podukt za 1 Kč!":"Zvoľte v ponuke, či chcete alebo nie objednať aj podukt za 0.04 €"); 
	  					return false;
	  				}
	  			}
	  			else {return true;}
	  		}
	  	}
	  	else { return false; }
	  }
	  
	  function ValidationKosik()
	  {
//	    alert(document.Form1.action.value);
	  	if (document.Form1.action.value==1)
	  	{
	  		SetElement('Form1','action',0);
	  		return confirm((glang==0)?"Opravdu odstranit z košíku?":"Naozaj chcete položku odstrániť z košíka?");
	  	}
	  	else
	  	{
	  		if (document.Form1.action.value==2)
	  		{
	  			SetElement('Form1','action',0);
	  			return confirm((glang==0)?"Opravdu odstranit vše z košíku?":"Naozaj chcete všetko odstrániť z košíka?");
	  		}
	  		else {return true;}
	  	}
	  }
	  
	  function SetElement(f,e,v)
	  {
	  	document.forms[f].elements[e].value=v;
	  }
	  
	  function ValidationLogin()
	  {
	  	var ok = false;
	  	if((parseInt(document.Form1.login.value)>0)||(document.Form1.login.value.length>=5))
	  	{
	  		if(document.Form1.heslo.value.length>=1) {ok = true;}
	  		else { alert((glang==0)?"Heslo musí být řádně vyplněno!":"Heslo musí byť správne vyplnené!"); }
	  	}
	  	else {alert((glang==0)?"Login (e-mail / číslo karty KPŽ) musí být řádně vyplněn!":"Login (e-mail) musí byť správne vyplnený!");}
  		return ok;
	  }
	  
	  function check_pass(typ)
	  {
	  	if ((typeof document.Form1.heslo=='object') && (typeof document.Form1.heslo2=='object') && (typeof document.Form1.heslo_puv=='object'))
	  	{
	  		if ((document.Form1.heslo.value.length>0) || (document.Form1.heslo2.value.length>0))
	  		{
	  			if ((typ==1) || (typ==2)&&(document.Form1.heslo_puv.value.length>0))
	  			{	  		
		  			if (document.Form1.heslo.value.length>=5)
		  			{
		  				if (document.Form1.heslo.value==document.Form1.heslo2.value){	return 0;} 
		  				else { return 3; }
		  			} 
		  			else { return 2; }
			  	}
		  		else {return 5;}
	  		} 
	  		else { return 1; }
	  	} 
	  	else {return 4;}
	  }
	  
	  function ValidationRegistrace(typ)
	  {
	  	var ok = true;
	  	var message = '';
	  	var pass = 4;
	  	for (i=1;i<=6;i++)
	  	{
	  		if ((typeof document.Form1.elements[inputs[i]]=='object')&&(document.Form1.elements[inputs[i]].value.length>maxlength[i])) {}
	  		else { ok=false; message += "Položka '"+nazev[i]+"' musí být řádně vyplněna!\n";}
	  	}
	  	if (!ok) { alert(message); return false;}
	  	else 
	  	{
  			pass = check_pass(typ);
	  		if (((document.getElementById('reg')!=null) && (pass==0))||((document.getElementById('zmena')!=null)&&(pass<=1))) { return true; } 
	  		else { alert(messpass[pass]); return false;}
	  	}
	  }
	  
	  function ValidationHeslo()
	  {
	  	ok = false;
	  	message = (glang==0)?'E-mail musí být řádně vyplněn!':'Login (e-mail) musí byť správne vyplnený!';
	  	if (typeof document.Form1.email=='object')
	  	{
	  		if (document.Form1.email.value.length>=5) { ok=true;}
	  		else {alert(message);}
	  	}
	  	return ok;
	  }

	  function ValidationObjednavky(objednavka, objednavky)
	  {
	  	ok = false;
		message = "Musíte zvolit způsob "+objednavky+"!";
	  	if ((typeof document.Form1.elements[objednavka+"_pocet"]=='object')&&(parseInt(document.Form1.elements[objednavka+"_pocet"].value)>0))
	  	{
	  		check = false;
	  		for (i=1;i<=parseInt(document.Form1.elements[objednavka+"_pocet"].value);i++)
	  		{
	  			if((typeof document.Form1.elements[objednavka+i]=='object')&&(document.Form1.elements[objednavka+i].checked))
	  			{
	  				check = true;
	  				break;
	  			}
	  		}
	  		if (check) { ok=true;}
	  		else {alert(message);}
	  	}
	  	else {alert("Stránku musíte načíst znovu / aktualizovat (refresh-F5)!");}
	  	return ok;	  	
	  }
	  
	  function ValidationDoprava()
	  {
	  	return ValidationObjednavky("doprava", "dopravy");
	  }
	  
	  function ValidationPlatba()
	  {
	  	return ValidationObjednavky("platba", "platby");	
	  }
	  
	  function ValidationKupony()
	  {
	  	if ((typeof document.Form4.kupon=='object')&&(document.Form4.kupon.value.length==13))	{return true;}
	  	else {alert((glang==0)?"Musíte vložit kupón ve správném tvaru (ABCDEF-123456).":"Musíte vložiť kód kupónu v správnom tvare (ABCDEF-123456)."); return false;}
	  }
	  
	  function ValidationKPZ()
	  {
	  	if ((typeof document.Form2.kpz=='object')&&(document.getElementById('send_kpz')!=null))
	  	{
	  		if (document.Form2.kpz.value.length>0) {return true;}
	  		else {alert("Musíte vložit číslo karty Kolo pro život."); return false;}
	  	}
	  	else
	  	{
	  		if (document.getElementById('del_kpz')!=null) {return confirm("Opravdu smazat číslo karty Kolo pro život?");}
	  		else {alert("Stránku musíte načíst znovu / aktualizovat (refresh-F5)!"); return false;}
	  	}
	  }	  
	  
	  function ValidationKuponyDel()
	  {
	  	return confirm("Opravdu odstranit kupóny?");
	  }
	  
	  function ValidationObjednavka()
	  {
	  	return ValidationObjednavky("charita", "charity");
	  }
	  
	  function ValidationZeptejtese(typ)
	  {
	  	ok = false;
	  	if (typ==2)
	  	{
	  		if ((typeof document.Form3.jmeno=='object') && (document.Form3.jmeno.value.length>1))
	  		{
	  			if ((typeof document.Form3.email=='object') && (fcheck_email(document.Form3.email.value)))	{ok=true;}
	  			else {alert((glang==0)?"Položka 'e-mail' musí být řádně vyplněná!":"Položka 'e-mail' musí byť správne vyplnená!");}
	  		}
	  		else {alert((glang==0)?"Položka 'jméno' musí být vyplněna!":"Položka 'Meno' musí byť vyplnená!")}
	  	}
	  	else{ok = true;}
	  	if (ok)
	  	{
	  		if ((typeof document.Form3.dotaz=='object') && (document.Form3.dotaz.value.length>0))	{}
	  		else
	  		{
	  			alert ((glang==0)?"Text dotazu musí být vyplněn!":"Text otázky musí byť vyplnený!")
	  			ok = false;
	  		}
	  	}
	  	return ok;
//	  	return true;
	  }
	  
	  function ValidationDoporucit()
	  {
	  	ok = false;
  		if ((typeof document.Form1.jmeno=='object') && (document.Form1.jmeno.value.length>1))
  		{
  			if ((typeof document.Form1.email=='object') && (document.Form1.email.value.length>4))	
  			{
  				if ((typeof document.Form1.komentar=='object') && (document.Form1.komentar.value.length>0))	{ok = true;}
		  		else {alert ("Komentář k produktu musí být vyplněn!");}
  			}
  			else {alert("Položka 'e-mail' musí být řádně vyplněná!");}
  		}
  		else {alert("Položka 'jméno' musí být vyplněná!");}
	  	return ok;
	  }	  
	  
	  function ValidationStorno()
	  {
	  	return confirm('Opravdu chcete stornovat objednávku?');
	  }
	  
	  function ValidationHodnoceni(typ)
	  {
		ok = false;	  
	  	if (typ==1)
	  	{
	  		if ((typeof document.Form2.jmeno=='object') && (document.Form2.jmeno.value.length>1))
	  		{
	  			if ((typeof document.Form2.mesto=='object') && (document.Form2.mesto.value.length>1)){ok=true;}
	  			else {alert((glang==0)?"Položka 'město' musí být vyplněna!":"Položka 'mesto' musí byť vyplnená!")}
	  		}
	  		else {alert((glang==0)?"Položka 'jméno' musí být vyplněna!":"Položka 'Meno' musí byť vyplnená!")}
	  	}
	  	else{ok = true;}
	  	if (ok)
	  	{
	  		ok = false;
	  		if ((typeof document.Form2.hodnoceni=='object') && (document.Form2.hodnoceni.value.length>1))
	  		{
	  			if ((typeof document.Form2.hvezdicky=='object') && (document.Form2.hvezdicky.value>0) && (document.Form2.hvezdicky.value<=5)){ok = true;}
	  			else {alert((glang==0)?"Musí být zvolen počet hvězdiček!\n1-nejhorší, 5-nejlepší":"Musí byť zvolený počet hviezdičiek!\n1-najhoršie, 5-najlepšie")}
	  		}
	  		else {alert((glang==0)?"'Text hodnocení' musí být vyplněn!":"'Text hodnotenia' musí byť vyplnený!")}
	  	}
	  	return ok;
//	  	return true;
	  }
	  
	  function ValidationHledani()
	  {
/*	  
	  	if ((typeof Form1.hledani_nazev=='object') && (Form1.hledani_nazev.value.length>0)){return true;}
	  	else
	  	{
	  		alert("Hledaný text musí být vyplněn!");
	  		return false;
	  	}
*/	  	
		return true;
	  }
	  
	  function ValidationReklamace()
	  {
	  	ok = false;
		if ((document.Form1.typ1.checked) || (document.Form1.typ2.checked)|| (document.Form1.typ3.checked)|| (document.Form1.typ4.checked))
		{
			if ((document.Form1.typ1.checked) || ((document.Form1.typ2.checked) || (document.Form1.typ3.checked) || (document.Form1.typ4.checked))&& (document.Form1.duvod.value.length>0))
			{
				if ((document.Form1.reseni1.checked) || (document.Form1.reseni2.checked) || (document.Form1.reseni3.checked))
				{
					if ((!document.Form1.reseni2.checked) || (document.Form1.reseni2.checked)&&(document.Form1.ucet.value.length>0)&&(document.Form1.banka_kod.value.length>0))
					{
						if ((!document.Form1.reseni3.checked) || (document.Form1.reseni3.checked)&&(document.Form1.informace.value.length>0))
						{
							if (document.Form1.prohlaseni.checked) 
                            {
                                if ((document.Form1.typ1.checked) && (document.Form1.id_fa.value>0) && (document.Form1.fa.value==0))
                                {
                                    produkt_za_korunu();
                                }
                                ok = true;
                            }
							else { alert ((glang==0)?"Prohlášení musí být zatrhnuto!":"Políčko Prehlásenie musí byť zaškrtnuté!");}
						}
						else { alert ((glang==0)?"Musíte uvést více informací!":"Musíte uviesť viac informácií!");}
					}
					else { alert ((glang==0)?"Musíte uvést číslo účtu a kód banky!":"Musíte uviesť číslo účtu a kód banky!");}
				}
				else { alert ((glang==0)?"Musíte zvolit preferovaný způsob řešení reklamace!":"Musíte zvoliť preferovaný spôsob riešenia reklamácie!");}
			}
			else { alert ((glang==0)?"Musíte vyplnit popis reklamace!":"Musíte vyplniť popis reklamácie!");}
		}
		else { alert ((glang==0)?"Musíte zvolit typ požadavku!":"Musíte zvoliť typ požiadavky!");}
  		return ok;
//  		return true;
	  }
	  
	  function ValidationExpedice()
	  {
	  	if ((typeof document.Form1.jmeno=='object') && (document.Form1.jmeno.value.length>0))
	  	{
	  		if ((typeof document.Form1.email=='object') && (document.Form1.email.value.length>=5))
	  		{
	  			if ((typeof document.Form1.velikosti_pocet == "object") && (parseInt(document.Form1.velikosti_pocet.value)>0))
	  			{
	  				velikosti = true;
	  				for (i=1;i<=parseInt(document.Form1.velikosti_pocet.value);i++)
	  				{
	  					if ((typeof document.Form1.elements["velikost"+i] == "object") && (parseInt(document.Form1.elements["velikost"+i].value)>0))
	  					{
	  					}
	  					else
	  					{
	  						velikosti = false;
	  						break;
	  					}
	  				}
	  				if (velikosti){return true;}
	  				else 
	  				{	
	  					alert ("Všechny vlastnosti produktu musí být zvoleny!"); 
	  					return false;
	  				}
	  			}
	  			else{return true;}
	  		}
	  		else
	  		{
	  			alert("Položka 'e-mail' musí být řádně vyplněna!");
	  			return false;
	  		}
	  	}
	  	else
	  	{
  			alert("Položka 'jméno' musí být řádně vyplněna!");
  			return false;
	  	}
	  }
	  
	  function ValidationSkladem()
	  {
		if ((typeof document.Form1.velikosti_pocet == "object") && (parseInt(document.Form1.velikosti_pocet.value)>0))
		{
			velikosti = true;
			for (i=1;i<=parseInt(document.Form1.velikosti_pocet.value);i++)
			{
				if ((typeof document.Form1.elements["velikost"+i] == "object") && (parseInt(document.Form1.elements["velikost"+i].value)>0))
				{
				}
				else
				{
					velikosti = false;
					break;
				}
			}
			if (velikosti){return true;}
			else 
			{	
				alert ("Všechny vlastnosti produktu musí být zvoleny!"); 
				return false;
			}
		}
		else{return true;}
	  }
      	  
	  function ValidationAukce()
	  {
	  	if ((typeof document.Form1.prihoz_castka=='object') && (document.Form1.prihoz_castka.value.length>0))
	  	{
	  		if (parseInt(document.Form1.prihoz_castka.value)>=parseInt(document.Form1.min_castka.value)){return true;}
	  		else
	  		{
	  			alert("Částka k přihození musí být minimálně "+parseInt(document.Form1.min_castka.value)+" Kč!");
	  			return false;
	  		}
	  	}
	  	else
	  	{
	  		alert("Částka k přihození musí být vyplněna!");
	  		return false;
	  	}
	  }
	  
	  function ValidationAukcePotvrzeni()
	  {
	  	if ((typeof document.Form1.souhlas=='object') && (document.Form1.souhlas.checked)){return true;}
	  	else
	  	{
	  		alert("Musíte potvrdit Souhlas se smluvním ujednáním a všeobecnými podmínkami SportObchod.cz");
	  		return false;
	  	}
	  }
	  
    function fcheck_kategorie(id)
    {
    	vsechny = true;
    	zadna = true;
    	if (id==0)
    	{
	    	for (i=0;i<=document.Form1.kategorie_pocet.value;i++)
	    	{
	    		if (typeof document.Form1.elements["hledani_kategorie"+i]=='object')
	    		{
    				document.Form1.elements["hledani_kategorie"+i].checked = true;
	    		}
	    	}    	
    	}
    	else
    	{
	    	for (i=1;i<=document.Form1.kategorie_pocet.value;i++)
	    	{
	    		if (typeof document.Form1.elements["hledani_kategorie"+i]=='object')
	    		{
	    			if (!document.Form1.elements["hledani_kategorie"+i].checked)
	    			{
	    				vsechny = false;
	    			}
	    			else
	    			{
	    				zadna = false;
	    			}
	    		}
	    	}
	    }
   		document.Form1.hledani_kategorie0.checked = vsechny;
   		if (zadna)
   		{
   			document.Form1.elements["hledani_kategorie"+id].checked = true;
   		}
	}
	
	function ValidationOnLine()
    {
    		ok = false;
    		for (i=1;i<=4;i++)
    		{
    			if (document.MERCHANTFORM.elements["brand"+i].checked)
    			{
    				ok = true;
    			}
    		}
    		if (ok)
    		{
    			return true;
    		}
    		else
    		{
    			alert("Musíte zvolit typ Vaší platební karty!")
    			return false;
    		}
    }	

    function ValidationAnketa()
    {
    		if (document.Form1.anketa_email.value.length<5)
	    	{
	      		alert ("Položka \'e-mail\' musí být správně vyplněna!");
	      		return false;
	    	}
	    	else
	    	{
				message = "";
				for (i=1;i<=5;i++)
				{
					zatrhnuto = false;
					odpovedi = false;
					for (j=1;j<=4;j++)
					{
						if (document.getElementById("odpoved"+i+""+j) != null)
						{
							odpovedi = true;
							if (document.Form1.elements["odpoved"+i+""+j].checked)
							{
								zatrhnuto = true;
								break;
							}
						}
					}
					message += (odpovedi&&!zatrhnuto)?"U otázky č."+i+" nemáte vyplněnou žádnou odpověď!\n":"";
				}
				if (message=="")
				{
					return true;
				}
				else
				{
					alert(message);
					return false;
				}
	    	}
    }
    
    function fsort()
    {
        document.getElementById('znacky_url2').value = (document.getElementById('orderby').value==1)?'sort=1':'';
//        document.getElementById('znacky_url2').value = (document.getElementById('znacky_url2').value=='')?'sort=1':'';
        fset_znacka();
    }
    
    function fset_znacka()
    {
    	var znacky ='';
    	var vlastnosti ='';
    	var sort ='';
    	var pocet = 0;
    	if (document.getElementById('znacek_count')!=null)
    	{
        	for (i=document.getElementById('znacek_count').value;i>=1;i--)
        	{
        		if (document.getElementById('znacka'+i).checked)
        		{
        			znacky += (znacky=='')?'':',';
        			znacky += document.getElementById('znacka'+i).value;
        			pocet ++;
        		}
        	}
//        	znacky = ((pocet==document.getElementById('znacek_count').value)||(pocet==0))?'':'/'+znacky;
        	znacky = (pocet==0)?'':'/'+znacky;
        }
    	if (document.getElementById('znacky_url2').value!='')
    	{
//    	   sort = (znacky=='')?'?':'&';
    	   sort = '?'+document.getElementById('znacky_url2').value;
    	}
    	if ((document.getElementById('vlastnosti_pocet')!=null) && (parseInt(document.getElementById('vlastnosti_pocet').value)>0))
    	{
    	   for (i=0;i<=parseInt(document.getElementById('vlastnosti_pocet').value);i++)
    	   {
    	       if (!document.getElementById('vlastnosti'+i).disabled)
    	       {
    	           vlastnosti += (vlastnosti!='')?'&':'';
    	           vlastnosti += "vlastnosti"+i+"="+document.getElementById('vlastnosti'+i).value;
    	           if (document.getElementById('vlastnosti_max'+i)!= null)
    	           {
    	               vlastnosti += "&vlastnosti_max"+i+"="+document.getElementById('vlastnosti_max'+i).value;
    	           }
    	           vlastnosti += "&prvek"+i+"="+document.getElementById('prvek'+i).value;
    	       }
    	   }
    	   if (vlastnosti!='')
    	   {
    	       vlastnosti += "&select_vlastnosti=ZOBRAZIT&vlastnosti_pocet="+parseInt(document.getElementById('vlastnosti_pocet').value);
    	   }
    	}
    	if (vlastnosti!='')
    	{
        	vlastnosti = (sort=='')?'?'+vlastnosti:'&'+vlastnosti;
    	}
//    	alert(document.getElementById('znacky_url1').value+" z:"+znacky+" s:"+sort+" v:"+vlastnosti);
//        alert(document.getElementById('znacky_url1').value+"|||"+znacky+sort+vlastnosti)
    	document.location = document.getElementById('znacky_url1').value+znacky+sort+vlastnosti;
    }
    
    function fset_znacka_all()
    {
        for (i=1;i<=document.getElementById('znacek_count').value;i++)
        {
            document.getElementById('znacka'+i).checked = true;
        }
        document.getElementById('znacka_all').checked = false;
        fset_znacka(); 
    }

    function zkontroluj_email(adresa)
    {
        var ok = true;
        re1 = /^[^.]+(\.[^.]+)*@([^.]+[.])+[a-z]{2,3}$/;
        re2 = /^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+$/;
        re = /.+@.+\..+$/;
        if (adresa.search(re) != 0)
        {
            chyba = (glang==0)?'E-mail musí být řádně vyplněn!':'E-mail musí byť správne vyplnený!';

            ok = false;
        }
        else
        {
            
        }
        return ok;
    } 

    function fcheck_doprava_stat()
    {
        var ok = false;
        if (astaty.length>0)
        {
            for (i=0;i<astaty.length;i++)
            {
                if (document.Form2.stat.value==astaty[i])
                {
                    ok = true;
                    break;
                }
            }
        }
        else
        {
            alert ("Chyba stránky, zkuste stránku znovu načíst/aktualizovat (F5, refresh, reload).");
        }
        return ok;
    }

    function OdeslaniValidace()
    {
        
        var ok = false;
        var polozky = new Array();
        polozky[1] = Array();
        polozky[1][1] = 'jmeno';
        polozky[1][2] = (glang==0)?'<li>Jméno dodací adresy</li>':'<li>Meno dodacej adresy</li>';
        polozky[2] = Array();
        polozky[2][1] = 'prijmeni';
        polozky[2][2] = (glang==0)?'<li>Příjmení dodací adresy</li>':'<li>Priezvisko dodacej adresy</li>';
        polozky[3] = Array();
        polozky[3][1] = 'ulice';
        polozky[3][2] = (glang==0)?'<li>Ulice dodací adresy</li>':'<li>Ulica dodacej adresy</li>';
        polozky[4] = Array();
        polozky[4][1] = 'mesto';
        polozky[4][2] = (glang==0)?'<li>Město dodací adresy</li>':'<li>Mesto dodacej adresy</li>';
        polozky[5] = Array();
        polozky[5][1] = 'psc';
        polozky[5][2] = (glang==0)?'<li>PSČ dodací adresy</li>':'<li>PSČ dodacej adresy</li>';
        polozky[6] = Array();
        polozky[6][1] = 'krukam_jmeno';
        polozky[6][2] = (glang==0)?'<li>Jméno fakturačních údajů</li>':'<li>Meno fakturačných údajov</li>';
        polozky[7] = Array();
        polozky[7][1] = 'krukam_prijmeni';
        polozky[7][2] = (glang==0)?'<li>Příjmení fakturačních údajů</li>':'<li>Priezvisko fakturačných údajov</li>';
        polozky[8] = Array();
        polozky[8][1] = 'dod_ulice';
        polozky[8][2] = (glang==0)?'<li>Ulice fakturačních údajů</li>':'<li>Ulica fakturačných údajov</li>';
        polozky[9] = Array();
        polozky[9][1] = 'dod_mesto';
        polozky[9][2] = (glang==0)?'<li>Město fakturačních údajů</li>':'<li>Mesto fakturačných údajov</li>';
        polozky[10] = Array();
        polozky[10][1] = 'dod_psc';
        polozky[10][2] = (glang==0)?'<li>PSČ fakturačních údajů</li>':'<li>PSČ fakturačných údajov</li>';
        polozky[11] = Array();
        polozky[11][1] = 'dod_nazev';
        polozky[12] = Array();
        polozky[12][1] = 'gsm';
        polozky[12][2] = (glang==0)?'<li>Telefon</li>':'<li>Telefon</li>';
        
        var chyba = '';
        if (fcheck_doprava_stat())
        {
            if (typeof document.Form2.email == "object")
            {
                for (i=1;i<=6;i++)
                {
                    i=(i==6)?12:i;
                    if (typeof document.Form2.elements[polozky[i][1]] == "object")
                    {
                        if (document.Form2.elements[polozky[i][1]].value.length==0)
                        {
                            chyba += polozky[i][2];
                            document.getElementById(polozky[i][1]).className="chyba-input";
                        }
                        else
                        {
                            document.getElementById(polozky[i][1]).className="";
                        }
                    }
                    else
                    {
                        chyba += polozky[i][2];
                    }
                }
                
                var vyplneny = false;
                if (document.getElementById("fakturace").checked)
                {
                    for (i=6;i<=11;i++)
                    {
                        if (typeof document.Form2.elements[polozky[i][1]] == "object")
                        {
                            if (document.Form2.elements[polozky[i][1]].value.length!=0)
                            {
                                vyplneny = true;
                                break;
                            }
                        }
                    }
                }
                    if (vyplneny)
                    {
                        for (i=8;i<=10;i++)
                        {
                            if (typeof document.Form2.elements[polozky[i][1]] == "object")
                            {
                                if (document.Form2.elements[polozky[i][1]].value.length==0)
                                {
                                    chyba += polozky[i][2];
                                    document.getElementById(polozky[i][1]).className="chyba-input";
                                }
                                else
                                {
                                    document.getElementById(polozky[i][1]).className="";
                                }
                            }
                            else
                            {
                                chyba += polozky[i][2];
                            }
                        }
                    }
                
                
            }
            if (chyba!='')
            {
            
                document.getElementById("email_error").innerHTML=(glang==0)?'<div class="chyba"><strong>Nevyplnil(a) jste následující položky:</strong></br><ul>'+chyba+'</ul></div>':'<div class="chyba"><strong>Nevyplnil/a ste následujúce položky:</strong></br><ul>'+chyba+'</ul></div>';
                document.getElementById("h1").scrollIntoView(true);
            }
            else
            {
                var cont=true;
                if(!document.Form2.novinky.checked)
                {
                    if (glang==0)
                    {
                        cont = confirm("Bonusové body za objednávku se přičítají pouze zákazníkům, kteří přijímají náš zpravodaj o akčních nabídkách.\n\nChcete přesto pokračovat bez souhlasu se zasíláním zpravodaje?");
                    }
                    else
                    {
                        cont = confirm("Bonusové body za objednávku sa pripočítajú len zákazníkom, ktorí dostávajú náš Spravodaj o akčných ponukách.\n\nChcete napriek tomu pokračovať bez súhlasu so zasielaním Spravodaja?");
                    }
                }
                if (cont)
                {
                    if (!document.Form2.souhlas.checked)
                    {
                        alert((glang==0)?"Potvrďte prosím souhlas obchodních podmínek.":"Potvrďte, prosím, súhlas s obchodnými podmienkami.")
                    }
                    else
                    {
                        ok = true;
                    }
                }
                else
                {
                    ok = false;
                }
            }
        }
        else
        {
            if (glang==0)
            {
                document.getElementById("email_error").innerHTML='<div class="chyba2">Vámi zvolený typ dopravy "'+doprava_nazev+'" <B>nelze použít</b> pro doručení zboží pro stát "'+document.Form2.stat.options.item(document.Form2.stat.selectedIndex).text+'"!<BR>'+
                                                            'Zvolte jiný způsob dopravy nebo jiný stát pro doručení v dodací adrese.<br><input type="button" class="formsubmit2" value="&lt;&lt; Zpět na nastavení dopravy" onclick="document.Form2.zpet.click();"></div>';
            }
            else
            {
                document.getElementById("email_error").innerHTML='<div class="chyba2">Vami zvolený typ dopravy "'+doprava_nazev+'" <B>nie je možné použiť</b> pre doručenie tovaru pre štát "'+document.Form2.stat.options.item(document.Form2.stat.selectedIndex).text+'"!<BR>'+
                                                            'Zvoľte, prosím, iný spôsob dopravy alebo iný štát pre doručenie na dodaciu adresu. <br><input type="button" class="formsubmit2" value="&lt;&lt; Späť na nastavenie dopravy" onclick="document.Form2.zpet.click();"></div>';

            }
            document.getElementById("h1").scrollIntoView(true);
            ok = false;
        }
//        alert(ok);
//////////////////////////////////                return true;
        return ok;
    }


    function OdeslaniRegistraceValidace(typ)
    {
        
        var ok = false;
        var polozky = new Array();
        polozky[1] = Array();
        polozky[1][1] = 'jmeno';
        polozky[1][2] = (glang==0)?'<li>Jméno</li>':'<li>Meno</li>';
        polozky[2] = Array();
        polozky[2][1] = 'prijmeni';
        polozky[2][2] = (glang==0)?'<li>Příjmení</li>':'<li>Priezvisko</li>';
        polozky[3] = Array();
        polozky[3][1] = 'ulice';
        polozky[3][2] = (glang==0)?'<li>Ulice a čp</li>':'<li>Ulica a popisné číslo</li>';
        polozky[4] = Array();
        polozky[4][1] = 'mesto';
        polozky[4][2] = (glang==0)?'<li>Město</li>':'<li>Mesto</li>';
        polozky[5] = Array();
        polozky[5][1] = 'psc';
        polozky[5][2] = '<li>PSČ</li>';
        
        polozky[6] = Array();
        polozky[6][1] = 'nazev_dod';
        polozky[7] = Array();
        polozky[7][1] = 'krukam_dod';
        polozky[7][2] = (glang==0)?'<li>K rukám</li>':'<li>Do rúk</li>';
        polozky[8] = Array();
        polozky[8][1] = 'ulice_dod';
        polozky[8][2] = (glang==0)?'<li>Ulice dodací adresy</li>':'<li>Ulica dodacej adresy</li>';
        polozky[9] = Array();
        polozky[9][1] = 'mesto_dod';
        polozky[9][2] = (glang==0)?'<li>Město dodací adresy</li>':'<li>Mesto dodacej adresy</li>';
        polozky[10] = Array();
        polozky[10][1] = 'psc_dod';
        polozky[10][2] = (glang==0)?'<li>PSČ dodací adresy</li>':'<li>PSČ dodacej adresy</li>';
        
        var chyba = '';
            if (typeof document.Form1.email == "object")
            {
                for (i=1;i<=5;i++)
                {
                    if (typeof document.Form1.elements[polozky[i][1]] == "object")
                    {
                        if (document.Form1.elements[polozky[i][1]].value.length==0)
                        {
                            chyba += polozky[i][2];
                            document.getElementById(polozky[i][1]).className="chyba-input";
                        }
                        else
                        {
                            document.getElementById(polozky[i][1]).className="";
                        }
                    }
                    else
                    {
                        chyba += polozky[i][2];
                    }
                }
                pass = check_pass(typ);
	  		    if (((document.getElementById('reg')!=null) && (pass==0))||((document.getElementById('zmena')!=null)&&(pass<=1))) 
                {} 
	  		    else 
                {
//                    alert(pass)
                    chyba += '<li>'+messpass[pass]+'</li>';
                    document.getElementById("heslo").className="chyba-input"
                    document.getElementById("heslo2").className="chyba-input"
                    if (pass==5)
                    {
                        document.getElementById("heslo_puv").className="chyba-input"
                    }
                    
                } 
                
                var vyplneny = false;
//                if (document.getElementById("fakturace").checked)
                {
                    for (i=6;i<=10;i++)
                    {
                        if (typeof document.Form1.elements[polozky[i][1]] == "object")
                        {
                            if (document.Form1.elements[polozky[i][1]].value.length!=0)
                            {
                                vyplneny = true;
                                break;
                            }
                        }
                    }
                }
                    if (vyplneny)
                    {
                        for (i=7;i<=10;i++)
                        {
                            if (typeof document.Form1.elements[polozky[i][1]] == "object")
                            {
                                if (document.Form1.elements[polozky[i][1]].value.length==0)
                                {
                                    chyba += polozky[i][2];
                                    document.getElementById(polozky[i][1]).className="chyba-input";
                                }
                                else
                                {
                                    document.getElementById(polozky[i][1]).className="";
                                }
                            }
                            else
                            {
                                chyba += polozky[i][2];
                            }
                        }
                    }
                
                
            }
            if (chyba!='')
            {
                document.getElementById("email_error").innerHTML=(glang==0)?'<div class="chyba"><strong>Nevyplnil(a) jste následující položky:</strong></br><ul>'+chyba+'</ul></div>':'<div class="chyba"><strong>Nevyplnil/a ste následujúce položky:</strong></br><ul>'+chyba+'</ul></div>';
                document.getElementById("h1").scrollIntoView(true);
            }
            else
            {
                ok = true;
            }
        
//        alert(ok);
//////////////////////////////////                return true;
        return ok;
    }

    function fcheck_email_start(reg, f, varianta)
    {
//        alert(reg);
//        alert(document.Form2.email.value);
        document.getElementById("iframe").src="check_email.php?reg="+reg+"&email="+document.forms[f].email.value+"&varianta="+varianta;
        return false;
    }
    
    function fcheck_email_end(chyba, typ, varianta)
    {
//        alert(chyba+", "+ typ+", "+varianta);
        if (chyba!='')
        {
            document.getElementById("email_error").innerHTML=chyba;
            document.getElementById("email").className="chyba-input";
            document.getElementById("h1").scrollIntoView(true);
///////////////////////////////////                                    document.Form1.formsubmit.click();
        }
        else
        {
            document.getElementById("email_error").innerHTML="";
            document.getElementById("email").className="";
            if (typ!=1)
            {
//                alert("click");
                document.getElementById("formsubmit").click();
            }
        }
        
        
    }
    
    function fcheck_email_blur(reg, f, varianta)
    {
//        alert(document.Form2.email.value);
        if (document.forms[f].email.value.length>0)
        {
            document.getElementById("iframe").src="check_email.php?reg="+reg+"&typ=1&email="+document.forms[f].email.value+"&varianta="+varianta;
            return false;
        }
        else
        {
            document.getElementById("email_error").innerHTML="";
            document.getElementById("email").className="";
        }
        
    }

    function fcheck_psc(f, el_psc, el_mesto)
    {
        if (document.forms[f].elements[el_psc].value.length>=5)
        {
            if (document.forms[f].elements[el_mesto].value.length==0)
            {
                document.getElementById("iframe").src="check_psc.php?psc="+document.forms[f].elements[el_psc].value+"&el_mesto="+el_mesto+"&form="+f;
            }
        }
        return false;
    }

    function Validation_Vas_Nazor()
    {
        ok = true;
        if (document.Form1.poznamka.value.length==0)
        {
            alert("Text poznamky musí být vyplněný!");
            ok = false;
        }
        return ok;
    }

    function fshow_kosik_save()
    {
        document.getElementById("link_save").className="invisible";
        document.getElementById("Form5").className="";
        
    }
    
    function ValidationKosikEmail()
    {
        var ok = true;
        if(!zkontroluj_email(document.Form5.email.value))
        {
            alert("E-mailová adresa pro zaslání znovuobnovovacího kódu musí být řádně vyplněna!");
            ok = false;
        }
        return ok;
    }

function zobrazSkryj(el, el2, nocheck)
{
    if (nocheck)
    {
        document.getElementById(el).checked = !document.getElementById(el).checked;
    } 
    document.getElementById(el2).className = (document.getElementById(el).checked)?"":"invisible";
}

/*
function browser_function()
{
    var nav = navigator.appVersion;
	if ((nav.indexOf('MSIE 7')>0) || (nav.indexOf('MSIE 6')>0))
	{ 
    	document.getElementById("WBControl").ExecWB(7, 1);
    	document.getElementById("WBControl").outerHTML = "";
    }
    else
    {
        window.print();
    }
}
*/

function fshow_kosik(stav)
{
    document.getElementById("kosik").style.display=stav;
}

function fkosik_click(id, cena)
{
    document.getElementById('so_iframe').src="/get_produkt_atribs.php?id="+id+"&cena="+cena+"&lang="+glang;
}

function fclose_vel_box()
{
    document.getElementById("atribs").style.display='none';
    document.getElementById("overlay1").style.height = "0px";
    document.getElementById("overlay1").style.width = "0px"

}

function get_my_height()
{
  var  myHeight = 0;
  if( typeof( window.innerHeight ) == 'number' ) 
  {
    //Non-IE
    myHeight = window.innerHeight;
  } 
  else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
  {
    //IE 6+ in 'standards compliant mode'
    myHeight = document.documentElement.clientHeight;
  } 
  else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
  {
    //IE 4 compatible
    myHeight = document.body.clientHeight;
  }
  return myHeight;
}

function get_src_offsety()
{
  
  var scrOfY=0;
  if( typeof( window.pageYOffset ) == 'number' ) 
  {
    //Netscape compliant
    scrOfY = window.pageYOffset;
  } 
  else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) 
  {
    //DOM compliant
    scrOfY = document.body.scrollTop;
  } 
  else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) 
  {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
  }
  return scrOfY;
}

function get_src_height()
{
  
  var scrOfY=0;
  if( typeof( window.pageYOffset ) == 'number' ) 
  {
    //Netscape compliant
    scrOfY = window.innerHeight;
  } 
  else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) 
  {
    //DOM compliant
    scrOfY = document.body.clientHeight;
  } 
  else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) 
  {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.clientHeight;
  }
  else
  {
    scrOfY = document.documentElement.clientHeight;
  }
  return scrOfY;
}


function fvel_box_pos() 
{
  document.getElementById('atribs').style.top=get_src_offsety()+100+"px";
  document.getElementById('atribs').style.left=document.body.clientWidth/2-150+"px"
}



function fcheck_email(str) 
{
    var regex = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
    return str.search(regex)!=-1;
//    return true;
  				
}

var aprolinac_title = new Array();
var aprolinac_annot = new Array();
var aprolinac_ahref = new Array();
var aprolinac_background = new Array();
var aprolinac_textcontent = new Array();
var prolinac_page = 0;
var prolinac_timeout_id = 0;
var prolinac_fade_timeout_id = 0;
var prolinac_fade_value = 0;

function fprolinac_goto(page)
{
    prolinac_page = page;
    document.getElementById("prolinac_title").innerHTML=aprolinac_title[page];
    document.getElementById("prolinac_annot").innerHTML=aprolinac_annot[page];
    document.getElementById("prolinac_ahref").href=aprolinac_ahref[page];
    document.getElementById("prolinac_ahref").innerHTML=aprolinac_textcontent[page];
    
//    alert(document.getElementById("prolinac_ahref").innerHTML);


    opak = aprolinac_title.length;
    for (i=1;i<=opak;i++)
    {
        document.getElementById("prolinac_dot"+i).src="/img/paging-row-dot.png";
    }
    for (i=opak+1;i<=5;i++)
    {
//        alert(i);
        document.getElementById("aprol"+i).style.display = "none";
    }
    l = 296-12*(opak-3)
    document.getElementById("paging-row").style.left =l+"px" ;
    
    document.getElementById("prolinac_dot"+(page+1)).src="/img/paging-row-active.png";
    
    if (typeof(document.getElementById("prolinac_img").style.filter)=="string")
    {
//        alert(1)
        if(typeof(document.getElementById("prolinac_img").filters)=="object")
        {
            document.getElementById("prolinac_img").filters[0].Apply();
        }
        document.getElementById("prolinac_img").style.backgroundImage = "url("+aprolinac_background[page]+")";
        if(typeof(document.getElementById("prolinac_img").filters)=="object")
        {
            document.getElementById("prolinac_img").filters[0].Play();
        }
        window.clearTimeout(prolinac_timeout_id);
        prolinac_timeout_id = window.setTimeout("fprolinac_start()", 5000);
    }
    else
    {
//        alert(2)
        document.getElementById("prolinac").style.backgroundImage = document.getElementById("prolinac_img").style.backgroundImage;
        document.getElementById("prolinac").style.MozOpacity = 100;
        document.getElementById("prolinac_img").style.MozOpacity = 0;
        document.getElementById("prolinac_img").style.backgroundImage = "url("+aprolinac_background[page]+")";
        prolinac_fade_value = 0;
        window.clearTimeout(prolinac_timeout_id);
        prolinac_timeout_id = window.setTimeout("ffade_images()", 25);
    }
}


function fprolinac_move(page)
{
    opak = aprolinac_title.length
    prolinac_page += page;
    prolinac_page = (prolinac_page<0)?opak-1:prolinac_page;
    prolinac_page = (prolinac_page>opak-1)?0:prolinac_page;
    fprolinac_goto(prolinac_page);
}

function fprolinac_start()
{ 
    fprolinac_move(1);
}

function ffade_images()
{
    window.clearTimeout(prolinac_timeout_id);
    if (prolinac_fade_value<1)
    {
        prolinac_fade_value += 0.1;
        document.getElementById("prolinac_img").style.MozOpacity = prolinac_fade_value;
        prolinac_timeout_id = window.setTimeout("ffade_images()", 25);
    }
    else
    {
        prolinac_timeout_id = window.setTimeout("fprolinac_start()", 5000);
    }
}


var prolinac_leva_page = 0;
var prolinac_leva_last_page = 0;
var prolinac_leva_timeout_id = 0;
var prolinac_leva_fade_value = 0;
var prolinac_leva_pocet = 0;
var prolinac_go = true;

function flevy_prolinac_create()
{
    var i=1;
    var prolinac_leva_kod = "";
    var prolinac_class = ""; 
    var html_kod = "";

    var oDiv=document.createElement("DIV");
    oDiv.setAttribute('id', 'sem_levy_box_all' );
    oDiv.setAttribute('class', "" );
    
    var cisla = ""; 
    
    for (i=1; i<=10;i++)
    {
        if(document.getElementById("levy_box"+i)!=null)
        {
            prolinac_leva_pocet++;
            prolinac_class = (prolinac_leva_pocet==1)?'box1':'invisible';
            html_kod = document.getElementById("levy_box"+prolinac_leva_pocet).innerHTML;
            prolinac_leva_kod += '<div id="sem_levy_box'+prolinac_leva_pocet+'" class="'+prolinac_class+'" style="FILTER: progid:DXImageTransform.Microsoft.Alpha( style=1,opacity=0,finishOpacity=100,startX=0,finishX=0,startY=0,finishY=0);">'+html_kod+'</div>';
//            prolinac_leva_kod += '<div id="sem_levy_box'+prolinac_leva_pocet+'" class="'+prolinac_class+'" >'+html_kod+'</div>';
            cisla_class = (prolinac_leva_pocet==1)?'levybox_page_selected':'levybox_page_not_selected';
            cisla += '<span id="levybox_page'+i+'" class="'+cisla_class+'"><a href="#" style="text-decoration:none" onclick="flevy_prolinac_click('+i+');return false;">'+i+'</a></span>';
            prolinac_leva_page = i;
        }
        else
        {
            break;
        }
    }
    oDiv.innerHTML = prolinac_leva_kod+'<div id="levy_box_cisla">'+cisla+'</div>';
    
    if(typeof(document.getElementById("levy_box_all"))=="object")
    {
//        alert(document.getElementById("lb").innerHTML)
        document.getElementById("levy_box_all").appendChild(oDiv);
        flevy_prolinac_start();
    }
    
    if (navigator.userAgent.indexOf('MSIE 7')>0)
    {
        document.getElementById('levy_box_cisla').style.marginTop = "-20px";
    }
    
    
    
} 

function flevy_prolinac_goto(page)
{
    prolinac_leva_last_page = prolinac_leva_page;
    if (page<100)
    {
        prolinac_leva_page += page;
    }
    else
    {
        prolinac_leva_page = page-100;
    }   
    prolinac_leva_page = (prolinac_leva_page<1)?prolinac_leva_pocet:prolinac_leva_page;
    prolinac_leva_page = (prolinac_leva_page>prolinac_leva_pocet)?1:prolinac_leva_page;

    document.getElementById("sem_levy_box"+prolinac_leva_last_page).className='invisible';
    document.getElementById("sem_levy_box"+prolinac_leva_page).className='box1';
    
    document.getElementById("levybox_page"+prolinac_leva_last_page).className='levybox_page_not_selected';
    document.getElementById("levybox_page"+prolinac_leva_page).className='levybox_page_selected';
    
    if(typeof(document.getElementById("sem_levy_box"+prolinac_leva_last_page).filters)=="object")
    {
        prolinac_leva_fade_value = 0;
        window.clearTimeout(prolinac_leva_timeout_id);
        prolinac_leva_timeout_id = window.setTimeout("flevy_prolinac_start()", 15000);
    
        document.getElementById("sem_levy_box"+prolinac_leva_last_page).filters.item('DXImageTransform.Microsoft.Alpha').opacity=0;
        document.getElementById("sem_levy_box"+prolinac_leva_page).filters.item('DXImageTransform.Microsoft.Alpha').opacity=0;
        
    }
    else
    {
        document.getElementById("sem_levy_box"+prolinac_leva_last_page).style.MozOpacity = 0;
        document.getElementById("sem_levy_box"+prolinac_leva_page).style.MozOpacity = 0;
    }

        prolinac_leva_fade_value = 0;
        window.clearTimeout(prolinac_leva_timeout_id);
        prolinac_leva_timeout_id = window.setTimeout("flevy_fade_boxs()", 25);
//    prolinac_leva_timeout_id = window.setTimeout("flevy_prolinac_start()", 5000);
}

function flevy_prolinac_click(page)
{
    prolinac_go = false;
    flevy_prolinac_goto(100+page);
}

function flevy_prolinac_start()
{ 
//    alert(2)
    flevy_prolinac_goto(1);
}

function flevy_fade_boxs()
{
    window.clearTimeout(prolinac_leva_timeout_id);
    if (prolinac_leva_fade_value<1)
    {
        prolinac_leva_fade_value += 0.1;
        if(typeof(document.getElementById("sem_levy_box"+prolinac_leva_last_page).filters)=="object")
        {
            document.getElementById("sem_levy_box"+prolinac_leva_page).filters.item('DXImageTransform.Microsoft.Alpha').opacity=prolinac_leva_fade_value*100;
        }
        else
        {
            document.getElementById("sem_levy_box"+prolinac_leva_page).style.MozOpacity = prolinac_leva_fade_value;
        }
        prolinac_leva_timeout_id = window.setTimeout("flevy_fade_boxs()", 25);
    }
    else
    {
        if (prolinac_go)
        {
            prolinac_leva_timeout_id = window.setTimeout("flevy_prolinac_start()", 20000);
        }
    }
}


/*************************/
var prolinac_leva_page2 = 0;
var prolinac_leva_last_page2 = 0;
var prolinac_leva_timeout_id2 = 0;
var prolinac_leva_fade_value2 = 0;
var prolinac_leva_pocet2 = 0;
var prolinac_go2 = true;

function flevy_prolinac_create2()
{
    var i2=1;
    var prolinac_leva_kod2 = "";
    var prolinac_class2 = ""; 
    var html_kod2 = "";

    var oDiv2=document.createElement("DIV");
    oDiv2.setAttribute('id', 'sem_levy_box_all2' );
    oDiv2.setAttribute('class', "" );
    var cisla = "";
    
    for (i2=1; i2<=10;i2++)
    {
        if(document.getElementById("pravy_box"+i2)!=null)
        {
            prolinac_leva_pocet2++;
            prolinac_class2 = (prolinac_leva_pocet2==1)?'box1':'invisible';
            html_kod2 = document.getElementById("pravy_box"+prolinac_leva_pocet2).innerHTML;
            prolinac_leva_kod2 += '<div id="sem_pravy_box'+prolinac_leva_pocet2+'" class="'+prolinac_class2+'" style="FILTER: progid:DXImageTransform.Microsoft.Alpha( style=1,opacity=0,finishOpacity=100,startX=0,finishX=0,startY=0,finishY=0);">'+html_kod2+'</div>';
//            prolinac_leva_kod += '<div id="sem_levy_box'+prolinac_leva_pocet+'" class="'+prolinac_class+'" >'+html_kod+'</div>';
            cisla_class = (prolinac_leva_pocet2==1)?'levybox_page_selected':'levybox_page_not_selected';
            cisla += '<a href="#" style="text-decoration:none" onclick="flevy_prolinac_click2('+i2+');return false;"><span id="levybox_page2'+i2+'" class="'+cisla_class+'">'+i2+'</span></a>';
            prolinac_leva_page2 = i2;
        }
        else
        {
            break;
        }
    }
    oDiv2.innerHTML = prolinac_leva_kod2+'<div id="levy_box_cisla2">'+cisla+'</div>';
    
  
    if(typeof(document.getElementById("pravy_box_all"))=="object")
    {
//        alert(document.getElementById("lb").innerHTML)
        document.getElementById("pravy_box_all").appendChild(oDiv2);
        flevy_prolinac_start2();
    }
    
    if (navigator.userAgent.indexOf('MSIE 7')>0)
    {
        document.getElementById('levy_box_cisla2').style.marginTop = "-10px";
    }
    
} 

function flevy_prolinac_goto2(page)
{
    prolinac_leva_last_page2 = prolinac_leva_page2;
    if (page<100)
    {
        prolinac_leva_page2 += page;
    }
    else
    {
        prolinac_leva_page2 = page-100;
    }
    prolinac_leva_page2 = (prolinac_leva_page2<1)?prolinac_leva_pocet2:prolinac_leva_page2;
    prolinac_leva_page2 = (prolinac_leva_page2>prolinac_leva_pocet2)?1:prolinac_leva_page2;

    document.getElementById("sem_pravy_box"+prolinac_leva_last_page2).className='invisible';
    document.getElementById("sem_pravy_box"+prolinac_leva_page2).className='box1';
    
    document.getElementById("levybox_page2"+prolinac_leva_last_page2).className='levybox_page_not_selected';
    document.getElementById("levybox_page2"+prolinac_leva_page2).className='levybox_page_selected';

    if(typeof(document.getElementById("sem_pravy_box"+prolinac_leva_last_page2).filters)=="object")
    {
        prolinac_leva_fade_value2 = 0;
        window.clearTimeout(prolinac_leva_timeout_id2);
        prolinac_leva_timeout_id2 = window.setTimeout("flevy_prolinac_start2()", 15000);
    
        document.getElementById("sem_pravy_box"+prolinac_leva_last_page2).filters.item('DXImageTransform.Microsoft.Alpha').opacity=0;
        document.getElementById("sem_pravy_box"+prolinac_leva_page2).filters.item('DXImageTransform.Microsoft.Alpha').opacity=0;
        
    }
    else
    {
        document.getElementById("sem_pravy_box"+prolinac_leva_last_page2).style.MozOpacity = 0;
        document.getElementById("sem_pravy_box"+prolinac_leva_page2).style.MozOpacity = 0;
    }

        prolinac_leva_fade_value2 = 0;
        window.clearTimeout(prolinac_leva_timeout_id2);
        prolinac_leva_timeout_id2 = window.setTimeout("flevy_fade_boxs2()", 25);
//    prolinac_leva_timeout_id = window.setTimeout("flevy_prolinac_start()", 5000);
}

function flevy_prolinac_click2(page)
{
    prolinac_go2 = false;
    flevy_prolinac_goto2(100+page);
}

function flevy_prolinac_start2()
{ 
//    alert(2)
    flevy_prolinac_goto2(1);
}

function flevy_fade_boxs2()
{
    window.clearTimeout(prolinac_leva_timeout_id2);
    if (prolinac_leva_fade_value2<1)
    {
        prolinac_leva_fade_value2 += 0.1;
        if(typeof(document.getElementById("sem_pravy_box"+prolinac_leva_last_page2).filters)=="object")
        {
            document.getElementById("sem_pravy_box"+prolinac_leva_page2).filters.item('DXImageTransform.Microsoft.Alpha').opacity=prolinac_leva_fade_value2*100;
        }
        else
        {
            document.getElementById("sem_pravy_box"+prolinac_leva_page2).style.MozOpacity = prolinac_leva_fade_value2;
        }
        prolinac_leva_timeout_id2 = window.setTimeout("flevy_fade_boxs2()", 25);
    }
    else
    {
        if (prolinac_go2)
        {
            prolinac_leva_timeout_id2 = window.setTimeout("flevy_prolinac_start2()", 20000);
        }
    }
}
/********************************************/

function fopen_zasoby(produkt_id)
{
    var win = window.open("/Produkt_skladem.php?id="+produkt_id, "online_skladova_dostupnost", "width=800,height=400,toolbar=no,toolbar=no,toolbar=no,status=no,menubar=no,resizable=yes,scrollbars=yes");
    win.focus();
}   

function fshow_kat()
{
    document.getElementById('hide_kat').className=''; 
    document.getElementById('link_kat').className='invisible';
}

function fshow_add_kosik()
{
//    alert(document.body.clientHeight)
    document.getElementById("overlay1").style.height = document.body.clientHeight+"px";
    document.getElementById("overlay1").style.width = document.body.clientWidth+"px"
}

function fclick_dalsi_sporty()
{
    if (sportyclick==0)
    {
        sportyclick = 1;
        document.getElementById("ul_sporty").style.display="block";
    }
    else
    {
        sportyclick = 0;
        document.getElementById("ul_sporty").style.display="none";
    
    }
//    alert(sportyclick)
}

function fonbody_click()
{
    if (sportyclick==1)
    {
        sportyclick = 2;
    }
    else
    {
        if (sportyclick==2)
        {
            document.getElementById("ul_sporty").style.display="none";
            sportyclick = 0;
        }
    }
//    alert(sportyclick)
}


// Zobrazovani a skryvani dlouhych textu
function showInline(id) {
	var prvek = document.getElementById(id);
	// skryt
	if (prvek.style.display == 'inline') {
		prvek.style.display = 'none';
	}
	// zobrazit
	else {
		prvek.style.display = 'inline';
	}
}

// Zobrazovani a skryvani dlouhych textu
function showInline_new(id, id2) {
	var prvek = document.getElementById(id);
	// skryt
	if (prvek.style.display == 'inline') {
		prvek.style.display = 'none';
//		alert(document.getElementById(id2).innerHTML);
		document.getElementById(id2).innerHTML = 'Zobrazit celý text >>';
	}
	// zobrazit
	else {
		prvek.style.display = 'inline';
//		alert(document.getElementById(id2).innerHTML);
		document.getElementById(id2).innerHTML = '<< Skrýt text';
	}
}

function show_velikosti(styl)
{
    if (document.getElementById("velikosti_pocet")!=null)
    {
        if (document.getElementById("velikosti_pocet").value>0)
        {
            for (i=1;i<=document.getElementById("velikosti_pocet").value;i++)
            {
                document.getElementById("velikost"+i).style.display=styl;
            }
        }
    }
    if (document.getElementById("zdarma")!=null)
    {
        document.getElementById("zdarma").style.display=styl;
    }
}

function show_image(poradi)
{
//    if (gal_show)
    {
        gal_show = true;
//        document.getElementById("lightbox").className="";
//        document.getElementById("lightboxImage").src="/Show_picture.php?typ=10&id="+aobr_id[poradi];
//        document.getElementById("lightboxImage").src="http://www.sportobchod.cz/img/produkty/full/"+aobr_id[poradi];
        document.getElementById("lightboxImage").src="/img/produkty/full/"+aobr_id[poradi];
//        document.getElementById("lightboxImage").src="http://www.sportobchod.cz/img/produkty/full/"+aobr_id[poradi];
        document.getElementById('lightbox').style.top=get_src_offsety()+20+"px";
        document.getElementById('loading').style.display="inline";
        gal_akt = poradi;
        gal_poprve = 1;
        fonload_image();
    }
}

function fonload_image()
{
//    alert(gal_poprve)
//    gal_poprve=1;
    if /*(gal_poprve>0)*/(gal_show)   
    {
        fshow_add_kosik();
        show_velikosti("none");

        document.getElementById("lightbox").className="";
        document.getElementById("lightboxImage").className="";
        wi = (document.getElementById("lightboxImage").width>=250)?document.getElementById("lightboxImage").width:250;
        document.getElementById("outerImageContainer").style.width=wi+20+"px";
        document.getElementById("outerImageContainer").style.height=document.getElementById("lightboxImage").height+20+"px";
        document.getElementById("imageDataContainer").style.width=wi+20+"px";
        document.getElementById("prevLink").style.display= (gal_akt<=1)?"none":"inline";
//        document.getElementById("prevLink").style.height= document.getElementById("lightboxImage").height;
        document.getElementById("nextLink").style.display=(gal_akt>=document.getElementById("imgs_count").value)?"none":"inline";
//        document.getElementById("nextLink").style.height= document.getElementById("lightboxImage").height;
        document.getElementById('loading').style.display="none";
        offset = get_src_offsety();
        height = document.body.clientHeight;  
        fsize = (height>offset+document.getElementById("lightboxImage").height+100)?height:offset+document.getElementById("lightboxImage").height+100;
        document.getElementById("overlay1").style.height = fsize+"px";
        document.getElementById("caption").innerHTML = (glang==0)?"Galerie k produktu "+gal_nazev:"Galéria k produktu "+gal_nazev;
        pocet = (document.getElementById("imgs_count").value==0)?1:document.getElementById("imgs_count").value;
        document.getElementById("numberDisplay").innerHTML = (glang==0)?"Obrázek "+gal_akt+" z "+pocet:"Obrázok "+gal_akt+" z "+pocet;
        
        
    }
/*    
    else
    {
        gal_poprve = 1;
    }
*/    
}

function show_prev()
{
    if (gal_akt>1)
    {
        show_image(gal_akt-1)
    }
}

function show_next()
{
    if (gal_akt<document.getElementById("imgs_count").value)
    {
        show_image(gal_akt+1)
    }
}

function close_galery()
{
    document.getElementById("lightbox").className="invisible";
    document.getElementById("overlay1").style.height = "0px";
    document.getElementById("overlay1").style.width = "0px"
    show_velikosti("inline");
    gal_show = false
}


function fonload_pictures()
{
    load_count++;
//    alert(load_count+" "+document.getElementById("imgs_count").value);
    if ((load_count==document.getElementById("imgs_count").value)||(load_count==1&&(document.getElementById("imgs_count").value==0)))
    {
////        gal_show = true;
//        alert('x');
    }
}


function show_video(poradi)
{
    vid_akt = poradi;
    
    fshow_add_kosik();
    show_velikosti("none");
    document.getElementById("lightbox2").className="";

    if(poradi==0)
    {
        if (document.getElementById("vids_count").value>1)
        {
            document.getElementById("video").src="/Show_video.php?produkt="+document.Form1.id.value;
        }
        else
        {
            document.getElementById("video").src="/Show_video.php?id="+avid_id[vid_akt];
        }
    }
    else
    {
        document.getElementById("video").src="/Show_video.php?id="+avid_id[vid_akt];
    }
    document.getElementById('lightbox2').style.top=get_src_offsety()+100+"px";

    document.getElementById("prevLink2").style.display= 'none';
    document.getElementById("nextLink2").style.display= 'none';

//    document.getElementById("prevLink2").style.display= (vid_akt<=1)?"none":"inline";
//    document.getElementById("nextLink2").style.display=(vid_akt>=document.getElementById("vids_count").value)?"none":"inline";
    offset = get_src_offsety();
    
    height = document.body.clientHeight;  
    fsize = (height>offset+document.getElementById("imageContainer2").height+100)?height:offset+document.getElementById("imageContainer2").height+100;
    document.getElementById("overlay1").height = fsize+"px";
    
    pocet = (document.getElementById("vids_count").value==0)?1:document.getElementById("vids_count").value;
//    document.getElementById("numberDisplay2").innerHTML = "Video "+vid_akt+" z "+pocet;
    
    return false; 
}

function close_video()
{
    document.getElementById("lightbox2").className="invisible";
    document.getElementById("overlay1").style.height = "0px";
    document.getElementById("overlay1").style.width = "0px"
    show_velikosti("inline");
}

function show_prev_video()
{
    if (vid_akt>1)
    {
        show_video(vid_akt-1)
    }
}

function show_next_video()
{
    if (vid_akt<document.getElementById("vids_count").value)
    {
        show_video(vid_akt+1)
    }
}


function show_cetelem(typ, produkt_id)
{
    var page=(typ==1)?'Produkt_cetelem.php':((typ==2)?'Produkt_skladem.php':'St_bonus.php');
//    page = (glang==0)?page:'/'+page;
    fshow_add_kosik();
    show_velikosti("none");
    document.getElementById("lightbox3").className="";
    produkt_id = (typ==2)?document.Form1.id.value:produkt_id;
    document.getElementById("cetelem").src="/"+page+"?id="+produkt_id;
    document.getElementById('lightbox3').style.top=get_src_offsety()+100+"px";
    offset = get_src_offsety();
    height = document.body.clientHeight;  
    fsize = (height>offset+document.getElementById("imageContainer3").height+100)?height:offset+document.getElementById("imageContainer3").height+100;
    document.getElementById("overlay1").height = fsize+"px";
    document.getElementById('cetelem').style.width="500px";
    document.getElementById('cetelem').style.height="550px";
    document.getElementById("imageDataContainer3").style.width=500+"px";
    
    return false; 
}

function show_cetelem2(typ, produkt_id)
{
    var page=(typ==1)?'Produkt_cetelem.php':((typ==2)?'Produkt_skladem.php':'St_bonus.php');
//    page = (glang==0)?page:'/'+page;
    fshow_add_kosik();
    show_velikosti("none");
    document.getElementById("lightbox3").className="";
    document.getElementById("cetelem").src="/"+page+"?id="+produkt_id;
    document.getElementById('lightbox3').style.top=get_src_offsety()+100+"px";
    offset = get_src_offsety();
    height = document.body.clientHeight;  
    fsize = (height>offset+document.getElementById("imageContainer3").height+100)?height:offset+document.getElementById("imageContainer3").height+100;
    document.getElementById("overlay1").height = fsize+"px";
    document.getElementById('cetelem').style.width="500px";
    document.getElementById('cetelem').style.height="550px";
    document.getElementById("imageDataContainer3").style.width=500+"px";
    
    return false; 
}

function show_sk(url)
{
    fshow_add_kosik();
    document.getElementById("lightbox3").className="";
    document.getElementById("cetelem").src="/redirect.php?url="+url;
    document.getElementById('lightbox3').style.top=get_src_offsety()+100+"px";
    document.getElementById('cetelem').style.width="700px";
    document.getElementById('cetelem').style.height="300px";
    offset = get_src_offsety();
    height = get_src_height();
    height2 =  	document.body.clientHeight;  
    fsize = (height>height2)?height:height2;
    document.getElementById("overlay1").style.height = fsize+"px";
    document.getElementById("imageDataContainer3").style.width="700px";
    document.getElementById("imageDataContainer3").style.display="none";
    
    return false; 
}

function close_cetelem()
{
    document.getElementById("lightbox3").className="invisible";
    document.getElementById("overlay1").style.height = "0px";
    document.getElementById("overlay1").style.width = "0px"
    show_velikosti("inline");
    document.getElementById("cetelem").src="/_blankw.html";
}


function frezervace()
{
    rez = false;
    if (document.Form1.jmeno.value.length>0)
    {
        if ((document.Form1.email.value.length>0)&&(zkontroluj_email(document.Form1.email.value)))
        {
                rez = true;
        }
        else
        {
            alert((glang==0)?'E-mail musí být řádně vyplněn!':'E-mail musí byť riadne vyplněný!');
        }
    }
    else
    {
        alert((glang==0)?"Vaše jméno musí být vyplněno.":"Vaše jméno musí být vyplněno.");
    }   
    return rez; 
    
}

function fzdarma_onblur(elem)
{
    elem.style.width='270px';
}

function fzdarma_onfocus(elem)
{
    var nav = navigator.userAgent;
	if (nav.indexOf('MSIE')>0)
	{
        var oColl = elem.options;
        max_width = 0;
        for (i=0;i<oColl.length;i++)
        {
            max_width = (elem.options.item(i).innerHTML.length>max_width)?elem.options.item(i).innerHTML.length:max_width;
        }
        if (max_width>42)
        {
            elem.style.width='auto';
        }
    }
}


function  fchange_hvezda_move(id_hvezda)
{
    for (i=1;i<=id_hvezda;i++)
    {
        document.getElementById("hvezda"+i).src="/img/star-active.jpg";
    }
    if (id_hvezda<5)
    {
        for (i=id_hvezda+1;i<=5;i++)
        {
            document.getElementById("hvezda"+i).src="/img/star-deactive.jpg";
        }
    }
    document.getElementById("hodnoceni_text").innerHTML = hodnoceni_array[glang][id_hvezda];
}


function  fchange_hvezda_out()
{
    if (document.Form2.hvezdicky.value==0)
    {
        sta=1;
        document.getElementById("hodnoceni_text").innerHTML = hodnoceni_array[0][0];
    }
    else
    {
        sta=parseInt(document.Form2.hvezdicky.value)+1;
        document.getElementById("hodnoceni_text").innerHTML = hodnoceni_array[glang][document.Form2.hvezdicky.value];
    }
//    alert(sta)
    for (i=1;i<=sta-1;i++)
    {
        document.getElementById("hvezda"+i).src="/img/star-active.jpg";
    }
    for (i=sta;i<=5;i++)
    {
        document.getElementById("hvezda"+i).src="/img/star-deactive.jpg";
    }
    
}


function fset_hvezdy(id_hvezda)
{
    document.Form2.hvezdicky.value=id_hvezda;
}


function fcena_mouse_down(carka)
{
    carka_down = carka;
}

function fcena_mouse_up()
{
    if(prepoctcena[1]==prepoctcena[2])
    {
        prepoctcena[2] = (prepoctcena[1]<=min_cena)?prepoctcena[1]+10:prepoctcena[2];
        prepoctcena[1] = (prepoctcena[2]>=max_cena)?prepoctcena[2]-10:prepoctcena[1];
    }
    document.getElementById("vlastnosti0").value=prepoctcena[1];
    document.getElementById("vlastnosti_max0").value=prepoctcena[2];
    carka_down = 0;
    document.FormVlastnosti.select_vlastnosti.click();
}

function fcena_mouse_out()
{
//    carka_down = 0;
    mouse_out = 1;
//    alert(1)
}

function fcena_mouse_move(event)
{
    mena = (gbonus==2)?' b':((glang==1)?' &euro;':' Kč');
    pricist = (glang==1)?1:10;
    if (carka_down!=0)
    {
        offsetLeft_posuvnik_row = document.getElementById("all").offsetLeft;
        posLeft_posuvnik_row = document.documentElement.scrollLeft;
    
        new_pos = event.clientX - offsetLeft_posuvnik_row + posLeft_posuvnik_row - 342;
        
        if (carka_down==1)
        {
            pos2 = document.getElementById("posuvnik_right").offsetLeft;
            new_pos = (new_pos<0)?0:new_pos;
            new_pos = (new_pos>=pos2-pricist)?pos2-pricist:new_pos;
        }
        else
        {
            if(carka_down==2)
            {
                pos2 = document.getElementById("posuvnik_left").offsetLeft;
                new_pos = (new_pos<pos2+pricist)?pos2+pricist:new_pos;
                new_pos = (new_pos>=400)?400:new_pos;
            }
        }
//        document.getElementById("help").value = event.clientX+" "+offsetLeft_posuvnik_row+" "+posLeft_posuvnik_row+" "+new_pos +" "+carky[carka_down] + " "+mouse_out+" "+carka_down
        document.getElementById("posuvnik_"+carky[carka_down]).style.left = new_pos+"px"
        
        akt_cena = Math.round((((max_cena-min_cena)/400)*new_pos)/pricist)*pricist+min_cena;
//        document.getElementById("help").value += " "+akt_cena;
        prepoctcena[carka_down] = akt_cena;
        document.getElementById(ceny[carka_down]).innerHTML = akt_cena+mena;
    }
    else
    {
        offsetLeft_posuvnik_row = 0;
        posLeft_posuvnik_row = 0;
        new_pos = 0;
//        document.getElementById("help").value = event.clientX+" "+offsetLeft_posuvnik_row+" "+posLeft_posuvnik_row+" "+new_pos +" "+carky[carka_down] + " "+mouse_out+" "+carka_down
    }

}

function fnastav_posuvniky()
{
    mena = (gbonus==2)?' b':((glang==1)?' &euro;':' Kč');
    if ((akt_min_cena>0)&&(akt_max_cena>0))
    {
        akt_min_cena = ((akt_min_cena<min_cena)||(akt_min_cena>max_cena)||(akt_min_cena>=akt_max_cena))?min_cena:akt_min_cena;
        akt_max_cena = ((akt_max_cena>max_cena)||(akt_max_cena<min_cena)||(akt_max_cena<=akt_min_cena))?max_cena:akt_max_cena;
        prepoctcena[1] = akt_min_cena;
        prepoctcena[2] = akt_max_cena;

        new_pos = Math.round((akt_min_cena-min_cena)/((max_cena-min_cena)/400));
        document.getElementById("posuvnik_left").style.left = new_pos+"px"
        document.getElementById(ceny[1]).innerHTML = akt_min_cena+mena;

        new_pos = Math.round((akt_max_cena-min_cena)/((max_cena-min_cena)/400));
        document.getElementById("posuvnik_right").style.left = new_pos+"px"
        document.getElementById(ceny[2]).innerHTML = akt_max_cena+mena;
    }
    else
    {
        document.getElementById(ceny[1]).innerHTML = min_cena+mena;
        document.getElementById(ceny[2]).innerHTML = max_cena+mena;
        prepoctcena[1] = min_cena;
        prepoctcena[2] = max_cena;
    }
}