//Función de contról del menú
function menu(id,oForm)
{
	if (id!="")
	{
		document.location=id;
	}
}
var nav4 = window.Event ? true : false;
function acceptNum(evt)
{     
	var key = nav4 ? evt.which : evt.keyCode;
	return (key <= 13 || (key >= 48 && key <= 57));
}
function validarfechas()
{
	campohora = document.getElementById("horaentradajs");
	horafinal = document.getElementById("horasalidajs");
	horaasp = document.getElementById("horaentrada");
	fechaentradaasp = document.getElementById("fechaddmmaaaa");
	var fechahora=new Date();
	var horaactual=fechahora.getHours();
	var minutoactual=fechahora.getMinutes();
	entrada=campohora.value;
	entradaasp=horaasp.value;
	fechaasp=fechaentradaasp.value;
	horaentrada=entrada.substring(0,2);
	minutoentrada=entrada.substring(3,5);
	horaentradaasp=entradaasp.substring(0,2);
	minutoentradaasp=entradaasp.substring(3,5);
	diaasp=fechaasp.substring(0,2);
	mesasp=fechaasp.substring(3,5);
	anyoasp=fechaasp.substring(6,10);
	if (horaactual<horaentrada)
	{
		return false;
	}
	else
	{
		if (horaactual==horaentrada)
		{
			if (minutoactual<minutoentrada)
			{
				return false;
			}
			else
			{
				//alert("Minutoactual: "+minutoactual);
				//alert("Minutoentrada: "+minutoentrada);
				//alert("Minutoentradaasp Antes: "+minutoentradaasp);
				sumaminutos=parseInt(minutoactual)-parseInt(minutoentrada);
				//alert("Sumaminutos: "+sumaminutos);
				minutoentradaasp=parseInt(minutoentradaasp)+parseInt(sumaminutos);
				//alert("Minutoentradaasp Despues: "+minutoentradaasp);
				sumahoras=0;
				if (minutoentradaasp>=60)
				{
					minutoentradaasp=parseInt(minutoentradaasp)-60;
					sumahoras=parseInt(sumahoras)+1;
				}
				if (minutoentradaasp>=60)
				{
					minutoentradaasp=parseInt(minutoentradaasp)-60;
					sumahoras=parseInt(sumahoras)+1;
				}
				//alert("Sumahoras: "+sumahoras);
				horaentradaasp=parseInt(horaentradaasp)+parseInt(sumahoras);
				//alert("Horaentradaasp: "+horaentradaasp);
				if (minutoentradaasp<10)
					minutoentradaasp="0"+minutoentradaasp;
				if (horaentradaasp<10)
					horaentradaasp="0"+horaentradaasp;
				horadefinitiva=horaentradaasp+"."+minutoentradaasp;
				horafinal.value=horadefinitiva;
				//alert("Hora Anterior: "+entradaasp);
				//alert("Hora Definitiva: "+horadefinitiva);
				return true;
			}
		}
		else
		{
			if (minutoactual<minutoentrada)
			{
				sumaminutos=60-parseInt(minutoentrada);
				sumaminutos=parseInt(sumaminutos)+parseInt(minutoactual);
				sumahoras=0;
				horaentradaasp=parseInt(horaentradaasp)+parseInt(sumahoras);
				if (minutoentradaasp<10)
					minutoentradaasp="0"+minutoentradaasp;
				if (horaentradaasp<10)
					horaentradaasp="0"+horaentradaasp;
				horadefinitiva=horaentradaasp+"."+minutoentradaasp;
				horafinal.value=horadefinitiva;
				return true;
			}
			else
			{
				sumaminutos=60-parseInt(minutoentrada);
				sumaminutos=parseInt(sumaminutos)+parseInt(minutoactual);
				sumahoras=parseInt(horaactual)-parseInt(horaentrada);
				if (sumaminutos>=60)
				{
					sumaminutos=parseInt(sumaminutos)-60;
					sumahoras=parseInt(sumahoras)+1;
				}
				if (sumaminutos>=60)
				{
					sumaminutos=parseInt(sumaminutos)-60;
					sumahoras=parseInt(sumahoras)+1;
				}
				minutoentradaasp=parseInt(minutoentradaasp)+parseInt(sumaminutos);
				if (minutoentradaasp>=60)
				{
					minutoentradaasp=parseInt(minutoentradaasp)-60;
					sumahoras=parseInt(sumahoras)+1;
				}
				if (minutoentradaasp>=60)
				{
					minutoentradaasp=parseInt(minutoentradaasp)-60;
					sumahoras=parseInt(sumahoras)+1;
				}
				horaentradaasp=parseInt(horaentradaasp)+parseInt(sumahoras);
				if (minutoentradaasp<10)
					minutoentradaasp="0"+minutoentradaasp;
				if (horaentradaasp<10)
					horaentradaasp="0"+horaentradaasp;
				horadefinitiva=horaentradaasp+"."+minutoentradaasp;
				horafinal.value=horadefinitiva;
				return true;
			}
		}
	}
}
function fechatope(hmax, fechamax)
{
	fechatop = document.getElementById("fechasorteomax");
	fechaentrada = document.getElementById("fechaddmmaaaa");
	horafinal = document.getElementById("horasalidajs");
	fechaent=fechaentrada.value;
	//alert("fechaEnt : "+fechaent);
	fechamax=fechatop.value;
	//alert("fechaMax : "+fechamax);
	horadefinitiva=horafinal.value;
	//alert("HoraDefinitiva : "+horadefinitiva);
	diaent=fechaent.substring(0,2);
	mesent=fechaent.substring(3,5);
	anyoent=fechaent.substring(6,10);
	diamax=fechamax.substring(0,2);
	mesmax=fechamax.substring(2,4);
	anyomax=fechamax.substring(4,8);
	horadef=horadefinitiva.substring(0,2);
	//alert("HoraDef : "+horadef);
	if (anyoent>anyomax)
	{
		alert("JUEGO INACTIVO. SOBREPASADA FECHA MAXIMA DE SORTEO.");
		return false;
	}
	else
	{
		if (anyoent<anyomax)
		{
			return true;
		}
		else
		{
			if (mesent>mesmax)
			{
				alert("JUEGO INACTIVO. SOBREPASADA FECHA MAXIMA DE SORTEO.");
				return false;
			}
			else
			{
				if (mesent==mesmax)
				{
					if (diaent>diamax)
					{
						alert("JUEGO INACTIVO. SOBREPASADA FECHA MAXIMA DE SORTEO.");
						return false;
					}
					else
					{
						if (diaent==diamax)
						{
							if (horadef>=hmax)
							{
								alert("JUEGO INACTIVO. SOBREPASADA HORA MAXIMA EN DIA DE SORTEO.");
								return false;
							}
							else
							{
								return true;
							}
						}
						else
						{
							return true;
						}
					}
				}
				else
				{
					return true;
				}
			}
		}
	}
}
//compra de loteria
function lotto(concepto, precio, quiere, ventas, stock)
{
	stock=stock-ventas;
	if (quiere>stock)
	{
		alert("EL STOCK DEL NUMERO SELECCIONADO ES INFERIOR AL SOLICITADO \n ACTUALMENTE DISPONEMOS DE "+stock+" UNIDADES");
		return false;
	}
	else
	{
		numero=concepto.substring(concepto.length-5, concepto.length);
		dolar=concepto.indexOf('$');
		inter=concepto.indexOf('?');
		fecha=concepto.substring(dolar+1, inter);
		existe=compruebabasket(numero, fecha);
		if (existe!="NO")
		{
			existeint=parseInt(existe);
			quiereint=parseInt(quiere);
			totalquiere=eval(existeint+quiereint);
			if (totalquiere>stock)
			{
				alert("DISPONE DE "+existe+" DECIMOS DE ESTE NUMERO Y SORTEO ACTUALMENTE EN SU CARRITO \n SU NUEVA SOLICITUD SUPERA NUESTRO STOCK QUE ES DE "+stock+" UNIDADES");
				return false;
			}
			else
			{
				buyItem(concepto, precio, quiere);
			}
		}
		else
		{
			buyItem(concepto, precio, quiere);
		}
	}
}
function penass(concepto, precio, quiere, ventas, stock)
{
	stock=stock-ventas;
	if (quiere>stock)
	{
		alert("EL STOCK DE LA PEÑA SELECCIONADA ES INFERIOR AL SOLICITADO \n ACTUALMENTE DISPONEMOS DE "+stock+" UNIDADES");
		return false;
	}
	else
	{
		numero=concepto.substring(concepto.length-5, concepto.length);
		dolar=concepto.indexOf('$');
		inter=concepto.indexOf('?');
		fecha=concepto.substring(dolar+1, inter);
		existe=compruebabasket(numero, fecha);
		if (existe!="NO")
		{
			existeint=parseInt(existe);
			quiereint=parseInt(quiere);
			totalquiere=eval(existeint+quiereint);
			if (totalquiere>stock)
			{
				alert("DISPONE DE "+existe+" PARTICIPACIONES DE ESTA PEÑA ACTUALMENTE EN SU CARRITO \n SU NUEVA SOLICITUD SUPERA NUESTRO STOCK QUE ES DE "+stock+" UNIDADES");
				return false;
			}
			else
			{
				buyItem(concepto, precio, quiere);
			}
		}
		else
		{
			buyItem(concepto, precio, quiere);
		}
	}
}
function compruebabasket(num, fech) 
{
	index = document.cookie.indexOf("TheBasket");
	countbegin = (document.cookie.indexOf("=", index) + 1);
   	countend = document.cookie.indexOf(";", index);
   	if (countend == -1) 
	{
       	countend = document.cookie.length;
	}
	fulllist = document.cookie.substring(countbegin, countend);
	totprice = 0;
	itemlist = 0;
	decimos=0;
	for (var i = 0; i <= fulllist.length; i++) 
	{
		if (fulllist.substring(i,i+1) == '[') 
		{
			itemstart = i+1;
		}
		else if (fulllist.substring(i,i+1) == ']') 
		{
			itemend = i;
			thequantity = fulllist.substring(itemstart, itemend);
			itemtotal = 0;
			itemtotal = (eval(theprice*thequantity));
			temptotal = itemtotal * 100;
			var tax = itemtotal / 100 * (16 - 0);
    		tax = Math.floor(tax * 100)/100
			totprice = totprice + itemtotal;// + tax;
			itemlist=itemlist+1;
			numero=theitem.substring(theitem.length-6, theitem.length-1);
			dolar=theitem.indexOf('$');
			inter=theitem.indexOf('?');
			fecha=theitem.substring(dolar+1, inter);
			juego=theitem.substring(1, 6);
			if (numero==num && fecha==fech)
			{
				cantidadint=parseInt(thequantity);
				decimosint=parseInt(decimos);
				decimos=eval(decimosint+cantidadint);
			}
		}
		else if (fulllist.substring(i,i+1) == ',') 
		{
			theitem = fulllist.substring(itemstart, i);
			itemstart = i+1;
		}
		else if (fulllist.substring(i,i+1) == '#') 
		{
			theprice = fulllist.substring(itemstart, i);
			itemstart = i+1;
		}
	}
	if (decimos=="0")
	{
		return "NO";
	}
	else
	{
		return decimos;
	}
}
//Carrito de la compra funciones Agregar y vaciar carrito
function buyItem(newItem, newPrice, newQuantity)
{
	if (newQuantity <= 0) 
	{
		rc = alert('La cantidad ingresada es incorrecta');
		return false;
	}
	//alert('----'+newQuantity+' '+newItem+' '+newPrice+'----');
	//if (confirm('¿Agregar '+newQuantity+' '+newItem+' al carrito?')) 
	if (confirm('¿AGREGAR ESTA APUESTA A SU CARRITO?')) 
	{
		index = document.cookie.indexOf("TheBasket");
		countbegin = (document.cookie.indexOf("=", index) + 1);
		countend = document.cookie.indexOf(";", index);
		if (countend == -1) 
		{
				countend = document.cookie.length;
		}
		document.cookie="TheBasket="+document.cookie.substring(countbegin, countend)+"["+newItem+"|,"+newPrice+"|#"+newQuantity+"]";
		//recarga la pagina despues de hacer una compra
		window.location.reload();
	}
	return true;
}
function resetShoppingBasket() 
{
	index = document.cookie.indexOf("TheBasket");
	document.cookie="TheBasket=.";
}
function alterError(value) 
{
	if (value<=0.99) 
	{
		newPounds = '0';
	}
	else
	{
		newPounds = parseInt(value);
	}
	newPence = parseInt((value+.0008 - newPounds)* 100);
	if (eval(newPence) <= 9) newPence='0'+newPence;
	newString = newPounds + '.' + newPence;
	return (newString);
}
function showItems() 
{
	index = document.cookie.indexOf("TheBasket");
	countbegin = (document.cookie.indexOf("=", index) + 1);
   	countend = document.cookie.indexOf(";", index);
   	if (countend == -1) 
	{
       	countend = document.cookie.length;
	}
	fulllist = document.cookie.substring(countbegin, countend);
	totprice = 0;
	document.writeln('<form><table border="1" cellspacing="0" width="640" bgcolor="#E0E0E0" bordercolor="#FFFFFF" class="td">');
	document.writeln('<TR><TD width="250"><b>Producto</b></TD><TD width="80" align="right"><b>Cantidad</b></TD><TD width="120" align="right"><b>Costo x unidad</b></TD><td width="100" align="right"><b>Costo total</b><TD width="90">&nbsp;</TD></TR>');
	itemlist = 0;
	for (var i = 0; i <= fulllist.length; i++) 
	{
		if (fulllist.substring(i,i+1) == '[') 
		{
			itemstart = i+1;
		}
		else if (fulllist.substring(i,i+1) == ']') 
		{
			itemend = i;
			thequantity = fulllist.substring(itemstart, itemend);
			itemtotal = 0;
			itemtotal = (eval(theprice*thequantity));
			temptotal = itemtotal * 100;
			var tax = itemtotal / 100 * (16 - 0);
    		tax = Math.floor(tax * 100)/100
			totprice = totprice + itemtotal;// + tax;
			itemlist=itemlist+1;
			document.writeln('<tr><td>'+theitem+'</td><td align=right>'+thequantity+'</td><td align=right>'+theprice+'</td><td align=right>'+alterError(itemtotal)+'</td><td align=center><input TYPE="button" NAME="remove" VALUE="Quitar" onclick="javascript:removeItem('+itemlist+')"></td></tr>');
		}
		else if (fulllist.substring(i,i+1) == ',') 
		{
			theitem = fulllist.substring(itemstart, i);
			itemstart = i+1;
		}
		else if (fulllist.substring(i,i+1) == '#') 
		{
			theprice = fulllist.substring(itemstart, i);
			itemstart = i+1;
		}
	}
	document.writeln('<tr><td colspan=3><b>Impuestos</b></td><td align=right>16%</td><td>&nbsp;</td></tr>');
	document.writeln('<tr><td colspan=3><b>Total</b></td><td align=right>'+alterError(totprice)+'</td><td>&nbsp;</td></tr>');
	document.writeln('</TABLE>');
}
//Muestra el total de lo que hay en el carrito de la compra. Forma parte del Menu horizontal de la cabecera
function showTotalP() 
{
	index = document.cookie.indexOf("TheBasket");
	countbegin = (document.cookie.indexOf("=", index) + 1);
   	countend = document.cookie.indexOf(";", index);
   	if (countend == -1) 
	{
       	countend = document.cookie.length;
	}
	fulllist = document.cookie.substring(countbegin, countend);
	totprice = 0;
	itemlist = 0;
	for (var i = 0; i <= fulllist.length; i++) 
	{
		if (fulllist.substring(i,i+1) == '[') 
		{
			itemstart = i+1;
		}
		else if (fulllist.substring(i,i+1) == ']') 
		{
			itemend = i;
			thequantity = fulllist.substring(itemstart, itemend);
			itemtotal = 0;
			itemtotal = (eval(theprice*thequantity));
			temptotal = itemtotal * 100;
			var tax = itemtotal / 100 * (16 - 0);
    		tax = Math.floor(tax * 100)/100
			totprice = totprice + itemtotal;// + tax;
			itemlist=itemlist+1;
			alterError(itemtotal);
		}
		else if (fulllist.substring(i,i+1) == ',') 
		{
			theitem = fulllist.substring(itemstart, i);
			itemstart = i+1;
		}
		else if (fulllist.substring(i,i+1) == '#') 
		{
			theprice = fulllist.substring(itemstart, i-1);
			itemstart = i+1;
		}
	}
	if (alterError(totprice)=="0.00")
		document.writeln('<b>Carrito Vacio</b></td><td>&nbsp;</td><td>');
	else
		document.writeln('<b>'+alterError(totprice)+' €</b></td><td width="16">&nbsp;</td><td width="82" align="left"><a href="estado.asp" target="_self"><span class="dia2">VER CARRITO</span></a>');
}
//Muestra el total de lo que hay en el carrito de la compra. Forma parte de la pagina de Pagar
function showTotalPC() 
{
	index = document.cookie.indexOf("TheBasket");
	countbegin = (document.cookie.indexOf("=", index) + 1);
   	countend = document.cookie.indexOf(";", index);
   	if (countend == -1) 
	{
       	countend = document.cookie.length;
	}
	fulllist = document.cookie.substring(countbegin, countend);
	totprice = 0;
	itemlist = 0;
	for (var i = 0; i <= fulllist.length; i++) 
	{
		if (fulllist.substring(i,i+1) == '[') 
		{
			itemstart = i+1;
		}
		else if (fulllist.substring(i,i+1) == ']') 
		{
			itemend = i;
			thequantity = fulllist.substring(itemstart, itemend);
			itemtotal = 0;
			itemtotal = (eval(theprice*thequantity));
			temptotal = itemtotal * 100;
			var tax = itemtotal / 100 * (16 - 0);
    		tax = Math.floor(tax * 100)/100
			totprice = totprice + itemtotal;// + tax;
			itemlist=itemlist+1;
			alterError(itemtotal);
		}
		else if (fulllist.substring(i,i+1) == ',') 
		{
			theitem = fulllist.substring(itemstart, i);
			itemstart = i+1;
		}
		else if (fulllist.substring(i,i+1) == '#') 
		{
			theprice = fulllist.substring(itemstart, i-1);
			itemstart = i+1;
		}
	}
	document.writeln('<b>'+alterError(totprice)+' €</b>');
}
//Muestra el precio del carrito sumado a los portes. Pagina de Pagar
function showTotalPCYP() 
{
	index = document.cookie.indexOf("TheBasket");
	countbegin = (document.cookie.indexOf("=", index) + 1);
   	countend = document.cookie.indexOf(";", index);
   	if (countend == -1) 
	{
       	countend = document.cookie.length;
	}
	fulllist = document.cookie.substring(countbegin, countend);
	totprice = 0;
	itemlist = 0;
	for (var i = 0; i <= fulllist.length; i++) 
	{
		if (fulllist.substring(i,i+1) == '[') 
		{
			itemstart = i+1;
		}
		else if (fulllist.substring(i,i+1) == ']') 
		{
			itemend = i;
			thequantity = fulllist.substring(itemstart, itemend);
			itemtotal = 0;
			itemtotal = (eval(theprice*thequantity));
			temptotal = itemtotal * 100;
			var tax = itemtotal / 100 * (16 - 0);
    		tax = Math.floor(tax * 100)/100
			totprice = totprice + itemtotal// + tax;
			itemlist=itemlist+1;
			alterError(itemtotal);
		}
		else if (fulllist.substring(i,i+1) == ',') 
		{
			theitem = fulllist.substring(itemstart, i);
			itemstart = i+1;
		}
		else if (fulllist.substring(i,i+1) == '#') 
		{
			theprice = fulllist.substring(itemstart, i-1);
			itemstart = i+1;
		}
	}
	var preciofina=eval(alterError(totprice))+9
	document.writeln('<b>'+alterError(preciofina)+' €</b>');
}
//Muestra la comision que debe el usuario pagar para pagar con Tarjeta. Forma parte de la pagina de Pagar.
function showTotalPCGT() 
{
	index = document.cookie.indexOf("TheBasket");
	countbegin = (document.cookie.indexOf("=", index) + 1);
   	countend = document.cookie.indexOf(";", index);
   	if (countend == -1) 
	{
       	countend = document.cookie.length;
	}
	fulllist = document.cookie.substring(countbegin, countend);
	totprice = 0;
	itemlist = 0;
	for (var i = 0; i <= fulllist.length; i++) 
	{
		if (fulllist.substring(i,i+1) == '[') 
		{
			itemstart = i+1;
		}
		else if (fulllist.substring(i,i+1) == ']') 
		{
			itemend = i;
			thequantity = fulllist.substring(itemstart, itemend);
			itemtotal = 0;
			itemtotal = (eval(theprice*thequantity));
			temptotal = itemtotal * 100;
			var tax = itemtotal / 100 * (16 - 0);
    		tax = Math.floor(tax * 100)/100
			totprice = totprice + itemtotal;// + tax;
			itemlist=itemlist+1;
			alterError(itemtotal);
		}
		else if (fulllist.substring(i,i+1) == ',') 
		{
			theitem = fulllist.substring(itemstart, i);
			itemstart = i+1;
		}
		else if (fulllist.substring(i,i+1) == '#') 
		{
			theprice = fulllist.substring(itemstart, i-1);
			itemstart = i+1;
		}
	}
	var comision=2
	document.writeln('<b>'+alterError(totprice)+' €</b>');
}
//Muestra la comision que debe el usuario pagar para pagar con E-Pagado. Forma parte de la pagina de Pagar.
function showTotalPCE() 
{
	index = document.cookie.indexOf("TheBasket");
	countbegin = (document.cookie.indexOf("=", index) + 1);
   	countend = document.cookie.indexOf(";", index);
   	if (countend == -1) 
	{
       	countend = document.cookie.length;
	}
	fulllist = document.cookie.substring(countbegin, countend);
	totprice = 0;
	itemlist = 0;
	for (var i = 0; i <= fulllist.length; i++) 
	{
		if (fulllist.substring(i,i+1) == '[') 
		{
			itemstart = i+1;
		}
		else if (fulllist.substring(i,i+1) == ']') 
		{
			itemend = i;
			thequantity = fulllist.substring(itemstart, itemend);
			itemtotal = 0;
			itemtotal = (eval(theprice*thequantity));
			temptotal = itemtotal * 100;
			var tax = itemtotal / 100 * (16 - 0);
    		tax = Math.floor(tax * 100)/100
			totprice = totprice + itemtotal;// + tax;
			itemlist=itemlist+1;
			alterError(itemtotal);
		}
		else if (fulllist.substring(i,i+1) == ',') 
		{
			theitem = fulllist.substring(itemstart, i);
			itemstart = i+1;
		}
		else if (fulllist.substring(i,i+1) == '#') 
		{
			theprice = fulllist.substring(itemstart, i-1);
			itemstart = i+1;
		}
	}
	document.writeln('<b>'+alterError(totprice)+' €</b>');
}
//Sumamos los valores de la compra y los valores de los portes y lo asignamos a los campos ocultos correspondientes y en los campos de los pagos con tarjeta, e-pagado y comisiones.
function sumavaloresocultos() 
{
	precioc = document.getElementById("preciocompra");
	totalc = document.getElementById("totcompra");
	saldoc = document.getElementById("saldocliente");
	capaptc = document.getElementById("taryepag");
	capapcc = document.getElementById("pagoccli");
	campoTT = document.getElementById("PtotalT");
	campoCT = document.getElementById("GastosT");
	campoTE = document.getElementById("PtotalE");
	campoCE = document.getElementById("GastosE");
	index = document.cookie.indexOf("TheBasket");
	countbegin = (document.cookie.indexOf("=", index) + 1);
   	countend = document.cookie.indexOf(";", index);
   	if (countend == -1) 
	{
       	countend = document.cookie.length;
	}
	fulllist = document.cookie.substring(countbegin, countend);
	totprice = 0;
	itemlist = 0;
	for (var i = 0; i <= fulllist.length; i++) 
	{
		if (fulllist.substring(i,i+1) == '[') 
		{
			itemstart = i+1;
		}
		else if (fulllist.substring(i,i+1) == ']') 
		{
			itemend = i;
			thequantity = fulllist.substring(itemstart, itemend);
			itemtotal = 0;
			itemtotal = (eval(theprice*thequantity));
			temptotal = itemtotal * 100;
			var tax = itemtotal / 100 * (16 - 0);
    		tax = Math.floor(tax * 100)/100
			totprice = totprice + itemtotal;// + tax;
			itemlist=itemlist+1;
			alterError(itemtotal);
		}
		else if (fulllist.substring(i,i+1) == ',') 
		{
			theitem = fulllist.substring(itemstart, i);
			itemstart = i+1;
		}
		else if (fulllist.substring(i,i+1) == '#') 
		{
			theprice = fulllist.substring(itemstart, i-1);
			itemstart = i+1;
		}
	}
	var preciofina=alterError(totprice);
	saldocliente=saldoc.value.replace(',','.');
	precioc.value=preciofina;
	totalc.value=preciofina;
	campoTT.value=preciofina;
	campoTE.value=preciofina;
	saldocliente = redondear(saldocliente, '2');
	totalcompr = redondear(totalc.value, '2');
	if (saldocliente<totalc.value)
	{
		capaptc.style.display = '';
		capapcc.style.display = 'none';	
	}
	else
	{
		capaptc.style.display = 'none';
		capapcc.style.display = '';	
	}
	document.fpago.depo[1].click();
	//comision para Tarjeta y E-Pagado
	//TARJETA
	gastoT=2;
	tot=preciofina*gastoT/100;
	campoCT.value=alterError(tot);
	//E-PAGADO
	gastoE=4;
	tot1=preciofina*gastoE/100;
	campoCE.value=alterError(tot1);
}
//Funcion para redondear numeros
function redondear(num, dec)
{
    num = parseFloat(num);
    dec = parseFloat(dec);
    dec = (!dec ? 2 : dec);
    return Math.round(num * Math.pow(10, dec)) / Math.pow(10, dec);
   }
