
if (typeof GLB == "undefined") {
    var GLB = {};
}
GLB.namespace = function() {
	var object = null, arrObjects = [];
    for (var i=0; i<arguments.length; i++) {
		object = GLB;
		
        for (var objI = arguments[i].split("."), j=(objI[0]=="GLB")? 1 : 0; j<objI.length; j++) {
            object[ objI[j] ] 	= object[ objI[j] ] || {};
            object 				= object[ objI[j] ];
        }
		arrObjects.push(object);
    }
    return (arrObjects.length>1)? arrObjects : object;
};
/*
Captura de elementos
*/
GLB.$ = function(){
	return function(){
		var elements = [];
				
		for(var i=0; i<arguments.length; i++){
			var obj = null;
			
			if(typeof arguments[i] === "string")		var obj = document.getElementById(arguments[i]) || null;
			else if(typeof arguments[i] === "object")	var obj = arguments[i];
			if(obj==null && arguments[i]== "html")		var obj = document.getElementsByTagName("html")[0];
			if(obj==null && arguments[i]== "body")		var obj = document.body;
			if(obj==null && arguments[i]== "window")	var obj = window;
			
			if(obj!=null)elements.push(obj);
		}
		
		if(elements.length==1)return elements[0];
		if(elements.length>1) return elements;
			
		return null;
	}
}();
/*
Cria??o de elementos
*/
GLB.create = function(){
	return function(element, props){
		var el = document.createElement(element);
		if(!el) return null;
		
		for(var attr in props){
			if(attr=="innerHTML")
				el.innerHTML = props[attr];
			else
				el[attr] = props[attr];
		}
		
		return el;
	}
}();

GLB.queryString = function(){
	
	var _get = function(ID){
		var URL = document.location.href;
		if(URL.indexOf('?' + ID + '=')>-1){
			var qString = URL.split('?');
			var keyVal = qString[1].split('&');
			for(var i=0;i<keyVal.length;i++){
				if(keyVal[i].indexOf(ID + '=')==0){
					var val = keyVal[i].split('=');
					return val[1];
				}
			}
			return null;
		}else{
			return null;
		}
	}	
	
	var _set = function(ID, value){
	}
	
	return {
			get: _get, 
			set: _set
		   }
}();

/*
Eventos
*/
GLB.event = function() {
	/*
		.version: 1.0

		.date:
		26/09/2007
		
		.usage:
		GLB.event.add(window, 'load', _onload);
		or
		GLB.event.add(window, 'load', {scope: objeto, callback: "methodOfObject"});
	*/
	var _add = function(obj, evt, callback) {		
		if(callback && typeof(callback)==="function")var func =  callback;
		else if(typeof(callback)==="object"){
			if(typeof(callback.scope)==="object"){
				var func = GLB.util.delegate.create(callback.scope, callback.callback);
			}
		}
		if(obj.addEventListener) {
			obj.addEventListener(evt, func, false);
		} else if(obj.attachEvent) {
			obj.attachEvent('on' + evt, func);
		}
	}	

	return  {
		add: function(obj, event, callback) { 
			if(typeof obj==="object" && typeof event==="string" && (typeof callback==="function" || 
			  (typeof callback==="object" && typeof callback.scope==="object" && typeof callback.callback==="string")))
				return _add(obj, event, callback);
			else
				return null;
		}
	};		

}();

GLB.addDOMLoadEvent = (function(){
								
   var _callbacks = [];
   var _intervalVerify;
   var _isLoaded;
   
   var _doLoad = function () {
	   clearInterval(_intervalVerify);
	   
        _isLoaded = true;   
		var callback;
        while (callback = _callbacks.shift())
            callback();

        if(document.onreadystatechange) document.onreadystatechange = null;
    };

    return function (func) {
        if (_isLoaded) return func();        
        if (!_callbacks[0]) {
            //Mozilla/Opera9
            if(document.addEventListener)
               document.addEventListener("DOMContentLoaded", _doLoad, false);

			//Internet Explorer
            document.onreadystatechange = function(){
             	if(this.readyState == "complete")_doLoad();
            }

            //Safari
            if (/WebKit/i.test(navigator.userAgent)) { // sniff
                _intervalVerify = setInterval(function() {
                    if (/loaded|complete/.test(document.readyState))_doLoad();
                }, 10);
            }

            //Outros
            var oldOnload = window.onload;
            window.onload = function() {
                _doLoad();
                if(oldOnload)oldOnload();
            };
        }
        _callbacks.push(func);
    }
})();

/**
Version
**/
GLB.namespace("Browser");
GLB.Browser.version = function(){
	var o={
	    ie:0,
	    opera:0,
        gecko:0,
        webkit:0
    };
    var ua=navigator.userAgent, m;

    // Modern KHTML browsers should qualify as Safari X-Grade
    if ((/KHTML/).test(ua)) {
        o.webkit=1;
    }
    // Modern WebKit browsers are at least X-Grade
    m=ua.match(/AppleWebKit\/([^\s]*)/);
    if (m&&m[1]) {
        o.webkit=parseFloat(m[1]);
    }

    if (!o.webkit) { // not webkit
        // @todo check Opera/8.01 (J2ME/MIDP; Opera Mini/2.0.4509/1316; fi; U; ssr)
        m=ua.match(/Opera[\s\/]([^\s]*)/);
        if (m&&m[1]) {
            o.opera=parseFloat(m[1]);
        } else { // not opera or webkit
            m=ua.match(/MSIE\s([^;]*)/);
            if (m&&m[1]) {
                o.ie=parseFloat(m[1]);
            } else { // not opera, webkit, or ie
                m=ua.match(/Gecko\/([^\s]*)/);
                if (m) {
                    o.gecko=1; // Gecko detected, look for revision
                    m=ua.match(/rv:([^\s\)]*)/);
                    if (m&&m[1]) {
                        o.gecko=parseFloat(m[1]);
                    }
                }
            }
        }
    }
    return o;
}();

