$(document).ready(function(){
    initContentSidebar();
});

var imgdir = "http://www.biscue.net/images/style/";

function initContentSidebar(){
  var eyecatch_icon = imgdir+'media_tab_eyecatch.png';
  $.each($('#navi_mediatab li span.media'), function(k,val) {
      $(val).html('<img src="'+eyecatch_icon+'">'+$(val).text());
    });

  var imgplus = imgdir+"bulletplus.gif";
  var imgminus = imgdir+"bulletminus.gif";
  var imgdefault = imgplus;

  $('#navi_mediatab a').click(function(e){
    $('#navi_mediatab li').removeClass('selected');
    $(this).parent().addClass('selected');
    var elm = $(this).attr('href');
    $('.tabcontent').addClass('hidden');
    $(elm).removeClass('hidden');
    e.preventDefault();
  });
  $("#openelearningtab").click(function(e) {
    $('#navi_mediatab li').removeClass('selected');
    $('#elearningtab').addClass('selected');
    var elm = $(this).attr('href');
    $('.tabcontent').addClass('hidden');
    $(elm).removeClass('hidden');
    e.preventDefault();
  });
  $("#openmobiletab").click(function(e) {
    $('#navi_mediatab li').removeClass('selected');
    $('#mobiletab').addClass('selected');
    var elm = $(this).attr('href');
    $('.tabcontent').addClass('hidden');
    $(elm).removeClass('hidden');
    e.preventDefault();
  });





};


function el_kyk(){
    var dw,dh,w,h,x,val;
    dw = screen.width;
    dh = screen.height;
    if(!dw){dw = 800;}
    if(!dh){dh = 600;}
    w = 480;
    h = Math.round(dh * 0.9);
    x = Math.round((dw - w) * 0.98);
    val = "left=" + x + ",top=0,width=" + w + ",height=" + h + ",scrollbars=1,resizable=1";
    ekykwindow = window.open("http://192.168.1.3/bcn/bcn4/bcn4i/bcelekyk.html","ekyk",val);
    ekykwindow.focus();
}

function k_kyk(){
    var dw,dh,w,h,x,val;
    dw = screen.width;
    dh = screen.height;
    if(!dw){dw = 800;}
    if(!dh){dh = 600;}
    w = 480;
    h = Math.round(dh * 0.9);
    x = Math.round((dw - w) * 0.98);
    val = "left=" + x + ",top=0,width=" + w + ",height=" + h + ",scrollbars=1,resizable=1";
    kkykwindow = window.open("http://192.168.1.3/bcn/bcn4/bcn4i/mobile/bckkyk.html","kkyk",val);
    kkykwindow.focus();
}

function r_kyk(){
    var dw,dh,w,h,x,val;
    dw = screen.width;
    dh = screen.height;
    if(!dw){dw = 800;}
    if(!dh){dh = 600;}
    w = 480;
    h = Math.round(dh * 0.9);
    x = Math.round((dw - w) * 0.98);
    val = "left=" + x + ",top=0,width=" + w + ",height=" + h + ",scrollbars=1,resizable=1";
    rkykwindow = window.open("http://192.168.1.3/bcn/bcn4/bcn4i/mobile_r/bcrkyk.html","rkyk",val);
    rkykwindow.focus();
}


  var zooming;
  function showImg(id){
    if (zooming) {
      hideImg(zooming);
    }
    var y = window.pageYOffset || (window.document.documentElement.scrollTop || window.document.body.scrollTop);
    var windowHeight = window.innerHeight || (window.document.documentElement.clientHeight || window.document.body.clientHeight);
    var zoomY = y + windowHeight/2;

    $("#"+id).animate({top : zoomY});
    $("#"+id).show("fast");
    zooming = id;
  }
  function hideImg(id){
    $("#"+id).hide();
    zooming = null;
  }

