//*****************************************************************************

//* Executar arquivos FLASHES sem solicitar para ativar Control-X

//*****************************************************************************

	function ExecSwf(url,width,height,salign){

		if (AC_FL_RunContent == 0) {

			alert("This page requires AC_RunActiveContent.js. In Flash, run \'Apply Active Content Update\' in the Commands menu to copy AC_RunActiveContent.js to the HTML output folder.");

		} else {

			AC_FL_RunContent(

				"codebase",						"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0",

				"width",					width,

				"height",					height,

				"src",						url,

				"quality",					"high",			

				"pluginspage",				"http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash",

				"loop",						"false",

				"scale",					"noscale",			

				"wmode",					"transparent",			

				"allowScriptAccess",		"sameDomain",

				"movie",					url,

				"salign",					salign); //end AC code

		}

	}



//*****************************************************************************

//* Abrir PopUps de imagens

//*****************************************************************************



	function PopupImagens(imgs, width, height) {

		imagens = new String(imgs);

		arrImagens = imagens.split(";");

		win1 = window.open("","Imagens","menubar=no,width=" + width + ",height=" + height + ",toolbar=no");

		for (i=0; i<arrImagens.length; i++) {

			win1.document.write("<center><br><img src='" + arrImagens[i] +"' border=1>" + "<br></center>");	

		}

	}



//*****************************************************************************

//* Executar as páginas internas sem navegar novamente

//*****************************************************************************

	function CarregarPagina(valor){

		url="http://www.hitechbrasil.com.br/sites/callisto/paginas/"+valor+".phtml";

		ajax(url);

	}



	function ajax(url){

		req = null;

		if (window.XMLHttpRequest) {

			req = new XMLHttpRequest();

			req.onreadystatechange = processReqChange;

			req.open("GET",url,true);

			req.send(null);

		} else if (window.ActiveXObject) {

			req = new ActiveXObject("Microsoft.XMLHTTP");

			if (req) { 

				req.onreadystatechange = processReqChange;

				req.open("GET",url,true);

				req.send();

			}

		}

	} 



	function processReqChange(){

		if (req.readyState == 4) {

			if (req.status ==200) { 

				document.getElementById('pagina').innerHTML = req.responseText;

			} else {

				alert("Houve um problema ao obter os dados. Tente novamente.");

			}

		}

	} 
	
//*****************************************************************************

//* AJAX em um componente específico do site

//*****************************************************************************

	function ajaxInit() {
	var req;
	try {
	 	req = new ActiveXObject("Microsoft.XMLHTTP");
		} catch(e) {
	 		try {
	  			req = new ActiveXObject("Msxml2.XMLHTTP");
	 		} catch(ex) {
	  			try {
	   				req = new XMLHttpRequest();
	  			} catch(exc) {
	   				alert("Esse browser não tem recursos para uso do Ajax");
	   				req = null;
	  			}
	 		}
		}
		return req;
	}
	
	function CarregarValorComponente(valor, componente){
		p_target="paginas/"+valor;
		var ajaxUC = ajaxInit(); //inicia a variavel ajax para uso e UserCount
		if (ajaxUC==null){
			var o_componente = document.getElementById(componente);
			o_componente.innerHTML = "<span style='background-color:#FF0000;font-size:14px;color:#FFFFFF;font-weight:bold;padding:0px;'>&nbsp;Este browser não suporta o uso de AJAX.&nbsp;</span>";
		}else{
		var o_componente = document.getElementById(componente);
		o_componente.innerHTML = "<span style='background-color:#FF0000;font-size:14px;color:#FFFFFF;font-weight:bold;padding:0px;'>&nbsp;&nbsp;&nbsp;Aguarde...&nbsp;&nbsp;&nbsp;</span>";
		ajaxUC.open("GET", p_target, true);
		//alert("entrou aqui");
		ajaxUC.onreadystatechange = function() { //funcao executada ao trocar de stado
			o_componente.innerHTML = "Leu. readyState="+ajaxUC.readyState+", status="+ajaxUC.status;
			if((ajaxUC.readyState == 4)||(ajaxUC.status==200)) { //verifica se o estado atual é "concluido"
				o_componente.innerHTML = ajaxUC.responseText; //define o texto do span
			}
		}
		ajaxUC.send(null); //enviar dados para poder receber resposta		
		}
	}

/*

	function ajax_c(url, componente){

		req = null;
		var o_componente=document.getElementById(componente);
		o_componente.innerHTML = "AGUARDE...";

		if (window.XMLHttpRequest) {

			req = new XMLHttpRequest();

			//req.onreadystatechange = processReqChange_c;

			
			req.open("GET",url,true);			
			req.onreadystatechange = function() { //funcao executada ao trocar de stado
				if(req.readyState == 4) { //verifica se o estado atual é "concluido"
					o_componente.innerHTML = req.responseText; //define o texto do span
				}
			}
			req.send(null);

		} else if (window.ActiveXObject) {

			req = new ActiveXObject("Microsoft.XMLHTTP");

			if (req) { 

//				req.onreadystatechange = processReqChange_c;
			req.onreadystatechange = function() { //funcao executada ao trocar de stado
				if(req.readyState == 4) { //verifica se o estado atual é "concluido"
					o_componente.innerHTML = req.responseText; //define o texto do span
				}
			}

				req.open("GET",url,true);

				req.send();

			}

		}

	} 



	function processReqChange_c(componente){

		if (req.readyState == 4) {

			if (req.status ==200) { 

				document.getElementById(componente).innerHTML = req.responseText;

			} else {

				alert("Houve um problema ao obter os dados. Tente novamente.");

			}

		}

	} 	
*/
	
