var bgimg1 = new Image();
bgimg1.src = "v2/static/cyan_index-1.jpg";

var bgimg2 = new Image();
bgimg2.src = "v2/static/cyan_index-2.jpg";


var bgimg = document.getElementById('bgimg');
var bgdiv = document.getElementById('bgdiv');

function bgresize(){ 
  var screenx = 0;
  var screeny = 0
  if (self.innerHeight)  {
      screenx = self.innerWidth;
      screeny = self.innerHeight;
  }
  // Explorer 6 Strict Mode
  else if (document.documentElement && document.documentElement.clientHeight) {
      screenx = document.documentElement.clientWidth;
      screeny = document.documentElement.clientHeight;
  }
  // other Explorers
  else if (document.body) {
      screenx = document.body.clientWidth;
      screeny = document.body.clientHeight;
  }    
  var ratiow = screenx / bgimg.width;
  var ratioh = screeny / bgimg.height;  
  var ratio;
  //alert (" H"+screeny+" B"+screenx+" rh"+ratioh+" rb"+ratiow+" => "+ratio);
  (ratiow < ratioh) ? ratio = ratioh : ratio = ratiow; 
  bgimg.height *=  ratio;
  bgdiv.style.height = screeny;
  document.getElementById('bgimg').src="v2/static/cyan_index-1.jpg";
  $("bgdiv").show();
  return true;
}


function blink1(){ 
bgimg.src= bgimg2.src;
blinker1=setTimeout("blink2()",1000);
}

function blink2(){ 
bgimg.src= bgimg1.src;
blinker2=setTimeout("blink1()",2000);
}

function run_funcs(){

}


//bgimg.onload = bgresize;
window.onresize =bgresize;
//window.onload = run_funcs();
Event.observe(window,'load',function(){
bgresize(); 
blink1();

})
