function check_Form(formname) {
    ctrl = document.forms[formname];
    var chckdata;
    eval('chckdata = '+formname+';');
    return FormControl(ctrl, chckdata);
}

function FormControl(ctrl,FC){
    var Message,Field,value,i;
    var RetVal=true;
    
    for (i=0; i<FC.length && RetVal; i++){
        Field=eval("ctrl."+FC[i][0]);
        if (Field) {
            value=Field.value;
            checked=Field.checked;
            if(!eval(FC[i][1])){
                Message=FC[i][2];
                RetVal=false;
            }
        }
    }

    if(!RetVal){
        alert(Message);
        if (!Field.type) {
            if (Field.length != 'undefined') {
                Field[0].focus();
            }
        } else Field.focus();
        if (Field.type=="text" || Field.type=="password"){
            Field.select();
        }
    }
    return RetVal;
}

function clearContent(id) {
    var x = document.getElementById(id);
    if (x) {
        if (x.value) {
            if ( (x.value.substring(0,1)=='\u00A0') || (x.value.substring(0,1) == ' ')) {
                x.value = '';
            }
        }
    }
}