// JavaScript Document
function sendForm(form,PageId){
	if(typeof PageId=='undefined'){
		form.action=base_url;
	}else{
		form.action=getUrl(PageId);
	}
	form.submit();
}

function checkForm(form,required){
	required=required.split(",");
	for(i=0;i<required.length;i++){
		control=document.getElementById(required[i]);
		switch(control.type){
			case 'text':
				if(control.value.length<1){
					showError(control.id);
					control.focus();
					return false;
				}
				break;
			case 'textarea':
				if(control.value.length<1){
					showError(control.id);
					control.focus();
					return false;
				}
				break;
			case 'checkbox':
				if(control.checked==false){
					showError(control.id);
					control.focus();
					return false;
				}
				break;
		}
		
	}
	return true;
}

function showError(controlName){
		alert("The " + controlName + " is required field!");
	}