function marcarconvo(con)
{


}

function salir()
{
document.form1.submit()
window.close()
}

function checkbae(){
if (document.layers||document.all)
return validarusuario(form1)
else
return true
}

function borrar(name,id){
  if(confirm("¿Desea dar de baja el Curso "+name+"?")){
    document.formBorrar.id.value=id;
    document.formBorrar.submit();
  }
}
function alta(name,id){
  if(confirm("¿Desea dar de alta el Curso "+name+"?")){
    document.formAlta.id.value=id;
    document.formAlta.submit();
  }
}

function fechas(cajaTxt) {
var fechaOK = "ok"
var fecha;
fecha = cajaTxt.value
if(fecha!=""){
meses = new Array(31,28,31,30,31,30,31,31,30,31,30,31) 
parts = fecha.split("/")
if (parts.length!=3) 
	fechaOK = "error"
else 
	{ 
		if (isNaN(parts[0]) || isNaN(parts[1]) || isNaN(parts[2]) ||  parts[2].length != 4)
		fechaOK = "error" 
		if((fecha.indexOf('.')!=-1) || (fecha.indexOf(' ')!=-1))
		fechaOK = "error"
		if ((fechaOK=="ok") && (parts[2].length == 4 ))
			{ 
	 			if ( parseInt(parts[2],10)%4 == 0 )
	 			meses[1] = 29
	 		} 
		else 
			fechaOK = "error" 
		if ((fechaOK=="ok") && (parts[1].length <= 2 ) && (parseInt(parts[1],10) <=12)) 
			{ 
			mes = (parts[1]) - 1
			diasMax = eval("meses["+mes+"]")
			//diasMax = meses[mes]
			} 
		else 
			fechaOK = "error" 
		if (((fechaOK=="ok") && ((parts[0].length >= 3 ) || (parseInt(parts[0],10) >diasMax || (parseInt(parts[0],10) == 0)))))

			fechaOK = "error" 
			
	}
}
//else{fechaOK = "vacia"}
if(fechaOK=="error"){
alert("Error al introducir la fecha")
cajaTxt.focus()
}
}

function marcartemas(campo)
{
for(var i=0; i < campo.length ;i++)
	if (campo.elements(i).id=="tema") 
		campo.elements[i].checked=true;
}
function desmarcartemas(campo)
{
for(var i=0; i < campo.length ;i++)
	if (campo.elements[i].id=="tema") 
		campo.elements[i].checked=false;
}

function enviarcontacte(campo){
var txarea=campo.mensaje.value
  if (txarea.length<1){
      alert("Debe indicar el Comentario a enviar");
	  campo.mensaje.focus();}
  else if (txarea.length>500){
      alert("El campo Comentarios no puede tener mas de 500 caracteres. Usted ha introducido "+txarea.length+" caracteres");
		campo.mensaje.focus();}
  else {
      campo.submit();
      }
    }  


function marcar(campo,valor)
{
for(var i=0; i < campo.length ;i++)
	if (campo.elements[i].id==valor) 
		campo.elements[i].checked=true;
}
function desmarcar(campo,valor)
{
for(var i=0; i < campo.length ;i++)
	if (campo.elements[i].id==valor) 
		campo.elements[i].checked=false;
}


function algun(campo,valor)
{var i
for(i=0; i < campo.length ;i++)
	if ((campo.elements[i].id==valor) && (campo.elements[i].checked==true))
		{
		i=campo.length + 5;
		}
		
if (i>campo.length)
	campo.submit();
else
	alert('Debes marcar alguna casilla');
}


function validar(campo)
{
	for(var i=0; i < campo.length ;i++)
	{
	if ( (campo.elements[i].value.replace(/ /g,"")=="") && (campo.elements[i].id=="1")   )
			{ 
			alert("El campo "+ campo.elements[i].name +" no puede estar vacío");
			campo.elements[i].focus();
			i=campo.length+2;
			}
	}

	if(i==campo.length)
		campo.submit()

}

function cambiamail (buzon)
{
var res = "";
for (var n = 0; n < buzon.length; n++)
res += String.fromCharCode(buzon.charCodeAt(n));
if (res.indexOf('@') < 0)
res = res + '@' + 'conferenzias.com';
location = "mail" + "to:" + res;
}


function validarusuario(campo)
{
if (campo.correo==null) 
	var str=campo.email.value.replace(/ /g,"")
else
{	
	campo.correo.value=campo.correo.value.replace(/ /g,"")
	var str=campo.correo.value
}
var filter=/^.+@.+\..{2,4}$/
if (filter.test(str))
	{
	for(var i=0; i < campo.length ;i++)
	{
	if ( (campo.elements[i].value.replace(/ /g,"")=="") && (campo.elements[i].id=="1")   )
			{ 
			alert("El campo "+ campo.elements[i].name +" no puede estar vacío");
			campo.elements[i].focus();
			i=campo.length+2;
			}
	}

	if(i==campo.length)
		campo.submit()
	
	}
else{
	alert("Por favor, introduzca una dirección de E-Mail existente")
	campo.correo.focus();	
	}
}


function haz_tamano()
{
window.resizeTo(320,300);
}


function quitacomillas(DnEvents) 
{


var navegador = navigator.appName;
if (navegador == "Microsoft Internet Explorer")
	k = (document.layers) ? DnEvents.which : window.event.keyCode;
else
	k = (document.layers) ? DnEvents.which : DnEvents.keyCode;

if ((k == 34)|| (k == 39)) 
return false; 
else 
return true; 
} 
document.onkeypress = quitacomillas; 


