
function lmenua(idn)
{
document.getElementById("lb"+idn).style.color = '#3399CC';

}
function lmenup(idn)
{
document.getElementById("lb"+idn).style.color = 'white';
}

function LoadWindow(url)
{
	window.open(url,'_self');
}

function zmena_a(i)
{
if(i==1){
document.images['tm'+i].src='grafika/hmenu/Text/png/uvod_a.png';
} 
if(i==2){
document.images['tm'+i].src='grafika/hmenu/Text/png/sluzby_a.png';

}
if(i==3){
document.images['tm'+i].src='grafika/hmenu/Text/png/kontakt_a.png';

}
}
function zmena_p(i)
{
if(i==1){
document.images['tm'+i].src='grafika/hmenu/Text/png/uvod_p.png';
} 
if(i==2){
document.images['tm'+i].src='grafika/hmenu/Text/png/sluzby_p.png';
}
if(i==3){
document.images['tm'+i].src='grafika/hmenu/Text/png/kontakt_p.png';
}

}

function okno(url){
	window.open(url,'','left=280, top=340, width=440, height=130, menubar=no,directories=no,toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes');
	
}
function zpet_okno(){
	
	opener.open('produkty.php');
	self.close();
}


function pasiv(id)
{
var element=document.getElementById('stitek'+id);
var element2=document.getElementById('menu'+id);

//element.className = 'stitek'+id;
element2.className = 'menu'+id;


}

function aktiv(id)
{
var element=document.getElementById('stitek'+id);
var element2=document.getElementById('menu'+id);

//element.className = 'stitek'+id+'_aktiv';
element2.className = 'menu'+id+'_aktiv';

}

function setfocus()
{
	document.kontakt.elements[0].focus();
	}


function isblank(s) {
    for(var i = 0; i < s.length; i++) {
        var c = s.charAt(i);
        if ((c != ' ') && (c != '\n') && (c != '\t')) return false;
    }
    return true;
}

function kontrola() {
    var msg="\n";
	var cislo;
	for(var x=0 ; x<5; x++)
	{
		document.kontakt.elements[x].style.backgroundColor="#fff";

		}
    
//var prvek = document.form_nova_objednavka.elements[18];
//var hodnota = prvek.value;

var odeslat=true;
document.kontakt.elements[3].numeric=true;
document.kontakt.elements[3].min=1;
document.kontakt.elements[3].max=999999999;


var hodnota_int=parseInt(5,10);


for(var x = 0; x < hodnota_int ; x++ )
 {
 		
       // var e = document.getElementById('objednavka_cislo_nova'+pom);
       var e = document.kontakt.elements[x];
		if (((e.type == "text") || (e.type == "textarea")) && !e.optional) {
            
            if ((e.value == null) || (e.value == "") || isblank(e.value)  ) {
                 odeslat=false; var znak=true;
                
				e.style.backgroundColor="#FC9";
				if(x==1)
				{	e.style.backgroundColor="#FFF";
					odeslat=true; znak=false;
					}
				}
			

          
            if (e.numeric || (e.min != null) || (e.max != null)) { 
               var t = e.value;
                if(t.length!=9) {
				odeslat=false; cislo=true; }
				 var v = parseInt(e.value,10);
        
    							
				if (isNaN(v) || 
                    ((e.min != null) && (v < e.min)) || 
                    ((e.max != null) && (v > e.max))) {
                     odeslat=false; cislo=true; 
                    if (e.min != null) 
                         odeslat=false; cislo=true;
                    if (e.max != null && e.min != null) 
                         odeslat=false;
                    else if (e.max != null)
                       odeslat=false;  cislo=true;
                }
            }
        }
    }


	if (!odeslat)
	{
		

if (znak==true){	
	msg  = "______________________________________________________\n\n";
    msg += "Formulář nebyl odeslán kvůli chybějícím údajům \n";
    msg += "Prosím doplňte zvýrazněné položky.\n";
    msg += "______________________________________________________\n\n";
}
if (cislo==true){
	
	msg += "Telefonní číslo musí být tvořeno pouze číselnými znaky ve správném formátu.\n\n";
	
	};
		alert(msg)
		}else { document.kontakt.submit();}

    
/*
    if (empty_fields) {
        msg += "- The following required field(s) are empty:" 
                + empty_fields + "\n";
        if (errors) msg += "\n";
    }
    msg += errors;
*/
    
    
}

var y=0;
var x=0;
var y_plus=20;
var x_plus=20;
var speed =100;
var interval;
var varpauza=0;
var time_pauza;
var time_zpet;
var uk=0;
function zpet()
{
	if( (x<5) && (x_plus<0) )
	{
		$("#animace").hide(2000);
		clearInterval(time_zpet);
		objekt.style.top="0px";
		objekt.style.left="0px";
		
		
		
		}
		else{
			var objekt = document.getElementById("animace");

			clearInterval(time_zpet);
	time_zpet = setInterval("zpet()",speed);
	y_plus--;
	x_plus--;
	 
	 y=y+y_plus;
	
	objekt.style.top=y+"px";
	
	x=x+x_plus;
	objekt.style.left=x+"px";
		
		}
	}
