function ckeckHelpDeskForm()
{
	var empty = document.help_desk_form.comment.value;
    if(chkEmpty(empty)==false){
    document.help_desk_form.comment.select();
    document.help_desk_form.comment.focus();
    return false;
    }
	
	document.help_desk_form.method="post"
	document.help_desk_form.action="Submit_Query.asp"
	document.help_desk_form.submit();
}

function ckeckSMSForm()
{
	var empty = document.SMS_form.Messages.value;
    if(chkEmpty(empty)==false) {
    document.SMS_form.Messages.select();
    document.SMS_form.Messages.focus();
    return false;
    }
	
	document.SMS_form.method="post"
	document.SMS_form.action="Submit_SMSQuery.asp"
	document.SMS_form.submit();
}

function ckeckAnnouncementForm()
{
	var empty = document.Announcement_form.Messages.value;
    if(chkEmpty(empty)==false) {
    document.Announcement_form.Messages.select();
    document.Announcement_form.Messages.focus();
    return false;
    }

	document.Announcement_form.method="post"
	document.Announcement_form.action="Submit_AnnouncementQuery.asp"
	document.Announcement_form.submit();
}
function ckeckFeedbackForm()
{
	
	var empty = document.feedback_form.comment.value;
    if(chkEmpty(empty)==false){
    document.feedback_form.comment.select();
    document.feedback_form.comment.focus();
    return false;
    }



// validation for email
	var email = document.feedback_form.email.value;
    if(chkEmail(email)==false){
    document.feedback_form.email.select();
    document.feedback_form.email.focus();
    return false;
    }
	
	var empty = document.feedback_form.requestername.value;
    if(chkEmpty(empty)==false){
    document.feedback_form.requestername.select();
    document.feedback_form.requestername.focus();
    return false;
    }
	
	
	document.feedback_form.method="post"
	document.feedback_form.action="Submit_Feedback.asp"
	document.feedback_form.submit();
	
}
function ckeckPosterForm()
{
	//alert("hgjh");
	
	var empty = document.poster_form.requestername3.value;
    if(chkEmptyname(empty)==false){
    document.poster_form.requestername3.select();
    document.poster_form.requestername3.focus();
    return false;
    }
	
	var empty = document.poster_form.studentid.value;
    if(chkEmptySTUDENTID(empty)==false){
    document.poster_form.studentid.select();
    document.poster_form.studentid.focus();
    return false;
    }




	
	
	
	document.poster_form.method="post"
	document.poster_form.action="Submit_poster.asp"
	document.poster_form.submit();
	
}

function ckeckTransferForm()
{
	var empty = document.transfer_form.requestername2.value;
    if(chkEmptyname(empty)==false){
    document.transfer_form.requestername2.select();
    document.transfer_form.requestername2.focus();
    return false;
    }
	
	var empty = document.transfer_form.studentid.value;
    if(chkEmptySTUDENTID(empty)==false){
    document.transfer_form.studentid.select();
    document.transfer_form.studentid.focus();
    return false;
    }




	
	
	
	document.transfer_form.method="post"
	document.transfer_form.action="Submit_transfer.asp"
	document.transfer_form.submit();
	
}
function ckeckTransferEPForm()
{
	
	  
	var empty = document.transferEP_form.studentid.value;
    if(chkEmptySTUDENTID(empty)==false){
    document.transferEP_form.studentid.select();
    document.transferEP_form.studentid.focus();
    return false;
    }




	
	var empty = document.transferEP_form.requestername2.value;
    if(chkEmptyname(empty)==false){
    document.transferEP_form.requestername2.select();
    document.transferEP_form.requestername2.focus();
    return false;
    }
	
	
	document.transferEP_form.method="post"
	document.transferEP_form.action="Submit_transferEP.asp"
	document.transferEP_form.submit();
	
}

function checkLogin()
{
	//alert("hgjh");
	document.loginForm.method="post"
	document.loginForm.action="login.asp"
	document.loginForm.submit();
	//document.dataForm.reset();
	
}

