/*Create links for social bookmark sites*/
/*
<a href="http://del.icio.us/post?url={URL}&title={PAGENAME}">del.icio.us</a>
<a href="http://digg.com/submit?phase=2&url={URL}&title={PAGENAME}">Digg it</a>
<a href="http://reddit.com/submit?url={URL}&title={PAGENAME}">reddit</a>
*/

/**
 * add links to "social" links;
 * return nothing
 */
function createSocials()
{
	var loc = window.location;
	var TITLE = document.title;
	var URL = '';
	var LIST = new Object;
	if (loc.protocol == 'http:'){
		URL = loc.protocol + '//' + loc.host + '/' + loc.pathname;
		LIST['del.icio.us'] = 'http://del.icio.us/post?url=' + URL + '&title=' + TITLE;
		LIST['digg.com'] 	= 'http://digg.com/submit?phase=2&url=' + URL + '&title=' + TITLE;
		LIST['reddit.com'] 	= 'http://reddit.com/submit?url=' + URL + '&title=' + TITLE;
		LIST['email-this'] 	= 'mailto:?subject=' + TITLE + '&body=' + URL;
		
		for (linkitem in LIST){
			var itemo = $('social-' + linkitem);
			if (itemo != null){
				/*
					object exists
					i.e. id="social-del.icio.us" equal to LIST['del.icio.us']
				*/
				itemo.href = LIST[linkitem];
			}
		}
	}
	/* print link */
	var regfile = /\/|\\/;
	var found = loc.pathname.split(regfile);
	var aprint = $('link-print-this');
	if (aprint != null){
		aprint.href = 'print/' + found[found.length-1];
	}
}
function $(id)
{
	return document.getElementById(id);
}
function bookmarkIt()
{
	var url = location.href;
	var title = document.title;
	
    if (window.location.protocol == 'http:'){
		if (document.all){
			window.external.addFavorite(url, title);
		} else {
			window.sidebar.addPanel(title,url,'');
		}
	}
}