// global.js onetoone.de 

$(document).ready(function(){   
  $('a[href^="http://"]').not('[rel!=""]').not("[href*='onetoone.de']").not("[href*='otodev.de']").attr('target','_blank').attr('title','Dieser Link oeffnet sich in einem neuen Fenster'); // externe Links in neuem Fenster, nicht von eigener Domain
  $("a[href$=pdf]").addClass("pdflink"); // Links auf ein PDF auszeichnen
  $("a[href$=zip]").addClass("ziplink"); // Links auf ein zip auszeichnen
  
  //$("#otopagination > ul.linklist").tabs(); // tabs fuer einzelmeldung initialisieren
  
  $(".br_copy").click(function(){
      window.location=$(this).find("a").attr("href");return false;
  });
  $(".br_copy").css("cursor","pointer");  // box in der rechten Spalte vollflaechig klickbar      

// place play button over preview image
  $("img.videoteaser").each(function() {
    var iWidth = $(this).width();
    var iHeight = $(this).height();      
      if (iWidth == 520) {      
        var letimg = '<img src="/g/play_37x37.png" style="margin-bottom: ' + Math.ceil(iHeight/5) + 'px; margin-left: -' + Math.ceil(iWidth/6.2) + 'px;" />';  
      }
            else if (iWidth == 450) {      
        var letimg = '<img src="/g/play_37x37.png" style="margin-bottom: ' + Math.ceil(iHeight/5) + 'px; margin-left: -' + Math.ceil(iWidth/6.2) + 'px;" />';  
      }
      else if (iWidth == 400) {      
        var letimg = '<img src="/g/play_37x37.png" style="margin-bottom: ' + Math.ceil(iHeight/6) + 'px; margin-left: -' + Math.ceil(iWidth/5.7) + 'px;" />';  
      } 
      else {
        var letimg = '<img src="/g/play_37x37.png" style="margin-top: ' + Math.ceil(iHeight/1.4) + 'px; margin-left: -' + Math.ceil(iWidth/2.8) + 'px;" />';  
      }
    var wrapper = $('<span class="vteaserwrap" style="height: '+ Math.ceil(iHeight) + 'px; width: ' + Math.ceil(iWidth) + 'px;"></span>');    
    $(this).wrap(wrapper).after(letimg);
  });

// jobboerse teaser
  $("#br_joblist ul li:odd").css("background-color", "#f6f6f6");
  $("#br_joblist ul li:even").css("background-color", "#fff");

// default value fuer die suche
  $("#bsgsearchform").defaultvalue("Suche im ONEtoONE Business Guide");

// far accordion
  $('#accordion a:focus').css("outline","none");  
      
// png fix
  $("h1#otologo").pngFix();
  $("div#far_teaser_img a").pngFix();
  $("div#wissenkompakt_teaser").pngFix();
  $(".vteaserwrap").pngFix();
    
});