function showImage(img, wi, he){		
		// if (wi > he){
			// var w = 470;
			// var h = 320;	
		// }else if (he > wi){
			// var w = 320;
			// var h = 470;	
		// }else{
			// var w = 470;
			// var h = 320;	
		// }
	
		if (wi < 1) {
			var w = 600;
			var h = 400;
		}
		else {
			var w = wi;
			var h = he;
		}
		var winl = (screen.width - w) / 2;
		var wint = ((screen.height - h) / 2) - 25; // - 40 aadido por mi para evitar que la imagen quede por debajo de la barra de tareas
		//alert("alto: " + wint + " /// ancho: " + winl);
		var sizer;
  	if (document.all)
			sizer=window.open('','Imagenes','left='+winl+',top='+wint+',width='+w+',height='+h+',scrollbars=no,fullscreen=no');
		else
			sizer=window.open(img,'img','width='+w+',height='+h+',left='+winl+',top='+wint+',menubar=no,status=no,scrollbars=no,location=no,fullscreen=no,directories=no,resizable=yes');
			sizer.document.write('<html><body style="text-align:center; margin:0px;">');
			sizer.document.write('<div style="margin: 0px auto;"><img src="'+img+'" onClick="window.close();" /></div>');			
			sizer.document.write('</body></html>');
}

// function MostrarTeamList(secc){
	// var iduser = document.getElementById("user")[document.getElementById("user").selectedIndex].value;
	// document.location.href="teamList.php?secc="+secc+"&user="+iduser;
// }

function MostrarTeamList(id){
	var iduser = document.getElementById(id)[document.getElementById(id).selectedIndex].value;
	document.location.href="team.php?idper="+iduser;
}

/*
function MostrarTeamList(){
	var iduser = document.getElementById("select_artista")[document.getElementById("select_artista").selectedIndex].value;
	document.location.href="team.php?idper="+iduser;
}
*/

function MostrarArtista(){
	var artista = document.getElementById("select_artista")[document.getElementById("select_artista").selectedIndex].value;
	document.location.href="artists.php?idcon="+artista;
}


function MostrarYAV() {
	var artista = document.getElementById("select_artista")[document.getElementById("select_artista").selectedIndex].value;
	document.location.href="yav.php?idcon="+artista;
}

function showReproductores(){	 
	var w =390;
	var h=393;
	var winl = (screen.width - w) / 2;
	var wint = ((screen.height - h) / 2) - 25; // - 40 aadido por mi para evitar que la imagen quede por debajo de la barra de tareas
	var sizer;
	if (document.all)
		sizer=window.open('reproductores.php','Reproductores','left='+winl+',top='+wint+',width='+w+',height='+h+',scrollbars=no,fullscreen=no,status=yes');
	else
		sizer=window.open('reproductores.php','Reproductores','width='+w+',height='+h+',left='+winl+',top='+wint+',menubar=no,status=yes,scrollbars=no,location=no,fullscreen=no,directories=no,resizable=yes');
}

function enviar_form_select(){
	//alert(id);
	document.form_select.submit();
}

//////////////////////////////////////////////////////////////////////

function enviarFormulario(formulario)
{
	//formulario=document.getElementById(id_formulario);

	if(formulario.nick.value=="")
	{
		alert('Debe especificar un nombre de usuario');
		formulario.nick.focus();
		return false;
	}
	
	
	pas1=formulario.contra.value;
	pas2=formulario.contra2.value;
	if (pas1 != pas2 || pas1=="" || pas2=="") {
		alert ('Las dos passwords no coinciden');
		formulario.contra.focus();
		return false;
	}
		
	if(formulario.nombre.value=="")
	{
		alert('Debe indicar su nombre');
		formulario.nombre.focus();
		return false;
	}	
		
	if(formulario.apellido1.value=="")
	{
		alert('Debe indicar su primer apellido');
		formulario.apellido1.focus();
		return false;
	}
	
	if(formulario.telefono.value=="")
	{
		alert('Indique un numero de telefono');
		formulario.telefono.focus();
		return false;
	}
	
	email=formulario.mail.value;
	if( !comprobarCorreo(email) || comprobarCorreo(email)==0)
	{
		alert('Formato de correo electronico incorrecto.');
		formulario.mail.focus();
		return false;
	}
	
	if(formulario.localidad.value=="")
	{
		alert('Debe indicar su localidad');
		formulario.localidad.focus();
		return false;
	}
	
	if(formulario.provincia.value=="")
	{
		alert('Debe indicar su provincia');
		formulario.provincia.focus();
		return false;
	}
	
	if(formulario.direccion.value=="")
	{
		alert('Debe indicar su domicilio');
		formulario.direccion.focus();
		return false;
	}
	
	if(formulario.cp.value=="")
	{
		alert('Debe indicar su codigo postal');
		formulario.cp.focus();
		return false;
	}
	
	if(formulario.nif.value=="")
	{
		alert('Introduzca su DNI o el CIF de la empresa');
		formulario.nif.focus();
		return false;
	}

	//cod_provincia=formulario.provincia.value;
	//if(!comprobarCP(cp,cod_provincia))

		
	//formulario.submit();	
	return true;

}

function comprobarCorreo(correoe)
{
	
	//Formato de direccion de correo electronico
	var plantilla = /^[a-z][a-z-_0-9.]+@[a-z-_=>0-9.]+.[a-z]{2,3}$/i
	
	//Compara "correoe" con el formato "plantilla" y si coincide devuelve verdadero si no devuelve falso
	return (plantilla.test(correoe)) ? 1 : 0
}

//////////////////////////////////////////////
function abrir_ventana(ruta,nombre,ancho,alto)
{			
	var parametros="width=" + ancho + ", height=" + alto + ", resizable=yes";
	
	ventana=window.open(ruta,"",parametros);

	var xoffset=ventana.parent.screenX;
	if(xoffset==undefined)
		xoffset=ventana.opener.screenLeft;
		
	var yoffset=ventana.parent.screenY;
	if(yoffset==undefined)
		yoffset=ventana.opener.screenTop;
		
	var pancho=ventana.opener.innerWidth;
	if(pancho==undefined)
		pancho=document.body.clientWidth;
		
	var palto=ventana.opener.innerHeight;
	if(palto==undefined)
		palto=screen.height;
		
	var x_pos=xoffset + ((pancho-ancho)/2);
	var y_pos=yoffset + ((palto-alto)/2);
	
	ventana.moveTo(x_pos,y_pos);
}

///////////////////////////////
function comprobar_form(f) {
	if (f.nombre.value == "") {
		alert("Debe indicar su nombre.");
		f.nombre.focus();
		return false;
	}
	
	if (f.ap1.value == "") {
		alert("Debe indicar su primer apellido.");
		f.ap1.focus();
		return false;
	}
	
	if (f.telefono.value == "") {
		alert("Debe indicar un teléfono de contacto.");
		f.telefono.focus();
		return false;
	}
	
	if (f.mail.value == "") {
		alert("Debe indicar una dirección de correo electrónico de contacto.");
		f.mail.focus();
		return false;
	}
	return true;
}
