

$(document).ready(function(){
	
	//hide when JS off
	$('.search').val('');
	$('.print').html('Print');
	$('#wrap-controls').html('<ul id="controls"><li><a id="bar-previous" title="previous"></a></li><li><input type="button" value="" id="bar-pause" /></li><li><a id="bar-next" title="next"></a></li></ul>');
	
	last_settings = null;
	ticker_stop = null;
	ticker_position = 0;
	
	$('#bar-pause').click(function() {
		if(ticker_stop != true){
			ticker_stop = true;
			$('#controls').addClass("hi");
		}else{
			ticker_stop = false;
			$('#controls').removeClass("hi");
			$().newsTickerC(last_settings);
		}
	});

	$('#bar-next').click(function() {
		ticker_position = 1;
	});

	$('#bar-previous').click(function() {
		ticker_position = -1;
	});
	//bring links to parent level
	$(".side_link").live("click",function() {
		//stop link opening twice
		if($(this).attr("class").search('external') == '-1')
		self.location = $(this).find('a').attr("href");
	});
	//bring links to parent level and open in new window
	$("div.external").live("click",function() {
		window.open($(this).find('a').attr("href"));
	});
	// news ticker
	if(typeof $().newsTicker == "function" || $("#bars .wrap ul")) {
		var options = {
			newsList: "#bars .wrap ul",
			tickerRate: 100,
			startDelay: 100,
			loopDelay: 3000,
			placeHolder1: " -",
			placeHolder2: ""
		}
		$().newsTicker(options);
	}
});
