// JavaScript Document



//function para tirar a borda o flash no IE

function FUnblock(strName, nWidth, nHeight){

 

 var strFlash = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,29,0" width="'+nWidth+'" height="'+nHeight+'" id="'+strName+'">';

 strFlash += '<param name="allowScriptAccess" value="sameDomain" />';

 strFlash += '<param name="movie" value="'+strName+'.swf" />';

 strFlash += "<param name='wmode' value='transparent'>"

 strFlash += '<embed src="'+strName+'.swf" width="'+nWidth+'" height="'+nHeight+'" name='+strName+'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';

 strFlash += '</object>';

 

 document.write(strFlash); 

 

}



//Script para validacao de email

function validaEmail(email){

	if(email.value == ""){

		alert("informe seu E-mail!!")

		email.focus();

		return false;

	}

		if(email.value.indexOf("@", email.value.indexOf("@") + 1 ) != -1) {

			alert("O e-mail informado parece não estar correto.");

			email.focus();

			return false;

		}

		if(email.value.indexOf(".") < 1) {

			alert("O e-mail informado parece não estar correto.");

			email.focus();

			return false;

		}

		if(email.value.indexOf(" ") != -1) {

			alert("O e-mail informado parece não estar correto.");

			email.focus();

			return false;

		}

		if(email.value.indexOf(".@") > 0) {

			alert("O e-mail informado parece não estar correto.");

			email.focus();

			return false;

		}

		if(email.value.indexOf("@.") > 0) {

			alert("O e-mail informado parece não estar correto.");

			email.focus();

			return false;

		}

		if(email.value.indexOf(".com.br.") > 0) {

			alert("O e-mail informado parece não estar correto.");

			email.focus();

			return false;

		}

		if(email.value.indexOf("/") > 0) {

			alert("O e-mail informado parece não estar correto.");

			email.focus();

			return false;

		}

		if(email.value.indexOf("[") > 0) {

			alert("O e-mail informado parece não estar correto.");

			email.focus();

			return false;

		}

		if(email.value.indexOf("]") > 0) {

			alert("O e-mail informado parece não estar correto.");

			email.focus();

			return false;

		}

		if(email.value.indexOf("(") > 0) {

			alert("O e-mail informado parece não estar correto.");

			email.focus();

			return false;

		}

		if(email.value.indexOf(")") > 0) {

			alert("O e-mail informado parece não estar correto.");

			email.focus();

			return false;

		}

		if(email.value.indexOf("..") > 0) {

			alert("O e-mail informado parece não estar correto.");

			email.focus();

			return false;

		}

		return true;

}





//função para o menu top

function func_menu(param, img){

	document.getElementById(img).src = param;

}



//validação do formulario de contato

function func_validaContato(){

	var dc = document.form2



	if(dc.cmpNome.value==""){

		alert("Preencha o campo Nome!");

		dc.cmpNome.focus()

		return false

	}

	

	//colocar o validador de email

	//valida Email

	var ss = validaEmail(dc.email);

	if (ss==false){

		return false;

	}

	

	if(dc.assunto.value==""){

		alert("Preencha o campo Assunto!");

		dc.assunto.focus()

		return false

	}

	

	if(dc.mensagem.value==""){

		alert("Preencha o campo Mensagem!");

		dc.mensagem.focus()

		return false

	}

	

}



function func_validaOrcamento(){

	var dc = document.form2



	if(dc.cmpNome.value==""){

		alert("Preencha o campo Nome!");

		dc.cmpNome.focus()

		return false

	}

	

	//colocar o validador de email

	//valida Email

	var ss = validaEmail(dc.email);

	if (ss==false){

		return false;

	}

	

	if(dc.ddd.value==""){

		alert("Preencha o campo Ddd!");

		dc.ddd.focus()

		return false

	}

	

	if(dc.telefone.value==""){

		alert("Preencha o campo Telefone!");

		dc.telefone.focus()

		return false

	}

	

	

	if(dc.descricao.value==""){

		alert("Preencha o campo Descrição do orçamento!");

		dc.descricao.focus()

		return false

	}	

}







function func_abreDescricao(param, param2){

	document.getElementById(param).style.display = '';

	document.getElementById(param2).style.display = '';

	

	var total = document.getElementById("total").value;

	var desc;

	var mm_sub;

	var i;

	for(i=0; i < total ; i++){

		desc = "descricao"+i;

		mm_sub = "mm_subProduto"+i;

		//alert(desc+"\n"+param)

		if(desc != param){

			if(document.getElementById(desc)){

				document.getElementById(desc).style.display = 'none'

			}

		}

		

		if(mm_sub != param2){

			if(document.getElementById(mm_sub)){

				document.getElementById(mm_sub).style.display = 'none'

			}

		}

	}

}









