// JavaScript Document
var photosm=new Array();

for(p=2;p<10;p++)
{	photosm[p]=new Image();
}

for(p=2;p<10;p++)
{	photosm[p].src=("images/menu/"+ p + "o.jpg");}

function ponerM(donde,a)
{
	document.images[donde].src=photosm[a].src;
}
function sacarM(donde,q)
{
	document.images[donde].src="images/menu/"+q;
}

function ponerC(donde,a)
{
	document.images[donde].src=a;
}
function sacarC(donde,q)
{
	document.images[donde].src=q;
}
function validando()
{var n=0
var vec = new Array('nombre','apellido','dni','email','localidad','direccion','provincia','tel')
for ( var i=0; i<8;i++){
	if(document.all[vec[i]].value=='' || document.all[vec[i]].value=='campo requerido' || document.all[vec[i]].value== 'dirección de email invalida')
	{	document.all[vec[i]].value="campo requerido"
		document.all[vec[i]].style.color="#ff0000"
		n++
	}
	else{ 
			document.all[vec[i]].style.color="#333333"
			if(vec[i]=='email')//if(document.all['email'].value!='' && document.all[vec[i]].value!='REQ')
			{
				if ((document.all['email'].value.indexOf("@") == -1) || (document.all['email'].value.charAt(0) == ".") || (document.all['email'].value.charAt(0) == "@") || (document.all['email'].length < 6) || (document.all['email'].value.indexOf(".") == -1) || (document.all['email'].value.charAt(document.all['email'].value.indexOf("@")+1) == ".") || (document.all['email'].value.charAt(document.all['email'].value.indexOf("@")-1) == ".")) { 
					document.all['email'].value = 'dirección de email invalida'
					document.all['email'].style.color="#ff0000"
					n++
		 		}
			}
		}
}
	if(document.all['tipo_dni'].value==''){
		if(n==0){
			alert("El tipo de decomuento es obligatorio.");
		}
		n=1;
	}
	if(n==0){ return true
	}else{ return false}
}
function val(){
	if(document.all['tarjeta'].value==''){
		alert("Por favor, seleccione que tarjeta de crédito desea utilizar.");
		return false;
	}else{
		return true;
	}

}

function borrar(obj)
{
	if(obj.value== 'campo requerido' || obj.value== 'dirección de email invalida'){ obj.value =''
	obj.style.color="#000000"}
}
