function fbs_click() {u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;}
function checkform() {

  var cojetam = FCKeditorAPI.GetInstance('FCKeditor1').GetXHTML( false );
  if(cojetam == '<br />') {alert('Komentář nesmí být prázdný!'); return false;} else {return true;}

}

function smazani(){

  return confirm('Opravdu smazat komentář?');

}

function nahlaseni(){

  return confirm('Opravdu nahlásit komentář?');

}



$(document).ready(function() {
  $(".showresults").toggle(
    function () {
      $(".results").slideDown("medium");
      $(this).text("Skryj řešení příkazů");
    },
    function(){
      $(".results").slideUp("medium");
      $(this).text("Zobraz řešení příkladů");
    } 
  );
});


$(document).ready(function() {

  $("#pop_01").hover(function () {
      $(".pop_down_1").show("fast");
      $(".pop_down_2").hide("fast");
      $(".pop_down_3").hide("fast");
      $(".pop_down_4").hide("fast");
  });
  $("#pop_02").hover(function () {
      $(".pop_down_1").hide("fast");
      $(".pop_down_2").show("fast");
      $(".pop_down_3").hide("fast");
      $(".pop_down_4").hide("fast")
  });
  $("#pop_03").hover(function () {
      $(".pop_down_1").hide("fast");
      $(".pop_down_2").hide("fast");
      $(".pop_down_3").show("fast");
      $(".pop_down_4").hide("fast")
  });
  $("#pop_04").hover(function () {
      $(".pop_down_1").hide("fast");
      $(".pop_down_2").hide("fast");
      $(".pop_down_3").hide("fast");
      $(".pop_down_4").show("fast")
  });

  $(".mainmenuli").hover(function () {
      $(".pop_down_1").hide("fast");
      $(".pop_down_2").hide("fast");
      $(".pop_down_3").hide("fast");
      $(".pop_down_4").hide("fast");
  });

});

$(document).ready(function() {

  $(".content").hover(function () {
    $(".pop_down_1").hide("medium");
    $(".pop_down_2").hide("medium");
    $(".pop_down_3").hide("medium");
    $(".pop_down_4").hide("medium");
  });

  $(".header").hover(function () {
    $(".pop_down_1").hide("medium");
    $(".pop_down_2").hide("medium");
    $(".pop_down_3").hide("medium");
    $(".pop_down_4").hide("medium");
  });
  
});

$(document).ready(function() {

  $(".sd_fb").hover(function () {$(".popisek_sd").text("Sdílet na Facebooku");},function () {$(".popisek_sd").text("");} );
  $(".sd_tw").hover(function () {$(".popisek_sd").text("Sdílet na Twitteru");},function () {$(".popisek_sd").text("");} );
  $(".sd_li").hover(function () {$(".popisek_sd").text("Sdílet na Linkuj.cz");},function () {$(".popisek_sd").text("");} );
  $(".sd_em").hover(function () {$(".popisek_sd").text("Odeslat článek e-mailem");},function () {$(".popisek_sd").text("");} );
  $(".up_li_a").hover(function () {$(".arrowup").attr("src","images/icons/uparrow.png");},function () {$(".arrowup").attr("src","images/icons/bw_uparrow.png");} );
  $(".zpet_nahoru_a").hover(function () {$(".arrowup1").attr("src","images/icons/uparrow.png");},function () {$(".arrowup1").attr("src","images/icons/bw_uparrow.png");} );

});

$(document).ready(function() {

  $(".nazor_jm").hover(function () {$(this).next().text("Reagovat");},function () {$(this).next().text("");} );

});


$(document).ready(function() {

  $(".nazor_sipka").toggle(
    function () {
      $(this).next().fadeIn("medium");
    },
    function(){
      $(this).next().fadeOut("medium");
    } 
  );
  
});


$(document).ready(function() {

  $(".reseni").click(function () {$(this).next().text("Sdílet na Facebooku");},function () {$(".popisek_sd").text("");} );
  
});

$(document).ready(function() { 
    $('ul.sf-menu').superfish({ 
        delay:       100,                            // one second delay on mouseout 
        animation:   {opacity:'show'},  // fade-in and slide-down animation 
        speed:       "fast",                          // faster animation speed 
        dropShadows: true                            // disable drop shadows 
    }); 
}); 


$(document).ready(function() { 
    $(".koment_odkaz").hover(function() {
    
      var offset = $(this).offset();
      
      var commentdiv = "<div class=\"commentdiv\"><div class=\"quoted\"></div><div class=\"quotedtext\"></div></div>";
      
      var koment = $(this).attr("id").substring(1);
    
      $(this).after(commentdiv);
      
      // Set position
      $(".commentdiv").css({
        'top' : offset.top +20,
        'left' : offset.left -5,
      });
      
      var comtext = $("#"+koment).find(".nazor_text").text();
      
      $(".quotedtext").text(comtext);

      
    
    }, function() {
    
      $(".commentdiv").remove();
    
    });
}); 

$(document).ready(function() { 

  $(".odpoved").click(function() {

    var id = $(this).attr("id");
          
    $.ajax({
  		type: "POST",
  		url: "scripts/hlasuj.php",
  		data: 	"volba=" + id,
  		success: function(html){
  			$("#anketa").html(html);
  			$(".successanketa").fadeIn(2000);
  		}
	  });
	  
	
  });

});

$(document).ready(function() {

  $("#cse-search-box").submit(function() {
  
    var vyraz = $(".sss").val();

    if(vyraz.length == 0) {
    
      alert ("Zadejte prosím hledaný výraz");
      return false;
    
    } else {
      
      var search = vyraz.replace(" ", "+");
    
      var db = $("input[type='radio']:checked").val();
      
      if(db == "h2") {
      
        window.open("http://search.datasheetcatalog.net/key/"+search);
      
        return false;
    
      }
      
    }
    
  });

});


/* Form validation */


$(document).ready(function() {

  $("#commentForm").validate({
    
    rules: {
      jmeno: {
      required: true,
      }
    },
    messages: {
      jmeno: {
        required: "Zadejte, prosím, své jméno"
      }
    }
    });

});









