
function Highlight_Field(control_id){
   var ITSMHighlightFieldColor = "#FFFFFF";
   var jjsfieldname = document.getElementById(control_id);
   jjsfieldname.style.backgroundColor = ITSMHighlightFieldColor;
} //end Function
//=============================================================

function No_Highlight_Field(control_id){
   var ITSMBaseFieldColor = "#F4D1A7";
   var jjsfieldname = document.getElementById(control_id);
   jjsfieldname.style.backgroundColor = ITSMBaseFieldColor;
} //end Function
//=============================================================


function check(e) {
    ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm._-@QWERTYUIOPASDFGHJKLZXCVBNM";
    for(i=0; i < e.length ;i++){
        if(ok.indexOf(e.charAt(i))<0){
            return (false);
        }
    }
    if (document.images) {
        re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
        re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
        if (!e.match(re) && e.match(re_two)) {
            return (-1);
        }
    }
}

function _check(f){
    if(!check(f.email.value)){
        f.email.focus();
        alert('Invalid email address detected!'); 
        if(document.all || document.getElementByID){
            f.email.style.background = 'yellow';
        }
        return (false);
    }
    if(!check(f.femail0.value)){
        alert('Invalid email address detected!');
        f.femail0.focus();
        if(document.all || document.getElementByID){
            f.femail0.style.background = 'yellow';
        }
        return (false);
    } 
    // check optional emails
    for(a = 1; a < 3; a++){
        the_field = eval('f.femail' + a);
        if(the_field.value && !check(the_field.value)){ 
            alert('Invalid email address detected!');
            the_field.focus();
            if(document.all || document.getElementByID){
                the_field.style.background = 'yellow';
            }
            return (false);
        }
    }
}
