
if (typeof ASL == "undefined") {
    var ASL = {};
}
ASL.namespace = function() {
	var object = null, arrObjects = [];
    for (var i=0; i<arguments.length; i++) {
		object = ASL;
		
        for (var objI = arguments[i].split("."), j=(objI[0]=="ASL")? 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
*/
ASL.$ = 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
*/
ASL.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;
	}
}();

ASL.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
*/
ASL.event = function() {
	/*
		.version: 1.0

		.date:
		26/09/2007
		
		.usage:
		ASL.event.add(window, 'load', _onload);
		or
		ASL.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 = ASL.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;
		}
	};		

}();

ASL.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
**/
ASL.namespace("Browser");
ASL.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
**/
ASL.jsPathDefault = "../js";
ASL.setJsPath = function(path){
	if(!typeof path === "string")return;
	ASL.jsPathDefault = (path.lastIndexOf("/")>=path.length)? path.substring(0, path.length-1) : path;
}
/**
Version
**/
ASL.controlPackage = function(){
	/*
		.version: 1.0
		
		.date:
		20/09/2007
		
		.usage:
		ASL.controlPackage.include("../js/arquivo.js");
		ASL.controlPackage.loadScript("../js/arquivo.js", callBack);
		
		.required
		ASL.util.httpRequest
		ASL.util.delegate
	*/
	ASL.namespace("ASL.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 = ASL.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(!ASL.util.delegate){
				_log("Erro: O uso do m?todo ASL.controlPackage.loadScript exige o pacote ASL.util.delegate j? carregado");
				return null;
			}
			if(!ASL.util.httpRequest){
				_log("Erro: O uso do m?todo ASL.controlPackage.loadScript exige o pacote ASL.util.httpRequest j? carregado");
				return null;
			}
			
			var callbackLoad = {
				onComplete: _onLoadScript,
				arguments: {
					callback: callBack,
					path: path
				}
			}
			ASL.util.httpRequest.get(path, "", callbackLoad, false);			
		}
	}
}();

