// JavaScript Document

function VerifyContact() {
var txt = "";
	
	if (document.formular.name.value=="") {
	 txt = txt + "\n * Name";
	}
	if (document.formular.yourcountry.value=="") {
	 txt = txt + "\n * Your Country";
	}
	if (document.formular.telephone.value=="") {
	 txt = txt + "\n * Telephone";
	}
	var str=document.formular.email.value
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i 
	if (!filter.test(str)) {
	 txt = txt + "\n * Email is not Valid";
	}
	if (document.formular.message.value=="") {
	 txt = txt + "\n * Message";
	}
	if (document.formular.code.value=="") {
	 txt = txt + "\n * Confirmation Code";
	}
	
	for(var i = 0; i < document.formular.country_id.length; i++) {
	if(document.formular.country_id[i].selected) {
		if(document.formular.country_id[i].value=="") {
		  txt = txt + "\n * Country";
		}
	}
	}
	
	for(var i = 0; i < document.formular.prog_id.length; i++) {
	if(document.formular.prog_id[i].selected) {
		if(document.formular.prog_id[i].value=="") {
		  txt = txt + "\n * Programme";
		}
	}
	}
	
	if (txt) {
		alert ("The folowing fields are required:\n" + txt);
		return false;
	}		
}

function VerifyBooking() {
var txt = "";
	
	for(var i = 0; i < document.frmbook.country_id.length; i++) {
	if(document.frmbook.country_id[i].selected) {
		if(document.frmbook.country_id[i].value=="") {
		  txt = txt + "\n * Country";
		}
	}
	}
	
	if (document.frmbook.firstname.value=="") {
	 txt = txt + "\n * First Name";
	}
	if (document.frmbook.lastname.value=="") {
	 txt = txt + "\n * Last Name";
	}
	if (document.frmbook.address.value=="") {
	 txt = txt + "\n * Address";
	}
	if (document.frmbook.city.value=="") {
	 txt = txt + "\n * City";
	}
	if (document.frmbook.country.value=="") {
	 txt = txt + "\n * Country";
	}
	if (document.frmbook.nationality.value=="") {
	 txt = txt + "\n * Nationality";
	}
	if ((document.frmbook.dob.value=="") || (document.frmbook.dob.value=="DD/MM/YY"))  {
	 txt = txt + "\n * Date of Birth";
	}
	var str=document.frmbook.email.value
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i 
	if (!filter.test(str)) {
	 txt = txt + "\n * Email is not Valid";
	}
	
	var str=document.frmbook.confirmemail.value
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i 
	if (!filter.test(str)) {
	 txt = txt + "\n * Confirm Email is not Valid";
	}
	
	if (document.frmbook.email.value != document.frmbook.confirmemail.value) {
		txt = txt + "\n * Type Same Email Address Twice";
	}
	if (!document.frmbook.termsagree.checked) {
	 txt = txt + "\n * You have to accept our Terms & Conditions";
	}
	
	if (txt) {
		alert ("The folowing fields are required:\n" + txt);
		return false;
	}		
}

function VerifyPayInvoice() {
var txt = "";
	
	if (document.frmpayinv.name.value=="") {
	 txt = txt + "\n * Name";
	}
	var str=document.frmpayinv.email.value
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i 
	if (!filter.test(str)) {
	 txt = txt + "\n * Email is not Valid";
	}
	if (document.frmpayinv.invoice_number.value=="") {
	 txt = txt + "\n * Invoice Number";
	}
	if (document.frmpayinv.ammount.value=="") {
	 txt = txt + "\n * Amount";
	}
	
	if (txt) {
		alert ("The folowing fields are required:\n" + txt);
		return false;
	}		
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function VerifyCountry() {
var txt = "";
	
	for(var i = 0; i < document.formsearch.country_id.length; i++) {
	if(document.formsearch.country_id[i].selected) {
		if(document.formsearch.country_id[i].value=="") {
		  txt = txt + "\n * Country";
		}
	}
	}
	
	if (txt) {
		alert ("The folowing fields are required:\n" + txt);
		return false;
	}		
}
