<!-- hide from old browsers
if (document.images) {
    img1on = new Image();
    img1on.src = "pics/newsboard_on.gif";
    img1off = new Image();
    img1off.src = "pics/newsboard_off.gif";

    img2on = new Image();
    img2on.src = "pics/activities_on.gif";
    img2off = new Image();
    img2off.src = "pics/activities_off.gif";

    img3on = new Image();
    img3on.src = "pics/publications_on.gif";
    img3off = new Image();
    img3off.src = "pics/publications_off.gif";

    img4on = new Image();
    img4on.src = "pics/brainsmart_on.gif";
    img4off = new Image();
    img4off.src = "pics/brainsmart_off.gif";

    img5on = new Image();
    img5on.src = "pics/webresources_on.gif";
    img5off = new Image();
    img5off.src = "pics/webresources_off.gif";

    img7on = new Image();
    img7on.src = "pics/about_on.gif";
    img7off = new Image();
    img7off.src = "pics/about_off.gif";

    img8on = new Image();
    img8on.src = "pics/support_on.gif";
    img8off = new Image();
    img8off.src = "pics/support_off.gif";
}

 function imgOn(imgName) {
	if (document.images){
		document[imgName].src = eval(imgName + "on.src");
	 }
 }

 function imgOff(imgName) {
	if (document.images) {
		document[imgName].src = eval(imgName + "off.src");
 	}
 }

 function CheckLogin(form){
	if (form.login_name.value=="" || form.password.value=="")
	{	alert("Please input username and password.");
		if (form.password.value=="") form.password.focus();
		if (form.login_name.value=="") form.login_name.focus();
		return false;
	}
 }

 function showhints(){
	hintwindow=window.open("login_hints.htm","hints","width=500,height=290,resizeable=no,menubar=no,toolbar=no,directories=no,location=no,scrollbars=yes,status=no");
	hintwindow.focus();
 }


 function add_bookmark(link,name){
	window.external.AddFavorite(link,name)
 }

 function CheckForget(form){
	if(isFieldBlank(form.name))
	{	alert("Please enter your full name.");
		form.name.focus();
		return false;
	}

	if((form.programme.selectedIndex == 0))
	{	alert("Please select the CUMBA programme.");
		form.programme.focus();
		return false;
	}

	if(isFieldBlank(form.graduation_year))
	{	alert("Please enter the graduation year.");
		form.graduation_year.focus();
		return false;
	}

	if(CheckYear(form.graduation_year,form.programme.selectedIndex)==false)
	{	form.graduation_year.focus();
		return false;
	}

	if(isFieldBlank(form.email_address))
	{	alert("Please enter your e-mail address.");
		form.email_address.focus();
		return false;
	}

	if(isValidEmail(form.email_address) == false)
	{	alert("Please enter a valid e-mail address.");
		form.email_address.focus();
		return false;
	}

	if (!confirm("Thank you for using our website. Please wait while we are processing your information. It may take some time to finish. When it is done, we will send you an e-mail with your login ID and password again. If you have any problem receiving this e-mail, please contact our supporting personnel."))
	{	return false;
	}else
	{ 	form.submit();
	}
 }

function isValidEmail(field)
{	if(field.value.indexOf("@",0)==-1 || field.value.indexOf("@",0)==(field.value.length-1))
		return false;
	if (field.value.indexOf(".",0)==-1 || field.value.indexOf(".",0)==(field.value.length-1))
		return false;
	for (var i=0;i<field.value.length;i++)
	{	var ch = field.value.charAt(i)
		if (!((ch >= "A" && ch <= "Z") || (ch >= "a" && ch <= "z")
					|| (ch == "@") || (ch == ".") || (ch == "_")
					|| (ch == "-") || (ch >= "0" && ch <= "9")))
			return false;
	}
	return true
}

function isFieldBlank(field)
{	if(field.value == "")
		return true;
	else
		return false;
}

function isNumberInput(str)
{	for (var i=0;i<str.value.length;i++)
	{	var ch = str.value.charAt(i);
		if (ch < "0" || ch > "9")
			return false;
	}
	return true;
}

function CheckYear(year,programme){
	var now = new Date();
	var this_year=now.getYear()
	if (navigator.appName=="Netscape"){
		this_year=1900+this_year;
	}
	if(programme==6 && year.value!= "0000"){
		alert("For Programme staff registration, please enter \"0000\" in the graduation year field.");
		return false;
	}
	if(programme!=6 && year.value=="0000"){
		alert("Sorry, the graduation year you have entered is not valid.")
		return false;
	}
	for (var i=0;i<year.value.length;i++)
	{	var ch = year.value.charAt(i);
		if (ch < "0" || ch > "9"){
			alert("Please enter digits only.")
			return false;
		}
	}
	if (year.value.length!=4){
		alert("Please enter the graduation year in four digit format.");
		return false;
	}

	if (year.value!="0000" && (parseInt(year.value)>this_year+10 || parseInt(year.value)<1966)){
		alert("Sorry, the graduation year you have entered is not valid.");
		return false;
	}
}

function forgotten_password_validate(form)
{
	if(isFieldBlank(form.name))
	{	alert("Please enter your full name.");
		form.name.focus();
		return false;
	}

	if((form.programme.selectedIndex == 0))
	{	alert("Please select the CUMBA programme.");
		form.programme.focus();
		return false;
	}

	if(isFieldBlank(form.graduation_year))
	{	alert("Please enter the graduation year.");
		form.graduation_year.focus();
		return false;
	}

	if(CheckYear(form.graduation_year,form.programme.selectedIndex)==false)
	{	form.graduation_year.focus();
		return false;
	}
}

function forgotten_password_email_validate(form)
{
	if(isFieldBlank(form.email_address))
	{	alert("Please enter your e-mail address.");
		form.email_address.focus();
		return false;
	}

	if(isValidEmail(form.email_address) == false)
	{	alert("Please enter a valid e-mail address.");
		form.email_address.focus();
		return false;
	}
}

// -->