//Para sumar los portes
function pagaenvio() 
{
	capa1 = document.getElementById("portes");
	capa1a = document.getElementById("portes1");
	capa2 = document.getElementById("total2");
	capa3 = document.getElementById("total3");
	capaptc = document.getElementById("taryepag");
	capapcc = document.getElementById("pagoccli");
	precioc = document.getElementById("preciocompra");
	totalc = document.getElementById("totcompra");
	campoTT = document.getElementById("PtotalT");
	campoCT = document.getElementById("GastosT");
	campoTE = document.getElementById("PtotalE");
	campoCE = document.getElementById("GastosE");
	capa1.style.display = '';
	capa1a.style.display = 'none';
	capa2.style.display = 'none';
	capa3.style.display = '';
	totalc.value=eval(precioc.value)+9;
	saldocliente=saldoc.value.replace(',','.');
	saldocliente = redondear(saldocliente, '2');
	totalcompr = redondear(totalc.value, '2');
	if (saldocliente<totalc.value)
	{
		capaptc.style.display = '';
		capapcc.style.display = 'none';	
	}
	else
	{
		capaptc.style.display = 'none';
		capapcc.style.display = '';	
	}
	campoTT.value=totalc.value;
	campoTE.value=totalc.value;
	//comision para Tarjeta y E-Pagado
	//TARJETA
	gastoT=2;
	tot=totalc.value*gastoT/100;
	campoCT.value=alterError(tot);
	//E-PAGADO
	gastoE=4;
	tot1=totalc.value*gastoE/100;
	campoCE.value=alterError(tot1);
}
//Para no sumar los portes
function despagaenvio() 
{
	capa1 = document.getElementById("portes");
	capa1a = document.getElementById("portes1");
	capa2 = document.getElementById("total2");
	capa3 = document.getElementById("total3");
	capaptc = document.getElementById("taryepag");
	capapcc = document.getElementById("pagoccli");
	precioc = document.getElementById("preciocompra");
	totalc = document.getElementById("totcompra");
	campoTT = document.getElementById("PtotalT");
	campoCT = document.getElementById("GastosT");
	campoTE = document.getElementById("PtotalE");
	campoCE = document.getElementById("GastosE");
	capa1.style.display = 'none';
	capa1a.style.display = '';
	capa2.style.display = '';
	capa3.style.display = 'none';
	totalc.value=precioc.value;
	saldocliente=saldoc.value.replace(',','.');
	saldocliente = redondear(saldocliente, '2');
	totalcompr = redondear(totalc.value, '2');
	if (saldocliente<totalc.value)
	{
		capaptc.style.display = '';
		capapcc.style.display = 'none';	
	}
	else
	{
		capaptc.style.display = 'none';
		capapcc.style.display = '';	
	}
	campoTT.value=precioc.value;
	campoTE.value=precioc.value;
	//comision para Tarjeta y E-Pagado
	//TARJETA
	gastoT=2;
	tot=precioc.value*gastoT/100;
	campoCT.value=alterError(tot);
	//E-PAGADO
	gastoE=4;
	tot1=precioc.value*gastoE/100;
	campoCE.value=alterError(tot1);
}
//Para calcular los gastos de sumar saldo
function calculagastos() 
{
	campoImporte = document.getElementById("Importe");
	campoCT = document.getElementById("comisiontarjeta");
	campoCE = document.getElementById("comisionepagado");
	var original = campoImporte.value;
	var sustitut = original.replace(',', '.');
	var sustituido = sustitut.replace(',', '.');
	//alert(original);
	//alert(sustituido);
	var wpoint=sustituido.indexOf('.');
	if (wpoint!=-1)
	{
		var wpoint2=sustituido.lastIndexOf('.');
		if (wpoint2!=wpoint)
		{
			alert("EL SALDO DEBE SER UN NUMERO POSITIVO EN FORMATO: 0.00 €");
			campoImporte.value="";
			campoCT.value="";
			campoCE.value="";
			return false;
		}
	}
	campoImporte.value=sustituido;
	if (campoImporte.value<=0)
	{
		alert("EL SALDO DEBE SER UN NUMERO POSITIVO EN FORMATO: 0.00 €");
		campoImporte.value="";
		campoCT.value="";
		campoCE.value="";
		return false;
	}
	//comision para Tarjeta y E-Pagado
	//TARJETA
	gastoT=2;
	tot=campoImporte.value*gastoT/100;
	//alert(isNaN(tot));
	if (!isNaN(tot))
	{
		campoCT.value=alterError(tot);
	}
	else
	{
		alert("EL SALDO DEBE SER UN NUMERO POSITIVO EN FORMATO: 0.00 €");
		campoImporte.value="";
		campoCT.value="";
		campoCE.value="";
		return false;
	}
	//E-PAGADO
	gastoE=4;
	tot1=campoImporte.value*gastoE/100;
	campoCE.value=alterError(tot1);
}
function sumatransferencia()
{
	if (document.agregarsaldo.Importe.value=="")
	{
		alert("DEBE INDICAR UN IMPORTE POSITIVO EN FORMATO: 0.00 €");
		return false;
	}
	else
	{
		document.agregarsaldo.transferencia.value="EN PROCESO -->";
		document.agregarsaldo.transferencia.disabled=true;
		document.agregarsaldo.Tarjeta.disabled=true;
		document.agregarsaldo.fpago.value="TRANSFERENCIA";
		document.agregarsaldo.submit();
	}
}
function sumatarjeta()
{
	if (document.agregarsaldo.Importe.value=="")
	{
		alert("DEBE INDICAR UN IMPORTE POSITIVO EN FORMATO: 0.00 €");
		return false;
	}
	else
	{
		if (document.agregarsaldo.comisiontarjeta.value=="" || isNaN(document.agregarsaldo.comisiontarjeta.value))
		{
			alert("DEBE INDICAR UN IMPORTE POSITIVO EN FORMATO: 0.00 €");
			return false;
		}
		else
		{
			document.agregarsaldo.Tarjeta.value="EN PROCESO -->";
			document.agregarsaldo.Tarjeta.disabled=true;
			document.agregarsaldo.transferencia.disabled=true;
			document.agregarsaldo.fpago.value="TARJETA";
			document.agregarsaldo.submit();
		}
	}
}
function sumaepagado()
{
	if (document.agregarsaldo.Importe.value=="")
	{
		alert("DEBE INDICAR UN IMPORTE POSITIVO EN FORMATO: 0.00 €");
		return false;
	}
	else
	{
		if (document.agregarsaldo.comisionepagado.value=="" || isNaN(document.agregarsaldo.comisionepagado.value))
		{
			alert("DEBE INDICAR UN IMPORTE POSITIVO EN FORMATO: 0.00 €");
			return false;
		}
		else
		{
			document.agregarsaldo.fpago.value="EPAGADO";
			document.agregarsaldo.submit();
		}
	}
}
function removeItem(itemno) 
{
	if (confirm('¿SEGURO QUE DESEA ELIMINAR ESTA APUESTA?')) 
	{
		newItemList = null;
		itemlist = 0;
		for (var i = 0; i <= fulllist.length; i++) 
		{
			if (fulllist.substring(i,i+1) == '[') 
			{
				itemstart = i+1;
			}
			else if (fulllist.substring(i,i+1) == ']') 
			{
				itemend = i;
				theitem = fulllist.substring(itemstart, itemend);
				itemlist=itemlist+1;
				if (itemlist != itemno) 
				{
					newItemList = newItemList+'['+fulllist.substring(itemstart, itemend)+']';
				}
			}
		}
		index = document.cookie.indexOf("TheBasket");
		document.cookie="TheBasket="+newItemList;
		top.location = "estado.asp";
	}
}
function clearBasket() 
{
	if (confirm('¿SEGURO QUE DESEA REESTABLECER SU CARRITO?')) 
	{
		index = document.cookie.indexOf("TheBasket");
		document.cookie="TheBasket=.";
		top.location = "estado.asp";
	}
}
function clearBasketNP() 
{
	index = document.cookie.indexOf("TheBasket");
	document.cookie="TheBasket=.";
}