ASL.namespace("ASL.util");
ASL.util.delegate = function(){
	/*
		.version: 1.0
		
		.date:
		20/09/2007
		
		.usage:
		obj1.function = ASL.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);
			}			
		}
	}	
}();

ASL.namespace("ASL.util");
ASL.util.css = function(){
	/*
		.version: 1.0
		
		.date:
		20/09/2007
		
		.usage:
		obj1.function = ASL.util.Delegate(obj2, "method");
		
		.required
		ASL.util.html
		
	*/
	var _isIe 		= ASL.Browser.version.ie;
	var _isOpera 	= ASL.Browser.version.opera;
	
	var _getStyle	= function(element, style) {
		element = (typeof element === "object")? element: ASL.$(element);
		var value = undefined;
		
		style = (style == 'float' || style == 'cssFloat') ? (_isIe? 'styleFloat' : 'cssFloat') : ASL.util.html.camelize(style);
		if (!value && !_isIe) {
			var css = document.defaultView.getComputedStyle(element, null);
			value = css ? css[style] : null;
		}		
		
		if(element){
			if(element.currentStyle){
				if (!value && element.currentStyle && _isIe) value = element.currentStyle[style];
			}
		}
		
		if (style == 'opacity' && _isIe) {
			if(value = (ASL.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') && (ASL.util.css.getStyle('display') != 'none'))
			return element['offset'+ASL.util.html.capitalize(style)] + 'px';
		  
		  return null;
		}
		
		return value == 'auto' ? null : value;		  
	}
	
	var _setStyle = function(element, styles, camelized) {
		element = (typeof element === "object")? element: ASL.$(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 : ASL.util.html.camelize(property))] = styles[property];
	
		return element;
	}
	
	var _setOpacity = function(element, value) {
		
		
		element = (typeof element === "object")? element: ASL.$(element);	
		
		if(!_isIe){
			element.style.opacity = (value == 1 || value === '') ? '' :  (value < 0.00001) ? 0 : value;	
			//alert(" OPACITY ::: "+element.style.opacity);
		}else {
			var element1 = document.getElementById("divContent");			
			if(element1){
				if(element1.style){	
					var filter = _getStyle(element1, 'filter') || "", style = element1.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: ASL.$(element);
				
		var display = ASL.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 = ASL.$(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 = ASL.$(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 = ASL.$(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(!ASL.util.html)_log("Erro: O uso desse m?todo (ASL.util.css.getStyle) exige o pacote ASL.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(!ASL.util.html)_log("Erro: O uso desse m?todo (ASL.util.css.setStyle) exige o pacote ASL.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);
		}
	}
}();



ASL.namespace("ASL.util");
ASL.util.html = function(){
	/*
		.version: 1.0
		
		.date:
		20/09/2007
		
		.usage:
		obj1.function = ASL.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();
		}
	}
}();

ASL.namespace("ASL.util");
ASL.util.httpRequest = function(){
	/*
		.version: 1.0
		
		.date:
		20/09/2007
		
		.usage:
		ASL.util.httpRequest.get("url", {params}, callback=function(){}, waitResponse);
		or
		ASL.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(!ASL.util.delegate && handler)_log("Erro: O uso desse m?todo (get || post) exige o pacote ASL.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 = ASL.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 = ASL.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
ASL.namespace("ASL.util");
ASL.namespace("ASL.common");
ASL.util.popIn = function(){
	/*
		.version: 1.0
		
		.date:
		20/09/2007
		
		.usage:
		<a href="teste.htm" onclick="ASL.util.popIn.showContent({src: "", method: "POST || GET"});return false;">teste</a>	
		
		.requeried
		ASL.util.httpRequest
		ASL.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	 	= ASL.util.css;
		
		var TB_PDLEFT	= Number(Css.getStyle(ASL.$(_elWindow), "paddingLeft").replace("px", ""));
		var TB_PDRIGHT	= Number(Css.getStyle(ASL.$(_elWindow), "paddingRight").replace("px", ""));
		var TB_WIDTH 	= Css.getWidth(ASL.$(_elImage)? ASL.$(_elImage): ASL.$(_elWindow)) + TB_PDLEFT + TB_PDRIGHT;
		var TB_HEIGHT 	= Css.getHeight(ASL.$(_elWindow));	
		
		if(_animate.window && ASL.common.animation){
			var Tween 	= ASL.common.animation.Tween;
			
			var fl = parseInt(Css.getStyle(ASL.$(_elWindow), "padding-left").replace("px" ,""), 10) || 0;
			var fr = parseInt(Css.getStyle(ASL.$(_elWindow), "padding-right").replace("px" ,""), 10) || 0;
			var ft = parseInt(Css.getStyle(ASL.$(_elWindow), "padding-top").replace("px" ,""), 10) || 0;
			var fb = parseInt(Css.getStyle(ASL.$(_elWindow), "padding-bottom").replace("px" ,""), 10) || 0;
			
			var l = parseInt(((_page().w - TB_WIDTH) / 2),10);
			
			// Se a janela do popin for maior do que a altura interna do navegador então o topo inicia no pixel inicial da área interna do navegador.
			if((_page().h - TB_HEIGHT) < 0) {
				var t = parseInt(_scroll().yScroll ,10);
			}
			else {
				var t = parseInt(_scroll().yScroll + ((_page().h - TB_HEIGHT) / 2),10);
			}
			
			var w = TB_WIDTH  - (fl+fr);
			var h = TB_HEIGHT - (ft+fb);
			
			ASL.$(_elWindow).style.overflow = "hidden";
			
			ASL.util.css.setStyle((ASL.$(_elImage)? ASL.$(_elImage): ASL.$(_elContent)), "visibility: hidden");
			if(ASL.$(_elCaption))ASL.util.css.setStyle(ASL.$(_elCaption), "visibility: hidden");
			
			var anim = new Tween([0, 0, _page().w/2, _scroll().yScroll + _page().h/2], [w, h, l, t], 1000, {element: ASL.$(_elWindow)});
			//anim.easingEquation = ASL.common.animation.elasticEquation; 
			anim.onAnimation 	= _adjustSize;
			anim.onEndAnimation = _endAdjustSize;
			anim.init();			
		}else{
			ASL.$(_elWindow).style.left = parseInt(((_page().w - TB_WIDTH) / 2),10) + 'px';
			
			// Se a janela do popin for maior do que a altura interna do navegador então o topo inicia no pixel inicial da área interna do navegador.
			if((_page().h - TB_HEIGHT) < 0) {
				ASL.$(_elWindow).style.top  = parseInt(_scroll().yScroll,10) + 'px';
			}
			else {
				ASL.$(_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 && ASL.common.animation){
			var anim = new ASL.common.animation.Tween(0, 100, 1000, {element: (ASL.$(_elImage)? ASL.$(_elImage): ASL.$(_elContent))});
			anim.onAnimation 	= anim.onEndAnimation = _adjustAlpha;
			anim.init();
		
			/* -- */
			if(ASL.$(_elCaption)){
				var anim2 = new ASL.common.animation.Tween(0, 100, 1000, {element: ASL.$(_elCaption)});
				anim2.onAnimation 	= anim2.onEndAnimation = _adjustAlpha;
				anim2.init();
				//ASL.util.css.setStyle(ASL.$(_elCaption), "visibility: visible");			
			}
		}else{
			ASL.$(_elWindow).style.overflow = "";
			ASL.util.css.setStyle(ASL.$(_elContent), "visibility: visible");
			if(ASL.$(_elCaption))ASL.util.css.setStyle(ASL.$(_elCaption), "visibility: visible");
		}
		
		
	}

	var _adjustAlpha = function(values, args){	
		if(!args.element)return;
		ASL.util.css.setStyle(args.element, "opacity: "+(Math.round(values)/100));
		args.element.style.visibility = "";
	}
	
	var _page = function() {
		var _body = ASL.$("body");
		var _html = ASL.$("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 = ASL.$("body");
		var _html = ASL.$("html");
		
		ASL.$(_elOverlay).onclick = "";
		ASL.$(_elWindow).onclick = "";
		ASL.$(_elClose).onclick = "";
		
		ASL.$(_elWindow) 		&& 	_body.removeChild(ASL.$(_elWindow));
		ASL.$(_elLoad)	 	&& 	_body.removeChild(ASL.$(_elLoad));
		ASL.$(_elOculta) 	&& 	_body.removeChild(ASL.$(_elOculta));
		ASL.$(_elOverlay) 	&& 	_body.removeChild(ASL.$(_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;

		ASL.$(_elWindow).appendChild(ASL.create("div", {id: _elCtClose}));
		//if(arguments.title!=undefined)ASL.$(_elCtClose).appendChild(ASL.create("h3", {id: _elTitle, innerHTML: arguments.title}));
		if(arguments.title!=undefined)ASL.$(_elCtClose).appendChild(ASL.create("div", {id: _elCtCredito, innerHTML: arguments.title}));
		ASL.$(_elCtClose).appendChild(ASL.create("a", {href: "#fechar", id: _elClose, innerHTML: "", title: "Fechar"}));
		ASL.$(_elWindow).appendChild(ASL.create("div", {id: _elContent, innerHTML: args.responseText}));
				
		ASL.$(_elClose).onclick = _hide;
		ASL.$(_elOverlay).onclick = _hide;
				
		ASL.$("body").removeChild(ASL.$(_elLoad));
		
		setTimeout(_position, 50);
	}
	
	var _onLoadImage = function(){
		var Css	 	= ASL.util.css;
	
		this.onload = null;
		
		var x = _page().w - 150;
		var y = _page().h - 150;
		
		ASL.$(_elWindow).appendChild(ASL.create("div", {id: _elCtClose}));
		ASL.$(_elCtClose).appendChild(ASL.create("a", {href: "#fechar", id: _elClose, innerHTML: "x fechar"}));
		ASL.$(_elCtClose).appendChild(ASL.create("div", {id: _elCtCredito, innerHTML: this.alt}));
		ASL.$(_elWindow).appendChild(ASL.create("div", {id: _elContent, align:"center"}));
		ASL.$(_elWindow).appendChild(ASL.create("div", {id: _elCaption, innerHTML: this.caption}));
		ASL.$(_elContent).appendChild(ASL.create("img", {src: this.src, id: _elImage, alt: this.caption}));
		
		var imageWidth = this.width>0? this.width : Css.getWidth(ASL.$(_elImage));
		var imageHeight = this.height>0? this.height: Css.getHeight(ASL.$(_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); 
		}
		
		ASL.$(_elImage).width = imageWidth;
		ASL.$(_elImage).height = imageHeight;

				
		ASL.$(_elClose).onclick = _hide;
		ASL.$(_elOverlay).onclick = _hide;
		
		ASL.$("body").removeChild(ASL.$(_elLoad));
		
		setTimeout(_position, 50);
	}
	
	var _show = function(args, type) {		
		
		var _body 		= ASL.$("body");
		var _html 		= ASL.$("html");
		//var _classElWindow = args.class || "";
		
		var Css	  = ASL.util.css;
		
		if (typeof ASL.$("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 (ASL.$(_elOculta) === null)_body.appendChild(ASL.util.css.setStyle(ASL.create("iframe", {id: _elOculta}), "opacity:0;position:absolute;top:0;left:0;width:100%;"));
		
		}
			
		_body.appendChild(ASL.util.css.setStyle(ASL.create("div", {id: _elOverlay}), "z-index:"+(_zindex+1)+"; visibility:"+(_animate.shadow? "hidden": "visible")));
		//_body.appendChild(ASL.util.css.setStyle(ASL.create("div", {id: _elWindow, className: _classElWindow}), "z-index:"+(_zindex+2)));									 
		_body.appendChild(ASL.util.css.setStyle(ASL.create("div", {id: _elWindow}), "z-index:"+(_zindex+2)));									 
		_body.appendChild(ASL.util.css.setStyle(ASL.create("div", {id: _elLoad}), "z-index:"+(_zindex+3)));
		
		var h = (_body.scrollHeight > _body.offsetHeight) ? _body.scrollHeight :_body.offsetHeight + 'px';
		if(ASL.$(_elOculta))ASL.$(_elOculta).style.height = h;
		if(ASL.$(_elOculta)) {
			// Mozilla
			if(ASL.$(_elOculta).style.opacity != null) {
				ASL.$(_elOculta).style.opacity = 0;
			}
			// IE
			else if (ASL.$(_elOculta).style.filter != null) {
				ASL.$(_elOculta).style.filter = 'Alpha(opacity=0)';
			}
		}
		ASL.$(_elOverlay).style.height = h;
		if(ASL.$(_elOverlay)) {
			// Mozilla
			if(ASL.$(_elOverlay).style.opacity != null) {
				ASL.$(_elOverlay).style.opacity = 0.5;
			}
			// IE
			else if (ASL.$(_elOverlay).style.filter != null) {
				ASL.$(_elOverlay).style.filter = 'Alpha(opacity=50)';
			}
		}		
		ASL.$(_elWindow).style.position = "absolute";
		ASL.$(_elWindow).style.minWidth = "10px";
		ASL.$(_elWindow).style.minHeight = "10px";
		ASL.$(_elLoad).style.visible = "visible";
		
		//--Centralizando o load
		var loadW 	= Css.getWidth(ASL.$(_elLoad));
		var loadH 	= Css.getHeight(ASL.$(_elLoad));	
		var fl = parseInt(Css.getStyle(ASL.$(_elLoad), "padding-left").replace("px" ,""), 10) || 0;
		var fr = parseInt(Css.getStyle(ASL.$(_elLoad), "padding-right").replace("px" ,""), 10) || 0;
		var ft = parseInt(Css.getStyle(ASL.$(_elLoad), "padding-top").replace("px" ,""), 10) || 0;
		var fb = parseInt(Css.getStyle(ASL.$(_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);
		
		ASL.$(_elLoad).style.left = parseInt(((_page().w - loadW) / 2),10) + 'px';
		ASL.$(_elLoad).style.top  = parseInt(_scroll().yScroll + ((_page().h - loadH) / 2),10) + 'px';
		
		if(_animate.shadow && ASL.common.animation){
			var anim = new ASL.common.animation.Tween(0, 80, 1000, {element: ASL.$(_elOverlay)});
			anim.onAnimation = anim.onEndAnimation = _adjustAlpha;
			anim.init();
		}
		if(type=="content"){
			//Carregando dados;
			if(args.method && args.method.toLowerCase() == "post")
				ASL.util.httpRequest.post(args.src, args.params || "", {onComplete: _onLoadContent, arguments: args}, true);
			else
				ASL.util.httpRequest.get(args.src, args.params || "", {onComplete: _onLoadContent, arguments: args}, true);
				
		}else if(type=="image"){
			//Carregando Imagem
			var imgPreloader = ASL.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
ASL.namespace("ASL.common");
ASL.common.animation = function(){
	/*
		.version: 1.0
		
		.date:
		20/09/2007
		
		.usage:
		var anim = new ASL.common.animation.Tween(inivalue, endvalue, duration);
		anim.setAnimation(ASL.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
	}
}();


ASL.namespace("ASL.common");
ASL.common.thumbImage = function() {
	/*
		.version: 1.0
		
		.date:
		20/09/2007
		
		.usage:
		ASL.common.thumbImage.init()	
		
		.requeried
		ASL.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 cap = "";
		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;
		
		ASL.util.popIn.showImage({src:img, caption: cap, alt:credito}); 

		return false;
	}
	
	return {
		init: _initialize
	}
}();


ASL.namespace("ASL.common");
ASL.common.flash = function() {
	/*
		.version: 1.0
		
		.date:
		11/11/2007
		
		.usage:
		ASL.common.flash({
			width:100,
			height:100,
			swf:'flash.swf',
			div:'flash'
			variables: {galeria: "others.xml"}
			[
			 required: "9.0.45",
			 onFlashFail: funcaoDeErro
			]
		});
		
		.required:		
		ASL.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;
			}				
		}
	};
}();

/**
 * 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;


// Obter imagem via Ajax

function AjaxGetImage(urlImage,nmImage) {
	
	return GetImageDirect(urlImage,nmImage);
/*
	var urlImageAtual = document.getElementById("imgSelecionada").src;
	var nomeBase = document.getElementById("nomeBase").value; 
	var nmImageAtual = document.getElementById("nmImageAtual").value;

	SetEventsAndBorderColor(nmImageAtual, nmImage);

	// Microsoft.
	try{
		objAjax = new ActiveXObject("Microsoft.XMLHTTP");
	} 

	catch(e){
		// Mozilla.
		try{
			objAjax = new ActiveXObject("Msxml2.XMLHTTP");
		}

		catch(ex){
			try{
				objAjax = new XMLHttpRequest();
			}

			catch(exc){
				objAjax = null;
			}
		}
	}

	if(objAjax){		
		objAjax.onreadystatechange = function(){
			if(objAjax.readyState == 1){		
				document.getElementById("imgSelecionada").src="";
				document.getElementById("divLoad").style.display="block";
			}
			
			if(objAjax.readyState == 4 ){
				if (objAjax.status == 200) { 
					document.getElementById("imgSelecionada").src=urlImage;
					document.getElementById("nmImageAtual").value=nmImage;
				} else {
					document.getElementById("imgSelecionada").src=urlImageAtual;
					document.getElementById("nmImageAtual").value=nmImageAtual;
					SetEventsAndBorderColor(nmImage, nmImageAtual);
				}
				window.setTimeout("document.getElementById('divLoad').style.display = 'none';", 500);				
			}
		}
		objAjax.open("GET", urlImage, true);
		objAjax.setRequestHeader("Content-Type", "image/jpeg");	
		objAjax.send(urlImage);
	}
	scroll(0,0);
*/
}

function SetEventsAndBorderColor(imgOld, imgNew) {
	document.getElementById("table" + imgNew).onmouseover=function(){};
	document.getElementById("table" + imgNew).onmouseout=function(){};
	document.getElementById("table" + imgNew).style.borderColor="#CC6600";
	var count = 1
	while(document.getElementById("table" + count) != null){
		if((count)!=imgNew){
			document.getElementById("table" + count).style.borderColor='#CCCCCC';
			document.getElementById("table" + count).onmouseover=function(){this.style.borderColor='#000000'};
			document.getElementById("table" + count).onmouseout=function(){this.style.borderColor='#CCCCCC'};
		}
		count = count + 1
	}
}

var inExec;

function GetImageDirect(urlImage,nmImage) {
	
	var urlImageAtual = document.getElementById("imgSelecionada").src; 
	var nmImageAtual = document.getElementById("nmImageAtual").value;

	SetEventsAndBorderColor(nmImageAtual, nmImage);	
	
	if (inExec=='true'){
			if(timerFadeIn) {
				clearInterval(timerFadeIn);
			}
			document.getElementById("imgSelecionada").src=urlImage;
			return true;
	}
	
	inExec = 'true';	
	
	document.getElementById("divLoad").style.display="block";
	document.getElementById("imgSelecionada").src="../../imagens/dot_transp.gif";	

	try{
		var tmp_image = new Image();
		tmp_image.onload = function() {
			document.getElementById("imgSelecionada").src=urlImage;		
			document.getElementById("nmImageAtual").value=nmImage;
			setAlpha(document.getElementById("imgSelecionada"), 0);
			window.setTimeout("document.getElementById('divLoad').style.display = 'none';fadeIn('imgSelecionada', 1);", 1000);
			return true;			
		}
		tmp_image.src = urlImage;
	}catch(e){
		setAlpha(document.getElementById("imgSelecionada"), 1);
		document.getElementById("imgSelecionada").src=urlImageAtual;	
		document.getElementById("nmImageAtual").value=nmImageAtual;
		SetEventsAndBorderColor(nmImage, nmImageAtual);
		document.getElementById('divLoad').style.display = "none";
		inExec = 'false';
		return false;
	}
}

function fadeOut(id, time) {
	target = document.getElementById(id);
	alpha = 100;
	timer = (time*1000)/50;
	var i = setInterval(
			function() {
				if (alpha <= 0)
					clearInterval(i);
				setAlpha(target, alpha);
				alpha -= 2;
			}, timer);
}

var timerFadeIn;

function fadeIn(id, time) {
	target = document.getElementById(id);
	alpha = 0;
	timer = (time*1000)/50;
	var timerFadeIn = setInterval(
			function() {
				if (alpha >= 100) {
					inExec = 'false';
					clearInterval(timerFadeIn);
				}
				setAlpha(target, alpha);
				alpha += 2;
			}, timer);
}
 
function setAlpha(target, alpha) {
	target.style.filter = "alpha(opacity="+ alpha +")";
	target.style.opacity = alpha/100;
}
