
function pop_up_center(local, w, h, scrol)
{
	largura = screen.width;
	altura 	= screen.height;
	XX 		= (largura-w)/2;
	YY		= (altura-h)/2;
	janela = window.open(local,'POP_UP','width='+w+',height='+h+',left='+XX+',top='+YY+',scrollbars='+scrol+',status=no,resizable=yes, toolbar=no,directories=no,menubar=no');
	janela.focus();
}

function pop_up_center_flex(local, w, h, opt)
{
	largura = screen.width;
	altura 	= screen.height;
	XX 		= (largura-w)/2;
	YY		= (altura-h)/2;
	janela = window.open(local,'POP_UP_FLEX','width='+w+',height='+h+',left='+XX+',top='+YY+','+opt);
	janela.focus();
}


function cadnews_seta_cadastro()
{

	nome	=	document.home_cat_produtos_form.news_nome.value;
	email	=	document.home_cat_produtos_form.news_email.value;

	xmlhttp	=	mount_XMLHttp();
	url	=	"../ajax/ajax.cadastro.news.asp?a=1&nome="+nome+'&email='+email;
	xmlhttp.open("GET", url,true);

	xmlhttp.onreadystatechange=function() {
		if(xmlhttp.readyState==4){
			retorno	=	xmlhttp.responseText;
			document.getElementById('home_cat_produtos_form').style.display		= 'none';
			document.getElementById('cadastro_msg').style.display	= 'block';
			document.getElementById('cadastro_msg').innerHTML		= retorno;
			self.setTimeout('cadnews_show_cad()', 4000) ;
		}
	}
	xmlhttp.send(null);
}


function cadnews_show_cad()
{
	window.clearTimeout();
	document.getElementById('home_cat_produtos_form').style.display		= 'block';
	document.getElementById('cadastro_msg').style.display	= 'none';
	document.home_cat_produtos_form.reset();
}


function mount_XMLHttp()
{
	try{
		xmlhttp = new XMLHttpRequest();
	}catch(ee){
		try{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(E){
				xmlhttp = false;
			}
		}
	}
	return xmlhttp;
}


function _go(selObj)
{
	valor = selObj.options[selObj.selectedIndex].value;
	if (valor != "#")
		self.location = valor;
}

function addToFavorites(){
	if(document.all){
		window.external.AddFavorite(window.location,document.title);
	}else{
		window.sidebar.addPanel(document.title,location.href,"");
	}
}

function exibe_resp(obj)
{
	if (document.getElementById)
	{
		var style2 = document.getElementById(obj).style;
		style2.display = style2.display? "":"block";
	}
	else if (document.all)
	{
		var style2 = document.all[obj].style;
		style2.display = style2.display? "":"block";
	}
	else if (document.layers)
	{
		var style2 = document.layers[obj].style;
		style2.display = style2.display? "":"block";
	}
}

function ChangeFontSize(acao) {
	var ObjTexto		= (document.getElementById) ? document.getElementById('content') : document.all('content');
	
	var FonteTamAtual	= parseInt(document.form_busca.diversos.value);

	switch(acao){
		case '+':
			FonteTamNovo = FonteTamAtual+2;
			break;
		case '-':
			FonteTamNovo = FonteTamAtual-2;
			break;
		case 'r':
			FonteTamNovo = 10;
			break;
	}
	
	document.form_busca.diversos.value	= FonteTamNovo;
	ObjTexto.style.fontSize				= FonteTamNovo+"px";
}

function hideDefault(input){
  if(typeof(input.defaultValue)=="undefined")
    input.defaultValue = input.value;
  if(input.value == input.defaultValue)
    input.value = "";
  return true;
}
function showDefault(input){
  if(input.value == "" && typeof(input.defaultValue)!="undefined")
    input.value = input.defaultValue;
  return true;
}
// ex: <INPUT onFocus="return hideDefault(this);" onBlur="return showDefault(this);" value="Type your full name here" />

// Valida o form de pesquisa (deve ter no mínimo 3 características)
function canSearch(id){
	var campo = document.getElementById(id);

	if (campo.value.length < 3) {
		alert('Digite no mínimo 3 caracteres.');
		return false;
	}
	return true;
}