var menuses = 1;
function MM_reloadPage(init) 
{  
	if (init==true) with (navigator) 
	{
		if ((appName=="Netscape")&&(parseInt(appVersion)==4)) 
		{
			document.MM_pgW=innerWidth; 
			document.MM_pgH=innerHeight; 
			onresize=MM_reloadPage; 
		}
	}
    else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) 
		location.reload();
}
MM_reloadPage(true);
function MM_findObj(n, d) 
{
	var p,i,x;  
	if(!d) 
		d=document; 
	if((p=n.indexOf("?"))>0&&parent.frames.length) 
	{
    	d=parent.frames[n.substring(p+1)].document; 
		n=n.substring(0,p);
	}
  	if(!(x=d[n])&&d.all) 
		x=d.all[n]; 
	for (i=0;!x&&i<d.forms.length;i++)
		x=d.forms[i][n];
  	for(i=0;!x&&d.layers&&i<d.layers.length;i++)
		x=MM_findObj(n,d.layers[i].document);
  	if(!x && d.getElementById) 
		x=d.getElementById(n); 
	return x;
}
function MM_showHideLayers()
{
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  	if ((obj=MM_findObj(args[i]))!=null) 
	{ 
		v=args[i+2];
    	if (obj.style) 
		{ 
			obj=obj.style; 
			v=(v=='show')?'visible':(v=='hide')?'hidden':v; 
		}
    	obj.visibility=v; 
	}
}
for (var i=1; i<= menuses;i++) 
{
	eval('var tmrMenu'+i+' = null;');
}
function muestraMenu(x) 
{
	for (var i=1;i<=menuses;i++) 
	{
		if (i != x) MM_showHideLayers('subjuego'+i,'','hide');
		eval('if (tmrMenu'+i+') { clearTimeout(tmrMenu'+i+'); }');
	}
	MM_showHideLayers('subjuego'+x,'','show');
	eval('if (tmrMenu'+x+') { clearTimeout(tmrMenu'+x+'); }');
}
function anulaMenu(x) 
{
	eval('tmrMenu'+x+' = setTimeout(\'MM_showHideLayers(\\\'subjuego'+x+'\\\',\\\'\\\',\\\'hide\\\');\',1500);');
}
function totaldelostotales() 
{
	totalc = document.getElementById("totalcompra");
	portes = document.getElementById("portes");
	gastos = document.getElementById("gastos");
	total = document.getElementById("total");
	tot=0;
	tot=eval(Number(totalc.value) + Number(portes.value) + Number(gastos.value));
	total.value=alterError(tot);
}
function pagadero()
{
	if (document.fpago.narticulos.value=="0")
	{
		alert("NO EXISTEN ARTICULOS EN SU CARRITO DE LA COMPRA");
		document.location="index.asp";
		return false;
	}
	document.fpago.Enviar2.value="EN PROCESO -->";
	document.fpago.Enviar2.disabled=true;
	document.fpago.quierepagar.value="SALDOCLIENTE";
	document.fpago.submit();
}
function pagaderotarjeta()
{
	if (document.fpago.narticulos.value=="0")
	{
		alert("NO EXISTEN ARTICULOS EN SU CARRITO DE LA COMPRA");
		document.location="index.asp";
		return false;
	}
	document.fpago.EnviarTC.value="EN PROCESO -->";
	document.fpago.EnviarTC.disabled=true;
	document.fpago.quierepagar.value="TARJETA";
	document.fpago.submit();
}
function pagaderoepagado()
{
	if (document.fpago.narticulos.value=="0")
	{
		alert("NO EXISTEN ARTICULOS EN SU CARRITO DE LA COMPRA");
		document.location="index.asp";
		return false;
	}
	document.fpago.EnviarEP.value="EN PROCESO -->";
	document.fpago.EnviarEP.disabled=true;
	document.fpago.quierepagar.value="E-PAGADO";
	document.fpago.submit();
}
function altanuevousuario()
{
	if (document.altausuaria.nombre.value=="")
	{
		alert("DEBE RELLENAR EL CAMPO NOMBRE");
		document.altausuaria.nombre.focus();
		return false;
	}
	if (document.altausuaria.apellidos.value=="")
	{
		alert("DEBE RELLENAR EL CAMPO APELLIDOS");
		document.altausuaria.apellidos.focus();
		return false;
	}
	if (document.altausuaria.direccion.value=="")
	{
		alert("DEBE RELLENAR EL CAMPO DIRECCION");
		document.altausuaria.direccion.focus();
		return false;
	}
	if (document.altausuaria.poblacion.value=="")
	{
		alert("DEBE RELLENAR EL CAMPO POBLACIÓN");
		document.altausuaria.poblacion.focus();
		return false;
	}
	if (document.altausuaria.telefono.value=="")
	{
		alert("DEBE RELLENAR EL CAMPO TELEFONO");
		document.altausuaria.telefono.focus();
		return false;
	}
	if (document.altausuaria.pais.value=="")
	{
		alert("DEBE RELLENAR EL CAMPO PAIS");
		document.altausuaria.pais.focus();
		return false;
	}
	if (document.altausuaria.email.value=="")
	{
		alert("DEBE RELLENAR EL CAMPO E-MAIL");
		document.altausuaria.email.focus();
		return false;
	}
	if (checkemail(document.altausuaria.email.value))
	{
		alert("DEBE INTRODUCIR UNA DIRECCION DE E-MAIL VALIDA");
		document.altausuaria.email.focus();
		return false;
	}
	if (document.altausuaria.contrasen.value=="")
	{
		alert("DEBE RELLENAR SU CONTRASEÑA");
		document.altausuaria.contrasen.focus();
		return false;
	}
	if (document.altausuaria.contrasen2.value=="")
	{
		alert("DEBE RELLENAR LA CONFIRMACIÓN DE CONTRASEÑA");
		document.altausuaria.contrasen2.focus();
		return false;
	}
	if (document.altausuaria.contrasen.value!=document.altausuaria.contrasen2.value)
	{
		alert("NO COINCIDEN LA CONTRASEÑA Y SU CONFIRMACIÓN");
		document.altausuaria.contrasen.focus();
		return false;
	}
	if (!document.altausuaria.acuerdo.checked)
	{
		alert("DEBE ACEPTAR LAS CONDICIONES DE CONFIDENCIALIDAD PARA PODER CONTINUAR EL PROCESO");
		return false;
	}
	document.altausuaria.submit();
}
function modusuario()
{
	if (document.usuario.nombre.value=="")
	{
		alert("DEBE RELLENAR EL CAMPO NOMBRE");
		document.usuario.nombre.focus();
		return false;
	}
	if (document.usuario.apellidos.value=="")
	{
		alert("DEBE RELLENAR EL CAMPO APELLIDOS");
		document.usuario.apellidos.focus();
		return false;
	}
	if (document.usuario.direccion.value=="")
	{
		alert("DEBE RELLENAR EL CAMPO DIRECCION");
		document.usuario.direccion.focus();
		return false;
	}
	if (document.usuario.poblacion.value=="")
	{
		alert("DEBE RELLENAR EL CAMPO POBLACIÓN");
		document.usuario.poblacion.focus();
		return false;
	}
	if (document.usuario.telefono.value=="")
	{
		alert("DEBE RELLENAR EL CAMPO TELEFONO");
		document.usuario.telefono.focus();
		return false;
	}
	if (document.usuario.pais.value=="")
	{
		alert("DEBE RELLENAR EL CAMPO PAIS");
		document.usuario.pais.focus();
		return false;
	}
	if (document.usuario.email.value=="")
	{
		alert("DEBE RELLENAR EL CAMPO E-MAIL");
		document.usuario.email.focus();
		return false;
	}
	if (checkemail(document.usuario.email.value))
	{
		alert("DEBE INTRODUCIR UNA DIRECCION DE E-MAIL VALIDA");
		document.usuario.email.focus();
		return false;
	}
	if (document.usuario.contrasen.value!=document.usuario.contrasen2.value)
	{
		alert("NO COINCIDEN LA CONTRASEÑA Y SU CONFIRMACIÓN");
		document.usuario.contrasen.focus();
		return false;
	}
	document.usuario.submit();
}
function recuerdapass()
{
	if (document.recuerdausuaria.email.value=="")
	{
		alert("DEBE RELLENAR EL CAMPO USUARIO");
		document.recuerdausuaria.email.focus();
		return false;
	}
	if (checkemail(document.recuerdausuaria.email.value))
	{
		alert("DEBE SER UNA DIRECCION DE E-MAIL VALIDA");
		document.recuerdausuaria.email.focus();
		return false;
	}
	document.recuerdausuaria.submit();
}
function checkemail(email)
{
	var ind1, ind2, ind3;
	ind1 = email.indexOf('@');
	ind2 = email.lastIndexOf('.');
	ind3 = email.lastIndexOf('@');
	if ((ind1<=0) || (ind2<ind1) || (ind3 != ind1))
		  return true;
	else
		 return false;
}
function verCarrito()
{
	document.fpa.action="estado.asp";
	document.fpa.submit();
}
function continueP()
{
	document.fpa.action="pagando.asp";
	document.fpa.submit();
}
function aPagar()
{
	//window.document.fpa.action="pagar.asp";
	document.fpa.submit();
}
function sugerencias()
{
	if (document.suge.texto.value=="")
	{
		alert("DEBE RELLENAR EL APARTADO SUGERENCIAS");
		document.suge.texto.focus();
		return false;
	}
	document.suge.submit();
}
function contacte()
{
	if (document.cont.nombre.value=="")
	{
		alert("DEBE RELLENAR EL CAMPO NOMBRE");
		document.cont.nombre.focus();
		return false;
	}
	if (document.cont.apellidos.value=="")
	{
		alert("DEBE RELLENAR EL CAMPO APELLIDOS");
		document.cont.apellidos.focus();
		return false;
	}
	if (document.cont.email.value=="")
	{
		alert("DEBE RELLENAR EL CAMPO E-MAIL");
		document.cont.email.focus();
		return false;
	}
	if (checkemail(document.cont.email.value))
	{
		alert("DEBE INTRODUCIR UNA DIRECCION DE E-MAIL VALIDA");
		document.cont.email.focus();
		return false;
	}
	if (document.cont.texto.value=="")
	{
		alert("DEBE RELLENAR EL TEXRO DEL MENSAJE");
		document.cont.texto.focus();
		return false;
	}
	document.cont.submit();
}
function removeItem2(itemno) 
{
	//alert(itemno);
	newItemList = null;
	itemlist = 0;
	for (var i = 0; i <= fulllist.length; i++) 
	{
		if (fulllist.substring(i,i+1) == '[') 
		{
			itemstart = i+1;
		}
		else if (fulllist.substring(i,i+1) == ']') 
		{
			itemend = i;
			theitem = fulllist.substring(itemstart, itemend);
			itemlist=itemlist+1;
			if (itemlist != itemno) 
			{
				newItemList = newItemList+'['+fulllist.substring(itemstart, itemend)+']';
			}
		}
	}
	index = document.cookie.indexOf("TheBasket");
	document.cookie="TheBasket="+newItemList;
	laultimamuestra();
}
function laultimamuestra() 
{
	index = document.cookie.indexOf("TheBasket");
	countbegin = (document.cookie.indexOf("=", index) + 1);
   	countend = document.cookie.indexOf(";", index);
   	if (countend == -1) 
	{
       	countend = document.cookie.length;
	}
	fulllist = document.cookie.substring(countbegin, countend);
	totprice = 0;
	itemlist = 0;
	for (var i = 0; i <= fulllist.length; i++) 
	{
		if (fulllist.substring(i,i+1) == '[') 
		{
			itemstart = i+1;
		}
		else if (fulllist.substring(i,i+1) == ']') 
		{
			itemend = i;
			thequantity = fulllist.substring(itemstart, itemend);
			itemtotal = 0;
			itemtotal = (eval(theprice*thequantity));
			temptotal = itemtotal * 100;
			var tax = itemtotal / 100 * (16 - 0);
    		tax = Math.floor(tax * 100)/100
			totprice = totprice + itemtotal;// + tax;
			itemlist=itemlist+1;
			alterError(itemtotal);
		}
		else if (fulllist.substring(i,i+1) == ',') 
		{
			theitem = fulllist.substring(itemstart, i);
			itemstart = i+1;
		}
		else if (fulllist.substring(i,i+1) == '#') 
		{
			theprice = fulllist.substring(itemstart, i-1);
			itemstart = i+1;
		}
	}
}
function eliminarboleto(identi)
{
	if (confirm("ESTA SEGURO QUE DESEA ELIMINAR ESTE NUMERO DE LOTERIA\nEL PROCESO ES IRRREVERSIBLE?"))
	{
		document.location="bd_lotto.asp?id="+identi+"&accion=del";
		return true;
	}
	else
	{
		return false;
	}
}
function compruebacorreoalta()
{
	if (document.altaalerta.diremail.value=="")
	{
		alert("DEBE INDICAR SU E-MAIL");
		document.altaalerta.diremail.focus();
		return false;
	}
	if (checkemail(document.altaalerta.diremail.value))
	{
		alert("DEBE INTRODUCIR UNA DIRECCION DE E-MAIL VALIDA");
		document.altaalerta.diremail.focus();
		return false;
	}
	document.altaalerta.submit();
}
function verificausuario()
{
	if (document.usuarios.user.value=="")
	{
		alert("DEBE INDICAR SU NOMBRE DE USUARIO");
		document.usuarios.user.focus();
		return false;
	}
	if (document.usuarios.passw.value=="")
	{
		alert("DEBE INDICAR SU CONTRASEÑA");
		document.usuarios.passw.focus();
		return false;
	}
	document.usuarios.submit();
}
function compruebapagapremio()
{
	if (document.pagapremio.importe.value=="")
	{
		alert("DEBE INDICAR IMPORTE A ABONAR");
		document.pagapremio.importe.focus();
		return false;
	}
	if (document.pagapremio.juego.value=="")
	{
		alert("DEBE SELECCIONAR UN JUEGO");
		document.pagapremio.juego.focus();
		return false;
	}
	if (document.pagapremio.fsorteo.value=="")
	{
		alert("DEBE SELECCIONAR UNA FECHA DE SORTEO");
		document.pagapremio.fsorteo.focus();
		return false;
	}
	document.pagapremio.submit();
}
function estadomov()
{
	if (document.combiamov.estado.value=="P")
	{
		alert("DEBE INDICAR UN NUEVO ESTADO (CANCELADO O ACEPTADO)");
		document.combiamov.estado.focus();
		return false;
	}
	document.combiamov.submit();
}
function solicitadevolucion()
{
	if (document.devolucion.CoCuCl.value=="")
	{
		alert("DEBE INDICAR UN NUMERO DE CUENTA");
		document.devolucion.CoCuCl.focus();
		return false;
	}
	if (document.devolucion.CoCuCl.value.length<20)
	{
		alert("EL NUMERO DE CUENTA DEBE TENER 20 DIGITOS");
		document.devolucion.CoCuCl.focus();
		return false;
	}
	document.devolucion.ent.value=document.devolucion.CoCuCl.value.substring(0,4);
	document.devolucion.ofi.value=document.devolucion.CoCuCl.value.substring(4,8);
	document.devolucion.dc.value=document.devolucion.CoCuCl.value.substring(8,10);
	document.devolucion.plan.value=document.devolucion.CoCuCl.value.substring(10,14);
	document.devolucion.cuent.value=document.devolucion.CoCuCl.value.substring(14,20);
	if (document.devolucion.importe.value=="")
	{
		alert("DEBE INDICAR UN IMPORTE VALIDO");
		document.devolucion.importe.focus();
		return false;
	}
	var original = document.devolucion.importe.value;
	var saldoact = document.devolucion.saldoact.value;
	var sustitut = original.replace(',', '.');
	var sustituido = sustitut.replace(',', '.');
	var sustituido2 = saldoact.replace(',', '.');
	var wpoint=sustituido.indexOf('.');
	var valor=parseFloat(sustituido);
	var valor2=parseFloat(sustituido2);
	if (isNaN(valor))
	{
		alert("EL IMPORTE DEBE SER UN NUMERO POSITIVO");
		return false;
	}
	if(valor>(valor2-1))
	{
		alert("NO PUEDE SOLICITAR UNA CANTIDAD MAYOR A SU SALDO ACTUAL");
		return false;
	}
	if (wpoint!=-1)
	{
		var wpoint2=sustituido.lastIndexOf('.');
		if (wpoint2!=wpoint)
		{
			alert("EL SALDO DEBE SER UN NUMERO POSITIVO EN FORMATO: 0.00 €");
			document.devolucion.importe.value="";
			document.devolucion.importe.focus();
			return false;
		}
	}
	document.devolucion.importe.value=parseFloat(sustituido);
	if(!confirm("SEGURO QUE DESEA SOLICITAR DEVOLUCIÓN DE "+document.devolucion.importe.value+" €"))
	{
		return false;
	}
	if (document.devolucion.importe.value<=0)
	{
		alert("EL SALDO DEBE SER UN NUMERO POSITIVO EN FORMATO: 0.00 €");
		document.devolucion.importe.value="";
		document.devolucion.importe.focus();
		return false;
	}
	document.devolucion.solicitar.value="EN PROCESO -->";
	document.devolucion.solicitar.disabled=true;
	document.devolucion.submit();
}
wm=0;
function DetectaTecla(tecla)
{
	if (tecla==17)
	{ 
		wm=1;
	}
	else
	{
		wm=0;
	}
}
function Logo()
{
	if (wm==1) 
	{
		parent.location='administrador/index.asp'; 
	}
}