// FLASH 7//
function flash(nome, id, com, alt, query){
	document.write(
		'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+com+'" height="'+alt+'" id="'+id+'" align="middle">' +
		'<param name="allowScriptAccess" value="sameDomain" />' +
		'<param name="movie" value="'+nome+'" />' +
		'<param name="FlashVars" value="'+query+'" />'+
		'<param name="quality" value="best" />' +
		'<param name="bgcolor" value="#ffffff" />' +
		'<param name="wmode" value="transparent" />' +
		'<PARAM NAME=scale VALUE=noscale>'+
		'<embed src="'+nome+'" quality="best" bgcolor="#ffffff" wmode="transparent" FlashVars="'+query+'" width="'+com+'" height="'+alt+'" name="'+id+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />' +
		'</object>'
	);
}

function popUp(strURL,strType,strHeight,strWidth) {
		var strOptions="";
		if (strType=="console") strOptions="resizable,height="+strHeight+",width="+strWidth;
		if (strType=="fixed") strOptions="status,height="+strHeight+",width="+strWidth;
		if (strType=="elastic") strOptions="toolbar,menubar,scrollbars,resizable,location,height="+strHeight+",width="+strWidth;
		window.open(strURL, 'newWin', strOptions);
}

function showHide(id)
{
	$('dd#conteudo_' + id).toggleClass('blocked');
	$('dd#btn_fechar_' + id).toggleClass('blocked');
	$('dd#btn_lermais_' + id).toggleClass('blocked');
	
	return false;
}

/////////////////////////
////  Verifica Form  ////
/////////////////////////
var formularioID = 'formContato';

function verificaVazio(campo, nome)
{
	if (document.forms[formularioID].elements[campo] && document.forms[formularioID].elements[campo].value == "")
	{
		alert("Por favor preencha o campo " + nome + "!");
		return false;
	}
	return true;
}

function verificaNumero(campo, nome)
{
	if (document.forms[formularioID].elements[campo] && document.forms[formularioID].elements[campo].value == "")
		return true;

	expr = /[^\d]/;
	if (document.forms[formularioID].elements[campo] && document.forms[formularioID].elements[campo].value.match(expr))
	{
		alert("Por favor preencha somente com numeros o campo " + nome + "!");
		return false;
	}

	return true;
}

function verificaNumeroVazio(campo, nome)
{
	if (!verificaVazio(campo, nome))
		return false;
	
	if (!verificaNumero(campo, nome))
		return false;
	
	return true;
}

function verificaEmail(campo, nome)
{
	valido = /^.*\@.*\..*$/i;
	if (document.forms[formularioID].elements[campo] && document.forms[formularioID].elements[campo].value.search(valido) == -1)
	{
		alert("Prencha correctamente o campo " + nome + "!");
		return false;
	}
	
	return true;
}

function verificaForm(formulario)
{
	// nomeContato, departamento, tel_ddd, tel, email
	if (!verificaVazio('nome', 'nome')) return false;
	if (!verificaEmail('email', 'email')) return false;
	if (!verificaVazio('fone', 'telefone')) return false;
	if (!verificaVazio('mensagem', 'mensagem')) return false;
	
	return true;
}