/* Copyright Claude Needham gxxaxx@gmail.com All rights reserved
	Please refrain from using this script without permission.
	This is how I make my living. 
	If you would like to use the script contact me. We can work something out. 
	You can get a javascript without stealing it (I'll keep the price low).
	And I can live in a house instead of a station wagon.
*/
/*
SHARECURX:
	on inclusion in the webpage will automatically init itself.
	look for share links
	replace general site url with page specific url
*/

// Little trick to keep variable spaces from banging together.
var ShaCur = {};
ShaCur.linksharedivID = "linksharediv";
ShaCur.objlinksharediv = null;

ShaCur.myurl = null;
ShaCur.encurl = null;
ShaCur.imagedir = "http://galaxywebsitedesign.com/graphics/";
ShaCur.title = "Galaxy Website Design";


ShaCur.init = function () {
	ShaCur.insertlinks();
}

ShaCur.insertlinks = function () {
	ShaCur.myurl = document.location;
	if (!ShaCur.myurl) {
		// some weirdness happening just go away
		return;
	}
	if (document.title) {
		ShaCur.title = document.title;
	}
	ShaCur.enctitle =  encodeURIComponent(ShaCur.title);

	ShaCur.objlinksharediv = document.getElementById(ShaCur.linksharedivID);
	if (!ShaCur.objlinksharediv) {
		// the div is missing. can't stuff links
		return;
	}

	ShaCur.myurl = GrabFront("?", ShaCur.myurl + "?");

	ShaCur.encurl = encodeURIComponent(ShaCur.myurl);

	ShaCur.str2write = "";

	ShaCur.str2write += "<div style=\"float: left; height: 24px; overflow: hidden;\">\n";
	ShaCur.str2write += "<iframe src=\"http://www.facebook.com/plugins/like.php?app_id=140830705992747&amp;href=";
	ShaCur.str2write += ShaCur.encurl;
	ShaCur.str2write += "&amp;send=false&amp;layout=button_count&amp;width=47&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:47px; height:21px;\" allowTransparency=\"true\"></iframe>\n";
	ShaCur.str2write += "</div>\n";

	ShaCur.str2write += "<a href=\"http://www.facebook.com/share.php?u=";
	ShaCur.str2write += ShaCur.encurl;
	ShaCur.str2write += "\" name=\"sharecurlink\"><img src=\"";
	ShaCur.str2write += ShaCur.imagedir + "sm_facebook.png\" alt=\"[f]\" title=\"Facebook Share\" border=\"0\" style=\"float: left;\"></a>";

	ShaCur.str2write += "<a href=\"http://twitthis.com/twit?url=";
	ShaCur.str2write += ShaCur.encurl;
	ShaCur.str2write += "&title=";
	ShaCur.str2write += ShaCur.enctitle +"\" name=\"sharecurlink\"><img src=\"";
	ShaCur.str2write += ShaCur.imagedir + "sm_twitter.png\" alt=\"[T]\" title=\"Tweet This\" border=\"0\" style=\"float: left;\"></a>";

	ShaCur.str2write += "<a href=\"http://www.myspace.com/Modules/PostTo/Pages/?u=";
	ShaCur.str2write += ShaCur.encurl;
	ShaCur.str2write += "&t=";
	ShaCur.str2write += ShaCur.enctitle +"\" name=\"sharecurlink\"><img src=\"";
	ShaCur.str2write += ShaCur.imagedir + "sm_myspace.png\" alt=\"[ms]\" title=\"myspace share\" border=\"0\" style=\"float: left;\"></a>";

	ShaCur.str2write += "<a href=\"http://del.icio.us/post?url1=";
	ShaCur.str2write += ShaCur.encurl;
	ShaCur.str2write += "&title=";
	ShaCur.str2write += ShaCur.enctitle +"\" name=\"sharecurlink\"><img src=\"";
	ShaCur.str2write += ShaCur.imagedir + "sm_delicious.png\" alt=\"[d]\" title=\"de.lic.i.ous share\" border=\"0\" style=\"float: left;\"></a>";

	ShaCur.str2write += "<a href=\"http://digg.com/submit?phase=2&url=";
	ShaCur.str2write += ShaCur.encurl;
	ShaCur.str2write += "&title=";
	ShaCur.str2write += ShaCur.enctitle +"\" name=\"sharecurlink\"><img src=\"";
	ShaCur.str2write += ShaCur.imagedir + "sm_diggit.png\" alt=\"[dig]\" title=\"Digg it\" border=\"0\" style=\"float: left;\"></a>";

	ShaCur.str2write += "<a href=\"http://www.stumbleupon.com/submit?url=";
	ShaCur.str2write += ShaCur.encurl;
	ShaCur.str2write += "&title=";
	ShaCur.str2write += ShaCur.enctitle +"\" name=\"sharecurlink\"><img src=\"";
	ShaCur.str2write += ShaCur.imagedir + "sm_stumbleupon.png\" alt=\"[s]\" title=\"Stumble Upon\" border=\"0\" style=\"float: left;\"></a>";

	ShaCur.objlinksharediv.innerHTML = ShaCur.str2write;
}

addLoadEvent( ShaCur.init );


