function shareLink(linkToShare){
 var form =  document.getElementById('shareForm');
 if(form && form.txtLink)
 {
    form.txtLink.value = linkToShare;
 }
 screenCenter('share');
 showBlock('share');
}

function shareLinkParams(json_params){
  var form =  document.getElementById('shareForm');
  if(form && form.json_params)
  {
    form.json_params.value = json_params;
    j = str_replace("#","%23",json_params)
    document.getElementById('facebook').href = '/compartir/sendCommunity?json_params='+j+'&id_community=1';
    document.getElementById('myspace').href = '/compartir/sendCommunity?json_params='+j+'&id_community=2';
    document.getElementById('twitter').href = '/compartir/sendCommunity?json_params='+j+'&id_community=3';
    //document.getElementById('hi5').href = '/compartir/sendCommunity?json_params='+json_params+'&id_community=4';
  }
  screenCenter('share');
  showBlock('share');
}

function submitPromoForm(id){
    var promoForm = document.getElementById('promoForm'+id);
    new Ajax.Updater('result_div', '/points/assignPromo', {asynchronous:true, evalScripts:true, parameters:Form.serialize(promoForm)});
    return false;
}

function showCenter(id){
  screenCenter(id);
  showBlock(id);
}

function str_replace(busca, repla, orig)
{
  str 	= new String(orig);

  rExp	= "/"+busca+"/g";
  rExp	= eval(rExp);
  newS	= String(repla);

  str = new String(str.replace(rExp, newS));

  return str;
}




