/**
*
*  Client-side clickout uri encoder
*  author: sherbatov_yf
*
**/

var Clickout = {

  url : function (href, type, keyword, masterKeyword, landing) {
    var url = this.encode(href);

    if (type) {
      url += '/t:' + this.encode(type) + '/k:' + this.encode(keyword);
      if (masterKeyword) url += '/mk:' + this.encode(masterKeyword);
      if (landing) url += '/l:' + this.encode(landing);
    }

    return 'go/' + url;
  },

  encode : function (value)
  {
    var value = Base64.encode(value);
    return value.replace('=', '');
  }
}