/**
Version
**/
GLB.jsPathDefault = "../js";
GLB.setJsPath = function(path){
	if(!typeof path === "string")return;
	GLB.jsPathDefault = (path.lastIndexOf("/")>=path.length)? path.substring(0, path.length-1) : path;
}
/**
Version
**/
GLB.controlPackage = function(){
	/*
		.version: 1.0
		
		.date:
		20/09/2007
		
		.usage:
		GLB.controlPackage.include("../js/arquivo.js");
		GLB.controlPackage.loadScript("../js/arquivo.js", callBack);
		
		.required
		GLB.util.httpRequest
		GLB.util.delegate
	*/
	GLB.namespace("GLB.util");
	
	var _onLoadScript = function(args){
		var scriptElement = document.createElement("script");
		scriptElement.setAttribute('type', 'text/javascript');
		scriptElement.innerHTML = args.result.responseText;
				
		document.getElementsByTagName('head')[0].appendChild(scriptElement);
		
		var callback = args.callback;	
		if(typeof(callback)==="object" && typeof(callback.arguments)==="object")callback.arguments.result = args.result.responseText;
		
		if(callback && typeof(callback)==="function")callback();
		else if(typeof(callback)==="object"){
			if(typeof(callback.scope)==="object"){
				var func = GLB.util.delegate.create(callback.scope, typeof(callback.callback)==="string" ? callback.callback : 'onLoadScript');
				if(func)func((callback.arguments)? callback.arguments : args.result.responseText);
			}
		}		
	}
	
	var _log = function(message){
		alert(" >> "+message);
	}
	
	return {
		include: function(path){
			if(typeof(path) != "string") return null;
			
			var scriptElement = document.createElement("script");
			scriptElement.setAttribute('type', 'text/javascript');
			scriptElement.setAttribute('src', path);
			
			document.getElementsByTagName('head')[0].appendChild(scriptElement);
		},
		loadScript: function(path, callBack){
			if(typeof(path) != "string") return null;
				
			if(!GLB.util.delegate){
				_log("Erro: O uso do m?todo GLB.controlPackage.loadScript exige o pacote GLB.util.delegate j? carregado");
				return null;
			}
			if(!GLB.util.httpRequest){
				_log("Erro: O uso do m?todo GLB.controlPackage.loadScript exige o pacote GLB.util.httpRequest j? carregado");
				return null;
			}
			
			var callbackLoad = {
				onComplete: _onLoadScript,
				arguments: {
					callback: callBack,
					path: path
				}
			}
			GLB.util.httpRequest.get(path, "", callbackLoad, false);			
		}
	}
}();

GLB.namespace("GLB.util");
GLB.util.delegate = function(){
	/*
		.version: 1.0
		
		.date:
		20/09/2007
		
		.usage:
		obj1.function = GLB.util.Delegate(obj2, "method");
	*/
	return {
		create:function(obj, method){
			
			if(typeof(method) != "string" || typeof(obj) != "object" || typeof(obj[method]) != "function") return null;
			return function(){
				return obj[method].apply(obj, arguments);
			}			
		}
	}	
}();

GLB.namespace("GLB.util");
GLB.util.css = function(){
	/*
		.version: 1.0
		
		.date:
		20/09/2007
		
		.usage:
		obj1.function = GLB.util.Delegate(obj2, "method");
		
		.required
		GLB.util.html
		
	*/
	var _isIe 		= GLB.Browser.version.ie;
	var _isOpera 	= GLB.Browser.version.opera;
	
	var _getStyle	= function(element, style) {
		element = (typeof element === "object")? element: GLB.$(element);
		var value = undefined;
		
		style = (style == 'float' || style == 'cssFloat') ? (_isIe? 'styleFloat' : 'cssFloat') : GLB.util.html.camelize(style);
		if (!value && !_isIe) {
			var css = document.defaultView.getComputedStyle(element, null);
			value = css ? css[style] : null;
		}		
		
		if (!value && element.currentStyle && _isIe) value = element.currentStyle[style];
		
		if (style == 'opacity' && _isIe) {
			if(value = (GLB.util.css.getStyle(element, 'filter') || '').match(/alpha\(opacity=(.*)\)/))
				if (value[1])return parseFloat(value[1]) / 100;
		 
			return 1.0;
		}else if(style == 'opacity'){
			return value ? parseFloat(value) : 1.0;
		}
		
		if (value == 'auto' && _isIe) {
		  if ((style == 'width' || style == 'height') && (GLB.util.css.getStyle('display') != 'none'))
			return element['offset'+GLB.util.html.capitalize(style)] + 'px';
		  
		  return null;
		}
		
		return value == 'auto' ? null : value;		  
	}
	
	var _setStyle = function(element, styles, camelized) {
		element = (typeof element === "object")? element: GLB.$(element);
		
		var elementStyle = element.style, match;
		if (typeof styles === "string") {
			element.style.cssText += ';' + styles;
			return styles.indexOf('opacity') > -1 ? _setOpacity(element, styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : element;
		}
	
		for (var property in styles)
			if (property == 'opacity')
				element.setOpacity(styles[property])
			else
				elementStyle[(property == 'float' || property == 'cssFloat') ?
					(elementStyle.styleFloat === undefined ? 'cssFloat' : 'styleFloat') : (camelized ? property : GLB.util.html.camelize(property))] = styles[property];
	
		return element;
	}
	
	var _setOpacity = function(element, value) {
		
		
		element = (typeof element === "object")? element: GLB.$(element);	
		
		if(!_isIe){
			element.style.opacity = (value == 1 || value === '') ? '' :  (value < 0.00001) ? 0 : value;	
			//alert(" OPACITY ::: "+element.style.opacity);
		}else {
			
			var filter = _getStyle(element, 'filter') || "", style = element.style;
			if (value == 1 || value === '') {
				style.filter = filter.replace(/alpha\([^)]*\)/,'');
				return element;
			}else if(value < 0.00001){
				value = 0;
			}
			style.filter = filter.replace(/alpha\([^)]*\)/, '') + 'alpha(opacity=' + (value * 100) + ')';
		}
		
		return element;
	}
	
	var _getDimensions = function(element) {
		element = (typeof element === "object")? element: GLB.$(element);
				
		var display = GLB.util.css.getStyle(element, 'display');
		
		// Safari bug
		if (display != 'none' && display != null)return{width: element.offsetWidth, height: element.offsetHeight};
		
		// All *Width and *Height properties give 0 on elements with display none,
		// so enable the element temporarily
		var els = element.style;
		
		var originalVisibility = els.visibility;
		var originalPosition = els.position;
		var originalDisplay = els.display;
		
		els.visibility = 'hidden';
		els.position = 'absolute';
		els.display = 'block';
		
		var originalWidth = element.clientWidth;
		var originalHeight = element.clientHeight;
		
		els.display = originalDisplay;
		els.position = originalPosition;
		els.visibility = originalVisibility;
		
		return {width: originalWidth, height: originalHeight};
	}
	
	var _getPosition = function(element){
		var x = 0, y = 0;
		if (!document.layers) {
			
			var onWindows = navigator.platform ? navigator.platform == "Win32" : false;
			var mac = document.all && !onWindows && getExplorerVersion() == 4.5;
			var par = element;
			var lastOffsetTop = 0;
			var lastOffsetLeft = 0;
			
			while(par){
				if(par.leftMargin && !onWindows) x += parseInt(par.leftMargin);
				if(par.topMargin && !onWindows ) y += parseInt(par.topMargin);
				
				if((par.offsetLeft != lastOffsetLeft) && par.offsetLeft) 	x += parseInt(par.offsetLeft);
				if((par.offsetTop != lastOffsetTop) && par.offsetTop) 		y += parseInt(par.offsetTop);
				
				if(par.offsetLeft != 0) lastOffsetLeft 	= par.offsetLeft;
				if(par.offsetTop != 0 ) lastOffsetTop 	= par.offsetTop;
				
				par = mac ? par.parentElement : par.offsetParent;
			}
			
		} else if(element.x && element.y){
			x += element.x;
			y += element.y;
		}
		
		return {x: x, y: y};
	}
	
	var _addClass = function(element, _class){
		if(typeof element === "string") element = GLB.$(element);
		
		if (!element.className) element.className = ''; 
		var className = element.className;		
		if (!className.match(RegExp("\\b"+_class+"\\b"))) className = className.replace(/(\S$)/,'$1 ')+_class;		
		element.className = className;
	}
	var _removeClass = function(element, _class){
		if(typeof element === "string") element = GLB.$(element);
		
		if (!element.className) element.className = ''; 
		var className = element.className; 
		className = className.replace(RegExp("(\\s*\\b"+_class+"\\b(\\s*))*","g"),'$2');
		element.className = className;
	}
	
	var _checkClass = function(element, _class){
		if(typeof element === "string") element = GLB.$(element);
		
		if (!element.className) element.className = ''; 
		var className = element.className; 
		
		return className.match(RegExp("\\b"+_class+"\\b"));
	}
	
	var _log = function(message){
	}
			
	return {
		getStyle:function(element, style){
			if(!GLB.util.html)_log("Erro: O uso desse m?todo (GLB.util.css.getStyle) exige o pacote GLB.util.html j? carregado");
			
			if(_isOpera){
				switch(style) {
				  case 'left':
				  case 'top':
				  case 'right':
				  case 'bottom':
					if (_getStyle(element, 'position') == 'static') return null;
				  default: return _getStyle(element, style);
				}
			}else{
				return _getStyle(element, style);
			}			
		},
		setStyle:function(element, styles, camelized){
			if(!GLB.util.html)_log("Erro: O uso desse m?todo (GLB.util.css.setStyle) exige o pacote GLB.util.html j? carregado");			
			return 	_setStyle(element, styles, camelized);
		},
		getHeight: function(element) {
			return _getDimensions(element).height;
		},		
		getWidth: function(element) {
			return _getDimensions(element).width;
		},
		getPosition:function(element){
			return _getPosition(element);
		},
		addClass:function(element, _class){
			return _addClass(element, _class);
		},
		removeClass:function(element, _class){
			return _removeClass(element, _class);
		},
		checkClass:function(element, _class){
			return _checkClass(element, _class);
		}
	}
}();



