
/**
 * Created by Andrej Novotny & Patrik Lucan.
 * Require JQuery javascript library.
 *  
 */
 
function bb_insert_ad(bb_Swf, bb_Width, bb_Height, bb_redir, bb_target, bb_banner, bb_FlashVer) {

  if(navigator.appVersion.indexOf('MSIE')>=0 && navigator.appVersion.indexOf('Win')>=0) {
    document.writeln('<scr'+'ipt language=VBScript\>');
    document.writeln('on error resume next');
    for(i=3;i<10;i++) document.writeln('if (IsNull(CreateObject("ShockwaveFlash.ShockwaveFlash.'+i+'"))) then dummy=0 else bb_flashakt='+i+' end if');
    document.writeln('</'+'scr'+'ipt\>');
  }

  if(navigator.plugins && navigator.plugins["Shockwave Flash"]) {
    var flashdesc = navigator.plugins["Shockwave Flash"].description;
    bb_flashakt = parseInt(flashdesc.match(/[!\d]*(\d+)/)[0]);
  }

  var leader=
  '<div style="text-align: center;"><div style="width: 940px; margin: 0px auto 0px auto; position: relative; top:0px; left:0px; border-bottom: 10px solid #FFFFFF; border-left: 0px; text-align: center;">'+
  '<object type="application/x-shockwave-flash" data="'+bb_Swf+'" width="'+bb_Width+'" height="'+bb_Height+'"><param name="movie" value="'+bb_Swf+'" /><param name="wmode" value="transparent" /><param name="allowscriptaccess" value="always" /></object>'+
  '</div></div>';

  var sky=
  '<div style="position: absolute; top:165px; left:985px;">'+
  '<object type="application/x-shockwave-flash" data="'+bb_Swf+'" width="'+bb_Width+'" height="'+bb_Height+'"><param name="movie" value="'+bb_Swf+'" /><param name="wmode" value="transparent" /><param name="allowscriptaccess" value="always" /></object>'+
  '</div>';
  
  var bent=
  '<div style="position: absolute; top:0px; left:0px;">'+
  '<object type="application/x-shockwave-flash" data="'+bb_Swf+'" width="'+bb_Width+'" height="'+bb_Height+'"><param name="movie" value="'+bb_Swf+'" /><param name="wmode" value="transparent" /><param name="allowscriptaccess" value="always" /></object>'+
  '</div>';
  
  var other=
  '<div style="position: relative; top:0px; left:0px;">'+
  '<object type="application/x-shockwave-flash" data="'+bb_Swf+'" width="'+bb_Width+'" height="'+bb_Height+'"><param name="movie" value="'+bb_Swf+'" /><param name="wmode" value="transparent" /><param name="allowscriptaccess" value="always" /></object>'+
  '</div>';
  
  switch (pozicia)
  {
  case (pozicia = "leader"):
    if (bb_flashakt>=bb_FlashVer) {
      document.write(leader);
    } else {
      document.write("<div style='text-align: center;'><div style='margin: 0px auto 0px auto; width: 940px; position: relative; top:0px; left:0px; border-bottom: 10px solid #FFFFFF; border-left: 0px; text-align: left;'><a href='"+bb_redir+"' target='"+bb_target+"'><img src='"+bb_banner+"' width="+bb_Width+" height="+bb_Height+" /></a></div></div>");
    } 
  break;
  case (pozicia = "sky"):
    /* Homepage */
    if (document.getElementById('bmone2n-2063.12.4.7')) {var CID = 'bmone2n-2063.12.4.7';}
    /* Podstranky */
    if (document.getElementById('bmone2n-2063.50.4.7')) {var CID = 'bmone2n-2063.50.4.7';}

    // zrusenie povodneho <div> premenovanim
    var container = document.getElementById(CID); 
    container.setAttribute('id', CID+'-do-not-use');
    
    // vytvorenie noveho <div>
    $('#mainHeader').before("<div style='position: relative;' id='"+CID+"'></div>");
    
    if (bb_flashakt>=bb_FlashVer) {
      document.write(sky);
    } else {
      document.write("<div style='position: absolute; top:165px; left:985px;'><a href='"+bb_redir+"' target='"+bb_target+"'><img src='"+bb_banner+"' width="+bb_Width+" height="+bb_Height+" /></a></div>");
    }
  break;
  case (pozicia = "bent"):
    /* Homepage */
    if (document.getElementById('bmone2n-2063.12.4.7')) {var CID = 'bmone2n-2063.12.4.7';}
    /* Podstranky */
    if (document.getElementById('bmone2n-2063.50.4.7')) {var CID = 'bmone2n-2063.50.4.7';}

    // zrusenie povodneho <div> premenovanim
    var container = document.getElementById(CID); 
    container.setAttribute('id', CID+'-do-not-use');
    
    // vytvorenie noveho <div>
    $('#mainHeader').before("<div style='position: relative;' id='"+CID+"'></div>");    
  break;
  case (pozicia = "other"):
    /* do nothing */
    
  break;
  /* ORANGE skin, špeciálny formát */
  case (pozicia = "skin"):
    /* Homepage */
    if (document.getElementById('bmone2n-2063.12.4.7')) {var CID = 'bmone2n-2063.12.4.7';}
    /* Podstranka */
    if (document.getElementById('bmone2n-2063.50.4.7')) {var CID = 'bmone2n-2063.50.4.7';}

    // zrusenie povodneho <div> premenovanim
    var container = document.getElementById(CID); 
    container.setAttribute('id', CID+'-do-not-use');
    
    // vytvorenie noveho <div>
    $('#mainHeader').before("<div id='"+CID+"' style='margin-bottom: 0px; position: relative;'></div>");
    
    // vyfarbenie pozadia
    document.getElementById("body_div").style.background = "#FFFFFF url(http://hnonline.sk/img/sk/banner/background.jpg) no-repeat scroll top center"; 
  
  break;
  };

}

/*
var pozicia = "other";
$(document).ready(function() {
  bb_insert_ad("", "", "", "", "", "");
});
*/


