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); return x;
}

function MM_validateForm() {
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' Check your e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (val!=''+num) errors+='- '+nm+' Check this field.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+'  Please fill this field.\n'; }
  } if (errors) alert('There are the following errors\n'+errors);
  document.MM_returnValue = (errors == '');
}

function AddNum1(n){
		a=eval(document.john.hiddentotal2.value)
		b=eval(document.john.hiddentotal3.value)
		c=eval(document.john.hiddentotal4.value)
		d=eval(document.john.hiddentotal5.value)
		e=eval(document.john.hiddentotal6.value)
		f=eval(document.john.hiddentotal7.value)
		g=eval(document.john.hiddentotal8.value)
        return (n*1) + a + b + c + d + e + f + g;
}

function AddNum2(n){
		a=eval(document.john.hiddentotal9.value)
		b=eval(document.john.hiddentotal10.value)
		a1=eval(document.john.nights_Electra_Palace_superior.value)
		b1=eval(document.john.rooms_Electra_Palace_superior.value)

		c=eval(document.john.hiddentotal11.value)
		d=eval(document.john.hiddentotal12.value)
		c1=eval(document.john.nights_Electra_Palace_standard.value)
		d1=eval(document.john.rooms_Electra_Palace_standard.value)
		
		e=eval(document.john.hiddentotal13.value)
		f=eval(document.john.hiddentotal14.value)
		e1=eval(document.john.nights_Mediterranean_Hotel.value)
		f1=eval(document.john.rooms_Mediterranean_Hotel.value)		

		g=eval(document.john.hiddentotal15.value)
		h=eval(document.john.hiddentotal16.value)
		g1=eval(document.john.nights_City_Hotel.value)
		h1=eval(document.john.rooms_City_Hotel.value)

		i=eval(document.john.hiddentotal17.value)
		j=eval(document.john.hiddentotal18.value)
		i1=eval(document.john.nights_Capsis_Hotel.value)
		j1=eval(document.john.rooms_Capsis_Hotel.value)

		k=eval(document.john.hiddentotal19.value)
		l=eval(document.john.hiddentotal20.value)
		k1=eval(document.john.nights_AD_Imperial_Palace.value)
		l1=eval(document.john.rooms_AD_Imperial_Palace.value)
		
		m=eval(document.john.hiddentotal21.value)
		n=eval(document.john.hiddentotal22.value)
		m1=eval(document.john.nights_Queen_Olga.value)
		n1=eval(document.john.rooms_Queen_Olga.value)
		
		o=eval(document.john.hiddentotal23.value)
		p=eval(document.john.hiddentotal24.value)
		o1=eval(document.john.nights_Metropolitan.value)
		p1=eval(document.john.rooms_Metropolitan.value)				

        return (a*a1*b1) + (b*a1*b1) + (c*c1*d1) + (d*c1*d1) + (e*e1*f1) + (f*e1*f1) + (g*g1*h1) + (h*g1*h1) + (i*i1*j1) + (j*i1*j1) + (k*k1*l1) + (l*k1*l1) + (m*m1*n1) + (n*m1*n1) + (o*o1*p1) + (p*o1*p1);
}

function AddNum3(n){
		a=eval(document.john.REGISTRATION.value)
		b=eval(document.john.ACCOMODATION.value)
        return a + b;
}

function axia(form)
	{
		hiddentotal=eval(form.hiddentotal.value)
		hiddentotal2=eval(form.hiddentotal2.value)
		hiddentotal3=eval(form.hiddentotal3.value)
		hiddentotal4=eval(form.hiddentotal4.value)		
		hiddentotal5=eval(form.hiddentotal5.value)
		hiddentotal6=eval(form.hiddentotal6.value)
		hiddentotal7=eval(form.hiddentotal7.value)
		hiddentotal8=eval(form.hiddentotal8.value)				
		hiddentotal9=eval(form.hiddentotal9.value)		
		hiddentotal10=eval(form.hiddentotal10.value)				
		hiddentotal11=eval(form.hiddentotal11.value)				
		hiddentotal12=eval(form.hiddentotal12.value)				
		hiddentotal13=eval(form.hiddentotal13.value)				
		hiddentotal14=eval(form.hiddentotal14.value)				
		hiddentotal15=eval(form.hiddentotal15.value)				
		hiddentotal16=eval(form.hiddentotal16.value)				
		hiddentotal17=eval(form.hiddentotal17.value)				
		hiddentotal18=eval(form.hiddentotal18.value)				
		hiddentotal19=eval(form.hiddentotal19.value)				
		hiddentotal20=eval(form.hiddentotal20.value)				
		hiddentotal21=eval(form.hiddentotal21.value)				
		hiddentotal22=eval(form.hiddentotal22.value)
		hiddentotal23=eval(form.hiddentotal23.value)
		hiddentotal24=eval(form.hiddentotal24.value)				
		
		form.Ποσό_ασφάλισης.value = hiddentotal+hiddentotal2+hiddentotal3+hiddentotal4+hiddentotal5+hiddentotal6+hiddentotal7+hiddentotal8
	}