GLB.namespace("GLB.util");
GLB.util.html = function(){
	/*
		.version: 1.0
		
		.date:
		20/09/2007
		
		.usage:
		obj1.function = GLB.util.Delegate(obj2, "method");
	*/
	return {
		stripTags:function(htmlText){
			return htmlText.replace(/<\/?[^>]+>/gi, '');
		},
		escape:function(htmlText){
			var div = document.createElement('div');
			var text = document.createTextNode(htmlText);
			div.appendChild(text);
			
			return div.innerHTML;	
		},
		unescape:function(htmlText){
			var div = document.createElement('div');
			div.innerHTML = stripTags(htmlText);
			
			return div.childNodes[0].nodeValue;
		},
		camelize:function(htmlText) {
			var parts = htmlText.split('-'), len = parts.length;
			if (len == 1) return parts[0];
			
			var camelized = htmlText.charAt(0) == '-' ? 
				parts[0].charAt(0).toUpperCase() + parts[0].substring(1) : parts[0];
			
			for (var i = 1; i < len; i++)
				camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);
			
			return camelized;
		},		
		capitalize:function(htmlText) {
			return htmlText.charAt(0).toUpperCase() + htmlText.substring(1).toLowerCase();
		}
	}
}();

GLB.namespace("GLB.util");
GLB.util.httpRequest = function(){
	/*
		.version: 1.0
		
		.date:
		20/09/2007
		
		.usage:
		GLB.util.httpRequest.get("url", {params}, callback=function(){}, waitResponse);
		or
		GLB.util.httpRequest.post("url", {params}, {scope: object, onComplete: function(){}, arguments: {}}, waitResponse);
		
	*/	
	var _events = ["onStart", "onOpen", "onSend", "onLoad", "onComplete"];
	var _filter = encodeURIComponent;
	var	_objectsHTTP = [
						function(){return new XMLHttpRequest();},
						function(){return new ActiveXObject("MSXML2.XMLHTTP.3.0");},
						function(){return new ActiveXObject("Msxml2.XMLHTTP");},
						function(){return new ActiveXObject("Microsoft.XMLHTTP");}
						];
	/*
		 *- Met?do de verifica??o sobre o suporte ao HTTPRequest
		 |method _isSupported
		 |private static
		 |return {Boolean}  retorna o suporte ao uso do Objeto HTTP
	*/
	var _isSupported = function(){
		return !!_getConnection();
	};
	/*
		M?todo de captura de conex?o
		|method _getConnection
		|private static
		|return {HTTP}  retorna o Objeto HTTP
	*/
	var _getConnection = function(){
		for(var i=0; i<_objectsHTTP.length; i++){
			try{
				return _objectsHTTP[i]();
			}catch(e){};
		}
		return null;
	};
	/*
		Formata??o dos param?tros para envio via GET ou POST
		|method _formatParams
	 	|private static
		|param  {Object} params - lista dos parametros a ser formatado
		|return {String} retorna uma string com os par?metros formatados
	*/
	var _formatParams = function(params){
		var i, r = [];
		for(i in params){
			r[r.length] = i + "=" + (_filter ? _filter(params[i]) : params[i]);
		}
		return r.join("&");
	};
	/*
		Met?do de execu??o da consulta principal
		|method _request
	 	|private static
		|param  {String} method 			- Met?dod de consulta: GET ou POST
		|param  {String} url 				- Url do arquivo requisitado
		|param  {Object} params 			- Lista de param?tros a ser enviado ao arquivo
		|param  {Object||Function} handler	- callback
		|param  {String} headers 			- Cabe?alho para envio na solicita??o
		|param  {Boolean} waitResponse		- Defini??o sobre a assincronia na consulta
		|return {Booelan} retorna um valor booleano sobre o sucesso da consulta
	*/
	var _request = function(method, url, params, handler, headers, waitResponse){
		if(!GLB.util.delegate && handler)_log("Erro: O uso desse m?todo (get || post) exige o pacote GLB.util.delegate j? carregado");
		var i, o = _getConnection(), f = typeof handler === "function", a = typeof handler === "object" && handler.arguments;
		try{
			if(typeof handler === "object" && handler.arguments)handler.arguments.result = o;

			o.open(method, url, !waitResponse);

			waitResponse || (o.onreadystatechange = function(){
				var s = _events[o.readyState];
				var func = f ? handler : (handler[s] ? handler[s]: null);
				if(func){
					if(typeof handler === "object" && typeof handler.scope==="object")var func = GLB.util.delegate.create(handler.scope, func);			
					func((typeof handler === "object" && handler.arguments)? handler.arguments : o)
				}				
			});
			
			o.setRequestHeader("HTTP_USER_AGENT", "XMLHttpRequest");
			
			for(i in headers)o.setRequestHeader(i, headers[i]);
			o.send(params);
			
			var func = f ? handler : ((handler["onComplete"])? handler["onComplete"]: null);			
			if(waitResponse && func){
				if(typeof handler === "object" && typeof handler.scope === "object")var func = GLB.util.delegate.create(handler.scope, "onComplete");
				func((typeof handler === "object" && handler.arguments)? handler.arguments : o)
			}			
			
			return o;
		}
		catch(e){
			return false;
		}
	};
	
	var _log = function(message){
		alert(" >> "+message);
	}
	
	return {
		/*
			Met?do de execu??o da consulta via GET
			|method get
			|public static
			|param  {String} url 				- Url do arquivo requisitado
			|param  {Object} params 			- Lista de param?tros a ser enviado ao arquivo
			|param  {Object||Function} handler	- callback
			|param  {Boolean} waitResponse		- Defini??o sobre a assincronia na consulta
			|return {Booelan} retorna um valor booleano sobre o sucesso da consulta
		*/
		get:function(url, params, handler, waitResponse){
			return _request("GET", url + (url.indexOf("?") + 1 ? "&" : "?") + _formatParams(params), null, handler, {
				"Content-Type": "text/html; charset:UTF-8",
				"Content-length": 0,
				"Connection": "close"			
			}, waitResponse);
		},
		/*
			Met?do de execu??o da consulta via POST
			|method post
			|public static
			|param  {String} url 				- Url do arquivo requisitado
			|param  {Object} params 			- Lista de param?tros a ser enviado ao arquivo
			|param  {Object||Function} handler	- callback
			|param  {Boolean} waitResponse		- Defini??o sobre a assincronia na consulta
			|return {Booelan} retorna um valor booleano sobre o sucesso da consulta
		*/
		post:function(url, params, handler, waitResponse){
			return _request("POST", url, params = _formatParams(params), handler, {
				"Connection": "close",
				"Content-Length": params.length,
				"Method": "POST " + url + " HTTP/1.1",
				"Content-Type": "application/x-www-form-urlencoded; charset=utf-8"
			}, waitResponse);
		}
	}	
}();

