function checkSelect(list, to) {
    var value='';
    var pass='';
    var j=0;
    for (var i = 0; i < list.options.length; i++) {
        if(list.options[i].selected == true) {
            if (i==0) {alert("Please select a user");return false;}
             else {
               value=list.options[i].value;
               j=value.indexOf("|");
               pass=value.substr(j+1,999);
               value=value.substr(0,j);
               to.value=pass;
               list.options[i].value=value;
             }
            break;
        }
    }
    return true;
}