function compruebanum( valor_1,valor_2 ) {
var aceptar=1
for(var i=0; i < valor_1.length; i++)
	{
		var ch=valor_1.substring(i, i + 1)
		if ((ch < "0" || "9" < ch))
 
			{
			aceptar=0;
			}
	}
if(aceptar==0){
	alert("Debe introducir un valor entero y sin puntos.");
	valor_2.value="";
	valor_2.focus();
}
	return true;
}

function compruebanum1( valor_1,valor_2,valor_3 ) {
var aceptar1=1
for(var i=0; i < valor_1.length; i++)
	{
		var ch=valor_1.substring(i, i + 1)
		if (((ch < "0" || "9" < ch) && ch!=","))
 
			{
			aceptar1=0;
			}
	}
if(aceptar1==0){
	alert("Debe introducir el valor en Euros, sin puntos y separado por coma.");
	valor_2.value="";
	valor_2.focus();
}
	valor_1=valor_1.replace(",",".")
	valor_3.value=Math.round(valor_1*166.386);
	return true;
}


function ContarTexto( texto, salida, max ) {
   if (texto.value.length >	max) texto.value = texto.value.substr(0,max); salida.value = max - texto.value.length;
}

//Funcion para elegir el combo
function doSel(obj)
 {
 
     for (i = 0; i < obj.length; i++)
	    if (obj[i].selected == true)
           eval(obj[i].value);
}

function registrar_onclick()
{
if(document.form1.usuario.value=="" || document.form1.clave.value=="" || document.form1.email.value=="")
{
	alert("Debe rellenar todos los campos marcados con asterisco rojo.");
	document.form1.usuario.focus();	
}
else
{
    if (document.form1.pais.value=="")
    {
		alert("Debe rellenar el país de residencia");
		document.form1.pais.focus();
	}
	else 
	{
		if(document.form1.pais.value=="España" && (document.form1.provincia.value=="") )
		{
			alert("Debe rellenar la provincia");
			document.form1.provincia.focus();	
		}
		else{document.form1.submit();}
	}
}
}

function compruebanum_onchange( valor_1,valor_2 ) {
var aceptar=1
for(var i=0; i < valor_1.length; i++)
	{
		var ch=valor_1.substring(i, i + 1)
		if ((ch < "0" || "9" < ch))
 
			{
			aceptar=0;
			}
	}
if(aceptar==0){
	alert("En el Código Postal debe introducir un valor entero y sin puntos.");
	valor_2.value="";
	valor_2.focus();
}
	return true;
}

function checkemail(campo)
{
	campo.value=campo.value.replace(/ /g,"")
	var str=campo.value
	var filter=/^.+@.+\..{2,4}$/
	if(str!="")
	if (!filter.test(str))
	{
		alert("Por favor, introduzca una dirección de E-Mail existente")
		campo.focus();	
	}
}

function entrar_onclick() {
if(document.form2.usuario.value=="" || document.form2.clave.value==""){
	alert("Debe introducir su Usuario y Password");
	document.form2.usuario.focus();
}else{
	document.form2.submit();
}}

function buscar1_onclick(form,caja){
if(caja==""){
	alert("La búsqueda debe contener al menos 3 caracteres.");
}else{
	var buscar=caja
	
	for(i=0;i<10;i++)
		buscar=buscar.replace(" ","");
			

		if (buscar.length<=2){
			alert("La búsqueda debe contener al menos 3 caracteres.");
		}else{
			form.submit();
		}}
}

function enviar_onclick() {
if(document.form1.nombreempresa.value=="" || document.form1.personacontacto.value=="" || document.form1.telefono.value==""){
	alert("Debe rellenar todos los campos marcados.");
	document.form1.nombreempresa.focus();	
}else{
	document.form1.submit();
}}

var parametros1 = "toolbar=1;menubar=1;status=1;resizable=1;maximize=1;center=1;minimize=0"
var cnt1=0;
var wnd1;

function abrir_ventana(pagina2,ancho,alto)
{
cnt1++;
wnd1=open(pagina2, "gl"+cnt1, "width="+ancho+",height="+alto+",left=50,top=150,screenX=50,screenY=150");
}

function validarpais(form1,camprovincia,camregion,obligatorio)
{
if ((form1.pais.value!="España") && (form1.pais.value!=""))
{
	camprovincia.selectedIndex=55;
	camregion.id=obligatorio;
	camprovincia.id=0;
}
else 
if (form1.pais.value=="España")
{
	if (camregion!="")
	  {
		camregion.id=0;
	  }
	camprovincia.id=obligatorio;
}
else
{
	camprovincia.selectedIndex=0;
	camregion.value="";
}

}





function enviardatosalta1_onclick(){

if(document.form1.curso.value=="" || document.form1.tipoev.selectedIndex==0 || document.form1.tipo.selectedIndex==0)
	{
		alert("Debe rellenar todos los campos obligatorios.");
	}
else
	{	
		document.form1.submit();
    }
}


function enviardatosalta2_onclick(){
		document.form1.submit();
}

function pruebavalidar(campo)
{
 
	campo.submit();

}

function quitarcomilla(c)
{
 var buscar=c.value;
 c.value=buscar.replace("'","´");
}

function pruebacheckemail(campo,formu)
{
	campo.value=campo.value.replace(/ /g,"")
	var str=campo.value
	var filter=/^.+@.+\..{2,4}$/
	if(str!="")
	if (!filter.test(str))
		{
		formu.action="";
		formu.error.value="email";
		formu.submit();
		}
}

function pruebacompruebatextarea(campo,formulario)
{
var txarea=campo.value
if (txarea.length>500)
{
      formulario.action = "";
      formulario.error.value=campo.name;
      formulario.submit();
}
} 