function delete1()
{
	document.loginForm.method="post"
	document.loginForm.action="delete1.asp"
	document.loginForm.submit();
	//document.dataForm.reset();
	//alert("hgjh");
}
/* Script for form validation in Query submition 
Written by Md Mushtaq Ahamed Dtd : 03 - Apr - 2004 */

function chkCountry()
{
	l = document.dataForm.country.length;
	//alert (l);
	for(i=0;i<l;i++)
	{
		if(document.dataForm.country[i].selected)
		{
			//alert (i);
			document.dataForm.countryHidden.value = document.dataForm.country[i].value;
			//alert (document.dataForm.countryHidden.value);
		}
	}
}

function countChars(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else 
countfield.value = maxlimit - field.value.length;
}
						
/*function countChars()
{
	s = new String;
	s = document.dataForm.message.value;
	l = s.length;
	fixed_len = 299;
	document.dataForm.count.value = fixed_len - l;
	
	if (l >= 299)
	{
		document.dataForm.message.blur();
		alert("Cant type more !");
	}
}*/

function ckeckRegForm()
{
	
	//alert("ASDF");
	
	
	var pwd1 = document.login_register_form.login_pwd.value;
    if(chkEmpty(pwd1)==false){
    document.login_register_form.login_pwd.select();
    document.login_register_form.login_pwd.focus();
    return false;
    }
	
	//alert("uuu");
	var pwd2 = document.login_register_form.login_pwd2.value;
    if(chkEmpty(pwd2)==false){
    document.login_register_form.login_pwd2.select();
    document.login_register_form.login_pwd2.focus();
    return false;
    }
	
	//var pwd1 = document.login_register_form.login_pwd.value;
	//var pwd2 = document.login_register_form.login_pwd2.value;
    if(pwd1 != pwd2){
	alert("Password Error!");
    document.login_register_form.login_pwd.value="";
    document.login_register_form.login_pwd2.value="";
	document.login_register_form.login_pwd.focus();
    return false;
    }
	//alert("after validation");
		
	
	var empty = document.login_register_form.first_name.value;
    if(chkEmpty(empty)==false){
    document.login_register_form.first_name.select();
    document.login_register_form.first_name.focus();
    return false;
    }
	
	var numbers = document.login_register_form.dob_day.value;
	{
		if(chkDobDay(numbers)==false){
		//document.login_register_form.dob_day.select();
		document.login_register_form.dob_day.focus();
		return false;
		}
		//alert("please enter the day ");
	}
	
	var numbers = document.login_register_form.dob_month.value;
	{
		if(chkDobMonth(numbers)==false){
		//document.login_register_form.dob_month.select();
		document.login_register_form.dob_month.focus();
		return false;
		}
		//alert("please enter the month ");
	}
	
	
	var numbers = document.login_register_form.dob_year.value;
	{
		if(chkDobYear(numbers)==false){
		document.login_register_form.dob_year.select();
		document.login_register_form.dob_year.focus();
		return false;
		}
		//alert("please enter year ");
	}
	
	/*var country = document.dataForm.countryHidden.value;
    if(country =='0'){
    alert ("Please select a Country !!");
    document.dataForm.country.focus();
    return false;
    }
	
	var numbers = document.dataForm.cCode1.value;
	if(chkNumbers(numbers)==false){
	document.dataForm.cCode1.select();
	document.dataForm.cCode1.focus();
	return false;
	}
	
	var numbers = document.dataForm.code1.value;
	if(chkNumbers(numbers)==false){
	document.dataForm.code1.select();
	document.dataForm.code1.focus();
	return false;
	}
	
	var numbers = document.dataForm.phone1.value;
	if(chkNumbers(numbers)==false){
	document.dataForm.phone1.select();
	document.dataForm.phone1.focus();
	return false;
	}
	
	// Validating for phone2 if wrongly filled
	var numbers1 = document.dataForm.cCode2.value;
	var numbers2 = document.dataForm.code2.value;
	var numbers3 = document.dataForm.phone2.value;
	
	if ((numbers1 != '') || (numbers2 != '') || (numbers3 != '')){
	    if(chkNumbers(numbers1)==false){
	    document.dataForm.cCode2.select();
	    document.dataForm.cCode2.focus();
	    return false;
	    }
		
		if(chkNumbers(numbers)==false){
	    document.dataForm.code2.select();
	    document.dataForm.code2.focus();
	    return false;
	    }
		
		if(chkNumbers(numbers)==false){
	    document.dataForm.phone2.select();
	    document.dataForm.phone2.focus();
	    return false;
	    }
	}
	
		
	// validation for email
	var email = document.dataForm.email.value;
    if(chkEmail(email)==false){
    document.dataForm.email.select();
    document.dataForm.email.focus();
    return false;
    }
	
	var empty = document.dataForm.message.value;
    if(chkEmpty(empty)==false){
    document.dataForm.message.select();
    document.dataForm.message.focus();
    return false;
    }*/
	
	
	document.login_register_form.method="post"
	document.login_register_form.action="login_edit_success.asp"
	document.login_register_form.submit();
	document.login_register_form.reset();
	//alert('reset');
}



