
// Escreve o Flash
function Flash(arquivo,largura,altura,trans,ret){
	var trans = (trans) ? "wmode=\"transparent\"" : "";
	var valor = "";
	valor = '<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="'+largura+'" height="'+altura+'">\n';
	if(trans) valor += '<param name="wmode" value="transparent">';
	valor += '<param name="movie" value="'+arquivo+'" />\n';
	valor += '<param name="quality" value="high" />\n';
	valor += '<embed src="'+arquivo+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+largura+'" '+trans+' height="'+altura+'"></embed>\n';
	valor += '</object>';
	if(ret) return valor;
	else document.write(valor);
}

/////////////////
// cria o menu funcional
function AtivaFormulario(){
	var form = document.contato;
	for(var i=0;i<form.elements.length;i++){
		if(form[i].type=="submit") continue;
		form[i].onblur = function(){if(!form[this.name].value) form[this.name].value = form[this.name].defaultValue;}
		form[i].onchange = function(){if(!form[this.name].value) form[this.name].value = form[this.name].defaultValue;}
		form[i].onclick = function(){if(form[this.name].value==form[this.name].defaultValue) form[this.name].value = "";}
		form[i].onselect = function(){if(form[this.name].value==form[this.name].defaultValue) form[this.name].value = "";}
	}
}

/////////////////


// Verifica o formulario
function VerForm(){
	var cp = "";
	var val = "";
	var campos = arguments;
	var nomeform = campos[0];
	erro = false;
	var form = document[nomeform];
	for(var i=0;i<campos.length;i++){
		if(!i) continue;
		cp = campos[i];
		if(!cp) continue;
		val = "";
		val = form[cp].value;
		if(form[cp].value==form[cp].defaultValue) val = '';
		if(!val || val==0){
			erro = 1;
		}
	}
	if(erro){
		alert('Não foi possível enviar, todos os campos são obrigatórios.');
		return false;
	}
	return true;
}

/********************************************************
* Fotos
********************************************************/
function Fotos(arquivo,largura,altura){
	var tam = MyLib.getInnerXY();
	$('fotoarq').innerHTML="<img src='"+arquivo+"'width='"+largura+"' height='"+altura+"' alt='Aguarde, Carregando' />";
	var central = MyLib.CentralArea(largura,altura);
	var pos = MyLib.getScrollXY();
	var tam = Element.getDimensions('body');
	pos[1] = parseInt(pos[1])+50;
	Element.setStyle('fotos',{ 'height':tam.height+'px', 'width': tam.width+'px', 'top': '0px', 'left': '0px'});
	Element.setStyle('fotoscont',{ 'top':pos[1]+'px', 'left':central[0]+'px', 'width': largura+'px', 'height': altura+'px'});
	// botao fechar
	Element.setStyle('fotosfechar',{ 'left':parseInt(largura)-20+'px'});
	Element.show('fotos');
}


// fecha foto
function FechaFoto(){
	$('fotoarq').innerHTML="";
	Element.hide('fotos');
}



