$(document).ready(function() {

  /* alert(template_directory); */
  
/** Topbar mouseover **/

  $("#topBar li.page_item").hover(
    function(){ 
      //alert ('hallo');
      $(this).addClass('topHoverActive');
   },
   function(){
      $(this).removeClass("topHoverActive");
   }
  ); 
/** Creating custom :external selector **/
  $.expr[':'].external = function(obj){
      return !obj.href.match(/^mailto\:/)
              && (obj.hostname != location.hostname);
  };
  // Add 'external' CSS class to all external links
  $('a:external').bind( "click", function(){
      open(this.href);
      return false;
  });


/** Next/Privious Post Navi **/
  $(".nextPrevLink").hover(
    function(){
      $(this).children().fadeIn();
    },function(){
      $(this).children().fadeOut();
   });
   /* check for previous link*/
    if ($("#previousPageLink").length){
       var found = $("#previousPageLink").find( "a" )
       if (found.length != 0){
          $("#previousPageLink").bind( "click", function(){
             document.location.href =$(this).find( "a" ).attr("href");
          });
          $("#previousPageLink").addClass("activePrevious").fadeIn(1500);
       }
    }
   /* check for next link*/
  if ($("#previousPageLink").length){
     found = $("#nextPageLink").find( "a" );
     if (found.length != 0){
        $("#nextPageLink").bind( "click", function(){
           document.location.href =$(this).find( "a" ).attr("href");
        });
        $("#nextPageLink").addClass("activeNext").fadeIn(1500);
     }
  }
/* Load Syntax Highlighter */
  if ($(".syntax").length){
      $.getScript(template_directory + '/jquery-syntax-1.9/jquery.syntax.js', function() {          
         $.getScript( template_directory + '/jquery-syntax-1.9/jquery.syntax.cache.js', function() {
            $.syntax({root: template_directory + "/jquery-syntax-1.9/"});
         });
      }); /* END LOAD beautyOfCode */
  }
/* change logo in ie6 */
    var ie6 = (/MSIE (6)/.test(navigator.userAgent) && navigator.platform == "Win32");
   if (ie6) {
    $('#logo').attr("src", "http://donkeymedia.eu/wp-content/themes/donkeymedia/images/donkeymedia-logo.gif");
   }

}); /* END jQuery(document).ready */

