function openBookmark(url)
{
	var popupWindow=window.open(url,'addBookmark','width=770px,height=500px,status=0,location=0,resizable=1,scrollbars=1,left=0,top=100');
}

function addBookmark(siteIndex)
{
	var siteURL = document.location.href;
	var siteTitle = escape(document.title);

	switch (parseInt(siteIndex)) {
		case 0:
			openBookmark("http://www.blinklist.com/index.php?url="+siteURL+"&title="+siteTitle+"&Action=Blink/addblink.php");
			break;
			
		case 1:
			openBookmark("http://del.icio.us/post?url="+siteURL+"&title="+siteTitle);
			break;
			
		case 2:
			openBookmark("http://www.digg.com/submit?url="+siteURL+"&phase=2");
			break;
			
		case 3:	
			openBookmark("http://www.furl.net/storeIt.jsp?u="+siteURL+"&t="+siteTitle);
			break;
			
		case 4:
			openBookmark("http://fusion.google.com/add?feedurl="+siteURL);
			break;
			
		case 5:	
			openBookmark("http://www.simpy.com/simpy/LinkAdd.do?href="+siteURL+"&title="+siteTitle+"&v=6&src=bookmarklet");
			break;
			
		case 6:	
			openBookmark("http://myweb2.search.yahoo.com/myresults/bookmarklet?u="+siteURL+"t="+siteTitle+"&d=&ei=UTF-8");
			break;
			
		case 7:	
			openBookmark("http://www.spurl.net/spurl.php?url="+siteURL+"&title="+siteTitle+"&v=3");
			break;
	}
}

function addLinks()
{
	var links=document.getElementById("bookmarks").getElementsByTagName("a");

	for (var i=0;i<links.length;i++) {
		links[i].setAttribute("bookmarkId",i);
		links[i].onclick=function() { addBookmark(this.getAttribute("bookmarkId")); return false; };
	}
}

function addEvent(event,func)
{
	if (window.addEventListener) {
		window.addEventListener(event,func,false);
	}
	else if (document.addEventListener) {
		document.addEventListener(event,func,false);
	}
	else if (window.attachEvent) {
		window.attachEvent("on"+event,func);
	}
}

addEvent("load",addLinks);