addBookMark = 
{
	
	addFav:function()
	{
		
		var aTag = document.getElementsByTagName('a');
		
		if(!aTag){return;}
		
		var title = document.title;
		var url = self.location;
		
		
		for(i=0; i<aTag.length; i++)
		{
			if(aTag[i].className.match('addFav'))
			{
				aTag[i].onclick = function()
				{
					if(window.sidebar)
					{
						window.sidebar.addPanel(title,url,'');
					}
					else if(window.opera && window.print)
					{
						var elem = document.createElement('a');
						elem.setAttribute('href',url);
						elem.setAttribute('title',title);
						elem.setAttribute('rel','sidebar');
						elem.click();
					}
					else if(document.all)//IE
					{
					window.external.AddFavorite(url, title);
					}
					else {
						alert('Sorry your browser dosn\'t support this function');
					}
				}
			}
		}
	}
}
	


// OPEN NEW WINDOW
newWindow = {

	init:function() 
	{
		
		if(!document.getElementsByTagName)
		{
			return;
		}
		
		var webLink = document.getElementsByTagName('a');
		
		if(!webLink)
		{
			return;
		}
		
		for(var i=0; i<webLink.length; i++)
		{
			if(webLink[i].className.match('openUp'))
			{
				webLink[i].onclick = function()
				{
					window.open(this.getAttribute('href'),'newWindow');
					return false;
				}
			}
		}
		
		for(var i=0; i<webLink.length; i++)
		{
			if(webLink[i].className.match('alert'))
			{
				webLink[i].onclick = function()
				{
					alert('Please be patient whilst the PDF loads in your browser');
					window.open(this.getAttribute('href'),'PDFVIEW');
					return false;
				}
			}
		}
	}
}

	function addEvent(elm, evType, fn, useCapture)
	{
		if (elm.addEventListener){
			elm.addEventListener(evType, fn, useCapture);
			return true;
		} else if (elm.attachEvent) {
			var r = elm.attachEvent('on' + evType, fn);
			return r;
		} else {
			elm['on' + evType] = fn;
		}
	}
	
addEvent(window,'load',newWindow.init,false);
addEvent(window,'load',addBookMark.addFav,false);