function CheckChoice(whichbox)
	{
	with (whichbox.form)
	{
	if (whichbox.type == "radio")
	{
	hiddentotal.value = eval(hiddentotal.value);
	}
	else
	{
	if (whichbox.checked == false)
	{ hiddentotal.value = eval(hiddentotal.value) - eval(whichbox.value); }
	else 	{ hiddentotal.value = eval(hiddentotal.value) + eval(whichbox.value); }
	}
	if (hiddentotal.value < 0)
	{
	InitForm();
	}
	return(formatCurrency(hiddentotal.value));
	}
	}

function CheckChoice2(whichbox)
	{
	with (whichbox.form)
	{
	if (whichbox.type == "radio")
	{
	hiddentotal2.value = eval(hiddentotal2.value);
	}
	else
	{
	if (whichbox.checked == false)
	{ hiddentotal2.value = eval(hiddentotal2.value) - eval(whichbox.value); }
	else 	{ hiddentotal2.value = eval(hiddentotal2.value) + eval(whichbox.value); }
	}
	if (hiddentotal2.value < 0)
	{
	InitForm();
	}
	return(formatCurrency(hiddentotal2.value));
	}
	}	

function CheckChoice3(whichbox)
	{
	with (whichbox.form)
	{
	if (whichbox.type == "radio")
	{
	hiddentotal3.value = eval(hiddentotal3.value);
	}
	else
	{
	if (whichbox.checked == false)
	{ hiddentotal3.value = eval(hiddentotal3.value) - eval(whichbox.value); }
	else 	{ hiddentotal3.value = eval(hiddentotal3.value) + eval(whichbox.value); }
	}
	if (hiddentotal3.value < 0)
	{
	InitForm();
	}
	return(formatCurrency(hiddentotal3.value));
	}
	}	
	
function CheckChoice4(whichbox)
	{
	with (whichbox.form)
	{
	if (whichbox.type == "radio")
	{
	hiddentotal4.value = eval(hiddentotal4.value);
	}
	else
	{
	if (whichbox.checked == false)
	{ hiddentotal4.value = eval(hiddentotal4.value) - eval(whichbox.value); }
	else 	{ hiddentotal4.value = eval(hiddentotal4.value) + eval(whichbox.value); }
	}
	if (hiddentotal4.value < 0)
	{
	InitForm();
	}
	return(formatCurrency(hiddentotal4.value));
	}
	}

function CheckChoice5(whichbox)
	{
	with (whichbox.form)
	{
	if (whichbox.type == "radio")
	{
	hiddentotal5.value = eval(hiddentotal5.value);
	}
	else
	{
	if (whichbox.checked == false)
	{ hiddentotal5.value = eval(hiddentotal5.value) - eval(whichbox.value); }
	else 	{ hiddentotal5.value = eval(hiddentotal5.value) + eval(whichbox.value); }
	}
	if (hiddentotal5.value < 0)
	{
	InitForm();
	}
	return(formatCurrency(hiddentotal5.value));
	}
	}	
	
function CheckChoice6(whichbox)
	{
	with (whichbox.form)
	{
	if (whichbox.type == "radio")
	{
	hiddentotal6.value = eval(hiddentotal6.value);
	}
	else
	{
	if (whichbox.checked == false)
	{ hiddentotal6.value = eval(hiddentotal6.value) - eval(whichbox.value); }
	else 	{ hiddentotal6.value = eval(hiddentotal6.value) + eval(whichbox.value); }
	}
	if (hiddentotal6.value < 0)
	{
	InitForm();
	}
	return(formatCurrency(hiddentotal6.value));
	}
	}
	
