/**
* getting broveser name and version
* and setting default first timestamp
**/
var lastTimestamp = 0;
var minWidth = 952;
temp=navigator.appVersion.split('MSIE');                        
ieVer=parseInt(temp[1]);
var isIE6 = (((navigator.appName == "Internet Explorer") || navigator.appVersion.indexOf("MSIE") !=-1))&& (ieVer >= 6 && ieVer < 8); // test for IE6 or IE7
var isIEgt8 = (((navigator.appName == "Internet Explorer") || navigator.appVersion.indexOf("MSIE") !=-1))&& (ieVer >= 8);
/**
* funtction which is check body width
* and resize it if there is needs for it
* (function is working only if browser is ie6)
**/
function resize(resizeFinished){                   
  if(isIE6 && !resizeFinished){
    //we want to use some timeout for resize event
        
    currentTimestamp = new Date().getTime();
    difference = currentTimestamp-lastTimestamp;
    if(difference>50){
      if(self.innerWidth) {
        currentWidth = window.innerWidth;
      }
      else {
        if(document.documentElement && document.documentElement.clientWidth) {
          currentWidth = document.documentElement.clientWidth;
        }
        else {
          if(document.body) {
            currentWidth = document.body.clientWidth;
          }
        }
      }
      if(currentWidth<=minWidth){
        document.body.style.width=minWidth+"px";
      }
      else if(currentWidth>minWidth && document.body.style.width!="100%"){
        document.body.style.width="100%";
      }
      resizeFinished = true;
      lastTimestamp = currentTimestamp;
      resize(resizeFinished);
    }
    else{
      if(!resizeFinished){
        callResize();
      }
    }
  }
}

/**
* recalling resize function with timeout
**/
function callResize(){
  setTimeout("resize(false)",50);
}

/**
 * This function hides accelerator icon if browser is IE8 or greater and has
 *  particular service installed and hides icon if
 *  browser is not >= IE8
 */

function hideAccelerator(site_name){
//  alert("isIEgt8 = " + isIEgt8 + " navigator.appName = " + navigator.appName +
//    " navigator.appVersion= " + navigator.appVersion + " indexOf= " + navigator.appVersion.indexOf("MSIE") + " ieVer= " + ieVer);

//if (window.external.IsServiceInstalled('http://'+site_name,'search')) {
//      document.getElementById('acceleratorButton').style.display = "none";

  if (isIEgt8) {
    if (window.external.IsServiceInstalled('http://'+site_name,'search')) {
      document.getElementById('acceleratorButton').style.display = "none";
    }
  } else
  {
    document.getElementById('acceleratorButton').style.display = "none";
  }
}

