
//paramIN:	src:string - source do movie;
//			width:int - comprimento;
//			heigth:int - altura;
//			menu:string - permite ver menu (mousse right click)
//			wmode:string - permite transparent
//			version:string - versao do flash player
//			id - id do flash
//paramOUT: void
//summary: faz o render do objecto flash
function printFlash(src, width, height, menu, wmode, version, id){
	document.write('<object valign=\"bottom\" id=\"'+id+'\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + version + '\" width=\"' + width + '\" height=\"' + height + '\">');
	document.write('<param name=\"movie\" value=\"' + src + '\">');
	document.write('<param name=\"quality\" value=\"high\">');
	document.write('<param name=\"menu\" value=\"' + menu + '\">');
	document.write('<param name=\"scale\" value=\"noscale\">');
	document.write('<param name=\"allowScriptAccess\" value=\"sameDomain\" />');
	document.write('<param name=\"allowFullScreen\" value=\"false\" />');
	document.write('<param name=\"bgcolor\" value=\"#000000\" />');
	document.write('<param name=\"salign\" value=\"\">');	
	document.write('<param name=\"wmode\" value=\"' + wmode + '\">');
	document.write('<embed id=\"'+id+'\" src=\"' + src + '\" quality=\"high\" wmode=\"' + wmode + '\" menu=\"' + menu + '" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"' + width + '\" height=\"' + height + '\" scale=\"noscale\" salign=\"t\" align=\"absbottom\" allowScriptAccess=\"sameDomain\" allowFullScreen=\"false\" bgcolor=\"#000000\" ></embed>');
	document.write('</object>');
	
	
}


function flash_sendMail(destinatario){
	window.location = "mailto:" + destinatario;
} 



//Verifica a existencia de iframe no caso de chamada a links directos

function resizeIframe(){
    var newheight;
	frame = document.getElementById('content');
	innerDoc = (frame.contentDocument) ? frame.contentDocument : frame.contentWindow.document;
	newheight = innerDoc.body.scrollHeight;
	//alert(newheight);
	frame.height= (newheight) + "px";
}

function resizeIframeEspecifico(iframeID){
    var newheight;
	frame = document.getElementById(iframeID);
	innerDoc = (frame.contentDocument) ? frame.contentDocument : frame.contentWindow.document;
	newheight = innerDoc.body.scrollHeight;
	//alert(newheight);
    frame.height= (newheight) + "px";
}

function verificaParent(){
	var url = window.location.href;
	if(parent.document.getElementById('content') == null) {
		//Criação de FROM dinamico para tratamento de links directos
		myForm = document.createElement('form');
		myForm.method = 'POST';
		myForm.action = 'index.php';
		myForm.setAttribute('id', 'formToIndex');
		myForm.enctype = 'multipart/form-data';
		
		// Create a text field
		textField = document.createElement('input');
		textField.type = 'text';
		textField.setAttribute('value', url);
		textField.setAttribute('name', 'urlEncoded');
		textField.setAttribute('id', 'urlEncoded');
		
		myForm.appendChild(textField);
		//document.appendChild(myForm);
		document.body.appendChild(myForm);
		myForm.submit();

	} else {
		document.body.style.visibility = '';
	}
}

function abrirJanelaCentradaComScroll(url, largura, altura){
    var larguraEcra = window.screen.width;
    var alturaEcra = window.screen.height;
    var posicaoX = (larguraEcra / 2) - (largura / 2);
    var posicaoY = (alturaEcra / 2) - (altura / 2);
	window.open(url,"","left="+posicaoX+",top="+posicaoY+",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width="+largura+", height="+altura);
}