// JavaScript Document
GLB.namespace("GLB.util");
GLB.namespace("GLB.common");
GLB.util.popIn = function(){
	/*
		.version: 1.0
		
		.date:
		20/09/2007
		
		.usage:
		<a href="teste.htm" onclick="GLB.util.popIn.showContent({src: "", method: "POST || GET"});return false;">teste</a>	
		
		.requeried
		GLB.util.httpRequest
		GLB.util.css
	*/
	var _animate	 = {shadow:false, window:true, content:true}
	
	var _elOculta	 = "box-popin-oculta";
	var _elOverlay	 = "box-popin-sombra";
	var _elLoad	 	 = "box-popin-load";
	var _elWindow	 = "box-popin";
	var _elCtClose	 = "box-popin-fechar";
	var _elClose	 = "link-fechar-popin";
	var _elTitle	 = "titulo-popin";
	var _elContent	 = "conteudo-popin";
	var _elCaption	 = "legenda-popin";
	var _elCtCredito = "credito-popin";
	var _elImage	 = "imagem-popin";
	var _zindex		 = 99999;
	
	
	var _position = function() {
		
		var Css	 	= GLB.util.css;
		
		var TB_PDLEFT	= Number(Css.getStyle(GLB.$(_elWindow), "paddingLeft").replace("px", ""));
		var TB_PDRIGHT	= Number(Css.getStyle(GLB.$(_elWindow), "paddingRight").replace("px", ""));
		var TB_WIDTH 	= Css.getWidth(GLB.$(_elImage)? GLB.$(_elImage): GLB.$(_elWindow)) + TB_PDLEFT + TB_PDRIGHT;
		var TB_HEIGHT 	= Css.getHeight(GLB.$(_elWindow));	
		
		if(_animate.window && GLB.common.animation){
			var Tween 	= GLB.common.animation.Tween;
			
			var fl = parseInt(Css.getStyle(GLB.$(_elWindow), "padding-left").replace("px" ,""), 10) || 0;
			var fr = parseInt(Css.getStyle(GLB.$(_elWindow), "padding-right").replace("px" ,""), 10) || 0;
			var ft = parseInt(Css.getStyle(GLB.$(_elWindow), "padding-top").replace("px" ,""), 10) || 0;
			var fb = parseInt(Css.getStyle(GLB.$(_elWindow), "padding-bottom").replace("px" ,""), 10) || 0;
			
			var l = parseInt(((_page().w - TB_WIDTH) / 2),10);
			var t = parseInt(_scroll().yScroll + ((_page().h - TB_HEIGHT) / 2),10);
			var w = TB_WIDTH  - (fl+fr);
			var h = TB_HEIGHT - (ft+fb);
			
			GLB.$(_elWindow).style.overflow = "hidden";
			
			GLB.util.css.setStyle((GLB.$(_elImage)? GLB.$(_elImage): GLB.$(_elContent)), "visibility: hidden");
			if(GLB.$(_elCaption))GLB.util.css.setStyle(GLB.$(_elCaption), "visibility: hidden");
			
			var anim = new Tween([0, 0, _page().w/2, _scroll().yScroll + _page().h/2], [w, h, l, t], 500, {element: GLB.$(_elWindow)});
			//anim.easingEquation = GLB.common.animation.elasticEquation; 
			anim.onAnimation 	= _adjustSize;
			anim.onEndAnimation =_endAdjustSize;
			anim.init();			
		}else{
			GLB.$(_elWindow).style.left = parseInt(((_page().w - TB_WIDTH) / 2),10) + 'px';
			GLB.$(_elWindow).style.top  = parseInt(_scroll().yScroll + ((_page().h - TB_HEIGHT) / 2),10) + 'px';
		}
	}
	var _t = "";
	var _adjustSize = function(values, args){	
		if(!args.element)return;
		
		args.element.style.width 	= Math.round(values[0])+"px";
		args.element.style.height 	= Math.round(values[1])+"px";		
		args.element.style.left 	= Math.round(values[2])+'px';
		args.element.style.top  	= Math.round(values[3])+'px';	
		
		_t += args.element.id+" -> "+Math.round(values[0])+"px"+" - "+Math.round(values[1])+"px";
	}
	var _endAdjustSize = function(values, args){		
		_adjustSize(values, args);
		
		if(_animate.content && GLB.common.animation){
			var anim = new GLB.common.animation.Tween(0, 100, 500, {element: (GLB.$(_elImage)? GLB.$(_elImage): GLB.$(_elContent))});
			anim.onAnimation 	= anim.onEndAnimation = _adjustAlpha;
			anim.init();
			
			/* -- */
			if(GLB.$(_elCaption)){
				var anim2 = new GLB.common.animation.Tween(0, 100, 500, {element: GLB.$(_elCaption)});
				anim2.onAnimation 	= anim2.onEndAnimation = _adjustAlpha;
				anim2.init();
				//GLB.util.css.setStyle(GLB.$(_elCaption), "visibility: visible");			
			}
		}else{
			GLB.$(_elWindow).style.overflow = "";
			GLB.util.css.setStyle(GLB.$(_elContent), "visibility: visible");
			if(GLB.$(_elCaption))GLB.util.css.setStyle(GLB.$(_elCaption), "visibility: visible");
		}
		
		
	}

	var _adjustAlpha = function(values, args){	
		if(!args.element)return;
		GLB.util.css.setStyle(args.element, "opacity: "+(Math.round(values)/100));
		args.element.style.visibility = "";
	}
	
	var _page = function() {
		var _body = GLB.$("body");
		var _html = GLB.$("html");
		
		var de = document.documentElement;
		var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || _body.clientWidth;
		var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || _body.clientHeight;

		return {w: w,h: h};
	}
	
	var _scroll = function(){
		var yScroll;
		if (self.pageYOffset) yScroll = self.pageYOffset;
		else if (document.documentElement && document.documentElement.scrollTop) yScroll = document.documentElement.scrollTop;
		else if (document.body) yScroll = document.body.scrollTop;

		return {yScroll:yScroll};
	}
	
	var _hide = function() {
		var _body = GLB.$("body");
		var _html = GLB.$("html");
		
		GLB.$(_elOverlay).onclick = "";
		GLB.$(_elWindow).onclick = "";
		GLB.$(_elClose).onclick = "";
		
		GLB.$(_elWindow) 		&& 	_body.removeChild(GLB.$(_elWindow));
		GLB.$(_elLoad)	 	&& 	_body.removeChild(GLB.$(_elLoad));
		GLB.$(_elOculta) 	&& 	_body.removeChild(GLB.$(_elOculta));
		GLB.$(_elOverlay) 	&& 	_body.removeChild(GLB.$(_elOverlay));
		
		if (typeof _body.style.maxHeight == "undefined") {
			_body.style.height = _body.style.width = "auto";
			_html.style.height = _html.style.width = "auto";
			_html.style.overflow = "";
		}
		return false;
	}
	
	var _onLoadContent = function(arguments){
		var args = arguments.result;
		
		GLB.$(_elWindow).appendChild(GLB.create("div", {id: _elCtClose}));
		if(arguments.title!=undefined)GLB.$(_elCtClose).appendChild(GLB.create("h3", {id: _elTitle, innerHTML: arguments.title}));
		GLB.$(_elCtClose).appendChild(GLB.create("a", {href: "#fechar", id: _elClose, innerHTML: "x fechar"}));
		GLB.$(_elWindow).appendChild(GLB.create("div", {id: _elContent, innerHTML: args.responseText}));
				
		GLB.$(_elClose).onclick = _hide;
		GLB.$(_elOverlay).onclick = _hide;
				
		GLB.$("body").removeChild(GLB.$(_elLoad));
		
		setTimeout(_position, 50);
	}
	
	var _onLoadImage = function(){
		var Css	 	= GLB.util.css;
		
		this.onload = null;
		
		var x = _page().w - 150;
		var y = _page().h - 150;
		
		GLB.$(_elWindow).appendChild(GLB.create("div", {id: _elCtClose}));
		GLB.$(_elCtClose).appendChild(GLB.create("a", {href: "#fechar", id: _elClose, innerHTML: "x fechar"}));
		GLB.$(_elCtClose).appendChild(GLB.create("div", {id: _elCtCredito, innerHTML: this.alt}));
		GLB.$(_elWindow).appendChild(GLB.create("div", {id: _elContent, align:"center"}));
		GLB.$(_elWindow).appendChild(GLB.create("div", {id: _elCaption, innerHTML: this.caption}));
		GLB.$(_elContent).appendChild(GLB.create("img", {src: this.src, id: _elImage, alt: this.caption}));
		
		var imageWidth = this.width>0? this.width : Css.getWidth(GLB.$(_elImage));
		var imageHeight = this.height>0? this.height: Css.getHeight(GLB.$(_elImage));
		
		if (imageWidth/x > imageHeight/y) {
			imageHeight = imageHeight * (Math.min(x, imageWidth)/ imageWidth); 
			imageWidth = Math.min(x, imageWidth); 
		}else{
			imageWidth = imageWidth * (Math.min(y, imageHeight) / imageHeight); 
			imageHeight = Math.min(y, imageHeight); 
		}
		
		GLB.$(_elImage).width = imageWidth;
		GLB.$(_elImage).height = imageHeight;

				
		GLB.$(_elClose).onclick = _hide;
		GLB.$(_elOverlay).onclick = _hide;
		
		GLB.$("body").removeChild(GLB.$(_elLoad));
		
		setTimeout(_position, 50);
	}
	
	var _show = function(args, type) {		
		
		var _body 		= GLB.$("body");
		var _html 		= GLB.$("html");
		//var _classElWindow = args.class || "";
		
		var Css	  = GLB.util.css;
		
		if (typeof GLB.$("body").style.maxHeight === "undefined") { //if IE 6	
			
			_body.style.height = _body.style.width = "100%";
			_html.style.height = _html.style.width = "100%";
			//_html.style.overflow = "hidden";
			if (GLB.$(_elOculta) === null)_body.appendChild(GLB.util.css.setStyle(GLB.create("iframe", {id: _elOculta}), "opacity:0;position:absolute;top:0;left:0;width:100%;"));
		
		}
			
		_body.appendChild(GLB.util.css.setStyle(GLB.create("div", {id: _elOverlay}), "z-index:"+(_zindex+1)+"; visibility:"+(_animate.shadow? "hidde": "")));
		//_body.appendChild(GLB.util.css.setStyle(GLB.create("div", {id: _elWindow, className: _classElWindow}), "z-index:"+(_zindex+2)));									 
		_body.appendChild(GLB.util.css.setStyle(GLB.create("div", {id: _elWindow}), "z-index:"+(_zindex+2)));									 
		_body.appendChild(GLB.util.css.setStyle(GLB.create("div", {id: _elLoad}), "z-index:"+(_zindex+3)));
		
		var h = (_body.scrollHeight > _body.offsetHeight) ? _body.scrollHeight :_body.offsetHeight + 'px';
		if(GLB.$(_elOculta))GLB.$(_elOculta).style.height = h;
		GLB.$(_elOverlay).style.height = h;	
		GLB.$(_elWindow).style.position = "absolute";
		GLB.$(_elWindow).style.minWidth = "10px";
		GLB.$(_elWindow).style.minHeight = "10px";
		GLB.$(_elLoad).style.visible = "visible";
		
		//--Centralizando o load
		var loadW 	= Css.getWidth(GLB.$(_elLoad));
		var loadH 	= Css.getHeight(GLB.$(_elLoad));	
		var fl = parseInt(Css.getStyle(GLB.$(_elLoad), "padding-left").replace("px" ,""), 10) || 0;
		var fr = parseInt(Css.getStyle(GLB.$(_elLoad), "padding-right").replace("px" ,""), 10) || 0;
		var ft = parseInt(Css.getStyle(GLB.$(_elLoad), "padding-top").replace("px" ,""), 10) || 0;
		var fb = parseInt(Css.getStyle(GLB.$(_elLoad), "padding-bottom").replace("px" ,""), 10) || 0;
			
		var w = loadW - (fl+fr);
		var h = loadH - (ft+fb);
		
		var l = parseInt(((_page().w - loadW) / 2),10);
		var t = parseInt(_scroll().yScroll + ((_page().h - loadH) / 2),10);
		
		GLB.$(_elLoad).style.left = parseInt(((_page().w - loadW) / 2),10) + 'px';
		GLB.$(_elLoad).style.top  = parseInt(_scroll().yScroll + ((_page().h - loadH) / 2),10) + 'px';
		
		if(_animate.shadow && GLB.common.animation){
			var anim = new GLB.common.animation.Tween(0, 80, 500, {element: GLB.$(_elOverlay)});
			anim.onAnimation = anim.onEndAnimation = _adjustAlpha;
			anim.init();
		}
		if(type=="content"){
			//Carregando dados;
			if(args.method && args.method.toLowerCase() == "post")
				GLB.util.httpRequest.post(args.src, args.params || "", {onComplete: _onLoadContent, arguments: args}, true);
			else
				GLB.util.httpRequest.get(args.src, args.params || "", {onComplete: _onLoadContent, arguments: args}, true);
				
		}else if(type=="image"){
			//Carregando Imagem
			var imgPreloader = GLB.create("img");
			imgPreloader.caption = args.caption || "";
			imgPreloader.alt = args.alt || "";
			imgPreloader.onload = _onLoadImage;
			imgPreloader.src = args.src;
		}
	}
	return {
		showContent: function(args){_show(args, "content");},
		showImage: function(args){_show(args, "image");},
		hide: _hide
	}

}();

