/* UTILIZADO PARA EXIBIR O LOADING DAS REQUISIÇÕES AJAX NOS SITES E PORTAIS */
//var globais
if ( typeof _SiteConfig == "undefined" ) {
	_SiteConfig = {'_nSit':'3', '_nCss':'1'};
}

if ( _SiteConfig._nSit == "imovelpro") {
	_SiteConfig._nSit = "loading_ip";
} else if ( _SiteConfig._nSit == "pn" ) {
	_SiteConfig._nSit = "loading_pn";
} else {
	_SiteConfig._nSit = "loading_st" + _SiteConfig._nSit;
}

ajxLoading  = function() { 
    var sMsg 	= new String();
	var bCentro = true; //Exibe o carregando no centro da página
	var nPos 	= 0; 
	var swf  	= new Flash("/geral/swf/" + _SiteConfig._nSit + ".swf", "", "250", "90" );

    if ( arguments.length > 0 ){
	    sMsg = arguments[0];
		if ( typeof arguments[1] != "undefined" && arguments[1] == false ){
			bCentro = false;
		}
		//Div base para o centro
		if ( typeof arguments[2] != "undefined" ){
			nPos = ( $( arguments[2] ).offsetTop + 75 );
		}		
	}
	if ( sMsg.length < 3 ){
		sMsg = 'CARREGANDO';
	}

    //Quando postar para o xmlhttprequest exibe o carregando
	DWREngine.setPreHook(function() {
      try {
			var IE = false;
			var div_carregando = $('div_ajx_carregando'); 
			if ( navigator.appVersion.indexOf("MSIE 6") != -1 || navigator.appVersion.indexOf("MSIE 5") != -1 ){
				IE = true;	
			}
			if (!div_carregando) {		  	  	  
				div_carregando = document.createElement('div');
				div_carregando.setAttribute('id', 'div_ajx_carregando');
				document.body.appendChild( div_carregando ); 
				// Verifica se é IE 6 ou inferior
				if ( IE ) { 
					var div_frame = document.createElement('div');
					div_frame.innerHTML = '<iframe id="div_iframe" src="/geral/html_transparente.htm" frameborder="0" scrolling="no" style="z-index:98;"></iframe>';
					document.body.appendChild( div_frame );
				}		
			}
			
			// Exibe o carregando no centro da tela
			if( bCentro ){
				//div_carregando.className = 'ajx_carregando_centro';
				if ( IE ) {   $('div_iframe').className = 'ajx_carregando_centro';   }
			} else {
				div_carregando.className 	  = '';
				div_carregando.style.top 	  = nPos + 'px';
				div_carregando.style.position = 'absolute';
				if ( IE ) {
					$('div_iframe').className 	   = '';
					$('div_iframe').style.top 	   = nPos + 'px';
					$('div_iframe').style.position = 'absolute';
				}
			}
			
			swf.addParameter( "wmode", "transparent" );
			swf.addVariable( "texto", sMsg ); 
			swf.addVariable( "css", _SiteConfig._nCss ); 
			swf.write( "div_ajx_carregando" );
			if ( IE ) { 
				if ( $('div_iframe').style.visibility == 'hidden' ){
					$('div_iframe').style.visibility = 'visible';
				}
			}
			if ( div_carregando.style.visibility == 'hidden' ){
				div_carregando.style.visibility = 'visible';
				if( !IE ) {
					div_carregando.style.display = 'block';
				}
			}
		} catch(e) { } 
	});

	//Quando ocorrer o retorno do xmlhttprequest oculta o carregando
	DWREngine.setPostHook(function() {
		try {
			if ( $('div_ajx_carregando') ) { 
				$('div_ajx_carregando').style.visibility = 'hidden';
				if (navigator.appVersion.indexOf("MSIE 6") == -1 && navigator.appVersion.indexOf("MSIE 5") == -1) {
					$('div_ajx_carregando').style.display = 'none';
				}
				//$('div_ajx_carregando').style.height    = '1px';
				$('div_ajx_carregando').innerHTML = "";
				if ( navigator.appVersion.indexOf("MSIE 6") != -1 || navigator.appVersion.indexOf("MSIE 5") != -1 ) { 
					$('div_iframe').style.visibility = 'hidden';
				}
			}
		} catch(e) { }
	});
}

/* ============================================================================= */
var bInclude = true;
function include_arquivo( filename, ext ) {
    if ( ext == 'css' ){
	    document.write( '<link href="' + filename + '" rel="stylesheet" type="text/css">');
	} else if ( ext == 'js' ){
		document.write( '<script type="text/javascript" src="' + filename + '"></script>');
	}
}
include_arquivo( '/geral/css/def_carregando.css' , 'css' );
include_arquivo( '/js/flashtag.js' , 'js' );