Shadowbox.init({
	overlayColor: "#eee",
  overlayOpacity: "0.8"
});
$(document).ready(function(){
  $('.hslide').shuffle();
  
	$(function() {
	  $("a[rel^='lightbox']").lightbox();
	}); 
	$('.kulate, fieldset').corner('5px');
	$('#langbar, #search').corner('bottom 5px');
	
	$("#reference a").hover(function(){
    $(this).find("img").attr("src","/images/reference/"+$(this).attr("id")+"on.png");
  },function(){ 
    $(this).find("img").attr("src","/images/reference/"+$(this).attr("id")+".png"); 
  });

	$("#technologie span").hover(function(){
    $(this).find("img").attr("src","/images/technologie/"+$(this).attr("id")+"on.jpg");
  },function(){ 
    $(this).find("img").attr("src","/images/technologie/"+$(this).attr("id")+".jpg"); 
  });
    
  $('input[type="checkbox"]').ezMark();
  $('input[type="radio"]').ezMark();
  
  /* slideshow na titulce */
	$("#myheader-slides").cycle({ 
		speed: 2000,
		timeout: 7000
	});
	/* faq*/
 
  $('.popis').click(function(){
    if ($(this).next('div').css("display") == "none") 
    {
      $(this).next('div').slideDown();
      $(this).css("background-color","#E5E5E5");
    }
    else
    {
      $(this).next('div').slideUp();
      $(this).css("background-color","#FFF");
    }
    
  });
  /* konec faq*/
  /* tabulka radky*/
	$(function() { 
		$(".obecna").find("tr:even").addClass("suda");
    $(".obecna").find("tr:odd").addClass("licha"); 
	});
	/* / tabulka radky */
});
re = /^[^.]+(\.[^.]+)*@([^.]+[.])+[a-z]{2,4}$/;

function kontrolapoptavka() {
 if (document.bigform.jmeno.value== ""){
		alert("Prosím, vložte své jméno");
    document.bigform.jmeno.focus();
    document.bigform.jmeno.select();
		return false;
	}
 if (document.bigform.spolecnosti.value== ""){
		alert("Prosím, vložte název společnosti");
    document.bigform.spolecnosti.focus();
    document.bigform.spolecnosti.select();
		return false;
	}
 if (document.bigform.telefon.value== ""){
		alert("Prosím, vložte telefonní číslo");
    document.bigform.telefon.focus();
    document.bigform.telefon.select();
		return false;
	}
	if (document.bigform.email.value== ""){
		alert("Prosím, vložte svůj email");
		document.bigform.email.focus();
		document.bigform.email.select();
		return false;
	}
	if ( document.bigform.email.value != "" ) {
		if (re.test(document.bigform.email.value) == 0) {
			alert ("E-mailová adresa není správná");
			document.bigform.email.focus();
			document.bigform.email.select();
			return false;
		}
	}
if ($("input[name=sluzba]").filter(":checked").length == 0 )
		{
		  alert ('Vyberte prosím alespoň jednu službu');
		return false;
		}
	else{
		return true;
	}
}
function kontrolapoptavkaen() {
 if (document.bigform.jmeno.value== ""){
		alert("Please enter your name");
    document.bigform.jmeno.focus();
    document.bigform.jmeno.select();
		return false;
	}
 if (document.bigform.spolecnosti.value== ""){
		alert("Please enter the name of your company");
    document.bigform.spolecnosti.focus();
    document.bigform.spolecnosti.select();
		return false;
	}
 if (document.bigform.telefon.value== ""){
		alert("Please enter your telephone number");
    document.bigform.telefon.focus();
    document.bigform.telefon.select();
		return false;
	}
	if (document.bigform.email.value== ""){
		alert("Please enter your email address");
		document.bigform.email.focus();
		document.bigform.email.select();
		return false;
	}
	if ( document.bigform.email.value != "" ) {
		if (re.test(document.bigform.email.value) == 0) {
			alert ("This is not a valid email address format");
			document.bigform.email.focus();
			document.bigform.email.select();
			return false;
		}
	}
if ($("input[name=sluzba]").filter(":checked").length == 0 )
		{
		  alert ('Please select at least one service');
		return false;
		}
	else{
		return true;
	}
}

