//FUNCOES PARA REPETIR NO SITE TODO
//valida formulario newsletter
function ValidaForm_News(form){
	document.getElementById('acao').value = tipo;
	var str_email = form.email.value;
    if(str_email.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1){
		alert("O campo E-mail deve ser preenchido corretamente");
    	form.email.focus();
    	return false;
	}
}
function verificaEmail(newsletter,tipo){
	document.getElementById('acao').value = tipo;
	if(newsletter.email.value == ""){
		alert("Atenção!\nO campo EMAIL deve ser preenchido!");
		newsletter.email.focus();
		return false;
	}
	if(newsletter.email.value.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1){
		alert("Atenção!\nVocê não preencheu o campo EMAIL corretamente!");
		newsletter.email.focus();
		return false;
	}
	return true;
}
//FUNCAO PRINCIPAL DE TARGET
function fnTarget(str_target){
	//declaracao de variaveis
	var ch_tag_A, vet_A, int_i;
	var str_titulo;
	//pega todos os <a> da pagina e percorre um por um para achar o rel="external"
    ch_tag_A = document.getElementsByTagName('a');
    for(int_i=0; int_i<ch_tag_A.length; int_i++){
		vet_A = ch_tag_A[int_i];
		if(vet_A.getAttribute("href") && vet_A.getAttribute('rel') != null){
			if(vet_A.getAttribute('rel').substring(0,8) == 'external'){
				vet_A.target = str_target;
				str_titulo = ch_tag_A.title;
				ch_tag_A.title = str_titulo;
			}
		}
	}
}
//Funcao Adiciona a Favoritos
function fnAdicionaFavoritos(){
	str_titulo = "Auto Escola Catedral - Centro de formação de Condutores";
	str_url = "http://www.autoescolacatedral.com.br";
	if(window.sidebar){ window.sidebar.addPanel(str_titulo, str_url,""); }
	else if(window.external){ window.external.AddFavorite( str_url, str_titulo); }
	else if(window.opera && window.print){ return true; }
}
//Funcao para Abrir Pop Up
function MM_openBrWindow(theURL,winName,features){
	var myWin = window.open(theURL,winName,features);
	myWin.focus();
}
function fnMostraOculta(pId){
	if(document.getElementById(pId).style.display == 'block'){ document.getElementById(pId).style.display='none'; }
	else{ document.getElementById(pId).style.display='block'; }
}
/*ICONES*/
function linkOn(ico,txt){
	document.getElementById(ico).src = 'imagens/'+ico+'.jpg';
	document.getElementById('padrao').style.display = 'none';
	document.getElementById(txt).style.display = '';
}
function linkOff(ico,txt){
	document.getElementById(ico).src = 'imagens/'+ico+'.jpg';
	document.getElementById(txt).style.display = 'none';
	document.getElementById('padrao').style.display = '';
}
function fnFlash(str_url,int_largura,int_altura){
	document.writeln('<object type="application/x-shockwave-flash" data="'+str_url+'" width="'+int_largura+'" height="'+int_altura+'">');
	document.writeln('<param name="movie" value="'+str_url+'">');
	document.writeln('<param name="quality" value="high">');
	document.writeln('<param name="wmode" value="transparent">');
	document.writeln('</object>');
}