    if(!callback){
    var callback = "";
    }
    
    function goBranchesList(){
        document.location.href="/AgentRosterAdmin?op=branch&act=list";
    }
    function goAddAgent(){
        document.location.href="/AgentRosterAdmin?op=agent&act=add&branch_id=" +branch_id+ "&callback="+escape(callback);
    }
    function goEditAgent(agent_id){
        document.location.href="/AgentRosterAdmin?op=agent&act=edit&agent_id=" + agent_id+ "&callback="+escape(callback);
    }
    function goViewAgent(agent_id,where_it){
      if(!where_it){
        var lhref = "http://" + document.location.host + "/AgentRosterAgentProfile?op=agent&act=view&agent_id=" + agent_id;
        document.location.href = lhref + "&callback=" + callback;
      } else {
        if(where_it!="popup"){
          var lhref = "http://" + document.location.host + "/AgentRoster?op=agent&act=webprofile&agent_id=" + agent_id;
          document.location.href = lhref + "&back_link=" + where_it + "&callback=" + callback;
        } else {
          var lhref = "http://" + document.location.host + "/AgentRoster?op=agent&act=webprofile&frameset=no&agent_id=" + agent_id + "&back=" + where_it + "&callback=" + callback;
          var bars = 'directories=no,location=no,menubar=no,status=no,titlebar=no,toolbar=no,scrollbars=yes,resizable=yes,width=655,height=550';
          var newWin = window.open(lhref, agent_id, bars);
          newWin.focus();
        }
      }
    }
    function goDeleteAgent(agent_id){
        if(confirm("Agent will be deleted permanently!")){
          document.location.href="/AgentRosterAdmin?op=agent&act=delete&agent_id=" + agent_id+ "&callback="+escape(callback);
        }
    }

    function formatPhoneExt(frm,phone_field,target_phone_field){
      var ext_field = phone_field + '_ext';

      var ext_source = frm[ext_field].value;
      var phone_source = frm[phone_field].value;

      if(ext_source!=""){
        var sum = phone_source + ' ext. ' + ext_source;
      }else{
        var sum = phone_source;
      }
      frm[target_phone_field].value = sum;
    }

    function goEditBranch(branch_id){
      if (!branch_id) branch_id = "";
        document.location.href="/AgentRosterAdmin?op=branch&act=edit&branch_id=" +branch_id+ "&callback="+escape(callback);
    }
    function goDeleteBranch(branch_id){
      if(confirm("Branch will be deleted permanently along with agents assigned to this branch!")){
        document.location.href="/AgentRosterAdmin?op=branch&act=delete&branch_id=" +branch_id+ "&callback="+escape(callback);
      }
    }
    function CantDeleteBranch(title,def){
      if (def){
      alert(title + " cannot be deleted.\n");
      } else {
      alert(title + " cannot be deleted.\nNeed to remove all agent from " + title + ".");
      }
    }
    function goAgentsList(branch_id){
        document.location.href="/AgentRosterAdmin?op=agent&act=list&branch_id=" +branch_id+ "&callback="+escape(callback);
    }

    function viewMap(address, city, zip) {
      alert('!!');
    }

    function checkURL(obj_src){
      obj_src.value = _trim_(obj_src.value);
      if(obj_src.value != "" && obj_src.value.indexOf('http://')) {
        obj_src.value = 'http://' + obj_src.value;
      }
    }

    function _trim_(val){
      while(true){
        if(val.charAt(0) == " "){
          val=val.substring(1,val.length);
        }
        else{
          break;
        }
      }
      while(true){
        if(val.charAt(val.length-1) == " "){
          val=val.substring(0,val.length-1);
        }
        else{
          break;
        }
      }
      return val;
    }
