
function verifica_form(c,f) {
	lista = c.split(",");
	f = document.forms[f];
	erro = 0;
	for (i = 0; i < lista.length; i++) {
		lt = lista[i];
		if (f[lt].value.length <= 0) {
			alert("Observe o preenchimento dos campos obrigatórios.");
			erro = 1;
			break;
		}
	}
	if (erro == 0) f.submit();
}


function gravaCookie( name, value, expires, path, domain, secure ) {
	var hoje = new Date();
	hoje.setTime(hoje.getTime());
	if (expires) { expires = expires * 1000 * 60 * 60 * 24; }
	var expires_date = new Date(hoje.getTime() + (expires));
	document.cookie = name + "=" +escape(value) + ((expires) ? ";expires=" + expires_date.toGMTString() : "") + (( path ) ? ";path=" + path : "") + (( domain) ? ";domain=" + domain : "") + ((secure) ? ";secure" : "");
}

function consultaCookie( name ) {
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ((!start ) && (name != document.cookie.substring(0, name.length))) {
		return null;
	}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ";", len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}

function excluiCookie(name, path, domain) {
	if (consultaCookie(name)) document.cookie = name + "=" + ((path) ? ";path=" + path : "") + ((domain) ? ";domain=" + domain : "" ) + ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

function idiomaRedir() {
	i = consultaCookie('idioma');
	if (i != null) {
		this.location.href = "default.php?lang="+i+"&t=padrao&p=capa&m=padrao";
	} else {
		this.location.href = "selecao.php";
	}
}

function inscricoes(param) {
	msg = window.open('https://webapp.pucrs.br/eventos/servlet/eventos.generico.Login?idioma=I&serial=' + param ,'inscricao','toolbar=no,left=0,top=0,height=' + (screen.height-105)  + ',width=' + (screen.width-15)  + ',scrollbars=yes,resize=no ,directories=no,menubar=no,status=yes,resizable=yes');
	msg.focus();
}

function correctPNG() {
	if (navigator.appName == "Microsoft Internet Explorer") {
		 for(var i=0; i<document.images.length; i++) {
			 var img = document.images[i]
			 var imgName = img.src.toUpperCase()
			 if (imgName.substring(imgName.length-3, imgName.length) == "PNG") {
				 var imgID = (img.id) ? "id='" + img.id + "' " : ""
				 var imgClass = (img.className) ? "class='" + img.className + "' " : ""
				 var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
				 var imgStyle = "display:inline-block;" + img.style.cssText 
				 if (img.align == "left") imgStyle = "float:left;" + imgStyle
				 if (img.align == "right") imgStyle = "float:right;" + imgStyle
				 if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle		
				 var strNewHTML = "<span " + imgID + imgClass + imgTitle + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
				 img.outerHTML = strNewHTML
				 i--
			 }
		} // FECHA FOR
	} // FECHA IF DO TESTE DE BROWSER

}

if (navigator.appName == "Microsoft Internet Explorer") {
	window.attachEvent("onload", correctPNG);
}



function abre_foto(url,A,L) {
	fmtl_janela = window.open(url,'fmtl_janela','toolbar=no,location=no,directories=no,menubar=no,status=no,scrollbars=0,resizable=yes,width='+L+',height='+A);
	fmtl_janela.focus();
}