function CheckChoice7(whichbox)
	{
	with (whichbox.form)
	{
	if (whichbox.type == "radio")
	{
	hiddentotal7.value = eval(hiddentotal7.value);
	}
	else
	{
	if (whichbox.checked == false)
	{ hiddentotal7.value = eval(hiddentotal7.value) - eval(whichbox.value); }
	else 	{ hiddentotal7.value = eval(hiddentotal7.value) + eval(whichbox.value); }
	}
	if (hiddentotal7.value < 0)
	{
	InitForm();
	}
	return(formatCurrency(hiddentotal7.value));
	}
	}
	
function CheckChoice8(whichbox)
	{
	with (whichbox.form)
	{
	if (whichbox.type == "radio")
	{
	hiddentotal8.value = eval(hiddentotal8.value);
	}
	else
	{
	if (whichbox.checked == false)
	{ hiddentotal8.value = eval(hiddentotal8.value) - eval(whichbox.value); }
	else 	{ hiddentotal8.value = eval(hiddentotal8.value) + eval(whichbox.value); }
	}
	if (hiddentotal8.value < 0)
	{
	InitForm();
	}
	return(formatCurrency(hiddentotal8.value));
	}
	}
	
function CheckChoice9(whichbox)
	{
	with (whichbox.form)
	{
	if (whichbox.type == "radio")
	{
	hiddentotal9.value = eval(hiddentotal9.value);
	}
	else
	{
	if (whichbox.checked == false)
	{ hiddentotal9.value = eval(hiddentotal9.value) - eval(whichbox.value); }
	else 	{ hiddentotal9.value = eval(hiddentotal9.value) + eval(whichbox.value); }
	}
	if (hiddentotal9.value < 0)
	{
	InitForm();
	}
	return(formatCurrency(hiddentotal9.value));
	}
	}
	
function CheckChoice10(whichbox)
	{
	with (whichbox.form)
	{
	if (whichbox.type == "radio")
	{
	hiddentotal10.value = eval(hiddentotal10.value);
	}
	else
	{
	if (whichbox.checked == false)
	{ hiddentotal10.value = eval(hiddentotal10.value) - eval(whichbox.value); }
	else 	{ hiddentotal10.value = eval(hiddentotal10.value) + eval(whichbox.value); }
	}
	if (hiddentotal10.value < 0)
	{
	InitForm();
	}
	return(formatCurrency(hiddentotal10.value));
	}
	}	

function CheckChoice11(whichbox)
	{
	with (whichbox.form)
	{
	if (whichbox.type == "radio")
	{
	hiddentotal11.value = eval(hiddentotal11.value);
	}
	else
	{
	if (whichbox.checked == false)
	{ hiddentotal11.value = eval(hiddentotal11.value) - eval(whichbox.value); }
	else 	{ hiddentotal11.value = eval(hiddentotal11.value) + eval(whichbox.value); }
	}
	if (hiddentotal11.value < 0)
	{
	InitForm();
	}
	return(formatCurrency(hiddentotal11.value));
	}
	}
	
function CheckChoice12(whichbox)
	{
	with (whichbox.form)
	{
	if (whichbox.type == "radio")
	{
	hiddentotal12.value = eval(hiddentotal12.value);
	}
	else
	{
	if (whichbox.checked == false)
	{ hiddentotal12.value = eval(hiddentotal12.value) - eval(whichbox.value); }
	else 	{ hiddentotal12.value = eval(hiddentotal12.value) + eval(whichbox.value); }
	}
	if (hiddentotal12.value < 0)
	{
	InitForm();
	}
	return(formatCurrency(hiddentotal12.value));
	}
	}
	
function CheckChoice13(whichbox)
	{
	with (whichbox.form)
	{
	if (whichbox.type == "radio")
	{
	hiddentotal13.value = eval(hiddentotal13.value);
	}
	else
	{
	if (whichbox.checked == false)
	{ hiddentotal13.value = eval(hiddentotal13.value) - eval(whichbox.value); }
	else 	{ hiddentotal13.value = eval(hiddentotal13.value) + eval(whichbox.value); }
	}
	if (hiddentotal13.value < 0)
	{
	InitForm();
	}
	return(formatCurrency(hiddentotal13.value));
	}
	}
	
