var h2;
var w2;
var w;
var h;
var iswide=2;


function viewport()
{

 if (typeof window.innerWidth != 'undefined')
 {
      w = window.innerWidth,
      h = window.innerHeight
 }

 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       w = document.documentElement.clientWidth,
       h = document.documentElement.clientHeight
 }

 else
 {
       w = document.getElementsByTagName('body')[0].clientWidth,
       h = document.getElementsByTagName('body')[0].clientHeight
 }

//alert('w='+w+' and h='+h+' and bw='+background.width+' and bh='+background.height+' and iswide='+iswide);

if ((w/h > (background.width/background.height)) && (iswide!=1)){
    document.getElementById('bg').innerHTML="<img src='" + background.image + "' width='100%' alt='' />";
    iswide=1;
}else if ((w/h <= (background.width/background.height)) && (iswide!=0)){
    document.getElementById('bg').innerHTML="<img src='" + background.image + "' height='100%' alt='' />";
    iswide=0;
}


}


