function fecha ()
{
	/*Fecha*/
	var fech = "";	//Global
	var mydate=new Date();
	var year=mydate.getYear();
	if (year < 1000)
	year+=1900;
	var day=mydate.getDay();
	var month=mydate.getMonth();
	var daym=mydate.getDate();
	if (daym<10)
	daym="0"+daym;
	var dayarray=new Array("D.","L.","M.","X.","J.","V.","S.");
	var montharray=new Array("Ene.","Feb.","Mar.","Abr.","May.","Jun.","Jul.","Ago.","Sep.","Oct.","Nov.","Dic.");
	fech = dayarray[day]+" "+daym+"/"+montharray[month]+"/"+year;
	return fech;
	/*fin fecha*/
}
function confirmar()
{
	if (confirm('¿Está Ud. seguro que desea eliminar el registro seleccionado?'))
		return true;
	else
		return false;
}
	function cambiaFondo (objeto,color,semaforo)
	{
		if (semaforo == 0)
		{
			objeto.style.cursor = "hand";
			objeto.bgColor = color;
		}
		else
			{
				objeto.style.cursor = "hand";				
				objeto.bgColor = "d8EFF5";
			}
	}
	
function abrirVentana(urlpage, name, vwidth, vheight)
{
     window.open(""+urlpage+"",""+name+"","scrollbars=no,resizable=no,width="+vwidth+",height="+vheight+"");
}
function verImg(urlpage, name, vwidth, vheight,ruta)
{
<!--
     winImagen = window.open(""+urlpage+"",""+name+"","scrollbars=no,resizable=no,width="+vwidth+",height="+vheight+"");
	 winImagen.document.write("<html><head><title>Chiclana Natural S.A. - Visor Imágenes --</title></head><body bgcolor='#990000' leftmargin='0' topmargin='0' marginwidth='0' marginheight='0' >");
	 winImagen.document.write("<img src="+ruta+" width="+vwidth+" height="+vheight+"></body></html>");
	 winImagen.document.close();
//-->
}
function capas(esconde,muestra)
{

	if (document.getElementById)
						{
							if (esconde != "void")
					 			document.getElementById(esconde).style.visibility = 'hidden'							
					 		if (muestra != "void")
					 		document.getElementById(muestra).style.visibility = 'visible'
						}
					else
						if (document.layers)
							{
								if (esconde != "void")	
									document.esconde.visibility = 'hidden'
								if (muestra != "void")
									document.muestra.visibility = 'visible'
							}
}

function compruebanif(campo,tipopersona)
{
	var valornif = campo.value;
	if (valornif != "")
	{
		documento = 1;
		switch (documento)
		{
			case 1:
					var letras = 'TRWAGMYFPDXBNJZSQVHLCKE';
					var letraintroducida = valornif.substring(valornif.length-1,valornif.length);
					var nif = valornif.substring(0,valornif.length-1);
					var numero = nif%23;
					var letrabuena = letras.substring(numero,numero+1);
					if (letraintroducida.toUpperCase() != letrabuena)
						{
							alert('Compruebe la letra del nif que ha especificado.');
	//							campo.focus();
							return false;
						} break;
			case 2: if (!/^[a-zA-Z]\d{8}$/.test(valornif))
						{
							alert("El número de documento introducido no es válido.");
	//							campo.focus();
							return false;
						}
					break;
		}
	}
	else
		alert('Ha dejado el NIF/CIF en blanco. Rellénelo por favor.');
}
function cambiaboton(boton,caja_verificacion) {
	if (caja_verificacion.checked != true) {
		alert("Si no acepta la política de protección de datos no procede enviar el formulario. Disculpe las molestias.");
		boton.disabled = true;
		}
	else
		boton.disabled = false;
}
