// JavaScript to add website link to a users Favorite list depending on which browser the user is using.
// By Jonathan Hatten
function fav() {
	var linkText = document.createTextNode('Click here ');
	var not = document.createTextNode('This browser does not support links ');
	var favLink = document.getElementById('fav');
	if (window.sidebar) {
		favLink.appendChild(linkText);
		favLink.style.cursor = 'pointer';
		favLink.onclick = function() {window.sidebar.addPanel(document.title,self.location,'')};
	} else if (window.external) {
		favLink.appendChild(linkText);
		favLink.style.cursor = 'pointer';
		favLink.onclick = function() {window.external.AddFavorite(self.location.href,document.title)};
	} else if (window.opera) {
		favLink.appendChild(linkText);
		favLink.style.cursor = 'pointer';
		favLink.onclick = function() {
			 var e = document.createElement('a');
			 e.setAttribute('href',self.location);
			 e.setAttribute('title',document.title);
			 e.setAttribute('rel','sidebar');
			 e.click();
	  	}
	}else {
		favLink.appendChild(not);
		favLink.style.color = '#000';
	}
}

var pageLoaded = 0;
	window.onload = function() {pageLoaded = 1;}
function loaded(i,f) {
	if (document.getElementById && document.getElementById(i) != null) f();
	else if (!pageLoaded) setTimeout('loaded(\''+i+'\','+f+')',100);
}
loaded('fav',fav);