﻿var mytitle = document.title
mytitle = unfancy(mytitle)
var mytitleencoded = encodeURIComponent(mytitle)
var myloc = location.href
var mylocencoded = encodeURIComponent(myloc)
var mydesc = getDesc();
mydesc = unfancy(mydesc)
mydescencoded = encodeURIComponent(mydesc)
var myimg = getImg();
myimgencoded = encodeURIComponent(myimg)
// share facebook
document.write('<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>')
// share twitter
document.write('<script type="text/javascript" src="http://ajax.twitthis.com/chuug.twitthis.scripts/twitthis.js"></script>')
mytxt = '<p class="share_a">'
mytxt = mytxt+'Share'
mytxt = mytxt+'&nbsp;<a name="fb_share" type="icon" href="http://www.facebook.com/sharer.php"></a>'
mytxt = mytxt+'<a href="javascript:;" onclick="TwitThis.pop();"><img src="'+urlbase+'menu/logos/t_mini_a.png" alt="TwitThis" title="TwitThis" style="border:none;" /></a>'
// share email
mytxt = mytxt+'&nbsp;&nbsp;<a class="share_a" href="mailto:?subject=' + mytitleencoded;
mytxt = mytxt+'&body=I found this on the web and wanted to share it with you.%0A%0A'
mytxt = mytxt+ mydescencoded+"%0A%0A";
mytxt = mytxt+'You can view more details about '+mytitleencoded+' at ' + mylocencoded;
mytxt = mytxt+'"><img src="'+urlbase+'menu/buttons/envelope.jpg" border="0" alt="eMail to" title="eMail to" /></a>'
// share other
mytxt = mytxt+'&nbsp;&nbsp;<a class="share_a" href="'+urlbase+'c_share.html'
mytxt = mytxt+'?title='
mytxt = mytxt+mytitleencoded
mytxt = mytxt+'&amp;linkurl='
mytxt = mytxt+mylocencoded
mytxt = mytxt+'&amp;desc='
mytxt = mytxt+mydescencoded
mytxt = mytxt+'&amp;img='
mytxt = mytxt+myimgencoded
mytxt = mytxt+'">'
mytxt = mytxt+'Other</a>'
//mytxt = mytxt+'<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.facebook.com%2F%23%21%2Fpages%2FYellow-Bear-Journeys%2F85524453441%3Fv%3Dinfo%26ref%3Dts&amp;layout=button_count&amp;show_faces=false&amp;width=90&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:90px; height:21px;" allowTransparency="true"></iframe>'
mytxt = mytxt+'<iframe src="http://www.facebook.com/plugins/like.php?href='+mylocencoded+'&amp;layout=button_count&amp;show_faces=false&amp;width=90&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:90px; height:21px;" allowTransparency="true"></iframe>'
mytxt = mytxt+'<br />'
// Follow
mytxt = mytxt+'Follow'
mytxt = mytxt+'&nbsp;&nbsp;<a href="http://www.facebook.com/pages/Yellow-Bear-Journeys/85524453441?v=app_2347471856&viewas=1387350659#!/pages/Yellow-Bear-Journeys/85524453441?v=wall"><img src="'+urlbase+'menu/logos/f_mini_a.jpg" border="0" alt="facebook" title="Facebook" /></a>'
mytxt = mytxt+'&nbsp;&nbsp;<a href="http://www.twitter.com/ybecojourney"><img src="'+urlbase+'menu/logos/t_mini_a.png" alt="Twitter" title="Twitter" style="border:none;" /></a>'
//<img src="http://static01.linkedin.com/scds/common/u/img/webpromo/btn_cofollow_badge.png" alt="Yellow Bear Journeys on LinkedIn">
mytxt = mytxt+'&nbsp;&nbsp;<a href="http://www.linkedin.com/companies/yellow-bear-journeys?trk=fc_badge"><img src="'+urlbase+'menu/logos/in.gif" width="20" height="14" border="0" alt="Linked In" title="Linked In" /></a>'

mytxt = mytxt+'&nbsp;&nbsp;<a class="share_a" href="'+urlbase+'c_share.html">Other</a>'
mytxt = mytxt+'<br />'
mytxt = mytxt+'Newsletter &ndash; <a href="'+urlbase+'newsletter.html">Good Green News</a><br />'
mytxt = mytxt+'Blog &ndash; <a href="http:huggingthewind.yellowbearjourney.com">Hugging the Wind</a>'
mytxt = mytxt+'</p>'
writetolayerplain('share_this',mytxt)

// go to url
function getDesc(){
  var metas = document.getElementsByTagName('meta');
  for(var i=0;i<metas.length;i++){
    if(metas[i].getAttribute('name').toLowerCase() == 'description'){
      return metas[i].getAttribute('content');
    }
  }
  return '';//or null if you prefer
}
function getImg(){
  var links = document.getElementsByTagName('link');
  for(var i=0;i<links.length;i++){
    if(links[i].getAttribute('rel').toLowerCase() == 'image_src'){
      return links[i].getAttribute('href');
    }
  }
  return '';//or null if you prefer
}