function chkEmptySTUDENTID(field){
if(field==""){
alert("Please fill in your Student ID !!");
return false;
}
return true;
}

function chkEmptyname(field){
if(field==""){
alert("Please fill in your name !!");
return false;
}
return true;
}

function chkEmpty(field){
if(field==""){
alert("Please fill in the following field !!");
return false;
}
return true;
}

function chkLetters(field){
if(field!=""){
    for (var i = 0; i < field.length; i++){
    var chr = field.substring(i, i + 1);
        if((chr < "a" || "z" < chr) && (chr < "A" || "Z" < chr)){
        alert("Please enter text only !!");
        return false;
        }
    }
}else{
alert("Please enter text only !!");
return false;
}
return true;
}

/*function chkCountry(field){
if(field!=""){
    for (var i = 0; i < field.length; i++){
    var chr = field.substring(i, i + 1);
        if((chr < "a" || "z" < chr) && (chr < "A" || "Z" < chr)){
        alert("Please select a Country !!");
        return false;
        }
    }
}else{
alert("Please select a Country !!");
return false;
}
return true;
}*/

function chkNumbers(field){
if(field!=""){
    for (var i = 0; i < field.length; i++){
    var chr = field.substring(i, i + 1);
        if (chr < "0" || "9" < chr){
        alert("Please enter numbers only !!");
        return false;
        }
    }
}else{
alert("Please enter numbers only !!");
return false;
}
return true;
}

function chkDobDay(field){
if(field!=""){
    for (var i = 0; i < field.length; i++){
    var chr = field.substring(i, i + 1);
        if (chr < "0" || "9" < chr){
        alert("Please Select a day from the list !!");
        return false;
        }
    }
}else{
alert("Please Select a day from the list !!");
return false;
}
return true;
}

function chkDobMonth(field){
if(field==""){
alert("Please Select a month from the list !!");
return false;
}
return true;
}

function chkDobYear(field){
if(field!=""){
    for (var i = 0; i < field.length; i++){
    var chr = field.substring(i, i + 1);
        if (chr < "0" || "9" < chr){
        alert("Please enter a vaild year  !!");
        return false;
        }
    }
}else{
alert("Please enter a vaild year  !!");
return false;
}
return true;
}


function chkEmail(field){
if(field!=""){
    if (field.indexOf("@",0) == -1||field.indexOf(".",0) == -1){
    alert("Please enter a valid E-Mail !!");
    return false;
    }
}else{
alert("Please enter a valid E-Mail !!");
return false;
}
return true;
}
function ckeckAlumniForm()
{
	
	


// validation for email
	var email = document.alumni_form.email.value;
    if(chkEmail(email)==false){
    document.alumni_form.email.select();
    document.alumni_form.email.focus();
    return false;
    }

// validation for alumni name
	var empty = document.alumni_form.firstname.value;
    if(chkEmpty(empty)==false){
    document.alumni_form.firstname.select();
    document.alumni_form.firstname.focus();
    return false;
    }
	
	var empty = document.alumni_form.familyname.value;
    if(chkEmpty(empty)==false){
    document.alumni_form.familyname.select();
    document.alumni_form.familyname.focus();
    return false;
    }

// validation for civilid
	var empty = document.alumni_form.civilid.value;
    if(chkEmpty(empty)==false){
    document.alumni_form.civilid.select();
    document.alumni_form.civilid.focus();
    return false;
    }
	
	
	
	
	
//alert('reset');
	document.alumni_form.method="post"
	document.alumni_form.action="Submit_Alumni.asp"
	document.alumni_form.submit();
	
}

