/* rayJax Javascript Doument 					*/
/* Author: Md. Rayhan Chowdhury 			*/

var rayJax={
	updateOnlineForm: function(projId, id){
		if (id == 0 ) {
			id = $F(projId);
		} 
		var pars = 'id=' + id;		
		var url = '_lib/_ajaxbin/ajax.online_appl.php';
		//var pars = 'id='+hNdl.value;
		var target = 'proj_ajax_result';
		$('proj_address').value='';
		$('proj_name').value='';
		$(target).innerHTML='<div class="msg">Loading ...</div>'
		var myAjax = new Ajax.Updater(target, url, {method: 'post', parameters: pars,evalScripts: true});		
	},
	
	checkForm	:	function(){
		var formOk=true;
		err_msg='';
		
		if($F('apc_name').length < 5 || $F('apc_email').length < 6 || $F('apc_mailing_address').length < 2 || $F('apc_permanent_address').length < 2 || $F('apc_mobile').length < 9 || $F('apc_nationality').length < 5 || $F('apc_dob').length < 5){
			formOk=false;
			err_msg+='Please enter your personal information correctly! \r\n';
		}
		if($F('proj_name').length < 5 || $F('proj_address').length < 5){
			
			formOk=false;
			err_msg+='Please enter project information correctly! \r\n';
		}
		
		if(formOk){
			return true;
		}else{
			alert(err_msg);
			return false;
		}
	}
	
}