// automatic share page if facebook etc
/*
<div id="shareDiv" style="white-space:nowrap;"></div>
.....
<script src="/htm-webaxy/javascript/share.js"></script>
<style>
.shareButtons {
	width:28px;
	height:28px;
	border-width:0px;
	margin:3px;
</style>
<script>
var div = document.getElementById('shareDiv');
if (div) {
	insertShareLink(div,'http://www.facebook.com/sharer.php?&u=%%URL%%&t=%%TITLE%%','/htm-webaxy/javascript/share/facebook.jpg','Facebook');
	insertShareLink(div,'http://delicious.com/save?url=%%URL%%&title=%%TITLE%%','/htm-webaxy/javascript/share/delicious.jpg','Delicious');
	insertShareLink(div,'http://www.linkedin.com/shareArticle?mini=true&url=%%URL%%&title=%%TITLE%%&summary=&source=','/htm-webaxy/javascript/share/linkedin.png','LinkedIn');
	insertShareLink(div,'http://twitter.com/home?status=%%TITLE%%+%%URL%%','/htm-webaxy/javascript/share/twitter.jpg','Twitter');
}
</script>


*/

//===================================================================
//  
//  name: do 
//  
//===================================================================


function insertShareLink(div,shareURL,image,imageTitle,myurl,mytitle) {
	if (!myurl) {
		myurl = location.href;
	}
	if (!mytitle) {
		mytitle = document.title;
	}
	if (myurl.search(/\/$/) != -1) {
		myurl += "welcome.htm";
	}
	myurl = encodeURIComponent(myurl);
	mytitle = encodeURIComponent(mytitle); 
	
	shareURL = shareURL.replace(/%%URL%%/g,myurl);
	shareURL = shareURL.replace(/%%TITLE%%/g,mytitle);
	
	shareURL = shareURL.replace(/%%[^%]+%%/g,"");
	
	var a = document.createElement("a");
	a.href = shareURL;
	a.setAttribute("target","_blank");
	
	var img = document.createElement("img");
	img.src = image;
	img.className = "shareButtons";
	if (imageTitle) {
		img.title = imageTitle;
	}
	
	a.appendChild(img);
	div.appendChild(a);

}
                                                                                                                                                                                                                                                                                                                                                                                                                                