function montaFlash(swf, width, height, id, wmode) {
	monta_swf = "";
	monta_swf += "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" id=\""+ id +"\" width=\""+ width +"\" height=\""+ height +"\">";
	monta_swf += "<param name=\"movie\" value=\""+ swf +"\" />";
	monta_swf += "<param name=\"quality\" value=\"high\" />";
	monta_swf += "<param name=\"menu\" value=\"false\" />";
	monta_swf += "<embed src=\""+ swf +"\" quality=\"high\" wmode=\""+ wmode +"\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" id=\""+ id +"\" width=\""+ width +"\" height=\""+ height +"\"></embed>";
	monta_swf += "</object>";
	document.write(monta_swf);
}

function popWin(URL,NAME,WIDTH,HEIGHT,RESIZE,SCROLL) {
   winId = window.open(URL,NAME,'width='+WIDTH+',height='+HEIGHT+',resizable='+RESIZE+',scrollbars='+SCROLL+',menubar=no,toolbar=no,location=no,directories=no,status=no');
	var clientWidth = screen.availWidth;
	var clientHeight = screen.availHeight;
	var xPos = (clientWidth - WIDTH)/2;
	var yPos = (clientHeight - HEIGHT)/2;
	winId.moveTo(xPos,yPos);
}

function enquetes(URL) {
	winId = window.open(URL,"enquetes","top=0,left=0,width=300,height=400,resizable=no,scrollbars=no,menubar=no,toolbar=no,location=no,directories=no,status=no");
   	var clientWidth = screen.availWidth;
	var clientHeight = screen.availHeight;
	var xPos = (clientWidth - 300)/2;
	var yPos = (clientHeight - 400)/2;
	winId.moveTo(xPos,yPos);
}

function CheckMail(str){
	var testresults
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (filter.test(str)) testresults=false
	else testresults=true
	return (testresults)
}
function apenasNumero(objCampo,e) {
	var scan	= getKey(e);
	var tecla	= String.fromCharCode(scan);
	var mask	= "0123456789"
	if (scan == 13 || scan == 8 || scan == 0) return true;
	if (mask.indexOf(tecla) == -1) {
		return false;
	}
	return true;
}

function getKey(e) {
	return (window.event) ? event.keyCode : e.which
}

function abreVideo (str, nome) {
	floater('divClipes', 450, 390);
	echo = '<table border="0" cellspacing="0" cellpadding="5" width="100%" height="100%" bgcolor="#FFFFFF">';
	echo += '<tr><td align="center" width="100%" height="100%" valign="top">';
	echo += nome +'<br>';
	echo += '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/'+str+'"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/'+str+'" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>';
	echo += '</td></tr>';
	echo += '<tr><td align="center">';
	echo += '<a href="javascript:void(0)" onClick="document.getElementById(\'divBackground\').style.display=\'none\';document.getElementById(\'divClipes\').style.display=\'none\'; document.getElementById(\'divClipes\').innerHTML=\'\'; "><img src="imagens/closelabel.gif" border="0"></a>';
	echo += '</td></tr>';
	echo += '</table>';
	document.getElementById('divClipes').innerHTML = echo;
}
function floater (nome, width, height) {
	if (!document.getElementById('divBackground')) {
		var div = document.createElement('div');
		div.setAttribute('id', 'divBackground');
		document.body.appendChild(div);
		var divBack = document.getElementById('divBackground');
		divBack.style.display = "block";
		divBack.style.width = document.body.clientWidth;
		divBack.style.height = document.body.scrollHeight;
		var div = document.createElement('div');
		div.setAttribute('id', nome);
		document.body.appendChild(div);
		var divMain = document.getElementById(nome);
		divMain.style.border = "1px solid #666";
		divMain.style.width = width+"px";
		divMain.style.height = height+"px";
		divMain.style.position = 'fixed';
		divMain.style.zIndex = 2;
		divMain.style.top = document.body.scrollTop + (document.body.clientHeight / 9) - (divMain.clientHeight / 9);
		divMain.style.left = (document.body.clientWidth / 2) - (divMain.clientWidth / 2);
	}
	else {
		document.getElementById('divBackground').style.display = "block";
		document.getElementById(nome).style.display = "block";
	}
}