var casovac = null;

function TitleFotoStart(posun)
{
	if (casovac != null)
	{
		clearInterval(casovac);
	}
	casovac = setInterval('TitleFotoPosun('+posun+')',50);
}

function TitleFotoPosun(posun)
{
	var floatObj = document.getElementById('slider-content-float');
 	if (posun > 0 && floatObj.offsetLeft>=0)
	{
		TitleFotoStop();
		return;
	}
	
	if (posun < 0 && 771 - floatObj.offsetLeft >= floatObj.offsetWidth)
	{
		TitleFotoStop();
		return;
	}

	floatObj.style.left = (floatObj.offsetLeft + posun) + 'px';
}

function TitleFotoStop()
{
	if (casovac != null)
	{
		clearInterval(casovac);
		casovac = null;
	}
}

/* ESHOP */
function updatepocet(co,polozka,tmpurl)
{
	IDpol = polozka.name;
	pocet = polozka.options[polozka.selectedIndex].text;
	tmpurl=tmpurl+'?action=update&IDpol='+IDpol+'&'+co+'='+pocet;
	document.location.href = tmpurl;
}
function zmena_objednavky(id)
{
	if (id=='fyzicka'){
		document.getElementById('pravnicka').style.display="none";
	}else{
		document.getElementById('fyzicka').style.display="none";
	}	
	if (document.getElementById(id)!=null){
		document.getElementById(id).style.display="";
	}		
	if (document.getElementById('volba')!=null){
		document.getElementById('volba').value=id;
	}		
	if (id=='fyzicka'){
		zmena_balneho(document.getElementById('IDplatbyVF').value)
	}else{
		zmena_balneho(document.getElementById('IDplatbyV').value)
	}	
}
function zmena_balneho(val,pocet)
{
/*	document.getElementById('t_zadarmo').style.display="";
	document.getElementById('t_prevodem').style.display="none";
	document.getElementById('t_dobirka').style.display="none";
	document.getElementById('t_dpd').style.display="none";
	document.getElementById('finale').value=(1*document.getElementById('totalcena').value);
	document.getElementById('balne').value=0;
	var cena=document.getElementById('finale').value;
	if (val==2){
//		if (pocet<5) {//pocet polozek kosiku
			document.getElementById('t_zadarmo').style.display="none";
			document.getElementById('t_dobirka').style.display="";
			document.getElementById('balne').value=119;
			document.getElementById('finale').value=119+(1*document.getElementById('totalcena').value);
//		}	
	}	
	if (val==4){
//		if (pocet<5) {//pocet polozek kosiku
			document.getElementById('t_zadarmo').style.display="none";
			document.getElementById('t_dpd').style.display="";
			document.getElementById('balne').value=149;
			document.getElementById('finale').value=149+(1*document.getElementById('totalcena').value);
//		}	
	}	
	*/
}
function Valid_OBJ(theForm)
{
	if (theForm.volba.value == 'pravnicka')
	{
		   if (theForm.Nazev.value.length == 0)
		  {
		    alert("Do pole NÁZEV FIRMY je třeba něco zadat...");
		    theForm.Nazev.focus();
		    return (false);
		  }
		   if (theForm.Mail.value.length == 0)
		  {
		    alert("Do pole MAIL je třeba něco zadat...");
		    theForm.Mail.focus();
		    return (false);
		  }
		   if (theForm.Mobil.value.length == 0)
		  {
		    alert("Do pole MOBIL je třeba něco zadat...");
		    theForm.Mobil.focus();
		    return (false);
		  }
		   if (theForm.Ulice.value.length == 0)
		  {
		    alert("Do pole ULICE-ČP je třeba něco zadat...");
		    theForm.Ulice.focus();
		    return (false);
		  }
		   if (theForm.Mesto.value.length == 0)
		  {
		    alert("Do pole MĚSTO je třeba něco zadat...");
		    theForm.Mesto.focus();
		    return (false);
		  }
		   if (theForm.Psc.value.length == 0)
		  {
		    alert("Do pole PSČ je třeba něco zadat...");
		    theForm.Psc.focus();
		    return (false);
		  }
		   if (theForm.IC.value.length == 0)
		  {
		    alert("Do pole IČ je třeba něco zadat...");
		    theForm.IC.focus();
		    return (false);
		  }
		   if (theForm.DIC.value.length == 0)
		  {
		    alert("Do pole DIČ je třeba něco zadat...");
		    theForm.DIC.focus();
		    return (false);
		  }
		   if (theForm.IDplatbyV.value == 0)
		  {
		    alert("Zvolte DODACÍ a PLATEBNÍ podmínky...");
		    theForm.IDplatbyV.focus();
		    return (false);
		  }
  		   if (!theForm.obch_souhlas.checked)
		  {
		    alert("Musíte odsouhlasit obchodní podmínky E-SHOPU");
		    theForm.obch_souhlas.focus();
		    return (false);
		  }
	}else{
		   if (theForm.Jmeno.value.length == 0)
		  {
		    alert("Do pole JMÉNO je třeba něco zadat...");
		    theForm.Jmeno.focus();
		    return (false);
		  }
		   if (theForm.MailF.value.length == 0)
		  {
		    alert("Do pole MAIL je třeba něco zadat...");
		    theForm.MailF.focus();
		    return (false);
		  }
		   if (theForm.MobilF.value.length == 0)
		  {
		    alert("Do pole MOBIL je třeba něco zadat...");
		    theForm.MobilF.focus();
		    return (false);
		  }
		   if (theForm.UliceF.value.length == 0)
		  {
		    alert("Do pole ULICE-ČP je třeba něco zadat...");
		    theForm.UliceF.focus();
		    return (false);
		  }
		   if (theForm.MestoF.value.length == 0)
		  {
		    alert("Do pole MĚSTO je třeba něco zadat...");
		    theForm.MestoF.focus();
		    return (false);
		  }
		   if (theForm.PscF.value.length == 0)
		  {
		    alert("Do pole PSČ je třeba něco zadat...");
		    theForm.PscF.focus();
		    return (false);
		  }
		   if (theForm.IDplatbyVF.value == 0)
		  {
		    alert("Zvolte DODACÍ a PLATEBNÍ podmínky...");
		    theForm.IDplatbyVF.focus();
		    return (false);
		  }
  		   if (!theForm.obch_souhlasF.checked)
		  {
		    alert("Musíte odsouhlasit obchodní podmínky E-SHOPU");
		    theForm.obch_souhlasF.focus();
		    return (false);
		  }

	}
  return (true);
}

function rozbal_podmenu(co)
{
	if (document.getElementById(co)!=null){ 
		if (document.getElementById(co).style.display==""){
			document.getElementById(co).style.display="none";
		}else{
			document.getElementById(co).style.display="";
		}	
	}	
}

function smaz(obj,def){
	if (document.getElementById(obj)!=null){
		if (document.getElementById(obj).value==def) document.getElementById(obj).value='';
	}		
}

function Valid_FULLTEXT(form){
	if (form.fulltext.value.length < 2){
		alert("Zadejte alespoň dva znaky!");
		form.fulltext.focus();
		return (false);
	}
	return (true);
}

function zobrazTAB(o) {
	if (document.getElementById(o).style.display==""){
		document.getElementById(o).style.display="none";
	}else{
		document.getElementById(o).style.display="";
	}	
};

