var analogTv = new Object;

analogTv.onAir = function(){
  // 画像のURLを指定してください。
  var imgsrc = "http://www.mukairiku.net/analog-tv/analog-tv.png";
  
  // ウィンドウ幅を取得
  var h = 0;
  var w = 0;
  if(document.documentElement.clientWidth){
    h = document.documentElement.clientHeight;
    w = document.documentElement.clientWidth;
    
  }else if(document.body.clientWidth){
    h = document.body.clientHeight;
    w = document.body.clientWidth;
  
  }else if(window.innerHeight){
    h = window.innerHeight;
    w = window.innerWidth;
    
  }else{
    h = 600;
    w = 800;
  }
  
  // 画像の設定
  var origHeight = 178;
  var origWidth  = 774;
  var imgHeight = Math.ceil(h / 16);
  var imgWidth  = Math.ceil(origWidth * (imgHeight / origHeight));
  var offset = Math.ceil(imgHeight / 2);
  
  var img = document.createElement('IMG');
  img.src = imgsrc;
  img.height = imgHeight;
  img.width  = imgWidth;
  img.style.position = 'fixed';
  img.style.top = offset + 'px';
  img.style.right = offset + 'px';

  // レイヤーの組み立て
  var layer = document.createElement('DIV');
  layer.appendChild(img);
  layer.style.position   = "absolute";
  layer.style.top        = offset + 'px';
  layer.style.right      = offset + 'px';
  
  var bodys = document.getElementsByTagName('BODY')
  bodys[0].appendChild(layer);
};

