function check(strval,message){
	if(valid) {
    var re = new RegExp('[^A-Za-z0-9\n\-_.,()/ @]', 'g');
		strval.value=strval.value.replace(re,'');
		if(strval.value=="") {
			valid = false;
			alert(message);
			try{
			  strval.focus();
		  } catch(z) {}
		}
	}
}

function checkfieldnumeric(strval,message){
	if(valid) {
		str = (typeof strval == "object") ? strval.value : strval;
	  if (typeof strval == "object") strval.value = str;
		if((str == "") || isNaN(str)){
			valid = false;
			alert(message);
			try{
			  if (typeof strval == "object") strval.focus();
		  } catch(z) {}
		}
	}
}

function checklength(strval,minstr,message){
	if(valid) {
    var re = new RegExp('[^A-Za-z0-9\n\-_.,()/ @]', 'g');
		strval.value=strval.value.replace(re,'');
		if(strval.value.length < minstr) {
			valid = false;
			alert(message);
			try{
			  strval.focus();
		  } catch(z) {}
		}
	}
}

function checkfixlength(strval,fixstr,message){
	if(valid) {
    var re = new RegExp('[^A-Za-z0-9\n\-_.,()/ @]', 'g');
		strval.value=strval.value.replace(re,'');
		if(strval.value.length != fixstr) {
			valid = false;
			alert(message);
			try{
			  strval.focus();
		  } catch(z) {}
		}
	}
}

function checkradio(radioname, count, message) {
/*	Function untuk mengecek radio buttons
	radioname: nama radio
	count: jumlah radio
	message: pesan yang ditampilkan apabila tidak ada radio yang dipilih */
	if(valid) {
		valid=false;
		for(i=0; i<count; i++) {
			if(radioname(i).checked)
				valid=true;
		}
		if(!valid) {
			alert(message);
			radioname.focus();
		}
	}
}


