
	function Point(iX, iY){
    	this.x = iX;
    	this.y = iY;
  	}

	function fGetXY(aTag) {		
    	var pt = new Point(aTag.offsetLeft, aTag.offsetTop);
    	do {
      		aTag = aTag.offsetParent;
      		pt.x += aTag.offsetLeft;
      		pt.y += aTag.offsetTop;      		
    	} while(aTag.tagName!="BODY");
    	return pt;
  	}
	
	function searchOnEnterKey(e) {
	     var key;
	     if(window.event) {
	          key = window.event.keyCode;     //IE
	     } else {
	          key = e.which;     //firefox
	     }
	     if(key == 13) {
	        var keyword = document.getElementById('input_search');
	        onSearchClicked(keyword);
	     }
	}
	
	function isEnterKey(e) {
	     var key;
	     if(window.event) {
	          key = window.event.keyCode;     //IE
	     } else {
	          key = e.which;     //firefox
	     }
	     return (key == 13);
	}
	
	function isSpaceKey(e) {
	     var key;
	     if(window.event) {
	          key = window.event.keyCode;     //IE
	     } else {
	          key = e.which;     //firefox
	     }
	     return (key == 32);
	}
	
	function nvl(value, defaultValue) {
		return (value!=null?value:defaultValue);
	}
	
	function loadHeadCSS(pHref) {
		var link;
		if (document.createElement && (link = document.createElement('link')))
		{
			link.href = pHref; 
			link.rel = 'stylesheet';
			link.type = 'text/css';
			var head = document.getElementsByTagName('head')[0];
			if (head) {
				head.appendChild(link);
			}
		}
	}
	
	function replaceQuoteChar(input) {
		var result = input.replace("'", "\'");
		
		return result
	}

	// Verifica??o do tipo de browser
	function BrowserCheck() {
		var b = navigator.appName;
		if (b=="Netscape") this.b = "ns";
		else if (b=="Microsoft Internet Explorer") this.b = "ie";
		else this.b = b;
		this.version = navigator.appVersion;
		this.v = parseInt(this.version);
		this.ns = (this.b=="ns" && this.v>=4);
		this.ns4 = (this.b=="ns" && this.v==4);
		this.ns5 = (this.b=="ns" && this.v==5);
		this.ie = (this.b=="ie" && this.v>=4);
		this.ie4 = (this.version.indexOf('MSIE 4')>0);
		this.ie5 = (this.version.indexOf('MSIE 5')>0);
		this.min = (this.ns||this.ie);
	}
	var browserCheck = new BrowserCheck();
	
	function getWindowHeight() {
		var myHeight = 0;
		if (typeof(window.innerWidth) == 'number') {
			myHeight = window.innerHeight;
		} else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
			myHeight = document.documentElement.clientHeight;
		} else if(document.body && (document.body.clientWidth || document.body.clientHeight)) {
			myHeight = document.body.clientHeight;
		}
		return myHeight;
	}
	
	function getWindowWidth() {
		var myWidth = 0;
		if (typeof(window.innerWidth) == 'number') {
	    	myWidth = window.innerWidth;
	  	} else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
	    	myWidth = document.documentElement.clientWidth;
		} else if(document.body && (document.body.clientWidth || document.body.clientHeight)) {
			myWidth = document.body.clientWidth;
		}
		return myWidth;
	}

	function centerWidth(pWidth) {
		var localLeft = (780 - pWidth)/2;
		return localLeft;
	}

	function centerHeight(pHeight) {
		var localTop = (getWindowHeight() - pHeight)/2 + document.body.scrollTop;
		if (localTop < 90) localTop = 90;
		return localTop;
	}
	