// JavaScript Document
function wr (str) {
	document.write(str);
}

function flash(file,width,height,vars) {
	wr('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+width+'" height="'+height+'" id="swfobj" align="left" type="application/x-shockwave-flash">');
	if (vars) {
		wr('<param name="FlashVars" value="'+vars+'">');
	}
	wr('<param name="movie" value="'+file+'" />');
	wr('<param name="quality" value="high" />');
	wr('<param name="wmode" value="Transparent" />');
	wr('<embed src="'+file+'" flashvars="'+vars+'" quality="high" width="'+width+'" height="'+height+'" name="flashobj" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" wmode="Transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	wr('</object>');
}

function montaXMLHTTP(){
	try{
		myObj = new XMLHttpRequest()
	}catch(e){
		myObj = new ActiveXObject("Microsoft.XMLHTTP"); 
	}
	return myObj;
}

function TrocaFoto(num){
		
		var conteudo=document.getElementById("foto_galeria");
		
		obj_foto = new montaXMLHTTP();
				
		obj_foto.open("POST","scripts/troca_foto.php",true);
		obj_foto.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		
		obj_foto.onreadystatechange = function(){
			if(obj_foto.readyState == 1){
					conteudo.innerHTML = '<span style="text-align:center; float:left; margin:180px 0 0 0; width:500px;" ><img src="imagens/loading_ico.gif" width="64" height="43" alt="Enviando" /></span>';
			}
			if(obj_foto.readyState == 4){
					texto = obj_foto.responseText;
					conteudo.innerHTML = texto;
			}
		}
		obj_foto.send("id="+num);
		
}