function CheckChoice14(whichbox)
	{
	with (whichbox.form)
	{
	if (whichbox.type == "radio")
	{
	hiddentotal14.value = eval(hiddentotal14.value);
	}
	else
	{
	if (whichbox.checked == false)
	{ hiddentotal14.value = eval(hiddentotal14.value) - eval(whichbox.value); }
	else 	{ hiddentotal14.value = eval(hiddentotal14.value) + eval(whichbox.value); }
	}
	if (hiddentotal14.value < 0)
	{
	InitForm();
	}
	return(formatCurrency(hiddentotal14.value));
	}
	}
	
function CheckChoice15(whichbox)
	{
	with (whichbox.form)
	{
	if (whichbox.type == "radio")
	{
	hiddentotal15.value = eval(hiddentotal15.value);
	}
	else
	{
	if (whichbox.checked == false)
	{ hiddentotal15.value = eval(hiddentotal15.value) - eval(whichbox.value); }
	else 	{ hiddentotal15.value = eval(hiddentotal15.value) + eval(whichbox.value); }
	}
	if (hiddentotal15.value < 0)
	{
	InitForm();
	}
	return(formatCurrency(hiddentotal15.value));
	}
	}
	
function CheckChoice16(whichbox)
	{
	with (whichbox.form)
	{
	if (whichbox.type == "radio")
	{
	hiddentotal16.value = eval(hiddentotal16.value);
	}
	else
	{
	if (whichbox.checked == false)
	{ hiddentotal16.value = eval(hiddentotal16.value) - eval(whichbox.value); }
	else 	{ hiddentotal16.value = eval(hiddentotal16.value) + eval(whichbox.value); }
	}
	if (hiddentotal16.value < 0)
	{
	InitForm();
	}
	return(formatCurrency(hiddentotal16.value));
	}
	}
	
function CheckChoice17(whichbox)
	{
	with (whichbox.form)
	{
	if (whichbox.type == "radio")
	{
	hiddentotal17.value = eval(hiddentotal17.value);
	}
	else
	{
	if (whichbox.checked == false)
	{ hiddentotal17.value = eval(hiddentotal17.value) - eval(whichbox.value); }
	else 	{ hiddentotal17.value = eval(hiddentotal17.value) + eval(whichbox.value); }
	}
	if (hiddentotal17.value < 0)
	{
	InitForm();
	}
	return(formatCurrency(hiddentotal17.value));
	}
	}
	
function CheckChoice18(whichbox)
	{
	with (whichbox.form)
	{
	if (whichbox.type == "radio")
	{
	hiddentotal18.value = eval(hiddentotal18.value);
	}
	else
	{
	if (whichbox.checked == false)
	{ hiddentotal18.value = eval(hiddentotal18.value) - eval(whichbox.value); }
	else 	{ hiddentotal18.value = eval(hiddentotal18.value) + eval(whichbox.value); }
	}
	if (hiddentotal18.value < 0)
	{
	InitForm();
	}
	return(formatCurrency(hiddentotal18.value));
	}
	}
	
function CheckChoice19(whichbox)
	{
	with (whichbox.form)
	{
	if (whichbox.type == "radio")
	{
	hiddentotal19.value = eval(hiddentotal19.value);
	}
	else
	{
	if (whichbox.checked == false)
	{ hiddentotal19.value = eval(hiddentotal19.value) - eval(whichbox.value); }
	else 	{ hiddentotal19.value = eval(hiddentotal19.value) + eval(whichbox.value); }
	}
	if (hiddentotal19.value < 0)
	{
	InitForm();
	}
	return(formatCurrency(hiddentotal19.value));
	}
	}
	
function CheckChoice20(whichbox)
	{
	with (whichbox.form)
	{
	if (whichbox.type == "radio")
	{
	hiddentotal20.value = eval(hiddentotal20.value);
	}
	else
	{
	if (whichbox.checked == false)
	{ hiddentotal20.value = eval(hiddentotal20.value) - eval(whichbox.value); }
	else 	{ hiddentotal20.value = eval(hiddentotal20.value) + eval(whichbox.value); }
	}
	if (hiddentotal20.value < 0)
	{
	InitForm();
	}
	return(formatCurrency(hiddentotal20.value));
	}
	}
	
