
function checkForm(){

if(document.form1.ARR.value == 0){
alert("Please choose the arrival date");
return false;
}else if(document.form1.DEP.value == 0){
alert("Please choose the departure date");
return false;
}else if(document.form1.PERSONS.value == 0){
alert("Please fill in the number of persons");
return false;
}else if(document.form1.NIGHTS.value == 0){
alert("Please fill in the number of nights to stay");
return false;
}else if(document.form1.NAME.value.length == 0){
alert("Please fill in your Name");
return false;
}else if(document.form1.SURNAME.value.length == 0){
alert("Please fill in your Surname");
return false;
}else if(document.form1.COUNTRY.value == 0){
alert("Please fill in your Country");
return false;
}else if(document.form1.EMAIL.value.length == 0 || document.form1.EMAIL.value.indexOf("@") < 0 ||  document.form1.EMAIL.value.indexOf(".") < 0){
alert("Please fill in your Email correctly"); 
return false; //-----------------------------------------------------------------------------------
}
else {
  return true;     
  }
            
}



var ApartmentLow = 45; 
var ApartmentHigh = 60; 
var DoubleLow = 28; 
var DoubleHigh = 33; 
var SingleLow = 20; 
var SingleHigh = 30; 
var StudioLow = 30; 
var StudioHigh = 40; 
var TripleLow = 30; 
var TripleHigh = 35; 


function calculateIt(){
var single;
var double_r;
var triple;
var studio;
var apartment;

/*var SingleLow=20;
var SingleHigh=30;
var DoubleLow=25;
var DoubleHigh=33;
var TripleLow=30;
var TripleHigh=35;
var StudioLow=30;
var StudioHigh=40;
var ApartmentLow=40;
var ApartmentHigh=55;
*/


var days_n = 0;
var total = 0;

	for(i=0; i<document.form1.Single.length; i++) { 
		if (document.form1.Single.options[i].selected){
		single = document.form1.Single.options[i].value;
		}
 	}

 	for(i=0; i<document.form1.DAYS.length; i++) { 
		if (document.form1.DAYS.options[i].selected){
		days_n = document.form1.DAYS.options[i].value;
		}
 	}


	for(i=0;i<document.form1.Double.length;i++) { 
		if (document.form1.Double.options[i].selected){
		double_r = document.form1.Double.options[i].value;
		}
 	}

	for(i=0;i<document.form1.Triple.length;i++) { 
		if (document.form1.Triple.options[i].selected){
		triple = document.form1.Triple.options[i].value;
		}
 	}

	for(i=0;i<document.form1.Studio.length;i++) { 
		if (document.form1.Studio.options[i].selected){
		studio = document.form1.Studio.options[i].value;
		}
 	}
 	
 		for(i=0;i<document.form1.Apartment.length;i++) { 
		if (document.form1.Apartment.options[i].selected){
		apartment = document.form1.Apartment.options[i].value;
		}
 	}

if(document.form1.SEASON[0].checked){
total = ((single * SingleLow) *  days_n) + ((double_r * DoubleLow) *  days_n) + ((triple * TripleLow) *  days_n) + ((studio * StudioLow) *  days_n) + ((apartment * ApartmentLow) *  days_n)
}else{
total = ((single * SingleHigh) *  days_n) + ((double_r * DoubleHigh) *  days_n) + ((triple * TripleHigh) *  days_n) + ((studio * StudioHigh) *  days_n) + ((apartment * ApartmentHigh) *  days_n)
}

//document.form1.TOTAL.value = total;
//document.form1.DEPOSIT.value = total * 1/5 ;

document.form1.TOTAL.value = CurrencyFormatted(total);
document.form1.DEPOSIT.value = CurrencyFormatted(total * 1/5);

}


function CurrencyFormatted(amount)
{
	var i = parseFloat(amount);
	if(isNaN(i)) { i = 0.00; }
	var minus = '';
	if(i < 0) { minus = '-'; }
	i = Math.abs(i);
	i = parseInt((i + .005) * 100);
	i = i / 100;
	s = new String(i);
	if(s.indexOf('.') < 0) { s += '.00'; }
	if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
	s = minus + s;
	return s;
}


function movefocus(){
document.form1.CNAME.focus();
}