// JavaScript Document
GLB.namespace("GLB.common");
GLB.common.animation = function(){
	/*
		.version: 1.0
		
		.date:
		20/09/2007
		
		.usage:
		var anim = new GLB.common.animation.Tween(inivalue, endvalue, duration);
		anim.setAnimation(GLB.common.animation.bounceEquation);
		anim.init();				
	*/
	
	/*
	Static Function
	*/
	var _easingEquation = function(t,b,c,d,a,p)
	{
		return c/2 * ( Math.sin( Math.PI * (t/d-0.5) ) + 1 ) + b;
	}
	var _bounceEquation = function(t,b,c,d,a,p)
	{
		if ((t/=d) < (1/2.75)) {
			return c*(7.5625*t*t) + b;
		} else if (t < (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	}
	var _elasticEquation = function(t,b,c,d,a,p)
	{
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (!a || a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return (a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b);
	}
	/*
		Class		
	*/
	var $anim = function(inivalue, endvalue, duration, args){
		this._duration 	= duration;
		this._inicial 	= inivalue;	
		this._final 	= endvalue;
		this._args		= args;		
	}
	$anim.prototype = {
		init:function(){
			if(typeof this._inicial === "array" && typeof this._final === "array" && this._inicial.length != this._final.length)return;
			
			var _self = this;
		
			this._iniTime = new Date().getTime();
			this._interval = setInterval(function(){
				_self.setAnimation();
			}, 5);
		},
		setAnimation:function(){
			var curTime = new Date().getTime()-this._iniTime;	
			
			if (curTime >= this._duration){
				  this.onEndAnimation && this.onEndAnimation(this._final, this._args || {});
				 clearInterval(this._interval);
				 return;
			}
			
			if(typeof this._inicial === "object"){
				var _tempArr = [];
				for(var i=0; i<this._inicial.length; i++){
					_tempArr.push(this.easingEquation(curTime, this._inicial[i], parseInt(this._final[i]-this._inicial[i]), this._duration));
				}
				this.onAnimation && this.onAnimation(_tempArr, this._args || {});
			}else
				this.onAnimation && this.onAnimation(this.easingEquation(curTime, this._inicial, parseInt(this._final-this._inicial), this._duration), this._args || {});
		},
		easingEquation:_easingEquation
	}
	
	return {
		Tween			: $anim,
		easingEquation	: _easingEquation,
		bounceEquation	: _bounceEquation,
		elasticEquation	: _elasticEquation
	}
}();

GLB.namespace("GLB.common");
GLB.common.enquete = function(){
	/*
		.version: 1.0
		
		.date:
		12/11/2007
		
		.usage:
		var enqResponde = new GLB.common.enquete("id-form-enquete");	
		
		.requeried
		GLB.util.httpRequest
		GLB.util.delegate
		GLB.util.css
	*/
	var $enquete = function(idForm){
		this._form 		= GLB.$(idForm);
		this._action 	= this._form.action;
		this._method 	= this._form.method;
		this._option	= "";
		
		this._form.onsubmit = GLB.util.delegate.create(this, "send"); 
	}
	$enquete.prototype = {
		send:function(){
			this._option	= this.getOption();

			if(this._option!=null){
				var params = {};
				
				params.opcaoId 			= this._option;
				params.enqueteId 		= this._form.elements['enqueteId'].value;
				params.urlErro	 		= this._form.elements['urlErro'].value;
				params.urlSucesso 		= this._form.elements['urlSucesso'].value;
				
				GLB.util.popIn.showContent({src: this._action, params: params, method: "POST", title: "resultado"});
			
				return false;
			}else{
				alert("Selecione um item para votar");
				return false;
				
			}
		},
		getOption:function(){
			for(var i=0; i<this._form.elements['opcaoId'].length; i++)
				if(this._form.elements['opcaoId'][i].checked)return this._form.elements['opcaoId'][i].value;
			return null;
		}
	}
	return $enquete;
}();

GLB.namespace("GLB.common");
GLB.common.thumbImage = function() {
	/*
		.version: 1.0
		
		.date:
		20/09/2007
		
		.usage:
		GLB.common.thumbImage.init()	
		
		.requeried
		GLB.util.popIn
	*/
	var _classNameDefault = "foto-zoom-ef";

	var _initialize = function(){
		var items = document.getElementsByTagName("a");		

		for(var i=0; i<items.length; i++){
			if((items[i].className.indexOf(_classNameDefault)!=-1 && _classNameDefault.length==items[i].className.length) ||
				items[i].className.indexOf(_classNameDefault+" ")!=-1 || items[i].className.indexOf(" "+_classNameDefault)!=-1)
			{
				_createEvent(items[i]);
			}
		}
		
		
	}
	
	var _createEvent = function(element){
		element.onclick = _clickElement;	
	}
	
	var _clickElement = function(){	
		var img = this.href || "";
		var cap = this.title || "";
		var credito = (this.getElementsByTagName("div").length>0)? this.getElementsByTagName("div")[0].innerHTML : "";
		var credito = (this.getElementsByTagName("span").length>0)? this.getElementsByTagName("span")[0].innerHTML : credito;
		
		if(img=="" || img == "#")return false;
		
		GLB.util.popIn.showImage({src:img, caption: cap, alt:credito}); 
		
		return false;
	}
	
	return {
		init: _initialize
	}
}();

GLB.namespace("GLB.common");
GLB.common.materia = function() {
	/*
		.version: 1.0
		
		.date:
		20/09/2007
		
		.usage:
		GLB.common.materia.aumentaFonte(container);
		GLB.common.materia.diminuiFonte(container);
		GLB.common.materia.searchInit();
	*/
	var _value		= 1.175;
	var _valueAdd	= 0.085;
	
	var _limitMais	= 1.425;
	var _limitMenos	= 0.915;
	
	var _updateFont = function(container) {
		var pObjs = document.getElementById(container).getElementsByTagName("p");
		for (var i=0; i<pObjs.length; i++)
			pObjs[i].style.fontSize = _value+'em';
	}
	
	var _classNameDefault = "materia-busca";
	var _idBoxBusca = "box-busca-teste";
	var _idBoxLoad	= "box-busca-load";
	var _idClose	= "link-busca-fechar";
	var _classClose = "close";
	
	var _srcSearch	= "/GLB-UI/htm/glb-materia/v1/glb-materia-busca.jsp";
	
	var _offsetX	= 0;
	var _offsetY	= 40;
	var _lastSearch = null;
	
	var _search = function(element){
		
		var node 	= element.cloneNode(true);
		var img 	= node.getElementsByTagName('img')[0];
		
		var q 		= escape(node.innerHTML);
		var opt 	= "?q=" + q + "&=&idate=&edate=&initday=&initmonth=&inityear=&endday=&endmonth=&endyear=&op=fotos&query=" + q;
		var url 	= _srcSearch + opt;
		
		if(img)node.removeChild(img);
		
		var divT 	= GLB.create("div", {id: _idBoxBusca});
		var divC 	= GLB.create("div", {id: _idBoxLoad});
		var h4C	 	= GLB.create("h4", {innerHTML: "carregando..."});
				
		divC.appendChild(h4C);
		divT.appendChild(divC);
		
		GLB.$("body").appendChild(divT);
		
		divT.style.position = "absolute";
		divT.style.left 	= (GLB.util.css.getPosition(element).x + _offsetX) +"px";
		divT.style.top 		= (GLB.util.css.getPosition(element).y + (_value/0.085)*2.5) +"px";		
		
		GLB.util.httpRequest.get(url, "", {onLoad: _onLoadSearch, arguments: {container: divT}});
		
		if(_lastSearch) _lastSearch.parentNode.removeChild(_lastSearch);
		_lastSearch = divT;
	}
	
	var _closeSearch = function(obj) {
		_lastSearch = null;		
		obj.parentNode.removeChild(obj);
	}
	
	var _onLoadSearch = function(args){
		var div = args.container;
		div.innerHTML = '';
		div.innerHTML = args.result.responseText;
		
		var aObjs = div.getElementsByTagName("a");
		
		for(var i=0; i<aObjs.length; i++){
			
			if((aObjs[i].id.indexOf(_idClose)!=-1 && _idClose.length==aObjs[i].id.length) ||
				aObjs[i].id.indexOf(_idClose+" ")!=-1 || aObjs[i].id.indexOf(" "+_idClose)!=-1)
			{
				aObjs[i].closeSearch = _closeSearch;
				aObjs[i].onclick = function(){ this.closeSearch(div); return false; };
			}
		}
	}
	
	var _searchInit = function(){
		var items = document.getElementsByTagName("a");		
				
		for(var i=0; i<items.length; i++){
			if((items[i].className.indexOf(_classNameDefault)!=-1 && _classNameDefault.length==items[i].className.length) ||
				items[i].className.indexOf(_classNameDefault+" ")!=-1 || items[i].className.indexOf(" "+_classNameDefault)!=-1)
			{
				_createEvent(items[i]);
			}
		}
	}
	
	var _createEvent = function(element){
		element.onclick = _clickElement;
	}
	
	var _clickElement = function(){	
		_search(this);		
		return false;
	}
	
	return {
		aumentaFonte:function(container){
			_value = Math.min(_limitMais, _value+_valueAdd);
			_updateFont(container);
		},
		diminuiFonte:function(container){
			_value = Math.max(_limitMenos, _value-_valueAdd);
			_updateFont(container);
		},
		searchInit: _searchInit
	}
}();

GLB.namespace("GLB.common");
GLB.common.flash = function() {
	/*
		.version: 1.0
		
		.date:
		11/11/2007
		
		.usage:
		GLB.common.flash({
			width:100,
			height:100,
			swf:'flash.swf',
			div:'flash'
			variables: {galeria: "others.xml"}
			[
			 required: "9.0.45",
			 onFlashFail: funcaoDeErro
			]
		});
		
		.required:		
		GLB.others.swfobject
	
	*/
	
	var _get = function(a) {
		if(!a.swf) return false;
		if(typeof SWFObject == 'undefined') return false;
		
		if(a.required){
			if(!_validVersion(a.required)){
				a.onFlashFail && a.onFlashFail();
				return false;
			}
		}
		
		var width = a.width||100;
		var height = a.height||100;
		var id = a.id||'mymovie';
		var version = a.version||8;
		var color = a.color||'#000000';
		var so = new SWFObject(a.swf, id, width, height, version, color);
		if(a.quality) so.addParam("quality", a.quality);
		if(a.wmode) so.addParam("wmode", a.wmode);
		if(a.allowScriptAccess) so.addParam("allowScriptAccess", a.allowScriptAccess);		
		if(a.variables && typeof a.variables === "object")for(var vars in a.variables) so.addVariable(vars, a.variables[vars]);
		
		return so;
	};
	var _validVersion = function(ver){
		var verInstalled 	= deconcept.SWFObjectUtil.getPlayerVersion();
		var verReq 			= ver.split(".");
		
		if(verInstalled.major < verReq[0]) return false;
		if(verInstalled.major > verReq[0]) return true;
		if(verInstalled.minor < verReq[1]) return false;
		if(verInstalled.minor > verReq[1]) return true;
		if(verInstalled.rev < verReq[2]) return false;
		return true;
	};	
	return function (a) {
		if(a && a.constructor == Object) {
			var so = _get(a);
			if(!so) return false;
			if(a.div && document.getElementById(a.div)){
				so.write(a.div);
				return so;
			} else {
				var id = 'flash-' + (new Date()).getTime();
				document.write('<div id="'+id+'"></div>');
				if(document.getElementById(id))so.write(document.getElementById(id));
				
				return so;
			}				
		}
	};
}();

GLB.namespace("GLB.common");
GLB.common.formulario = function(){
	
	var _forms = [];

	var _validar = function(args) {
		_forms[args.nome] = args;
		// espera evento onload da pagina
		GLB.addDOMLoadEvent(_load);
	}
	var _blur = function(args) {
		args.className = args.className.replace(" on", "");
	}
	var _focus = function(args) {
		args.className += " on";
	}	
	var _load = function() {
		try {
			for(var i in _forms) {
				var _form = _forms[i];
				if(GLB.$(_form.nome)) {
					GLB.$(_form.nome).onsubmit = function() {
						return _valida(this);
					}
					var campos = _form.campos;
					for(var j=0;j<campos.length;j++) {
						var campo = GLB.$(_form.nome).elements[campos[j].nome];
						if(campo) {
							campo.onfocus = function(){ _focus(this); }
							campo.onblur = function() { _blur(this); }
						}
					}
				}
			}
		} catch(e) {}	
	}
	
	var _getCpfCnpj  = function() {
		for(var i in _forms) {
			var _form = _forms[i];
		}
		
		var meuForm = GLB.$(_form.nome);
		
		for (i=0; i<meuForm.tiporegistro.length; i++) {
			if (meuForm.tiporegistro[i].checked == true) {
				valCpfCnpj = meuForm.tiporegistro[i].value;
				return valCpfCnpj;
			}
		}
	}
	
	var _valida = function(args) {
		var retorno = true;
		var erros = [];
		var campos = _forms[args.id].campos;
		var callback = _forms[args.id].onsubmit;
		var boxErro = GLB.$(_forms[args.id].erro);
		var boxSucesso = GLB.$(_forms[args.id].sucesso);
		var listaErro = GLB.$(_forms[args.id].lista);
		var inputErro = _forms[args.id].classe;
		
		if (boxErro != null) boxErro.className = boxErro.className.replace(" on"," off");
		if (boxSucesso != null) boxSucesso.className = boxSucesso.className.replace(" on"," off");
		
		try {
			for(var i=0;i<campos.length;i++) {
				var campo = GLB.$(campos[i].nome);
				var erro = campos[i].erro;
				var tipo = campos[i].tipo;
				var req = campos[i].req;

				if(campo) {
					if(req) {
						campo.parentNode.className = campo.parentNode.className.replace(inputErro,"");
						switch(tipo) {
							case 'texto' :
								if(!campo.value) {
									retorno = false;
									erros.push( { obj:campo, erro:erro } );
								}
								
							break;
							
							case 'email' :
								emailPadrao = /^[\w-]+(\.[\w-]+)*@(([A-Za-z\d][A-Za-z\d-]{0,61}[A-Za-z\d]\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;
								if (!emailPadrao.test(campo.value)) {
									retorno = false;
									erros.push( { obj:campo, erro:erro } );
								}
								
							break;
							
							case 'data' :
								dataPadrao = /^((0[1-9]|[12]\d)\/(0[1-9]|1[0-2])|30\/(0[13-9]|1[0-2])|31\/(0[13578]|1[02]))\/\d{4}$/;
								if (!dataPadrao.test(campo.value)) {
									retorno = false;
									erros.push( { obj:campo, erro:erro } );
								}
								
							break;
							
							case 'cnpj' :
								cnpjPadrao = /^\d+$/;
								if (!cnpjPadrao.test(campo.value) || campo.value.length < 14) {
									retorno = false;
									erros.push( { obj:campo, erro:erro } );
								}
								
							break;
							
							case 'cpf' :
								cpfPadrao = /^\d+$/;
								if (!cpfPadrao.test(campo.value) || campo.value.length < 11) {
									retorno = false;
									erros.push( { obj:campo, erro:erro } );
								}
								
							break;
							
							case 'cpfCnpj' :
								val = _getCpfCnpj();
								num = /^\d+$/;
								if (val == "cnpj") {
									if (!num.test(campo.value) || campo.value.length != 14) {
										retorno = false;
										erros.push( { obj:campo, erro:erro } );
									}
								} else if (val == "cpf") {
									if (!num.test(campo.value) || campo.value.length != 11) {
										retorno = false;
										erros.push( { obj:campo, erro:erro } );
									}
								}
								
							break;
							
							case 'codigonet' :
								codigoPadrao = /^\d+$/;
								if (!codigoPadrao.test(campo.value) || campo.value.length < 12) {
									retorno = false;
									erros.push( { obj:campo, erro:erro } );
								}
							break;
						}
					}
				}
			}
		} catch(e) {}

		if(retorno) {
			if (boxErro != null) boxErro.className = boxErro.className.replace(" on"," off");
			//alert(" :>>> "+callback);
			if(callback!=undefined){
				callback();
				return false;
			}else
				return true;
		} else {
			var listagem = "";
			for (var x=0;x<erros.length;x++) {
				var campoErrado = erros[x];
				campoErrado.obj.parentNode.className += " "+inputErro;
				campoErrado.obj.focus();
				listagem += "<li>" + campoErrado.erro + "</li>"
			}
			if(boxErro.className.indexOf(" off")!=-1)
				boxErro.className = boxErro.className.replace(" off", " on");
			else
				boxErro.className += " on";
				
			listaErro.innerHTML = listagem;
			return false;
		}
		return retorno;
	}

	return {
		validar: _validar
	}
	
}();

/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;


