<!-- Begin

//-----------------------------------------------

//--- FORM Validations -------------------------
function ValidatefrmUserApprove(form){
	if(confirm('Approve Examinee?')) {
		//paidby - paidor
		//username - passwd	
		if(!trim(form.username.value)) 	return feedback(form.username,"Please fill-in username.");
		if(!trim(form.passwd.value)) 	return feedback(form.passwd,"Please fill-in password.");
		return true;
	} else {
		return false;
	}
}	


function ValidatefrmGroups(form){
	//group - notes
	if(!trim(form.groupname.value)) 	return feedback(form.groupname,"Please fill-in Group field.");
}

function ValidatefrmAdmin(form){
	//username - passwd - repasswd - fullname - email
	
	if(!trim(form.username.value)) 		return feedback(form.username,"Please fill-in all fields.");
	if(!trim(form.passwd.value)) 		return feedback(form.passwd,"Please fill-in all fields.");
	if(!trim(form.repasswd.value)) 		return feedback(form.repasswd,"Please fill-in all fields.");
	if(!trim(form.fullname.value)) 		return feedback(form.fullname,"Please fill-in all fields.");
	if(!trim(form.email.value)) 		return feedback(form.email,"Please fill-in all fields.");
	if(form.passwd.value != form.repasswd.value) return feedback(form.passwd,"Sorry, Passwords does not match.");
	return true;
}

function ValidatefrmOnlineregGroup(form){
	//name - position - organization - location - email - reemail - phone - fax 
	//mobile - referredby - interest - participants - others
	
	if(!trim(form.name.value)) 			return feedback(form.name,"Please fill-in all fields.");
	if(!trim(form.position.value)) 		return feedback(form.position,"Please fill-in all fields.");
	if(!trim(form.organization.value)) 	return feedback(form.organization,"Please fill-in all fields.");
	if(!trim(form.location.value)) 		return feedback(form.location,"Please fill-in all fields.");
	if(!trim(form.email.value)) 		return feedback(form.email,"Please fill-in all fields.");
	if(!trim(form.reemail.value)) 		return feedback(form.reemail,"Please fill-in all fields.");
	if(!trim(form.phone.value)) 		return feedback(form.phone,"Please fill-in all fields.");
	if(!trim(form.fax.value)) 			return feedback(form.fax,"Please fill-in all fields.");
	//if(!trim(form.mobile.value)) 		return feedback(form.mobile,"Please fill-in all fields.");
	if(form.email.value != form.reemail.value) return feedback(form.reemail,"Sorry, E-mail does not match.");
	return true;
}	

function ValidatefrmUserAccount(form){
	// lastname - firstname - nationality - organization - industry - position - email - age - gender - english - education
	if(!trim(form.firstname.value))		return feedback(form.firstname,"Please fill-in all fields.");
	if(!trim(form.lastname.value)) 		return feedback(form.lastname,"Please fill-in all fields.");
	if(form.nationality.value==0)		return feedback(form.nationality,"Please fill-in all fields.");
	if(!trim(form.organization.value))	return feedback(form.organization,"Please fill-in all fields.");
	if(!trim(form.industry.value))		return feedback(form.industry,"Please fill-in all fields.");
	if(!trim(form.position.value))		return feedback(form.position,"Please fill-in all fields.");
	if(!trim(form.email.value))			return feedback(form.email,"Please fill-in all fields.");
	//if(!trim(form.age.value))			return feedback(form.age,"Please fill-in all fields.");
	if(!trim(form.age.value))			form.age.value = '0'
	return true;
}	


function ValidatefrmChangePasswd(form){
	// username - oldpasswd - newpasswd - repasswd
	if(!trim(form.username.value)) 	return feedback(form.username,"Sorry, Invalid Authentication.");
	if(!trim(form.oldpasswd.value)) return feedback(form.oldpasswd,"Sorry, Invalid Authentication.");
	if(!trim(form.newpasswd.value)) return feedback(form.newpasswd,"Sorry, Invalid Authentication.");
	if(!trim(form.repasswd.value)) 	return feedback(form.repasswd,"Sorry, New Password Does Not Match.");
	if(form.newpasswd.value != form.repasswd.value) return feedback(form.repasswd,"Sorry, New Password Does Not Match.");
	return true;
}

function ValidatefrmGetPasswd1(form){
	// username - email
	if(!trim(form.username.value)) 	return feedback(form.username,"Sorry, Invalid Information.");
	if(!trim(form.email.value)) 	return feedback(form.email,"Sorry, Invalid Information.");
	return true;
}

function ValidatefrmGetPasswd2(form){
	// firstname - lastname 
	if(!trim(form.firstname.value)) return feedback(form.firstname,"Sorry, Invalid Information.");
	if(!trim(form.lastname.value)) 	return feedback(form.lastname,"Sorry, Invalid Information.");
	return true;
}

function ValidatefrmLogin(form) {
	// username - passwd
	if(!trim(form.username.value)) 	return feedback(form.username,"Sorry, Invalid Authentication.");
	if(!trim(form.passwd.value)) 	return feedback(form.passwd,"Sorry, Invalid Authentication.");
	return true;
}

function trim(value) {
   var temp = value;
   var obj = /^(\s*)([\W\w]*)(\b\s*$)/;
   if (obj.test(temp)) { temp = temp.replace(obj, '$2'); }
   var obj = / +/g;
   temp = temp.replace(obj, " ");
   if (temp == " ") { temp = ""; }
   return temp;
}
function feedback(obj,msg) {
	alert(msg);
	obj.focus()
	return false;
}

