function MM_preloadImages() {
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() {
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) {
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() {
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

var currentFontSize = 11;
function changeFontSize(sizeDifference) {
	currentFontSize = parseInt(currentFontSize) + parseInt(sizeDifference);
	if(currentFontSize > 19) {
		currentFontSize = 19;
		return;
	} else if(currentFontSize < 8) {
		currentFontSize =8;
		return;
	}
	setFontSize(currentFontSize);
}

function setFontSize(fontSize) {
	var stObj = document.getElementById('content');
	var arr = getElementsByClassName(stObj, 'par', 'sub', 'cite', fontSize);
}

function getElementsByClassName(node, classname, classname2, classname3, fontSize) {
    var re  = new RegExp('\\b' + classname  + '\\b');
    var re2 = new RegExp('\\b' + classname2 + '\\b');
    var re3 = new RegExp('\\b' + classname3 + '\\b');
    var els = node.getElementsByTagName("*");
    for(var i=0,j=els.length; i<j; i++) {
        if(re.test (els[i].className) || re2.test(els[i].className) || re3.test(els[i].className)) {
			els[i].style.fontSize = fontSize + 'px';
		}
	}
}

function showLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.visibility = "visible";
  var obj = getElemRefs('divescondida');
  if (obj && obj.css) obj.css.visibility = "visible";
}

function hideLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.visibility = "hidden";
  var obj = getElemRefs(id);
  if (obj && obj.css) obj.css.visibility = "hidden";
}

function getElemRefs(id) {
	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? getLyrRef(id,document): null;
	if (el) el.css = (el.style)? el.style: el;
	return el;
}

function mouseout() {
	window.setTimeout('hide()',5000);
}

function hide() {
	hideLayer('avaliecomente');
}

function imprimir(id) {
	window.open('imprimir.php?t='+id, 'janela','scrollbars=yes,status=no,location=no,toolbar=no,menubar=no,height=450,width=660');
}

function de_para(id_texto, id_subsecao) {
	window.open('de_para.php?t='+id_texto+'&s='+id_subsecao, 'janela','scrollbars=no,status=no,location=no,toolbar=no,menubar=no,height=500,width=400');
}

function avalie(id, avaliacao) {
	window.open('avalie.php?t='+id+'&avaliacao='+avaliacao, 'janela','scrollbars=no,status=no,location=no,toolbar=no,menubar=no,height=360,width=567');
}

function fls(nome) {
	document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" ID=flashad WIDTH=316 HEIGHT=139><param name="allowScriptAccess" value="sameDomain" /><PARAM NAME=movie VALUE="' + nome + '"> <PARAM NAME=quality VALUE=high><EMBED src="' + nome + '" quality=high NAME=flashad swLiveConnect=TRUE WIDTH=316 HEIGHT=139 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED></OBJECT>');
}

function fls_pat(nome) {
	document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" ID=flashad WIDTH=468 HEIGHT=60><param name="allowScriptAccess" value="sameDomain" /><PARAM NAME=movie VALUE="' + nome + '"> <PARAM NAME=quality VALUE=high><EMBED src="' + nome + '" quality=high NAME=flashad swLiveConnect=TRUE WIDTH=468 HEIGHT=60 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED></OBJECT>');
}

function movie(movie, w, h) {
	document.write("<object type='application/x-shockwave-flash' width='" + w + "' height='"+ h + "' wmode='transparent' data='/resources/flash/flvplayer.swf?file=" + movie + "&autoStart=false'><param name='movie' value='/resources/flash/flvplayer.swf?file=" + movie + "&autoStart=false' /><param name='wmode' value='transparent' /></object>");
}

function flash_interno(nome, w, h) {
	document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" ID=flashad WIDTH="' + w + '" HEIGHT="' + h +'"><param name="allowScriptAccess" value="sameDomain" /><PARAM NAME=movie VALUE="' + nome + '"><PARAM NAME=quality VALUE=high><EMBED src="' + nome + '" quality=high NAME=flashad swLiveConnect=TRUE WIDTH="' + w + ' " HEIGHT="' + h + '" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED></OBJECT>');
}

function valida_form() {
	var form = document.cadpol;
	var nome = form.nome;
	var email = form.email;
	if(email.value == '') {
		alert('Por favor, informe seu E-mail!');
		form.email.focus();
		return false;
	} else {
		var reg = /^[a-zA-Z0-9]([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		if(!reg.test(email.value)) {
			alert("O E-mail informado é inválido!");
			email.focus();
			return false;
		}
	}
	if(nome.value == '' || nome.value == 'Nome') {
		alert('Por favor, informe seu Nome!');
		form.nome.focus();
		return false;
	}
	form.submit();
}

