function Cerrar(pDiv) {
	pDiv.style.display='none';
}


// JavaScript Document
function PopUp(pURL, ancho, alto){
var Ventana;
var string;
var derecha;
var arriba;
	if(parseInt(ancho) == 0){
		ancho = 800;
	}
	if(parseInt(alto) == 0){
		alto = 600;
	}

	derecha=(screen.width-ancho)/2;
	arriba=(screen.height-alto)/2;

	string	= 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=' + ancho + ',height=' + alto + ',left=' + derecha + ',top=' + arriba;
	Ventana = window.open(pURL,'',string);
}

function ComprobarCodigo(pEstadoVotacion) {
	if(pEstadoVotacion == 'CERRADA'){
		alert('El plazo de votación está cerrrado');
	}else{
		if(document.getElementById('Codigo').value.length < 8){
			alert('El Código de Acceso no es válido.');
			document.getElementById('Codigo').focus();
		}else{
			document.getElementById('CodigoAcceso').submit();
		}
	}
}


function ImprimirActaVotacion(pVotacion){
var Ventana;

	Ventana	= window.open('Hoja_votacion_' + pVotacion + '_EGEDA.pdf','Imprimir','width=800,height=600,top='+((screen.height - 600)/2)+',left='+((screen.width - 800)/2)+',toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0')

	CloseDiv()
}

function CloseDiv(){
	document.getElementById('DivFlotante').style.display='none';
	document.getElementById('Sombra').style.display='none';
}


function AbrirVentana(pVentana,Nombre,Ancho,Alto,Left,Top,Scroll,Resize,Tool,Status,Menu,Location){
var Ventana;
var Opciones;

	if((Ancho > screen.width) || (Ancho == 0)){
		Ancho = screen.width - 2;
	}
	if((Alto > screen.height) || (Alto == 0)){
		Alto = screen.height - 2;
	}
	if(Left == 0){
		Left	= ((screen.width - Ancho)/2);
	}
	if(Top == 0){
		Top			= ((screen.height - Alto)/2);
	}
	Opciones	= 'width='+Ancho+',height='+Alto+',top='+Top+',left='+Left+',toolbar='+Tool+',scrollbars='+Scroll+',location='+Location+',statusbar='+Status+',menubar='+Menu+',resizable='+Resize;

	Ventana	= window.open(pVentana,Nombre,Opciones);
	Ventana.focus();
}

function AceptarCodigo(){
	if(document.getElementById('Codigo').value == ''){
		alert('Debe introducir su nuevo Código de Acceso.');
		document.getElementById('Codigo').focus();
	}else{
		if(document.getElementById('Codigo').value.length < 8){
			alert('El Código de Acceso debe tener al menos 8 caracteres.');
			document.getElementById('Codigo').focus();
		}else{
			if(document.getElementById('Codigo').value != document.getElementById('Codigo2').value){
				alert('El Código de Acceso no coincide.');
				document.getElementById('Codigo').focus();
			}else{
				document.getElementById('CodigoAcceso').submit();
			}
		}
	}
}

function MarcarFinalista(pFinalista,pVotos){
	document.getElementById('Finalista').value = pFinalista;
	document.getElementById('Votos').value = pVotos;
	document.getElementById('Votacion').submit();
}

function CerrarVotacion(Parametro){
	document.getElementById('Boton').value = 'Cerrar';
	document.getElementById('nVotacion').value = Parametro;
	document.getElementById('Votacion').submit();
}

function AbrirVotacion(pVotacion,pFinalistas){
var bVotar;

	bVotar = true;

	for(i=1;i<6;i++){
		if(!!eval(document.getElementById('Btn_Finalista'+i))){
			alert('Debe verificar las películas finalistas antes de abrir la segunda votación');
			bVotar = false;
			break
		}
	}

	if(bVotar){
		document.getElementById('Boton').value = 'Abrir';
		document.getElementById('nVotacion').value = pVotacion;
		document.getElementById('Votacion').submit();
	}
}

function Imprimir(pTipo){
	AbrirVentana('JMF_NotarioImprimir.asp?Ver='+pTipo,'Listado',667,600,0,0,1,0,0,0,0,0);
}

function ListarPeliculas(){
	AbrirVentana('JMF_Listar.asp','Listado',1067,750,0,0,1,0,0,0,0,0);
}

