function mFocus(c,p){
	c.bgColor = p;
}

function news(faz){
	var nome  = document.all.nome.value;
	var email = document.all.email.value;
	
	//var nome  = document.getElementById('nome').value;
	//var email = document.getElementById('email').value;
	
	parametros = 'nome='+nome+'&email='+email+'&faz='+faz
	
	if(nome==''||email==''){
		alert('Atenção !!!\n\nNome e e-mail são campos necessários !');
	}else{
		adm_ajax('gravaNews.asp', 'GET', 'true', 'news', parametros);
	}
}

nereidFadeObjects = new Object();
nereidFadeTimers = new Object();
function nereidFade(object, destOp, destNp, rate, delta){
	if (navigator.appName == 'Netscape') {
		if (object != "[object HTMLImageElement]"){
			setTimeout("nereidFade("+object+","+destOp+","+destNp+","+rate+","+delta+")",0);
			return;
		}
		clearTimeout(nereidFadeTimers[object.sourceIndex]);
		direction = .1;
		if(eval(object.style.opacity) > eval(destNp)){
			direction = -.1;
		}
		object.style.opacity = eval(object.style.opacity) + direction;
		if (object.style.opacity != destNp){
			nereidFadeObjects[object.sourceIndex]=object;
			nereidFadeTimers[object.sourceIndex]=setTimeout("nereidFade(nereidFadeObjects["+object.sourceIndex+"],"+destOp+","+destNp+","+rate+","+delta+")",rate);
		}else{
		//	alert('deu');
			clearTimeout(nereidFadeTimers[object.sourceIndex]);
			return;
		}
	}else{
		if(!document.all)
			return
			if (object != "[object]"){
				setTimeout("nereidFade("+object+","+destOp+","+rate+","+delta+")",0);
				return;
			}
			clearTimeout(nereidFadeTimers[object.sourceIndex]);
			diff = destOp-object.filters.alpha.opacity;
			direction = 1;
			if (object.filters.alpha.opacity > destOp){
				direction = -1;
			}
			delta=Math.min(direction*diff,delta);
			object.filters.alpha.opacity+=direction*delta;
			if (object.filters.alpha.opacity != destOp){
				nereidFadeObjects[object.sourceIndex]=object;
				nereidFadeTimers[object.sourceIndex]=setTimeout("nereidFade(nereidFadeObjects["+object.sourceIndex+"],"+destOp+","+destNp+","+rate+","+delta+")",rate);
			}
		}
		if(document.images) {
			var offimg = new Array()
			offimg["cool"] = new Image(120,50)
			offimg["cool"].src = "[INSERT]"
			function imageOn(imgName) {
				if (document.images) {
				document.images[imgName].src = onimg[imgName].src
				}
			}
			function imageOff(imgName) {
				if (document.images) {
				document.images[imgName].src = offimg[imgName].src
			}
		}
		function setMsg(msg) {
			window.status = msg
			return true
		}
		function playIt() {
		}
	}
}
function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}
function writeCookie(name, value, time_exp){
	if(time_exp != "" ){
	   var exp = new Date();
	   var expira = exp.getTime() + (time_exp * 3600000);
	   exp.setTime(expira);
	   document.cookie = "" + name + "=" + value + "; expires=" + exp.toGMTString();			   
	}  
}
function readCookie(name){
  var cookieValue = "";
  var search = name + "=";
  if(document.cookie.length > 0){ 
    offset = document.cookie.indexOf(search);
    if (offset != -1){ 
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      cookieValue = unescape(document.cookie.substring(offset, end))
    }
  }
  return cookieValue;
}
function IniConf(){
	ArrumaImageHome();
}
function ArrumaImageHome(){
	var tW = 0;
	var tH = 0;
	var mW = 64;
	var mH = 48;
	for( ic = 1 ; ic <= 3 ; ic++ ){
		img = document.getElementById('img_index_eventos_'+ic);
		if( img!=null ){
			//alert(img);
			while( eval(img.width) > eval(mW) || eval(img.height) > eval(mH) ){
				img.width = img.width - 1;
			}
			img.style.display='';
		}
	}
	//Para Redimensionar:
	//if (window.resizeTo) self.resizeTo(800,573);
	
	//Para Centralizar:
	//window.moveTo(0,0)
}
function ArrumaImage(id,tW,tH,mW,mH){
	/*
	tImg = eval(document.all[id]);
	alert(tImg);
	for( ic=0 ; ic<tImg ; ic++ ){
	//	alert(document.all[id][ic].src)
	}
	while( eval(img.width) > eval(mW) || eval(img.height) > eval(mH) ){
		img.width = img.width - 1;
	}
	*/
}
function efetuar_busca_cep(){
	var cep = document.cadastro.cep.value.replace('-','');
	window.open('inc/busca_cep.asp?cep='+cep,'action');
}
function ver_perfil_null(){
	p_null = document.getElementById('layer_perfil_textos');
	if( p_null == null ){
		if( document.getElementById('layer_perfil_textos_sem') == null ){
			setTimeout("ver_perfil_null();",500);
		}
	}else{
		var pos_perfil_fim = String(findPos(document.getElementById('img_perfil_txt_ini')));//CAPTURA LOCALIZAÇÃO DA IMAGEM
		//alert(pos_perfil_fim);
		pos_perfil_fim = pos_perfil_fim.split(",");
		pos_perfil_fim_1 = pos_perfil_fim[1];
		

		//alert( pos_perfil_fim_1 + ' X ' + pos_ini_1 + ' X ' + pos_fim_1 );
		TamSubTotal_1 = eval(pos_fim_1-pos_ini_1);
		TamSubTotal_2 = eval(pos_perfil_fim_1-pos_ini_1);
		TamTotal      = eval(TamSubTotal_1-TamSubTotal_2);

		document.getElementById('layer_perfil_textos').style.height=eval((eval(TamTotal)-6));

		//alert('tamanho total:'+ TamTotal);
	}
}
function close_perfil(){
	document.getElementById('layer_ver_perfil').innerHTML='';
	document.getElementById('layer_ver_perfil').style.display='none';
	document.getElementById('site_principal').style.display='';
}
function adm_ajax(url, metodo, modo, tagRetorno, parametros){
	if (window.XMLHttpRequest){
		// code for MOZILLA
		xmlhttp=new XMLHttpRequest()
	}else if (window.ActiveXObject){
		// code for IE
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	url = url+'?'+parametros+'&rnd'+ Math.random() 
	if(metodo == "GET") {
		xmlhttp.open("GET", url, modo);
	} else {        
		xmlhttp.open("POST", url, modo);
		xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=iso-8859-1");
		xmlhttp.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
		xmlhttp.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");
		xmlhttp.setRequestHeader("Pragma", "no-cache");
	}    
	xmlhttp.onreadystatechange = function() {
		if(xmlhttp.readyState == 4) {
			retorno=xmlhttp.responseText
			document.getElementById(tagRetorno).innerHTML=retorno
		}
	}
	if(metodo == "GET") {
		xmlhttp.send(null);
	} else {        
		xmlhttp.send(parametros);
	}
}