function ckeckwhereForm()
{
	
	//alert("ASDF");
	document.where_form.method="post"
	document.where_form.action="Submit_Alumni_where.asp"
	document.where_form.submit();
	
}

function ckeckmissForm()
{
	
	//alert("ASDF");
	document.miss_form.method="post"
	document.miss_form.action="Submit_Alumni_miss.asp"
	document.miss_form.submit();
	
}
function checkalumniLogin()
{
	//alert("hgjh");
	document.loginalumniForm.method="post"
	document.loginalumniForm.action="login_alumni_edit.asp"
	document.loginalumniForm.submit();
	//document.dataForm.reset();
	
}
function checkalumniLoginTop()
{
	//alert("hgjh");
	document.loginalumniForm.method="post"
	document.loginalumniForm.action="login_alumni_edit_top.asp"
	document.loginalumniForm.submit();
	//document.dataForm.reset();
	
}
function ckeckAlumniEditForm()
{
	

	//alert("ASDF");
	
	
	var pwd1 = document.alumniedit_form.pwd.value;
    if(chkEmpty(pwd1)==false){
    document.alumniedit_form.pwd.select();
    document.alumniedit_form.pwd.focus();
    return false;
    }
	
	//alert("uuu");
	var pwd2 = document.alumniedit_form.pwd2.value;
    if(chkEmpty(pwd2)==false){
    document.alumniedit_form.pwd2.select();
    document.alumniedit_form.pwd2.focus();
    return false;
    }
	
	//var pwd1 = document.login_register_form.login_pwd.value;
	//var pwd2 = document.login_register_form.login_pwd2.value;
    if(pwd1 != pwd2){
	alert("Password Error!");
    document.alumniedit_form.pwd.value="";
    document.alumniedit_form.pwd2.value="";
	document.alumniedit_form.pwd.focus();
    return false;
    }
	
//alert("hgjh");
	document.alumniedit_form.method="post"
	document.alumniedit_form.action="Submit_Alumni_edit.asp"
	document.alumniedit_form.submit();
	
}
function ckeckRegFormldap()
{
	
	//alert("ASDF");
	
	
	
	
	var empty = document.login_registerldap_form.first_name.value;
    if(chkEmpty(empty)==false){
    document.login_registerldap_form.first_name.select();
    document.login_registerldap_form.first_name.focus();
    return false;
    }
	
	var numbers = document.login_registerldap_form.dob_day.value;
	{
		if(chkDobDay(numbers)==false){
		//document.login_register_form.dob_day.select();
		document.login_registerldap_form.dob_day.focus();
		return false;
		}
		//alert("please enter the day ");
	}
	
	var numbers = document.login_registerldap_form.dob_month.value;
	{
		if(chkDobMonth(numbers)==false){
		//document.login_register_form.dob_month.select();
		document.login_registerldap_form.dob_month.focus();
		return false;
		}
		//alert("please enter the month ");
	}
	
	
	var numbers = document.login_registerldap_form.dob_year.value;
	{
		if(chkDobYear(numbers)==false){
		document.login_registerldap_form.dob_year.select();
		document.login_registerldap_form.dob_year.focus();
		return false;
		}
		//alert("please enter year ");
	}
	
	
	
	
	document.login_registerldap_form.method="post"
	document.login_registerldap_form.action="login_edit_success_ldap.asp"
	document.login_registerldap_form.submit();
	document.login_registerldap_form.reset();
	//alert('reset');
}