function kontrolapoptavkask() {
 if (document.bigform.jmeno.value== ""){
		alert("Prosím, zadajte svoje meno");
    document.bigform.jmeno.focus();
    document.bigform.jmeno.select();
		return false;
	}
 if (document.bigform.spolecnosti.value== ""){
		alert("Prosím, zadajte názov spoločnosti");
    document.bigform.spolecnosti.focus();
    document.bigform.spolecnosti.select();
		return false;
	}
 if (document.bigform.telefon.value== ""){
		alert("Prosím, zadajte telefónne číslo");
    document.bigform.telefon.focus();
    document.bigform.telefon.select();
		return false;
	}
	if (document.bigform.email.value== ""){
		alert("Prosím, zadajte svoj email");
		document.bigform.email.focus();
		document.bigform.email.select();
		return false;
	}
	if ( document.bigform.email.value != "" ) {
		if (re.test(document.bigform.email.value) == 0) {
			alert ("E-mailová adresa nie je správna");
			document.bigform.email.focus();
			document.bigform.email.select();
			return false;
		}
	}
if ($("input[name=sluzba]").filter(":checked").length == 0 )
		{
		  alert ('Vyberte, prosím, aspoň jednu službu');
		return false;
		}
	else{
		return true;
	}
}
function kontrolapoptavkafr() {
 if (document.bigform.jmeno.value== ""){
		alert("Veuillez entrer votre nom");
    document.bigform.jmeno.focus();
    document.bigform.jmeno.select();
		return false;
	}
 if (document.bigform.spolecnosti.value== ""){
		alert("Veuillez entrer le nom de la société");
    document.bigform.spolecnosti.focus();
    document.bigform.spolecnosti.select();
		return false;
	}
 if (document.bigform.telefon.value== ""){
		alert("Veuillez entrer le numéro de téléphone");
    document.bigform.telefon.focus();
    document.bigform.telefon.select();
		return false;
	}
	if (document.bigform.email.value== ""){
		alert("Veuillez entrer votre adresse e-mail");
		document.bigform.email.focus();
		document.bigform.email.select();
		return false;
	}
	if ( document.bigform.email.value != "" ) {
		if (re.test(document.bigform.email.value) == 0) {
			alert ("L’adresse e-mail est incorrecte");
			document.bigform.email.focus();
			document.bigform.email.select();
			return false;
		}
	}
if ($("input[name=sluzba]").filter(":checked").length == 0 )
		{
		  alert ('Veuillez sélectionner au moins un service');
		return false;
		}
	else{
		return true;
	}
}

function kontrolapoptavkade() {
 if (document.bigform.jmeno.value== ""){
		alert("Sie haben Ihren Namen nicht ausgefüllt");
    document.bigform.jmeno.focus();
    document.bigform.jmeno.select();
		return false;
	}
 if (document.bigform.spolecnosti.value== ""){
		alert("Sie haben die Bezeichnung der Gesellschaft nicht ausgefüllt");
    document.bigform.spolecnosti.focus();
    document.bigform.spolecnosti.select();
		return false;
	}
 if (document.bigform.telefon.value== ""){
		alert("Sie haben Ihre Telefonnummer nicht ausgefüllt");
    document.bigform.telefon.focus();
    document.bigform.telefon.select();
		return false;
	}
	if (document.bigform.email.value== ""){
		alert("Sie haben Ihre E-Mail nicht ausgefüllt");
		document.bigform.email.focus();
		document.bigform.email.select();
		return false;
	}
	if ( document.bigform.email.value != "" ) {
		if (re.test(document.bigform.email.value) == 0) {
			alert ("Die E-Mail-Adresse ist nicht richtig");
			document.bigform.email.focus();
			document.bigform.email.select();
			return false;
		}
	}
if ($("input[name=sluzba]").filter(":checked").length == 0 )
		{
		  alert ('Bitte, mindestens eine Dienstleistung auswähle');
		return false;
		}
	else{
		return true;
	}
}

(function($){
 
    $.fn.shuffle = function() {
 
        var allElems = this.get(),
            getRandom = function(max) {
                return Math.floor(Math.random() * max);
            },
            shuffled = $.map(allElems, function(){
                var random = getRandom(allElems.length),
                    randEl = $(allElems[random]).clone(true)[0];
                allElems.splice(random, 1);
                return randEl;
           });
 
        this.each(function(i){
            $(this).replaceWith($(shuffled[i]));
        });
 
        return $(shuffled);
 
    };
 
})(jQuery);