function pauza()
{

	

if(varpauza>=5){
	clearInterval(time_pauza);
zpet();
}
else{
clearInterval(time_pauza);
time_pauza=setInterval("pauza()", 1000);

varpauza++;
}
}
	
	
function animace()
{
var objekt = document.getElementById("animace");
	clearInterval(interval);
	interval = setInterval("animace()",speed);	
	if(x_plus>0)
	{
	y_plus--;
	x_plus--;	
	
		
	y=y+y_plus;
	
	objekt.style.top=y+"px";
	
	x=x+x_plus;
	objekt.style.left=x+"px";
	}else
	{
		if(uk==0)
	{uk=1;}
		}
	
	if(uk==1){
		
	y_plus=0;
	 x_plus=0;	
	clearInterval(interval);
	pauza();
	
}
	
	
	}

function slideshow_pata()
{
	$('#animace_pata').crossSlide({
  sleep: 1,
  fade: 2	
}, [
  { src: 'images/pata_animace_1.jpg' },
  { src: 'images/pata_animace_1_2.jpg'   },
  { src: 'images/pata_animace_1.jpg' },
  
  
  { src: 'images/pata_animace_2.jpg' },
  { src: 'images/pata_animace_2_2.jpg'   },
  { src: 'images/pata_animace_2.jpg' },
  
   { src: 'images/pata_animace_3.jpg' },
  { src: 'images/pata_animace_3_2.jpg'   },
  { src: 'images/pata_animace_3.jpg' }
  
  
]);
	}
	
	function slideshow_pata_seda()
{
	$('#animace_pata_seda').crossSlide({
  sleep: 1,
  fade: 2	
}, [
  { src: 'images/pata_animace_1_seda.jpg' },
  { src: 'images/pata_animace_1_2_seda.jpg'   },
  { src: 'images/pata_animace_1_seda.jpg' },
  
  
  { src: 'images/pata_animace_2_seda.jpg' },
  { src: 'images/pata_animace_2_2_seda.jpg'   },
  { src: 'images/pata_animace_2_seda.jpg' },
  
   { src: 'images/pata_animace_3_seda.jpg' },
  { src: 'images/pata_animace_3_2_seda.jpg'   },
  { src: 'images/pata_animace_3_seda.jpg' }
  
  
]);
	}
	
	 function example5() {  
       if ($("#animace_hlava").css("opacity") != 1) {  
            $("#animace_hlava").animate({ opacity: 1}, 2000, function() {$("#example5").attr("value", "Spustit příklad 5");});  
        } else {  
           $("#animace_hlava").animate({ opacity: 0}, 2000, function() {$("#example5").attr("value", "Vzít příklad 5 zpět");});  
        }  
    
	  
	
	}   
	
function slideshow(now)
{
	var allcookies = document.cookie;
	var pos = allcookies.indexOf("site=");
	
	if(pos!=-1)
	{
	var start = pos+5;
	var end = allcookies.indexOf(";",start);
	if(end==-1) end=allcookies.length;
	var site	= allcookies.substring(start,end);
	site = unescape(site);
	}
	
	var kontejner_now=document.getElementById("animace_hlava_bg");
	kontejner_now.style.visibility='hidden';
	
	var kontejner_site=document.getElementById("animace_hlava");
	kontejner_site.style.backgroundImage='url(\'images/bg_v'+site+'.jpg\')';
	
	kontejner_now.style.backgroundImage='url(\'images/bg_v'+now+'.jpg\')';
	
	
	example5();
	kontejner_now.style.visibility='visible';

	
	/*
	
	$('#animace_hlava').crossSlide({
  sleep: 1,
  fade: var_fade	
}, [
  { src: 'images/bg_v'+site+'.jpg' },
  { src: 'images/bg_v'+now+'.jpg'   }

  
]);
	var_fade=0;
	*/
	
	}

function okno_ano()
{
	$("#obal_stred").show(1000);
	}

function init_start()
{
	
	/***** cookie *******/
	
	document.cookie= "site="+escape('1');
	
	/********************/
	
	slideshow_pata();
	
	
	
}
	
function init(a)
{
	
	
	
	slideshow(a);
	slideshow_pata_seda();
	/***** cookie *******/
	
	document.cookie= "site="+escape(a);
	
	/********************/
	
	
	
	
	/*setTimeout(okno_ano,1000);*/
	/*
	var arg1=location.protocol;
	var arg2=location.host;
	var arg3=location.pathname;
	var arg4=document.location;
	var arg5=window.document.referrer;
	alert(arg1+" , "+arg2+" , "+arg3+" , "+arg4+" , "+arg5);
	*/
	
	}

