function detectIE(){
  var browser = navigator.appName;
  if (browser == "Microsoft Internet Explorer"){
    var b_version = navigator.appVersion;
    var re = /\MSIE\s+(\d\.\d\b)/;
    var res = b_version.match(re);
    if (res[1]){
      return true;
    }
  }
  return false;
}


var h;
var ismain=0;
var timer;

$(document).ready(function(){
$("#lace").each(function(i){ismain=1;});
 check();

 $("#body .r-col .portf_3 table").width(($("#body .r-col").width()-340));
});


window.onresize=resize;

function resize()
{
    clearTimeout(timer);
    timer=setTimeout("check()",100);
    return;
}



function windowHeight() {
var de = document.documentElement;

return self.innerHeight || ( de && de.clientHeight ) || document.body.clientHeight;
}


function check(){ 
//  if ( detectIE6() ) return;
$("body").css("height","auto");
 $("#body").css("height","auto");

 if (detectIE() &&  $("#body").height()<550) $("#body").height(550);
h=$("body").height();//+$(".top_companu_link").height()+$("#lang").height()+$("#ftr").height()
//alert($("body").height()+" "+windowHeight());
if (h<windowHeight())
 {
//   if (!ismain)
//         {
//         if (detectIE()) h-=218;
//         else h-=197;
//         if (h<530) h=530;
//         }
//          else
//          {
//           if (detectIE()) h-=177;
//           else h-=162;
//
//
//          }
 // alert($("#body").height()+(windowHeight()-h));
 
   if (detectIE()) {h-=40;}

   $("#body").css("height",($("#body").height()+(windowHeight()-h))+"px");
 }


}  


