// JS for SHOP
////// shows picture tooltip over the title in kosik.php
this.picshotPreview = function(){
 /* CONFIG */
 xOffset = -20;
 yOffset = -50;
 // these 2 variable determine popup's distance from the cursor
 // you might want to adjust to get the right result
 /* END CONFIG */
 $("a.picshot").hover(function(e){
 this.t = this.title;
 this.title = "";
 var c = (this.t != "") ? "<br/>" + this.t : "";
 $("body").append("<p id='picshot'><img width='80' src='"+ this.rel +"' alt='"+this.title+"' />"+ c +"</p>");
 $("#picshot")
 .css("top",(e.pageY - xOffset) + "px")
 .css("left",(e.pageX + yOffset) + "px")
 .fadeIn("fast");
 },
 function(){
 this.title = this.t;
 $("#picshot").remove();
 });
 $("a.picshot").mousemove(function(e){
 $("#picshot")
 .css("top",(e.pageY - xOffset) + "px")
 .css("left",(e.pageX + yOffset) + "px");
 });
};
// starting the script on page load
///// MAIN FUNCTION
$(document).ready(function() {
  var hlaska = 'Hledej';
  var textcolor   = $('#query').css("color");
  hodnota     = $('#query').val(); 
  if (hodnota.length < 1) {
     $('#query').val(hlaska);
  }
  $('#query').css("color",'#666666');
  $('#query').focus(function() {
      if ($(this).val() == hlaska) {
         $(this).val("");
      }	 
      $(this).css("color",textcolor);
  });
  $('#formhled').submit(function() {
     novahodnota = $('#query').val();
     $('#query').css("background-color", puvodnicolor);
     // v pripade ze pole vyhledavani obsahuje uvodni hlasku a nebo se nezmenilo a nebo je kratke tak se nic neodesila
     if ((novahodnota == hlaska) || (novahodnota.length < 3)) {
        return(false);
     }
     return(true);
  });
 // kdyz se zmeni select tak se odesle form
 $("select").change(function () {
   $("form:first").submit();
 });
 picshotPreview();
});
// END

