function getMouseXY(e) {
   if (bIE) { // grab the x-y pos.s if browser is IE
      tempX = event.clientX + document.body.scrollLeft;
      tempY = event.clientY + document.body.scrollTop;
   } else {  // grab the x-y pos.s if browser is NS
      tempX = e.pageX;
      tempY = e.pageY;
   }  
   
   if (tempX < 0){tempX = 0;}
   if (tempY < 0){tempY = 0;} 

   return true;
}

function findObjPosX(obj)
{
 var curleft = 0;
 if(obj.offsetParent)
     while(1) 
     {
       curleft += obj.offsetLeft;
       if(!obj.offsetParent)
         break;
       obj = obj.offsetParent;
     }
 else if(obj.x)
     curleft += obj.x;
 return curleft;
}

function findObjPosY(obj)
{
 var curtop = 0;
 if(obj.offsetParent)
     while(1)
     {
       curtop += obj.offsetTop;
       if(!obj.offsetParent)
         break;
       obj = obj.offsetParent;
     }
 else if(obj.y)
     curtop += obj.y;
 return curtop;
}

function getContentSize() {
   var winW = 630, winH = 460;
   
   if (parseInt(navigator.appVersion)>3) {  
      if (navigator.appName.indexOf("Microsoft")!=-1) {
         winW = document.body.offsetWidth;
         winH = document.body.offsetHeight;
      }else{
         winW = window.innerWidth;
         winH = window.innerHeight;
      }
   }
   
   var myReturn = new Array(winW, winH)
   return myReturn;
}

function getScreenSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  
  var myReturn = new Array(myWidth, myHeight);
  return myReturn;
}

function trim(str) {
	var whitespace = ' \n\r\t\f\x0b\xa0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000';
	for (var i = 0; i < str.length; i++) {
		if (whitespace.indexOf(str.charAt(i)) === -1) {
			str = str.substring(i);
			break;
		}
	}
	for (i = str.length - 1; i >= 0; i--) {
		if (whitespace.indexOf(str.charAt(i)) === -1) {
			str = str.substring(0, i + 1);
			break;
		}
	}
	return whitespace.indexOf(str.charAt(0)) === -1 ? str : '';
}
