$(document).ready( function()
			{
				$("#preamble").each( function (i) {
					var autoScrollTimer
					var index = 0;
					var scroller = $(this).css({ overflow: "hidden" })
					var controlWidth = parseInt(scroller.css("width"))
					var items = scroller.children("a")
					//alert ( items.length )
					var scrollPane = $("<div class=\"scroller\"></div>").append( items ).appendTo( this ).css({width: (controlWidth*items.length),  position: "relative"})
				
					if (items.length>1)
					{
						items.each( function (i) {
							$(this).css("width", controlWidth).css("float","left")
							$(this).css({display:"block" })
						} ) 
					}
					
					scroller.bind("mouseover", function() { pause() } )
					scroller.bind("mouseout", function() { play() }  )
					
					play()

					function pause()
					{
						if (autoScrollTimer) autoScrollTimer = clearInterval( autoScrollTimer ) 
					}
					
					function play()
					{
						pause()
						autoScrollTimer = setInterval( function() { scrollTo(++index)}, 15000 )
					}

					function scrollTo( newIndex )
					{			
				
						switch (newIndex)
						{
							case -1: index = items.length-1; break;
							case items.length: index = 0; break;
							default: index = newIndex; break;
						}		
						var width = parseInt(scroller.css("width"))
						multiplier = newIndex
						var end = (index * width) 
						if (index == 0) { end = 0 }		
						scrollPane.stop();
						scrollPane.animate({left: -end +"px"},350)
					}
				} )
			}
		)

$(document).ready( function()
	{
		var tooltip = $("<div id=\"tooltip\"></div>").appendTo(
document.body );

		function show(e)
		{
			tooltip.css({display:"block" })
			tooltip.text( this.title ).insertAfter(e.target);
			this.title="";
		}
		function hide(e)
		{
			this.title = tooltip.text();
			tooltip.remove();
		}

		$("#contacts-nav a[title]").each( function (i) 
		{
			$(this).hover( show, hide )
		})

	})
	
	
function fav() {
var newT = document.createTextNode('Add to Favourites');
var s = document.getElementById('fav');
if (window.sidebar) {
s.appendChild(newT);
s.style.cursor = 'pointer';
s.onclick = function() {window.sidebar.addPanel(document.title,self.location,'')};
} else if (window.external) {
s.appendChild(newT);
s.style.cursor = 'pointer';
s.onclick = function() {window.external.AddFavorite(self.location,document.title)};
} else if (window.opera) {
s.appendChild(newT);
s.style.cursor = 'pointer';
s.onclick = function() {
     var e = document.createElement('a');
     e.setAttribute('href',self.location);
     e.setAttribute('title',document.title);
     e.setAttribute('rel','sidebar');
     e.click();
  }
}
}

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) ;
