isIE=false;
isIE=(navigator.appVersion.indexOf("MSIE")!=-1);

isSafari=false;
isSafari=(navigator.appVersion.indexOf("Safari")!=-1);

isGecko=false;
isGecko=(navigator.userAgent.indexOf("Gecko")!=-1);

isOpera=false;
isOpera=(navigator.userAgent.indexOf("Opera")!=-1);

isKonqui=false;
isKonqui=(navigator.appVersion.indexOf("Konqueror")!=-1);

isWin=false;
if(navigator.appVersion.indexOf("Windows")!=-1) isWin=true;
isMac=false;
if(navigator.appVersion.indexOf("Mac")!=-1) isMac=true;

isIElt7=false;
isIElt6=false;
isIElt5=false;
if(isIE) {
	if(navigator.appVersion.indexOf("MSIE 5")!=-1) { isIElt7=true; isIElt6=true; }
	else if(navigator.appVersion.indexOf("MSIE 6")!=-1) isIElt7=true;
	else if(navigator.appVersion.indexOf("MSIE 4")!=-1) { isIElt7=true; isIElt6=true; isIElt5=true; }
}
	
	
function addEventHandler(obj, evt, funct) {
   if(isIE) {
      obj.attachEvent('on'+evt, funct);   
   } else {   
      obj.addEventListener(evt, funct, false);
   }
}
function removeEventHandler(obj, evt, funct) {
   if(isIE) {
      obj.detachEvent('on'+evt, funct);
   } else {   
      obj.removeEventListener(evt, funct, false);
   }
}
function prevDef(evt) {
   if(!evt) evt=window.event;
   if(isIE) evt.returnValue=false; else evt.preventDefault();
}
function stopProp(evt) {
   if(!evt) evt=window.event;
   if(isIE) evt.cancelBubble=true; else evt.stopPropagation();
}

function viewHeight(elem) {
   if(isIE) {
      return elem.offsetHeight;
   } else {
      var he =getComputedStyle(elem, null).height;
      return parseInt(he.substring(0,he.length-2));
   }
}

function viewWidth(elem) {
   if(isIE) {
      return elem.offsetWidth;
   } else {
      var wi =getComputedStyle(elem, null).width;
      return parseInt(wi.substring(0,wi.length-2));
   }
}

function absLeft(elem) {
	if (elem.offsetParent) {
      var obj=elem;
      var wsleft;
	   wsleft = obj.offsetLeft;
	   while (obj = obj.offsetParent) wsleft += obj.offsetLeft;
	   return wsleft;
   } else return 0;
}

function absTop(elem) {
	if (elem.offsetParent) {
      var obj=elem;
      var wstop;
	   wstop = obj.offsetTop
	   while (obj = obj.offsetParent) wstop += obj.offsetTop;
      return wstop;
   } else return 0;
}

function browserClientWidth() {
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    return window.innerWidth;
  } else if( document.documentElement && document.documentElement.clientWidth ) {
    //IE 6+ in 'standards compliant mode'
    return document.documentElement.clientWidth;
  } else if( document.body && document.body.clientWidth ) {
    //IE 4 compatible
    return document.body.clientWidth;
  }
}

function browserClientHeight() {
  if( typeof( window.innerHeight ) == 'number' ) {
    //Non-IE
    return window.innerHeight;
  } else if( document.documentElement && document.documentElement.clientHeight ) {
    //IE 6+ in 'standards compliant mode'
    return document.documentElement.clientHeight;
  } else if( document.body && document.body.clientHeight ) {
    //IE 4 compatible
    return document.body.clientHeight;
  }
}