function SearchForm(langid) {
    
	 if (document.getElementById('kategorie')) {
	   kategorieValue      = $('#kategorie option:selected').val();
	 }
	
	if (document.getElementById('skupina')) {
	   kategorieValue2     = $('#skupina option:selected').val();
	}
	
	if (document.getElementById('skupina2')) {
	   kategorieValue3     = $('#skupina2 option:selected').val();
	}	
	
    if (document.getElementById('znacka')) {
	   znackaValue     = $("#znacka option:selected").val();
	}	
	
	if (document.getElementById('velikost')) {
       velikostValue     = $("#velikost option:selected").val();
	}
	
	if (document.getElementById('hvel')) {
       hvelValue     = $("#hvel option:selected").val();
	}
	
	if (document.getElementById('barva')) {
	   barvaValue       = $("#barva option:selected").val();	
	}
	
//    alert("catID="+kategorieValue+"&znacka="+znackaValue+"&skupina="+kategorieValue2+"&skupina2="+kategorieValue3+"&velikost="+velikostValue+"&barva="+barvaValue+"&akce="+akce+"&langid="+langid);

	$.ajax({
							method: "get",
							url: "/ajax_search_form.php",
							data: "catID="+kategorieValue+"&znacka="+znackaValue+"&skupina="+kategorieValue2+"&skupina2="+kategorieValue3+"&velikost="+velikostValue+"&hvel="+hvelValue+"&barva="+barvaValue+"&akce="+akce+"&langid="+langid,
							beforeSend: 
							  function(){$("#loading").show("fast");}, //show loading just when link is clicked
							
                            complete: 
							  function(){ $("#loading").hide("fast");}, //stop showing loading when the process is complete
								  
							success: 
							  function(html){ //so, if data is retrieved, store it in html
							   
							    $("#searchForm").show(); //animation
							    $("#searchForm").html(html); //show the html inside .content div
							   
                              }
	});
	
}	

function Nacti_detail(item, langid) {
    	
	 if (document.getElementById('barva'+item)) {
	   barva      = $('#barva'+item+' option:selected').val();
	 }
	 
	 
	 if (document.getElementById('velikost'+item)) {
	   velikost      = $('#velikost'+item+' option:selected').val();
	 }  
			
	$.ajax({
							method: "get",
							url: "/ajax_detail.php",
							data: "item="+item+"&barva="+barva+"&velikost="+velikost+"&langid="+langid,
							beforeSend: 
							  function(){$("#loading"+item).show("fast");}, //show loading just when link is clicked
							
                            complete: 
							  function(){ $("#loading"+item).hide("fast");}, //stop showing loading when the process is complete
								  
							success: 
							  function(html){ //so, if data is retrieved, store it in html
							   
							    $("#ajaxSize"+item).show(); //animation
							    $("#ajaxSize"+item).html(html); //show the html inside .content div
							   
                              }
	});
	
}	

function Kontrola_dotazu() {
  	  
     //Get the data from all the fields  
        var name  = $('input[name=jmeno]');  
        var email = $('input[name=email]');  
        var text  = $('textarea[name=zprava]');
        var id    = $('input[name=id]');		
        	
        if (name.val()=='') {  
            name.addClass('hightlight');  
            return false;  
        } else name.removeClass('hightlight');  
          
        if (email.val()=='') {  
            email.addClass('hightlight');  
            return false;  
        } else email.removeClass('hightlight');  
          
        if (text.val()=='') {  
            text.addClass('hightlight');  
            return false;  
        } else text.removeClass('hightlight');  
          
        //organize the data properly  
        var data = 'item='+id.val()+'&jmeno=' + name.val() + '&email=' + email.val() + '&zprava='  + text.val();  
		
        $.ajax({
          type: "POST",
          url: "/dotaz_pr.php",
          data: data,
		  
		  beforeSend: 
			function(){$("#ldotaz").show("fast");}, //show loading just when link is clicked
							
          complete: 
			function(){ $("#ldotaz"+item).hide("fast");}, //stop showing loading when the process is complete		  
			
          success: function(html) {
              
			  $('#popForm').fadeOut('slow');
			  $('.popMess').fadeIn('slow');
			  //
		  }

        });
		
		return false;
	
 }
  
var otevreno = false;

function Otevri_poptavku(item) {
    
	if (otevreno == true) {
	
      $("#dotazAjax").hide('fast');
	  otevreno = false;
	
	} else {
	
	   otevreno = true;
	   $("#dotazAjax").show('fast');
	   $('#popForm').fadeIn('slow');
	   $('.popMess').hide();
	   
	
	}

}