function CheckChoice21(whichbox)
	{
	with (whichbox.form)
	{
	if (whichbox.type == "radio")
	{
	hiddentotal21.value = eval(hiddentotal21.value);
	}
	else
	{
	if (whichbox.checked == false)
	{ hiddentotal21.value = eval(hiddentotal21.value) - eval(whichbox.value); }
	else 	{ hiddentotal21.value = eval(hiddentotal21.value) + eval(whichbox.value); }
	}
	if (hiddentotal21.value < 0)
	{
	InitForm();
	}
	return(formatCurrency(hiddentotal21.value));
	}
	}
	
function CheckChoice22(whichbox)
	{
	with (whichbox.form)
	{
	if (whichbox.type == "radio")
	{
	hiddentotal22.value = eval(hiddentotal22.value);
	}
	else
	{
	if (whichbox.checked == false)
	{ hiddentotal22.value = eval(hiddentotal22.value) - eval(whichbox.value); }
	else 	{ hiddentotal22.value = eval(hiddentotal22.value) + eval(whichbox.value); }
	}
	if (hiddentotal22.value < 0)
	{
	InitForm();
	}
	return(formatCurrency(hiddentotal22.value));
	}
	}
	
function CheckChoice23(whichbox)
	{
	with (whichbox.form)
	{
	if (whichbox.type == "radio")
	{
	hiddentotal23.value = eval(hiddentotal23.value);
	}
	else
	{
	if (whichbox.checked == false)
	{ hiddentotal23.value = eval(hiddentotal23.value) - eval(whichbox.value); }
	else 	{ hiddentotal23.value = eval(hiddentotal23.value) + eval(whichbox.value); }
	}
	if (hiddentotal23.value < 0)
	{
	InitForm();
	}
	return(formatCurrency(hiddentotal23.value));
	}
	}
	
function CheckChoice24(whichbox)
	{
	with (whichbox.form)
	{
	if (whichbox.type == "radio")
	{
	hiddentotal24.value = eval(hiddentotal24.value);
	}
	else
	{
	if (whichbox.checked == false)
	{ hiddentotal24.value = eval(hiddentotal24.value) - eval(whichbox.value); }
	else 	{ hiddentotal24.value = eval(hiddentotal24.value) + eval(whichbox.value); }
	}
	if (hiddentotal24.value < 0)
	{
	InitForm();
	}
	return(formatCurrency(hiddentotal24.value));
	}
	}													

	
function formatCurrency(num)
		{
		num = num.toString().replace(/\€|\,/g,'');
		if(isNaN(num))
		   num = "0";
		sign = (num == (num = Math.abs(num)));
		num = Math.floor(num*100+0.50000000001);
		cents = num%100;
		num = Math.floor(num/100).toString();
		if(cents<10)
		    cents = "0" + cents;
		for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
		    num = num.substring(0,num.length-(4*i+3))+','+
		          num.substring(num.length-(4*i+3));
  	    return (((sign)?'':'-') + '€' + num + '.' + cents);
	}

function InitForm()
			{
			document.john.total.value='€0';
			document.john.total2.value=0;			
			document.john.hiddentotal.value=0;
			document.john.hiddentotal2.value=0;
			document.john.hiddentotal3.value=0;
			document.john.hiddentotal4.value=0;
			document.john.hiddentotal5.value=0;
			document.john.hiddentotal6.value=0;
			document.john.hiddentotal7.value=0;
			document.john.hiddentotal8.value=0;									
			document.john.hiddentotal9.value=0;
			document.john.hiddentotal10.value=0;
			document.john.hiddentotal11.value=0;
			document.john.hiddentotal12.value=0;
			document.john.hiddentotal13.value=0;
			document.john.hiddentotal14.value=0;
			document.john.hiddentotal15.value=0;
			document.john.hiddentotal16.value=0;
			document.john.hiddentotal17.value=0;
			document.john.hiddentotal18.value=0;
			document.john.hiddentotal19.value=0;
			document.john.hiddentotal20.value=0;
			document.john.hiddentotal21.value=0;
			document.john.hiddentotal22.value=0;
			document.john.hiddentotal23.value=0;			
			document.john.hiddentotal24.value=0;

			for (xx=0; xx < document.john.elements.length; xx++)
			{
		 	if (document.john.elements[xx].type == 'checkbox' | document.john.elements[xx].type == 'radio')
			{
			document.john.elements[xx].checked = false;
			}
		}
}
