// Run the script on DOM ready:
$(document).ready(function(){

// Background Resize

var bgimg = document.getElementById('bgimg');
var teaserimg = document.getElementById('teaserimg');
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;
  (ratiow < ratioh) ? ratio = ratioh : ratio = ratiow; 
  bgimg.height *=  ratio;
    //alert (" H"+screeny+" B"+screenx+" rh"+ratioh+" rb"+ratiow+" => "+ratio);
	if((bgimg.height/768)*100<100){
		teaserimg.height*=ratio;
	}else{
		teaserimg.height=230;
	}
  bgdiv.style.height = screeny;
}

bgimg.onload = bgresize;
window.onresize = bgresize;
window.onload = bgresize;




$('#teaser').hover(
	
	function(){
		$('#teaserimg').attr('src','img/teaser_fanconnection_over.png');
	},
	
	function(){
		$('#teaserimg').attr('src','img/teaser_fanconnection.png');

	}
);


});