//-----------------------------------------------
//-- windows popup 
function winpop(strURL, objName, width, height) {
	window.open(strURL, objName, 'scrollbars=yes,resizable=no,height=' + height + ',width=' + width +',left=' + (screen.width-width)/2 + ',top='+ (screen.height-height)/2 +',status=0');
}
//-----------------------------------------------

//------ no right click -------------------------
var message="Welcome to AIM - Emotional Intelligence Test";

function click(e) {
	if (document.all) {
		if (event.button == 2) {
			alert(message);
			return false;
		}
	}
	if (document.layers) {
		if (e.which == 3) {
			alert(message);
			return false;
		}
	}
}
if (document.layers) {
	document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;
//------------------------------------------------

//------ jscript tools ---------------------------

//replace invalid chars (for username)
function InvalidChars(frmObj) {
	var regInvalid = /[ ,:;~!@#$%^&*()?"'`<>+=|{}\/\\/]/gi;
	var str = frmObj.value.toLowerCase();

	if (str.match(regInvalid))	frmObj.value = str.replace(regInvalid,"");
}

//digits & valid phone/fax chas
function ValidatePhoneFax(frmObj) {
	var regNotPhone=/[^- +\/(0-9)]/gi;
	var tmpStr=frmObj.value;
	if(tmpStr.match(regNotPhone)) {
		frmObj.value=tmpStr.replace(regNotPhone,"");
	}
}

//integers input only
function ValidateInt(frmObj) {
	var regNotInt=/[^0-9]/gi;
	var tmpStr=frmObj.value;
	frmObj.value=tmpStr.replace(regNotInt,"");
}

//e-mail address
function ValidateEmail(frmObj) {
	var regEmail=/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi;
	frmObj.value = frmObj.value.toLowerCase();
	if(trim(frmObj.value)){
		if(!regEmail.test(frmObj.value)) {
			alert("Sorry, invalid email address format.");
			frmObj.select();
			frmObj.focus();
		}
	} else { frmObj.value = ""; }
}

//trim spaces - used by other functions
function trim(value) {
   var temp = value;
   var obj = /^(\s*)([\W\w]*)(\b\s*$)/;
   if (obj.test(temp)) { temp = temp.replace(obj, '$2'); }
   var obj = / +/g;
   temp = temp.replace(obj, " ");
   if (temp == " ") { temp = ""; }
   return temp;
}

//uppercase/lowercase text value
function LowerCase(frmObj){
	frmObj.value = frmObj.value.toLowerCase();
}	
function UpperCase(frmObj){
	frmObj.value = frmObj.value.toUpperCase();
}	
function ProperCase(frmObj) {
	var index;
	var tmpStr;
	var tmpChar;
	var preString;
	var postString;
	var strlen;

	tmpStr = trim(frmObj.value.toLowerCase());
	strLen = tmpStr.length;

	if (strLen > 0)  {
		for (index = 0; index < strLen; index++)  {
			if (index == 0)  {
				tmpChar = tmpStr.substring(0,1).toUpperCase();
				postString = tmpStr.substring(1,strLen);
				tmpStr = tmpChar + postString;
			} else {
				tmpChar = tmpStr.substring(index, index+1);
				if (tmpChar == " " && index < (strLen-1))  {
					tmpChar = tmpStr.substring(index+1, index+2).toUpperCase();
					preString = tmpStr.substring(0, index+1);
					postString = tmpStr.substring(index+2,strLen);
					tmpStr = preString + tmpChar + postString;
	         	}
	      	}
	   }
	}
	frmObj.value = tmpStr;
}
//------------------------------------------------

// ******** Status Bar Javascript Magic by Likno 1.0 **********
function statusbar_start() {clearInterval(statusbar.sttm);statusbar_init();if (arguments.length>0) statusbar_init2(arguments[0]);statusbar.sttm=setInterval ("doEffect('statusbar')",10);}
function statusbar_stop() {clearInterval(statusbar.sttm);window.status="";}

statusbar_init();
function statusbar_init() {statusbar={stel:0,stft:"",stec:1,stcel:1,stce:-1,stcl:-1,stls:-1,stcs:0,sttg:0,stea:["AIM-Emotiona Intelligence Test",11,10,1]};}
function statusbar_init2 (en) {statusbar.stea=[statusbar.stea[(en-1)*4],statusbar.stea[(en-1)*4+1],statusbar.stea[(en-1)*4+2],statusbar.stea[(en-1)*4+3]];statusbar.stec=1;statusbar.stel=0;}
function doEffect(es) {var s=eval(es);if (s.stce==s.stec) {if (s.stcel==s.stel) {clearInterval(s.sttm);window.status=s.stft;return;} else {if (s.stel>0) s.stcel++;s.stce=-1;s.stcl=s.stls;}}if (s.stcl==s.stls) {s.stce++;s.sttx=s.stea[s.stce*4];s.sttp=s.stea[s.stce*4+1];s.stsd=s.stea[s.stce*4+2];s.stls=s.stea[s.stce*4+3];s.stcl=0;s.stsp=1;s.sttg=0;}if (21-s.stsd-s.sttg==0) {var stres=eval("stEffect"+s.sttp+"(s.sttx,s.stsp++,es);");s.sttg=0;if (stres!="") window.status=stres;else {s.stcl++;s.stsp=1;}}s.sttg++;}
function stEffect11(text,step){if (step>3) return ""; else return text;}
statusbar_start();
// End -->