var need_ie_aspect_fixes = 0;
var need_ie_alpha_fixes = 0;


// tell me if you need IE fixes
if(!window.innerHeight)
{
  // IE only
  var agent = navigator.userAgent;
  var expr = /MSIE (.)\./;
  expr.exec(agent);
  var version = RegExp.$1;
  if(version>0)
  {
    need_ie_aspect_fixes = version <= 8;
    need_ie_alpha_fixes = version <= 6;
  }
  //alert(agent + " # " + version + " # " + need_ie_aspect_fixes + " # " + need_ie_alpha_fixes);
}
  
// fix aspect ratio of bg logo
function fix_bglogo()
{
  if(need_ie_aspect_fixes)
  {
    var bg_width=1408;
    var bg_height=924;    
    var bg=eval(document.getElementById("bglogo"));
    var h = document.body.clientHeight * 0.8;
    var w = document.body.clientWidth  * 0.8;
    if(h/w > bg_height/bg_width)  h = bg_height * w / bg_width;
    else                          w = bg_width * h / bg_height;
    bg.style.height = h;
    bg.style.width  = w;
    window.onresize = fix_bglogo;
  }
}

function fix_c2left()
{
  if(need_ie_alpha_fixes)
  {
    document.images["c2left"].src="img/c2left_ie2.png";
  }
}

function fix_c2right()
{
  if(need_ie_alpha_fixes)
  {
    document.images["c2right"].src="img/c2right_ie2.png";
  }
}

// fix aspect ratio of bike traum bg
function fix_traum()
{
  if(need_ie_aspect_fixes)
  {
    var bg_width=1400;
    var bg_height=264;    
    var bg=eval(document.getElementById("traum"));
    var h = document.body.clientHeight * 0.8;
    var w = document.body.clientWidth  * 1.0;
    if(h/w > bg_height/bg_width)  h = bg_height * w / bg_width;
    else                          w = bg_width * h / bg_height;
    bg.style.height = h;
    bg.style.width  = w;
    window.onresize = fix_traum;
  }
}

/*
function fix_aspect(id,width,height,maxwidth,maxheight)
{
  if(need_ie_aspect_fixes)
  {
    var bg=eval(document.getElementById(id));
    var w = document.body.clientWidth  * maxwidth;
    var h = document.body.clientHeight * maxheight;
    if(h/w > height/width)  h = height * w / width;
    else                    w = width * h / height;
    bg.style.width  = w;
    bg.style.height = h;
    window.onresize = fix_aspect(id,width,height,maxwidth,maxheight);
  }

}
*/