function Listar(pTipo){
	if(pTipo == 'F'){
		AbrirVentana('JMF_ListarF.asp','Listado',900,500,0,0,0,0,0,0,0,0);
	}else{
		location.href = 'JMF_Listar'+pTipo+'.asp';
	}
}

function ListarN(pTipo){
	AbrirVentana('JMF_Listar'+pTipo+'.asp','Listado',1067,750,0,0,1,0,0,0,0,0);
}

function InsertarEmail(){
	if(document.getElementById('Email').value != ''){
	var EmailValido;
		EmailValido = ComprobarEmail(document.getElementById('Email').value)
		if(EmailValido != '1'){
			alert('Debe escribir un email válido');
		}else{
			if(document.getElementById('Email').value != document.getElementById('Email2').value){
				alert('El email no coincide');
			}else{
				document.getElementById('frm_Email').submit();
			}
		}
	}
}

function ComprobarEmail(pEmail)
{
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(pEmail)){
		return ('1');
	}else{
		return ('0');
	}
}

function VerVotos(pVotacion){
	AbrirVentana('JMF_NotarioVotacion'+pVotacion+'.asp','Votaciones',1004,750,0,0,1,0,0,0,0,0);
}

function ResumenVotacion(){
	AbrirVentana('JMF_NotarioResumen.asp','Resumen',737,750,0,0,1,0,0,0,0,0);
}

// FLASH VOTACIONES
function Votaciones() {
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="167" height="96" title="Votaciones">')
	document.write('<param name="movie" value="JMF_Votaciones.swf" />')
	document.write('<param name="quality" value="high" />')
	document.write('<embed src="JMF_Votaciones.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="167" height="96"></embed>')
	document.write('</object>')
}

function Finalistas() {
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="194" height="96">')
	document.write('<param name="movie" value="JMF_Finalistas.swf" />')
	document.write('<param name="quality" value="high" />')
	document.write('<embed src="JMF_Finalistas.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="194" height="96"></embed>')
	document.write('</object>')
}

function Finalistas2010() {
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="194" height="70">')
	document.write('<param name="movie" value="JMF_Finalistas2010.swf" />')
	document.write('<param name="quality" value="high" />')
	document.write('<embed src="JMF_Finalistas2010.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="194" height="70"></embed>')
	document.write('</object>')
}
function Ganadoras2010() {
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="194" height="70">')
	document.write('<param name="movie" value="JMF_Ganadoras2010.swf" />')
	document.write('<param name="quality" value="high" />')
	document.write('<embed src="JMF_Ganadoras2010.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="194" height="70"></embed>')
	document.write('</object>')
}


function DossierPrensa() {
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="194" height="70">')
	document.write('<param name="movie" value="JMF_14DossierPrensa.swf" />')
	document.write('<param name="quality" value="high" />')
	document.write('<embed src="JMF_14DossierPrensa.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="194" height="70"></embed>')
	document.write('</object>')
}

function Ganadora() {
http://files.velocix.com/c183/FRPRXIV23_400.flv
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="194" height="70">')
	document.write('<param name="movie" value="JMF_Ganadora.swf" />')
	document.write('<param name="quality" value="high" />')
	document.write('<embed src="JMF_Ganadora.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="194" height="70"></embed>')
	document.write('</object>')
}

// Player Progressive Download
function Player(pPelicula,pImagen,pAncho,pAlto,pBuffer) {
	document.write('<embed src="player.swf" width="'+pAncho+'" height="'+pAlto+'" allowfullscreen="true" allowscriptaccess="always" flashvars="&controlbar=over&autostart=false&displayheight='+pAlto+'&bufferlength='+pBuffer+'&file='+pPelicula+'&height='+pAlto+'&image='+pImagen+'&width='+pAncho+'" />')
}

// Player Progressive Download
function PlayerAudio(pPelicula,pImagen,pAncho,pAlto,pBuffer) {
	document.write('<embed src="player.swf" width="'+pAncho+'" height="'+pAlto+'" allowfullscreen="false" allowscriptaccess="always" flashvars="&controlbar=bottom&autostart=false&displayheight='+pAlto+'&bufferlength='+pBuffer+'&file='+pPelicula+'&height='+pAlto+'&image='+pImagen+'&width='+pAncho+'" />')
}
