
var msie = false ;

if(navigator.appName == 'Microsoft Internet Explorer')
    msie = true ;
    
function openRequest(){
  var request = null ;
  if (window.XMLHttpRequest) {
    request = new XMLHttpRequest();
  } else if (window.ActiveXObject) {
    request = new ActiveXObject("Microsoft.XMLHTTP");
  }
  return request ;
}

function objById(id){
  return document.getElementById(id) ;
}

function stringMatch(aStr, bStr){
  if(aStr.length != bStr.length)
    return false ;
  for(i = 0 ; i < aStr.length ; i++)
    if(aStr.charAt(i) != bStr.charAt(i))
      return false ;
  return true ;
}

function trim(string){
    if(!string.length)
      return '' ;
    //try{
      while(string.length > 1 && string.charAt(0) == ' ')
        string = string.substr(1) ;
      while(string.length > 1 && string.charAt(string.length -1) == ' ')
        string = string.substr(0,string.length - 1) ;
      if(string == ' ')
        return '' ;
      return string ;
    //} catch(er) { alert('trim: ' + er) ; }
}

function windowSize() {
  var retArray = new Array() ;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    retArray[0] = window.innerWidth;
    retArray[1] = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    retArray[0] = document.documentElement.clientWidth;
    retArray[1] = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    retArray[0] = document.body.clientWidth;
    retArray[1] = document.body.clientHeight;
  }
 // alert( 'Width = ' + retArray[0] + ' Height = ' + retArray[1]);
  return retArray ;
}

function windowHeight(){
  var a = windowSize() ;
  return a[1] ;
}

function windowWidth(){
  var a = windowHeight()
  return a[0] ;
}

function logger(msg){
  if(debug)
    GLog.write(msg) ;
}

