/**
 * Various utils functions by Marcin Dziennik
 */

function utils() {
  var oTemp=new Object;
  oTemp.attachEvent=function (oObj,sEvt,fnCallback){
    if (oObj.addEventListener){
      oObj.addEventListener(sEvt,fnCallback,false);
      return true;
    }
    else if (oObj.attachEvent)
        return oObj.attachEvent("on"+sEvt,fnCallback);
      return false;
  }
  oTemp.getIEVersion=function () {
      var fResult = -1; // For non-IE.
      if (navigator.appName == 'Microsoft Internet Explorer'){
        var sUa = navigator.userAgent;
        var regR  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
        if (regR.exec(sUa) != null)
          fResult = parseFloat( RegExp.$1 );
        }
      return fResult;
  }
  oTemp.getViewWidth=function () {
   var iSW=window.innerWidth;
    if(!iSW) {
      iSW=document.documentElement.clientWidth;
      if(iSW==0)
        iSW=document.body.clientWidth;
    }
    return iSW;
  }
  oTemp.getViewHeight=function () {
   var iSH=window.innerHeight;
   if(!iSH) {
      iSH=document.documentElement.clientHeight;
      if(iSH==0)
        iSH=iSH=document.body.clientHeight;
    }
    return iSH;
  }
  oTemp.ie6selects=function (oObj,ff_fix) {
  if(this.getIEVersion()==6) {
    if(window.ff_fix) {
      oObj.removeChild(x.lastChild);
    }
    else {
      oObj.appendChild(ff_fix=document.createElement('iframe')).setAttribute('id','ff_fix');
      with (ff_fix.style) width=oObj.offsetWidth+'px',height=oObj.offsetHeight-6+'px';
    }
  }
}
  return oTemp;
}
window.utils=utils();