/**
 * myfurnipartners.js
 *
 * (c) 2009 Edu World Services Sdn. Bhd.
 * Scripts must not be copied, reproduced, modified or distributed without prior
 * written permission.
 */

// Restrict user input in a text field
var digitsOnly = /[1234567890]/g;
var integerOnly = /[0-9\.]/g;
var alphaOnly = /[A-Z]/g;

function restrictCharacters(myfield, e, restrictionType, checkdot){
	if (!e) var e = window.event
	if (e.keyCode) code = e.keyCode;
	else if (e.which) code = e.which;
	var character = String.fromCharCode(code);

	if (code==27){ this.blur(); return false; }
    
	if (!e.ctrlKey && code!=9 && code!=8 && code!=36 && code!=37 && code!=38 && (code!=39 || (code==39 && character=="'")) && code!=40){
		if (character.match(restrictionType)){
			if(checkdot == "checkdot"){
				return !isNaN(myfield.value.toString() + character);
			} else {
				return true;
			}
		} else {
            return false;
        }
    }
}