/*
Scrpt generado por Mythagos
para Elitew Miniaturas.*/
var gastos = 0
var a = 0
var b = 0
var c = 0
var d = 0
var e = 0
var f = 0
var g = 0
var h = 0
var u = 0
var j = 0
var k = 0
var l = 0
var m = 0
var n = 0
var o = 0
var p = 0
var q = 0
var r = 0
var s = 0
var t = 0
var aaa = 0
var bbb = 0


function Reset() {
document.forms[0].elements[92].value = "";
document.forms[0].elements[93].value = "";
document.forms[0].elements[94].value = "";  
document.forms[0].elements[95].value = "";
document.forms[0].elements[96].value = "";
document.forms[0].elements[97].value = "";
document.forms[0].elements[98].value = "";
document.forms[0].elements[99].value = "";
document.forms[0].elements[100].value = "";
document.forms[0].elements[101].value = "";
document.forms[0].elements[102].value = "";
document.forms[0].elements[92].focus();
}
function submitForms() {
if (  (total_onClick()) && (Dias()) && (isPortes()) &&(isEmail()) && (isName()) && (isDireccion()) && (isPostal()) && (isPobla()) && (isProvi()) && (isPais()) && (isPais()) && (isPrefi()) && (isTlf()) && (isComment()) && (isEmpresa()) && (advertir()) && (no_Tlf()) && (no_Pref()) && (no_Empr()) && (no_Comen()) && (reg_replace()) && (reg_replade()) && (isDatos()))
if (confirm("Vas ha enviar por E-mail este pedido.\nClick en OK para enviar.\nClick en CANCEL para abortar."))
{ 
alert("Este pedido podr‡ ser confirmado a :\n"+emailAddress+"\n v’a E-mail.");
return true;
}
else
{
alert("Has elejido no enviar el pedido");
return false;      
}
else
return false;
}
function isEmail()
{
emailAddress=document.forms[0].elements[92].value;
if (document.forms[0].elements[92].value == "") {
alert("El campo del E-mail esta vacio.\nPor favor introduce tu correo.")
document.forms[0].elements[92
].focus();
return false; 
}
if (document.forms[0].elements[92].value.indexOf ('@',0) == -1 || 
document.forms[0].elements[92].value.indexOf ('.',0) == -1)
{
alert("El E-mail requiere una \"@\" y un \".\" para ser correcto.\nPor favor reintruduce tu E-mail de nuevo.")
document.forms[0].elements[92].select();
document.forms[0].elements[92].focus();
return false;
}
else
{
return true;
}
}
function isEmpresa() {
if (document.forms[0].elements[93].value == "") {
if (confirm("El campo de la Empresa lo has dejado vacio.\nClick en CANCEL para incluirlo.\nClick en OK para continuar sin incluirlo.")) 
return true
else
{
document.forms[0].elements[93].focus();
return false;      
}
}
else
return true   
}
function isName() {
var str = document.forms[0].elements[94].value;
if (str == "") {
alert("\nEl campo del nombre esta vacio.\nPor favor introduce tu nombre.")
document.forms[0].elements[94].focus();
return false;
}
for (var i = 0; i < str.length; i++) 
{
var ch = str.substring(i, i + 1);
if (((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch)) && ch != ' ') 
{
alert("\nEl campo del nombre solo acepta letras y espacios.\n\nPor favor reintroduce tu nombre.");
document.forms[0].elements[94].select();
document.forms[0].elements[94].focus();
return false;
   }
}
return true;
}
function isDireccion() {
var stri = document.forms[0].elements[95].value;
if (stri == "") {
alert("Has dejado la direccion vacia.\nPor favor introducela.")
document.forms[0].elements[95].focus();
return false;
}
return true;
}
function isPostal() {
var strs = document.forms[0].elements[96].value;
if (strs == "") {
alert("Has dejado vacio el Codigo Postal.\nPor favor introducelo.")
document.forms[0].elements[96].focus();
return false;
} 
for (var i = 0; i < strs.length; i++) {
if (isNaN(parseInt(strs.charAt(i))) == true)
{
alert("El Codigo postal solo acepta numeros.\nPor Favor introducelo de nuevo.");
document.forms[0].elements[96].select();
document.forms[0].elements[96].focus();
return false;
   }
}
return true;
}
function isPobla() {
var strc = document.forms[0].elements[97].value;
if (strc == "") {
alert("El campo de la Poblacion esta vacio.\nPor favor introduce la Poblacion.")
document.forms[0].elements[97].focus();
return false;
}
for (var i = 0; i < strc.length; i++) 
{
var ch = strc.substring(i, i + 1);
if (((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch)) && ch != ' ') 
{
alert("\nEl campo de al Poblacion solo acepta letras y espacios.\n\nPor favor reintroduce la Poblacion.");
document.forms[0].elements[97].select();
document.forms[0].elements[97].focus();
return false;
   }
}
return true;
}
function isProvi() {
var stra = document.forms[0].elements[98].value;
if (stra == "") {
alert("El campo de la Provincia esta vacio.\nPor favor introduce la Provincia.")
document.forms[0].elements[98].focus();
return false;
}
for (var i = 0; i < stra.length; i++) 
{
var ch = stra.substring(i, i + 1);
if (((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch)) && ch != ' ') 
{
alert("El campo de la Provincia solo acepta letras y espacios.\nPor favor reintroduce la Provincia.");
document.forms[0].elements[98].select();
document.forms[0].elements[98].focus();
return false;
   }
}
return true;
}
function isPais() {
var stro = document.forms[0].elements[99].value;
if (stro == "") {
alert("No has introducido el Pais.\nPor Favor introduce tu Pais.")
document.forms[0].elements[99].focus();
return false;
}
for (var i = 0; i < stro.length; i++) 
{
var ch = stro.substring(i, i + 1);
if (((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch) && (ch < "&ntilde" < ch)) && ch != ' ') 
{
alert("El campo del Pais solo acepta letras y espacios.\nPor favor introducelo de nuevo.");
document.forms[0].elements[99].select();
document.forms[0].elements[99].focus();
return false;
   }
}
return true;
}
function isPrefi() {
if (document.forms[0].elements[100].value == "") {
if (confirm("No has incluido ningun Prefijo.\nClick en CANCEL para incluirlo.\nClick en OK para continuar sin incluirlo.")) 
return true
else
{
document.forms[0].elements[100].focus();
return false;      
}
}
else
return true   
}
function isTlf() {
if (document.forms[0].elements[101].value == "") {
if (confirm("No has incluido ningun Telefono.\nClick en CANCEL para incluirlo.\nClick en OK para continuar sin incluirlo.")) 
return true
else
{
document.forms[0].elements[101].focus();
return false;      
}
}
else
return true   
}
function isComment() {
if (document.forms[0].elements[102].value == "") {
if (confirm("No has incluido ningun comentario.\nClick en CANCEL para incluirlo.\nClick en OK para continuar sin incluirlo.")) 
return true
else
{
document.forms[0].elements[102].focus();
return false;      
}
}
else
return true   
}
function isPortes() {
if (document.forms[0].elements[90].value >= 25000)
alert ("Por superar su pedido las 25000 Ptas.\nno se le cobraran gastos de envio");
return true
}	
function reg_replace(){
if (document.forms[0].elements[102].value != "")
				regx = /,/g
				resultado = document.forms[0].elements[102].value.replace(regx, "/")

return true
}
function reg_replade(){
if (document.forms[0].elements[103].value != "")
				regx = /,/g
				resul = document.forms[0].elements[103].value.replace(regx, "/")

return true
}
 function no_Tlf(){
if (document.forms[0].elements[100].value == "")
document.forms[0].elements[100].value = 0;
return true
}
 function no_Pref(){
if (document.forms[0].elements[101].value == "")
document.forms[0].elements[101].value = 0;
return true
}
 function no_Empr(){
if (document.forms[0].elements[93].value == "")
document.forms[0].elements[93].value = "Vacio";
return true
}
 function no_Comen(){
if (document.forms[0].elements[102].value == "")
document.forms[0].elements[102].value = "Vacio";
return true
}
function Dias(){
fecha = new Date()
document.forms[0].elements[103].value = fecha.toGMTString();
return true
}



		function anular_onClick()
		{
				
		with (document.forms.A)
		{
			if (Aa.checked == true) a = 0 , a *= 0;
			if (A.checked == true) b = 0 , b *= 0;
			if (B.checked == true) c = 0 , c *= 0;
			if (C.checked == true) d = 0 , d *= 0;
			if (D.checked == true) e = 0 , e *= 0;
			if (E.checked == true) f = 0 , f *= 0;
			if (F.checked == true) g = 0 , g *= 0;
			if (G.checked == true) h = 0 , h *= 0;
			if (H.checked == true) u = 0 , u *= 0;
			if (I.checked == true) j = 0 , j *= 0;
			if (J.checked == true) k = 0 , k *= 0;
			if (K.checked == true) l = 0 , l *= 0;
			if (L.checked == true) m = 0 , m *= 0;
			if (M.checked == true) n = 0 , n *= 0;
			if (N.checked == true) o = 0 , o *= 0;
			if (O.checked == true) p = 0 , p *= 0;
			if (P.checked == true) q = 0 , q *= 0;
			if (Q.checked == true) r = 0 , r *= 0;
			if (R.checked == true) s = 0 , s *= 0;
			if (S.checked == true) t = 0 , t *= 0;
			if (A_A.checked == true) aaa = 0 , aaa *= 0;
			if (A_B.checked == true) bbb = 0 , bbb *= 0;
		
			txtAa.value = a;
			txtA.value = b;
			txtB.value = c;
			txtC.value = d;
			txtD.value = e;
			txtE.value = f;
			txtF.value = g;
			txtG.value = h;
			txtH.value = u;
			txtI.value = j;
			txtJ.value = k;
			txtK.value = l;
			txtL.value = m;
			txtM.value = n;
			txtN.value = o;
			txtO.value = p;
			txtP.value = q;
			txtQ.value = r;
			txtR.value = s;
			txtS.value = t;
			txtA_A.value = aaa;
			txtA_B.value = bbb;
			txteuro.value = 0;
			coste.value = 0;
		
		}	 
		
		}

		function total_onClick()
		{
				
		with (document.forms.A)
		{
			if (Aa.checked == true) a = 0 , a *= parseInt(Cant.value);
			if (A.checked == true) b = 0 , b *= parseInt(Canta.value);
			if (B.checked == true) c = 4000 , c *= parseInt(Cantb.value);
			if (C.checked == true) d = 4700 , d *= parseInt(Cantc.value);
			if (D.checked == true) e = 0 , e *= parseInt(Cantd.value);
			if (E.checked == true) f = 0 , f *= parseInt(Cante.value);
			if (F.checked == true) g = 2100 , g *= parseInt(Cantf.value);
			if (G.checked == true) h = 2300 , h *= parseInt(Cantg.value);
			if (H.checked == true) u = 2300 , u *= parseInt(Canth.value);
			if (I.checked == true) j = 2300 , j *= parseInt(Canti.value);
			if (J.checked == true) k = 2300 , k *= parseInt(Cantj.value);
			if (K.checked == true) l = 2300 , l *= parseInt(Cantk.value);
			if (L.checked == true) m = 2300 , m *= parseInt(Cantl.value);
			if (M.checked == true) n = 2300 , n *= parseInt(Cantm.value);
			if (N.checked == true) o = 2300 , o *= parseInt(Cantn.value);
			if (O.checked == true) p = 5200 , p *= parseInt(Canto.value);
			if (P.checked == true) q = 5200 , q *= parseInt(Cantp.value);
			if (Q.checked == true) r = 8500 , r *= parseInt(Cantq.value);
			if (R.checked == true) s = 5200 , s *= parseInt(Cantr.value);
			if (S.checked == true) t = 2300 , t *= parseInt(Cants.value);
			if (A_A.checked == true) aaa = 4700 , aaa *= parseInt(Canta_a.value);
			if (A_B.checked == true) bbb = 2300 , bbb *= parseInt(Canta_b.value);

			total = gastos + a + b + c + d + e + f + g + h + u + j + k + l + m + n + o + p + q + r + s + t + aaa + bbb;
			euros = total / 166.386
            txtAa.value = a;
			txtA.value = b;
			txtB.value = c;
			txtC.value = d;
			txtD.value = e;
			txtE.value = f;
			txtF.value = g;
			txtG.value = h;
			txtH.value = u;
			txtI.value = j;
			txtJ.value = k;
			txtK.value = l;
			txtL.value = m;
			txtM.value = n;
			txtN.value = o;
			txtO.value = p;
			txtP.value = q;
			txtQ.value = r;
			txtR.value = s;
			txtS.value = t;
			txtA_A.value = aaa;
			txtA_B.value = bbb;

			function xround(num, ndec)
   			{
		     var fact = 1;
 			 for (i=1; i<=ndec; i++)
			{
 			 fact *= 10
 			}
            return Math.round(num * fact)/fact;
            }
			txteuro.value = xround(euros,3)
			coste.value = total;
			
				
	}
		return true

		}

		function advertir()
		{
				
		with (document.forms.A)
		{
			if (Aa.checked == true) a = 0 , a *= parseInt(Cant.value);
			if (A.checked == true) b = 0 , b *= parseInt(Canta.value);
			if (B.checked == true) c = 4000 , c *= parseInt(Cantb.value);
			if (C.checked == true) d = 4700 , d *= parseInt(Cantc.value);
			if (D.checked == true) e = 0 , e *= parseInt(Cantd.value);
			if (E.checked == true) f = 0 , f *= parseInt(Cante.value);
			if (F.checked == true) g = 2100 , g *= parseInt(Cantf.value);
			if (G.checked == true) h = 2300 , h *= parseInt(Cantg.value);
			if (H.checked == true) u = 2300 , u *= parseInt(Canth.value);
			if (I.checked == true) j = 2300 , j *= parseInt(Canti.value);
			if (J.checked == true) k = 2300 , k *= parseInt(Cantj.value);
			if (K.checked == true) l = 2300 , l *= parseInt(Cantk.value);
			if (L.checked == true) m = 2300 , m *= parseInt(Cantl.value);
			if (M.checked == true) n = 2300 , n *= parseInt(Cantm.value);
			if (N.checked == true) o = 2300 , o *= parseInt(Cantn.value);
			if (O.checked == true) p = 5200 , p *= parseInt(Canto.value);
			if (P.checked == true) q = 5200 , q *= parseInt(Cantp.value);
			if (Q.checked == true) r = 8500 , r *= parseInt(Cantq.value);
			if (R.checked == true) s = 5200 , s *= parseInt(Cantr.value);
			if (S.checked == true) t = 2300 , t *= parseInt(Cants.value);
			if (A_A.checked == true) aaa = 4700 , aaa *= parseInt(Canta_a.value);
			if (A_B.checked == true) bbb = 2300 , bbb *= parseInt(Canta_b.value);
			if (total = 100) total = 0
			
			total = gastos + a + b + c + d + e + f + g + h + u + j + k + l + m + n + o + p + q + r + s + t + aaa + bbb;
			euros = total / 166.386;
				function xround(num, ndec)
   			{
		     var fact = 1;
 			 for (i=1; i<=ndec; i++)
			{
 			 fact *= 10
 			}
            return Math.round(num * fact)/fact;
            }
			return confirm ("TOTAL DE LA COMPRA:\n" + total + " PESETAS\n " + xround(euros,3) + " EUROS\nMAS GASTOS SEGUN PESO DEL ENVIO");
		
		}	 
		
		}


			function isDatos(){

			with (document.forms.A)
						{

var info = new Array(57)

info[0] = txtAa.value;
info[1] = txtA.value;
info[2] = txtB.value;
info[3] = txtC.value;
info[4] = txtD.value;
info[5] = txtE.value;
info[6] = txtF.value;
info[7] = txtG.value;
info[8] = txtH.value;
info[9] = txtI.value;
info[10] = txtJ.value;
info[11] = txtK.value;
info[12] = txtL.value;
info[13] = txtM.value;
info[14] = txtN.value;
info[15] = txtO.value;
info[16] = txtP.value;
info[17] = txtQ.value;
info[18] = txtR.value;
info[19] = txtS.value;
info[20] = txtA_A.value;
info[21] = txtA_B.value;
info[22] = Cant.value;
info[23] = Canta.value;
info[24] = Cantb.value;
info[25] = Cantc.value;
info[26] = Cantd.value;
info[27] = Cante.value;
info[28] = Cantf.value;
info[29] = Cantg.value;
info[30] = Canth.value;
info[31] = Canti.value;
info[32] = Cantj.value;
info[33] = Cantk.value;
info[34] = Cantl.value;
info[35] = Cantm.value;
info[36] = Cantn.value;
info[37] = Canto.value;
info[38] = Cantp.value;
info[39] = Cantq.value;
info[40] = Cantr.value;
info[41] = Cants.value;
info[42] = Canta_a.value;
info[43] = Canta_b.value;
info[44] = coste.value;
info[45] = document.forms[0].elements[92].value;
info[46] = document.forms[0].elements[93].value;
info[47] = document.forms[0].elements[94].value;
info[48] = document.forms[0].elements[95].value;
info[49] = document.forms[0].elements[96].value;
info[50] = document.forms[0].elements[97].value;
info[51] = document.forms[0].elements[98].value;
info[52] = document.forms[0].elements[99].value;
info[53] = document.forms[0].elements[100].value;
info[54] = document.forms[0].elements[101].value;
info[55] = resultado;
info[56] = resul;
datos.value = info;

			

			}

return true
}
			








