function mostraFlash(src, larg, alt, vars){
	var flash = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+ larg +'" height="'+ alt +'">';
	flash += '<param name="movie" value="'+ src +'" />';	
	flash += '<param name="menu" value="false" />';	
	flash += '<param name="wmode" value="transparent" />';	
	flash += '<embed src="'+ src +'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+ larg +'" height="'+ alt +'" menu = "false" wmode="transparent"></embed>';
	flash += '</object>';	
	
	document.write(flash);
}

function highlite(obj,type){
	if(type==-1){obj.className='';}
	else if(type==1){obj.className='inputOver';}
	else if(type==2){obj.id='inputOver';}
	else{obj.id='';obj.className='';}
}

function checkEmail(valor){
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor)){return (true);}
	return (false);
}

function checaCampos(form){  //verifica o preenchimento obrigatorios dos campos antes de enviá-los
	if(!form){return false;}
	var element,enviar=true;
	for(var i=0;i<form.elements.length;i++){
		element=form.elements[i];
		if(element.className.indexOf('email')>=0){  //campo tipo email
			if(!checkEmail(element.value)){
				alert('Favor escreva um e-mail válido.');
				element.focus();
				enviar=false;
				break;
			}
		}
		if(element.className.indexOf('required')>=0){  //campo requerido
			if(element.value.length<=0){  //nao preenchido
				alert('Favor preencha o campo corretamente');
				element.focus();
				enviar=false;
				break;
			}
		}
	}
	return enviar;
}

function limpaForm(form){
	if(confirm('Tem certeza de que deseja limpar as informações acima?')){
		form.reset();
		form.empresa.focus();
		return true;
	}
	return false;
}

function playVideo(id,isGoogle,url){
	if(id.indexOf('/')!=-1){var idv=id.split('/');id=idv[(idv.length-1)];}
	if(isGoogle){
		var embed='<embed style="width:366px; height:294px;" id="VideoPlayback" type="application/x-shockwave-flash" src="'+url+'" flashvars=""> </embed>';
	}else{
		var embed='<embed src="http://www.youtube.com/v/'+id+'" type="application/x-shockwave-flash" wmode="transparent" width="366" height="294"></embed>';
	}
	document.getElementById('moviePlayer').innerHTML=embed;
}
















//ADICIONA LEGENDA ÀS IMAGENS INSERIDAS NOS MODULOS DE PAGINA PERSONALIZADA
function addLegend(){
	var img;
	for(var i=0;i<document.images.length;i++){
		img=document.images[i];
		if(img.alt==''){continue;}
		if(paginaPersonalizada(img)){  //verifica se a imagem está dentro do div 'paginaPersonalizada'
			addlegenda(img,'legenda_'+i);
		}
	}
}

function paginaPersonalizada(obj){
	if(!obj.parentNode){return false;}
	while(obj.parentNode!=null){
		if(obj.id.toLowerCase()=='paginapersonalizada'){return true;}
		obj=obj.parentNode;
	}
	return false;
}

function addlegenda(obj,id){
	var newdiv = document.createElement('div');
	newdiv.setAttribute('id', id);
	newdiv.className='legenda';
	
	var width=obj.width;
	if(width>0){widthDiv="width:"+(width+35)+"px;";}else{widthDiv='';}
	
	var height=obj.height;
	if(height>0){height='height="'+height+'"';}else{height='';}
	
	newdiv.style.cssText="float:"+obj.align+";text-align:"+obj.align+"; "+widthDiv;
	newdiv.innerHTML='<img src="'+obj.src+'" width="'+width+'" '+height+' align="'+obj.align+'" style="'+obj.align+'"><br clear="all" />'+obj.alt;
	obj.replaceNode(newdiv);
}