//Funcao para flash
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>');
}
function jVerificaForm(form,evento)
{
	if(form.nome.value == "")
	{
		alert("Atenção!\nO Campo NOME deve ser preenchido corretamente");
		form.nome.focus();
		return false;
	}
	if(form.email.value == "")
	{
		alert("Atenção!\nO Campo E-MAIL deve ser preenchido corretamente");
		form.email.focus();
		return false;
	}
}

function jAmpliProd(jID,jFoto)
	{
		window.open('j.asp?p='+jID+'&i='+jFoto+'&m='+document.all.nomeImagem.value,'janela','width=640,height=600,scrollbars=yes,toolbar=no,location=no,status=no,menubar=no,resizable=no,left=5,top=5')
	}

function jConsulta(id)
	{
		window.open("consultar.asp?p="+id, "janelaConsulta", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,menubar=no,width=400,height=600");
	}

function jExibeThumb(thumbName) 
	{
		var tmpImg;
		tmpImg = thumbName.src;
		thumbName.src = document.mainImg.src;
		document.mainImg.src = tmpImg;
		document.all.nomeImagem.value=tmpImg;
	}

function MM_openBrWindow(theURL,winName,features)
	{ 
	  window.open(theURL,winName,features);
	}

function jVerifica(form)
{
	if (form.nome.value == "" || form.nome.value.length < 3)
	{
		alert("Atenção!\nO campo NOME deve ser preenchido.");
		form.nome.focus();
		return false;
	}
	if (form.email.value == "" || form.email.value.length < 6)
	{
		alert("Atenção!\nO campo E-MAIL deve ser preenchido.");
		form.email.focus();
		return false;
	}
	if (form.telefone.value == "" || form.telefone.value.length < 14)
	{
		alert("Atenção!\nO campo TELEFONE deve ser preenchido.");
		form.telefone.focus();
		return false;
	}
		
	if (form.endereco.value == "" || form.endereco.value.length < 7)
	{
		alert("Atenção!\nO campo Endereço deve ser preenchido.");
		form.endereco.focus();
		return false;
	}
		
	if (form.cidade.value == "" || form.cidade.value.length < 3)
	{
		alert("Atenção!\nO campo Cidade deve ser preenchido.");
		form.cidade.focus();
		return false;
	}
	
	if (form.estado.value == "")
	{
		alert("Atenção!\nO campo Estado deve ser preenchido.");
		form.estado.focus();
		return false;
	}
	
	if (form.cep.value == "" || form.cep.value.length < 9)
	{
		alert("Atenção!\nO campo CEP deve ser preenchido.");
		form.cep.focus();
		return false;
	}
	
	if (form.ondeconheceu.value == "" || form.ondeconheceu.value.length < 6)
	{
		alert("Atenção!\nO campo Onde você Conheceu? deve ser preenchido.");
		form.ondeconheceu.focus();
		return false;
	}
	
	if (form.mensagem.value == "" || form.mensagem.value.length < 7)
	{
		alert("Atenção!\nO campo Mensagem deve ser preenchido.");
		form.mensagem.focus();
		return false;
	}		
}




var enablepersist="on" //Enable saving state of content structure using session cookies? (on/off)
var collapseprevious="yes" //Collapse previously open content when opening present? (yes/no)
if (document.getElementById){
	document.write('<style type="text/css">')
	document.write('.switchcontent{display:none;}')
	document.write('</style>')
}
function getElementbyClass(classname){
ccollect=new Array()
var inc=0
var alltags=document.all? document.all : document.getElementsByTagName("*")
for (i=0; i<alltags.length; i++){
if (alltags[i].className==classname)
ccollect[inc++]=alltags[i]
}
}
function contractcontent(omit){
var inc=0
while (ccollect[inc]){
if (ccollect[inc].id!=omit)
ccollect[inc].style.display="none"
inc++
}
}
function expandcontent(cid){
if (typeof ccollect!="undefined"){
if (collapseprevious=="yes")
contractcontent(cid)
document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "none"
}
}
function revivecontent(){
contractcontent("omitnothing")
selectedItem=getselectedItem()
selectedComponents=selectedItem.split("|")
for (i=0; i<selectedComponents.length-1; i++)
document.getElementById(selectedComponents[i]).style.display="block"
}
function get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
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;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}
function getselectedItem(){
if (get_cookie(window.location.pathname) != ""){
selectedItem=get_cookie(window.location.pathname)
return selectedItem
}
else
return ""
}
function saveswitchstate(){
var inc=0, selectedItem=""
while (ccollect[inc]){
if (ccollect[inc].style.display=="block")
selectedItem+=ccollect[inc].id+"|"
inc++
}
document.cookie=window.location.pathname+"="+selectedItem
}
function do_onload(){
getElementbyClass("switchcontent")
if (enablepersist=="on" && typeof ccollect!="undefined")
revivecontent()
}
if (window.addEventListener)
window.addEventListener("load", do_onload, false)
else if (window.attachEvent)
window.attachEvent("onload", do_onload)
else if (document.getElementById)
window.onload=do_onload
if (enablepersist=="on" && document.getElementById)
window.onunload=saveswitchstate
// Funcao de Mascara de Campos
function FormatMask(objForm, strField, sMask, evtKeyPress){
	var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla;
	if(window.event){ nTecla = evtKeyPress.keyCode; }
	else if(evtKeyPress.which){ nTecla = evtKeyPress.which; }
	sValue = objForm[strField].value;
	sValue = sValue.toString().replace( "-", "" );
	sValue = sValue.toString().replace( "-", "" );
	sValue = sValue.toString().replace( ".", "" );
	sValue = sValue.toString().replace( ".", "" );
	sValue = sValue.toString().replace( "/", "" );
	sValue = sValue.toString().replace( "/", "" );
	sValue = sValue.toString().replace( "(", "" );
	sValue = sValue.toString().replace( "(", "" );
	sValue = sValue.toString().replace( ")", "" );
	sValue = sValue.toString().replace( ")", "" );
	sValue = sValue.toString().replace( " ", "" );
	sValue = sValue.toString().replace( " ", "" );
	fldLen = sValue.length;
	mskLen = sMask.length;
	i = 0;
	nCount = 0;
	sCod = "";
	mskLen = fldLen;
	if(nTecla != 8){
		if(sMask.charAt(i-1) == "9"){ return((nTecla > 47)&&(nTecla < 58)); }
		else{
			while(i <= mskLen){
				bolMask = ((sMask.charAt(i) == "-") || (sMask.charAt(i) == ".") || (sMask.charAt(i) == "/"))
				bolMask = bolMask || ((sMask.charAt(i) == "(") || (sMask.charAt(i) == ")") || (sMask.charAt(i) == " "))
				if(bolMask){
					sCod += sMask.charAt(i);
					mskLen++;
				}
				else{
					sCod += sValue.charAt(nCount);
					nCount++;
				}
				i++;
			}
			objForm[strField].value = sCod;
			return true;
		}
	}
	else{ return true; }
}
//Funcao para o PopUp
function fnPopup() {
	window.open('popup.html','popup','width=300,height=208,resizable=no,toolbar=no,status=no')
}