// JavaScript Document

function calc(f){ 
	vent=window.open('','tpv','width=725,height=600,scrollbars=no,resizable=yes,status=yes,menubar=no,location=no');
	document.forms[0].submit();
	//document.getElementById('logans').submit();
	document.getElementById('tabla01').style.display = 'none';
	document.getElementById('tabla02').style.display = 'block';
	//f.submit();
}

function ver(x){
	if(x.value=='2@@transferencia'){
		ocultar();
		document.getElementById('transferencia').style.display='block';
	}
	else if(x.value=='3@@tarjeta'){
		ocultar();
		document.getElementById('tarjeta').style.display='block';
	}
	else if(x.value=='4@@efectivo'){
		ocultar();
		document.getElementById('efectivo').style.display='block';
	}
	else if(x.value==''){
		ocultar();
	}

}
function ocultar(){
	if(document.getElementById('transferencia')!=null)
		document.getElementById('transferencia').style.display='none';
	if(document.getElementById('tarjeta')!=null)
		document.getElementById('tarjeta').style.display='none';
	if(document.getElementById('efectivo')!=null)
		document.getElementById('efectivo').style.display='none';
}
function panel(c,num){
	if(c.checked==true){
		opcion=false;
		color='#FFFFFF';
	}
	else if(c.checked==false){
		opcion=true;
		color='#CCCCCC';
	}
	document.getElementById('autores'+num).disabled=opcion;
	document.getElementById('autores'+num).style.backgroundColor= color;
	document.getElementById('titulo'+num).disabled=opcion;
	document.getElementById('titulo'+num).style.backgroundColor= color;
	document.getElementById('resumen'+num).disabled=opcion;
	document.getElementById('resumen'+num).style.backgroundColor= color;
	document.getElementById('palabras'+num).disabled=opcion;
	document.getElementById('palabras'+num).style.backgroundColor= color;
}
function ValF(f){
	if(trim(f.apellidos.value)=='')
		window.alert('Complete el campo \'Apellidos\'');
	else if(trim(f.nombre.value)=='')
		window.alert('Complete el campo \'Nombre\'');
	else if(trim(f.dni.value)=='')
		window.alert('Complete el campo \'DNI\'');
	else if(trim(f.calle.value)=='')
		window.alert('Complete el campo \'Rúa\'');
	else if(trim(f.cp.value)=='')
		window.alert('Complete el campo \'Código Postal\'');
	else if(trim(f.poblacion.value)=='')
		window.alert('Complete el campo \'Poboación\'');
	else if(trim(f.provincia.value)=='')
		window.alert('Complete el campo \'Provincia/Estado\'');
	else if(trim(f.pais.value)=='')
		window.alert('Complete el campo \'País\'');
	else if(trim(f.telefono.value)=='')
		window.alert('Complete el campo \'Teléfono\'.');
	else if(trim(f.email.value)=='')
		window.alert('Complete el campo \'Email\'.');
	else if(f.credito.checked==true & trim(f.universidad.value)=='')
		window.alert('Complete el campo \'Universidade\'.');
	else if(f.credito.checked==true & trim(f.facultad.value)=='')
		window.alert('Complete el campo \'Facultade\'.');
	else if(f.formapago.value=='')
		window.alert('Indique una forma de pago.');
	else if(f.formapago.value=='2@@transferencia' & !radiotrue(f.recibo_trans))
		window.alert('Indique una forma de envío del \'Recibo\' de la transferencia.');
	else if(f.formapago.value=='2@@transferencia' & !radiotrue(f.importe_trans))
		window.alert('Indique el \'Importe\' de la transferencia.');
	else if(f.formapago.value=='3@@tarjeta' & !radiotrue(f.importe_tarjeta))
		window.alert('Indique el \'Importe\' del pago con tarjeta.');
	else if(f.formapago.value=='4@@efectivo' & !radiotrue(f.importe_efectivo))
		window.alert('Indique el \'Importe\' del pago en efectivo.');
	else if(f.cartel1.checked==true & trim(f.titulo1.value)=='')
		window.alert('Si ha marcado el casillero \'Cartel1\' debe completar el campo \'Título\'.');
	else if(f.cartel1.checked==true & trim(f.autores1.value)=='')
		window.alert('Si ha marcado el casillero \'Cartel1\' debe completar el campo \'Autores\'.');
	else if(f.cartel2.checked==true & trim(f.titulo2.value)=='')
		window.alert('Si ha marcado el casillero \'Cartel2\' debe completar el campo \'Título\'.');
	else if(f.cartel2.checked==true & trim(f.autores2.value)=='')
		window.alert('Si ha marcado el casillero \'Cartel2\' debe completar el campo \'Autores\'.');
	else if(f.cartel3.checked==true & trim(f.titulo3.value)=='')
		window.alert('Si ha marcado el casillero \'Cartel3\' debe completar el campo \'Título\'.');
	else if(f.cartel3.checked==true & trim(f.autores3.value)=='')
		window.alert('Si ha marcado el casillero \'Cartel3\' debe completar el campo \'Autores\'.');
	else if(f.acepto.checked==false)
		window.alert('Debe aceptar los \'Terminos y condiciones de uso\' para continuar.');
	//else if(f.panelista.checked==true & trim(f.palabras.value)=='')
	//	window.alert('Si ha marcado el casillero \'Panelista\' debe completar el campo \'Palabras clave\'.');
	//else if(f.panelista.checked==true & trim(f.resumen.value)=='')
	////	window.alert('Si ha marcado el casillero \'Panelista\' debe completar el campo \'Resumen\'.');
	else f.submit();
}
function radiotrue(xradio){//devuelve true si algun radio esta checked
	if(xradio!=null){
		var long = xradio.length;
		if(long!=undefined){
			var i=0;
			while(i<long){
				if(xradio[i].checked==true)
					return true;
				i++;
			}
		}
		else{
			return(xradio.checked==true);
		}
		return false;
	}
}
function checkuncheck(f,obj,strobj,limite)
{
var elementos = f.elements.length;
for(i=0;i<elementos; i++){
if(f.elements[i].type == "checkbox" && f.elements[i].id!=strobj && (f.elements[i].id=='cursoe' || f.elements[i].id=='cursop'))
	f.elements[i].checked=0;
}
aux=0;
for(i=0;i<elementos; i++){
if(f.elements[i].type == "checkbox" && f.elements[i].checked==1 && (f.elements[i].id=='cursoe' || f.elements[i].id=='cursop'))
	aux++;
}
if(aux>limite)
	{
	obj.checked=0;
	alert('Solo puedes inscribirte en '+limite+' cursos.')
	}
}
