(function ($) {
	
	$(function(){
		clearFormFields({
			clearInputs: true,
			clearTextareas: false,
			passwordFieldText: true,
			addClassFocus: "focus",
			filterClass: "form-text"
		});
		initAutoScalingNav({
			menuId: "nav",
			sideClasses: true
		});
		ieHover('#nav li');
		$('div.gallery-block').fadeGallery({
			slideElements:'ul.gallery > li',
			pagerLinks:'ul.switcher li'
		});
		$('div.pictures-box').fadeGallery({
			slideElements:'ul.fade-gallery > li',
			pagerLinks:'ul.pictures-list li',
			title: true
		});
	});

	// slideshow plugin
	jQuery.fn.fadeGallery = function(_options){
		var _options = jQuery.extend({
			slideElements:'div.slideset > div',
			pagerLinks:'div.pager a',
			btnNext:'a.next',
			btnPrev:'a.prev',
			btnPlayPause:'a.play-pause',
			btnPlay:'a.play',
			btnPause:'a.pause',
			pausedClass:'paused',
			disabledClass: 'disabled',
			playClass:'playing',
			activeClass:'active',
			currentNum:false,
			allNum:false,
			startSlide:null,
			noCircle:false,
			pauseOnHover:true,
			autoRotation:true,
			autoHeight:false,
			onChange:false,
			switchTime:15000,
			duration:650,
			title:false,
			event:'click'
		},_options);

		return this.each(function(){
			// gallery options
			var _this = jQuery(this);
			var _slides = jQuery(_options.slideElements, _this);
			var _pagerLinks = jQuery(_options.pagerLinks, _this);
			var _btnPrev = jQuery(_options.btnPrev, _this);
			var _btnNext = jQuery(_options.btnNext, _this);
			var _btnPlayPause = jQuery(_options.btnPlayPause, _this);
			var _btnPause = jQuery(_options.btnPause, _this);
			var _btnPlay = jQuery(_options.btnPlay, _this);
			var _pauseOnHover = _options.pauseOnHover;
			var _autoRotation = _options.autoRotation;
			var _activeClass = _options.activeClass;
			var _disabledClass = _options.disabledClass;
			var _pausedClass = _options.pausedClass;
			var _playClass = _options.playClass;
			var _autoHeight = _options.autoHeight;
			var _duration = _options.duration;
			var _switchTime = _options.switchTime;
			var _controlEvent = _options.event;
			var _currentNum = (_options.currentNum ? jQuery(_options.currentNum, _this) : false);
			var _allNum = (_options.allNum ? jQuery(_options.allNum, _this) : false);
			var _startSlide = _options.startSlide;
			var _noCycle = _options.noCircle;
			var _onChange = _options.onChange;
			var _title = _options.title;

			// gallery init
			var _hover = false;
			var _prevIndex = 0;
			var _currentIndex = 0;
			var _slideCount = _slides.length;
			var _timer;
			if(_slideCount < 2) return;
			var _textBox = $('div.text-box',_slides);
			_textBox.each(function(){
				var _h = $(this).height();
				$(this).css({bottom:-_h});
			});
			_prevIndex = _slides.index(_slides.filter('.'+_activeClass));
			if(_prevIndex < 0) _prevIndex = _currentIndex = 0;
			else _currentIndex = _prevIndex;
			_slides.eq(_currentIndex).find('div.text-box').css({bottom:0});
			if(_startSlide != null) {
				if(_startSlide == 'random') _prevIndex = _currentIndex = Math.floor(Math.random()*_slideCount);
				else _prevIndex = _currentIndex = parseInt(_startSlide);
			}
			_slides.hide().eq(_currentIndex).show();
			if(_autoRotation) _this.removeClass(_pausedClass).addClass(_playClass);
			else _this.removeClass(_playClass).addClass(_pausedClass);

			// gallery control
			if(_btnPrev.length) {
				_btnPrev.bind(_controlEvent,function(){
					prevSlide();
					return false;
				});
			}
			if(_btnNext.length) {
				_btnNext.bind(_controlEvent,function(){
					nextSlide();
					return false;
				});
			}
			if(_pagerLinks.length) {
				_pagerLinks.each(function(_ind){
					jQuery(this).bind(_controlEvent,function(){
						if(_currentIndex != _ind) {
							_prevIndex = _currentIndex;
							_currentIndex = _ind;
							switchSlide();
						}
						return false;
					});
				});
			}

			// play pause section
			if(_btnPlayPause.length) {
				_btnPlayPause.bind(_controlEvent,function(){
					if(_this.hasClass(_pausedClass)) {
						_this.removeClass(_pausedClass).addClass(_playClass);
						_autoRotation = true;
						autoSlide();
					} else {
						_autoRotation = false;
						if(_timer) clearTimeout(_timer);
						_this.removeClass(_playClass).addClass(_pausedClass);
					}
					return false;
				});
			}
			if(_btnPlay.length) {
				_btnPlay.bind(_controlEvent,function(){
					_this.removeClass(_pausedClass).addClass(_playClass);
					_autoRotation = true;
					autoSlide();
					return false;
				});
			}
			if(_btnPause.length) {
				_btnPause.bind(_controlEvent,function(){
					_autoRotation = false;
					if(_timer) clearTimeout(_timer);
					_this.removeClass(_playClass).addClass(_pausedClass);
					return false;
				});
			}

			// gallery animation
			function prevSlide() {
				_prevIndex = _currentIndex;
				if(_currentIndex > 0) _currentIndex--;
				else {
					if(_noCycle) return;
					else _currentIndex = _slideCount-1;
				}
				switchSlide();
			}
			function nextSlide() {
				_prevIndex = _currentIndex;
				if(_currentIndex < _slideCount-1) _currentIndex++;
				else {
					if(_noCycle) return;
					else _currentIndex = 0;
				}
				switchSlide();
			}
			function refreshStatus() {
				if(_pagerLinks.length) _pagerLinks.removeClass(_activeClass).eq(_currentIndex).addClass(_activeClass);
				if(_currentNum) _currentNum.text(_currentIndex+1);
				if(_allNum) _allNum.text(_slideCount);
				_slides.eq(_prevIndex).removeClass(_activeClass);
				_slides.eq(_currentIndex).addClass(_activeClass);
				if(_noCycle) {
					if(_btnPrev.length) {
						if(_currentIndex == 0) _btnPrev.addClass(_disabledClass);
						else _btnPrev.removeClass(_disabledClass);
					}
					if(_btnNext.length) {
						if(_currentIndex == _slideCount-1) _btnNext.addClass(_disabledClass);
						else _btnNext.removeClass(_disabledClass);
					}
				}
				if(typeof _onChange === 'function') {
					_onChange(_this, _currentIndex);
				}
			}
			function switchSlide() {
				if(_title){
					_slides.eq(_prevIndex).find('div.text-box').animate({bottom:-56},function(){
					_slides.eq(_prevIndex).fadeOut(_duration);
					});
					_slides.eq(_currentIndex).fadeIn(_duration,function(){
						_slides.eq(_currentIndex).find('div.text-box').animate({bottom:0});
					});
				}
				else{
					_slides.eq(_prevIndex).fadeOut(_duration);
					_slides.eq(_currentIndex).fadeIn(_duration);
				}

				if(_autoHeight) _slides.eq(_currentIndex).parent().animate({height:_slides.eq(_currentIndex).outerHeight(true)},{duration:_duration,queue:false});
				refreshStatus();
				autoSlide();
			}

			// autoslide function
			function autoSlide() {
				if(!_autoRotation || _hover) return;
				if(_timer) clearTimeout(_timer);
				_timer = setTimeout(nextSlide,_switchTime+_duration);
			}
			if(_pauseOnHover) {
				_this.hover(function(){
					_hover = true;
					if(_timer) clearTimeout(_timer);
				},function(){
					_hover = false;
					autoSlide();
				});
			}
			refreshStatus();
			autoSlide();
		});
	}
	// IE6 hover
	function ieHover(h_list, h_class){
		if(jQuery.browser.msie && jQuery.browser.version < 7){
			if(!h_class) var h_class = 'hover';
			jQuery(h_list).mouseenter(function(){
				jQuery(this).addClass(h_class);
			}).mouseleave(function(){
				jQuery(this).removeClass(h_class);
			});
		};
	};
	function clearFormFields(o)
	{
		if (o.clearInputs == null) o.clearInputs = true;
		if (o.clearTextareas == null) o.clearTextareas = true;
		if (o.passwordFieldText == null) o.passwordFieldText = false;
		if (o.addClassFocus == null) o.addClassFocus = false;
		if (!o.filter) o.filter = "default";
		if(o.clearInputs) {
			var inputs = document.getElementsByTagName("input");
			for (var i = 0; i < inputs.length; i++ ) {
				if((inputs[i].type == "text" || inputs[i].type == "password") && inputs[i].className.indexOf(o.filterClass)) {
					inputs[i].valueHtml = inputs[i].value;
					inputs[i].onfocus = function ()	{
						if(this.valueHtml == this.value) this.value = "";
						if(this.fake) {
							inputsSwap(this, this.previousSibling);
							this.previousSibling.focus();
						}
						if(o.addClassFocus && !this.fake) {
							this.className += " " + o.addClassFocus;
							this.parentNode.className += " parent-" + o.addClassFocus;
						}
					}
					inputs[i].onblur = function () {
						if(this.value == "") {
							this.value = this.valueHtml;
							if(o.passwordFieldText && this.type == "password") inputsSwap(this, this.nextSibling);
						}
						if(o.addClassFocus) {
							this.className = this.className.replace(o.addClassFocus, "");
							this.parentNode.className = this.parentNode.className.replace("parent-"+o.addClassFocus, "");
						}
					}
					if(o.passwordFieldText && inputs[i].type == "password") {
						var fakeInput = document.createElement("input");
						fakeInput.type = "text";
						fakeInput.value = inputs[i].value;
						fakeInput.className = inputs[i].className;
						fakeInput.fake = true;
						inputs[i].parentNode.insertBefore(fakeInput, inputs[i].nextSibling);
						inputsSwap(inputs[i], null);
					}
				}
			}
		}
		if(o.clearTextareas) {
			var textareas = document.getElementsByTagName("textarea");
			for(var i=0; i<textareas.length; i++) {
				if(textareas[i].className.indexOf(o.filterClass)) {
					textareas[i].valueHtml = textareas[i].value;
					textareas[i].onfocus = function() {
						if(this.value == this.valueHtml) this.value = "";
						if(o.addClassFocus) {
							this.className += " " + o.addClassFocus;
							this.parentNode.className += " parent-" + o.addClassFocus;
						}
					}
					textareas[i].onblur = function() {
						if(this.value == "") this.value = this.valueHtml;
						if(o.addClassFocus) {
							this.className = this.className.replace(o.addClassFocus, "");
							this.parentNode.className = this.parentNode.className.replace("parent-"+o.addClassFocus, "");
						}
					}
				}
			}
		}
		function inputsSwap(el, el2) {
			if(el) el.style.display = "none";
			if(el2) el2.style.display = "inline";
		}
	}
	function initAutoScalingNav(o) {
		if (!o.menuId) o.menuId = "nav";
		if (!o.tag) o.tag = "a";
		if (!o.spacing) o.spacing = 0;
		if (!o.constant) o.constant = 0;
		if (!o.minPaddings) o.minPaddings = 0;
		if (!o.liHovering) o.liHovering = false;
		if (!o.sideClasses) o.sideClasses = false;
		if (!o.equalLinks) o.equalLinks = false;
		if (!o.flexible) o.flexible = false;
		var nav = document.getElementById(o.menuId);
		if(nav) {
			nav.className += " scaling-active";
			var lis = nav.getElementsByTagName("li");
			var asFl = [];
			var lisFl = [];
			var width = 0;
			for (var i=0, j=0; i<lis.length; i++) {
				if(lis[i].parentNode == nav) {
					var t = lis[i].getElementsByTagName(o.tag).item(0);
					asFl.push(t);
					asFl[j++].width = t.offsetWidth;
					lisFl.push(lis[i]);
					if(width < t.offsetWidth) width = t.offsetWidth;
				}
				if(o.liHovering) {
					lis[i].onmouseover = function() {
						this.className += " hover";
					}
					lis[i].onmouseout = function() {
						this.className = this.className.replace("hover", "");
					}
				}
			}
			var menuWidth = nav.clientWidth - asFl.length*o.spacing - o.constant;
			if(o.equalLinks && width * asFl.length < menuWidth) {
				for (var i=0; i<asFl.length; i++) {
					asFl[i].width = width;
				}
			}
			width = getItemsWidth(asFl);
			if(width < menuWidth) {
				var version = navigator.userAgent.toLowerCase();
				for (var i=0; getItemsWidth(asFl) < menuWidth; i++) {
					asFl[i].width++;
					if(!o.flexible) {
						asFl[i].style.width = asFl[i].width + "px";
					}
					if(i >= asFl.length-1) i=-1;
				}
				if(o.flexible) {
					for (var i=0; i<asFl.length; i++) {
						width = (asFl[i].width - o.spacing - o.constant/asFl.length)/menuWidth*100;
						if(i != asFl.length-1) {
							lisFl[i].style.width = width + "%";
						}
						else {
							if(navigator.appName.indexOf("Microsoft Internet Explorer") == -1 || version.indexOf("msie 8") != -1 || version.indexOf("msie 9") != -1)
								lisFl[i].style.width = width + "%";
						}
					}
				}
			}
			else if(o.minPaddings > 0) {
				for (var i=0; i<asFl.length; i++) {
					asFl[i].style.paddingLeft = o.minPaddings + "px";
					asFl[i].style.paddingRight = o.minPaddings + "px";
				}
			}
			if(o.sideClasses) {
				lisFl[0].className += " first-child";
				lisFl[0].getElementsByTagName(o.tag).item(0).className += " first-child-a";
				lisFl[lisFl.length-1].className += " last-child";
				lisFl[lisFl.length-1].getElementsByTagName(o.tag).item(0).className += " last-child-a";
			}
			nav.className += " scaling-ready";
		}
		function getItemsWidth(a) {
			var w = 0;
			for(var q=0; q<a.length; q++) {
				w += a[q].width;
			}
			return w;
		}
	}
	
})(jQuery);

;
(function ($) {
	
	$(document).ready(function() {

		//Default Action
		$("#sidebar .post-list-holder").hide(); //Hide all content
		$("ul.tabset li:first").addClass("active").show(); //Activate first tab
		$("#sidebar .post-list-holder:first").show(); //Show first tab content

		//On Click Event
		$("ul.tabset li").click(function() {
			$("ul.tabset li").removeClass("active"); //Remove any "active" class
			$(this).addClass("active"); //Add "active" class to selected tab
			$("#sidebar .post-list-holder").hide(); //Hide all tab content
			var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
			$(activeTab).fadeIn(); //Fade in the active content
			return false;
		});

	});	
	
})(jQuery);

;
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-1402455-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();;
/*!
 * jQuery Cycle Lite Plugin
 * http://malsup.com/jquery/cycle/lite/
 * Copyright (c) 2008-2011 M. Alsup
 * Version: 1.3.1 (07-OCT-2011)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * Requires: jQuery v1.3.2 or later
 */
(function(d){var a="Lite-1.3";d.fn.cycle=function(e){return this.each(function(){e=e||{};if(this.cycleTimeout){clearTimeout(this.cycleTimeout)}this.cycleTimeout=0;this.cyclePause=0;var l=d(this);var i=e.slideExpr?d(e.slideExpr,this):l.children();var g=i.get();if(g.length<2){window.console&&console.log("terminating; too few slides: "+g.length);return}var f=d.extend({},d.fn.cycle.defaults,e||{},d.metadata?l.metadata():d.meta?l.data():{});var m=d.isFunction(l.data)?l.data(f.metaAttr):null;if(m){f=d.extend(f,m)}f.before=f.before?[f.before]:[];f.after=f.after?[f.after]:[];f.after.unshift(function(){f.busy=0});var n=this.className;f.width=parseInt((n.match(/w:(\d+)/)||[])[1])||f.width;f.height=parseInt((n.match(/h:(\d+)/)||[])[1])||f.height;f.timeout=parseInt((n.match(/t:(\d+)/)||[])[1])||f.timeout;if(l.css("position")=="static"){l.css("position","relative")}if(f.width){l.width(f.width)}if(f.height&&f.height!="auto"){l.height(f.height)}var h=0;i.css({position:"absolute",top:0,left:0}).each(function(o){d(this).css("z-index",g.length-o)});d(g[h]).css("opacity",1).show();if(d.browser.msie){g[h].style.removeAttribute("filter")}if(f.fit&&f.width){i.width(f.width)}if(f.fit&&f.height&&f.height!="auto"){i.height(f.height)}if(f.pause){l.hover(function(){this.cyclePause=1},function(){this.cyclePause=0})}var j=d.fn.cycle.transitions[f.fx];j&&j(l,i,f);i.each(function(){var o=d(this);this.cycleH=(f.fit&&f.height)?f.height:o.height();this.cycleW=(f.fit&&f.width)?f.width:o.width()});if(f.cssFirst){d(i[h]).css(f.cssFirst)}if(f.timeout){if(f.speed.constructor==String){f.speed={slow:600,fast:200}[f.speed]||400}if(!f.sync){f.speed=f.speed/2}while((f.timeout-f.speed)<250){f.timeout+=f.speed}}f.speedIn=f.speed;f.speedOut=f.speed;f.slideCount=g.length;f.currSlide=h;f.nextSlide=1;var k=i[h];if(f.before.length){f.before[0].apply(k,[k,k,f,true])}if(f.after.length>1){f.after[1].apply(k,[k,k,f,true])}if(f.click&&!f.next){f.next=f.click}if(f.next){d(f.next).bind("click",function(){return c(g,f,f.rev?-1:1)})}if(f.prev){d(f.prev).bind("click",function(){return c(g,f,f.rev?1:-1)})}if(f.timeout){this.cycleTimeout=setTimeout(function(){b(g,f,0,!f.rev)},f.timeout+(f.delay||0))}})};function b(j,e,i,k){if(e.busy){return}var h=j[0].parentNode,n=j[e.currSlide],l=j[e.nextSlide];if(h.cycleTimeout===0&&!i){return}if(i||!h.cyclePause){if(e.before.length){d.each(e.before,function(p,q){q.apply(l,[n,l,e,k])})}var f=function(){if(d.browser.msie){this.style.removeAttribute("filter")}d.each(e.after,function(p,q){q.apply(l,[n,l,e,k])});m()};if(e.nextSlide!=e.currSlide){e.busy=1;d.fn.cycle.custom(n,l,e,f)}var g=(e.nextSlide+1)==j.length;e.nextSlide=g?0:e.nextSlide+1;e.currSlide=g?j.length-1:e.nextSlide-1}function m(){if(e.timeout){h.cycleTimeout=setTimeout(function(){b(j,e,0,!e.rev)},e.timeout)}}}function c(e,f,i){var h=e[0].parentNode,g=h.cycleTimeout;if(g){clearTimeout(g);h.cycleTimeout=0}f.nextSlide=f.currSlide+i;if(f.nextSlide<0){f.nextSlide=e.length-1}else{if(f.nextSlide>=e.length){f.nextSlide=0}}b(e,f,1,i>=0);return false}d.fn.cycle.custom=function(k,h,i,e){var j=d(k),g=d(h);g.css(i.cssBefore);var f=function(){g.animate(i.animIn,i.speedIn,i.easeIn,e)};j.animate(i.animOut,i.speedOut,i.easeOut,function(){j.css(i.cssAfter);if(!i.sync){f()}});if(i.sync){f()}};d.fn.cycle.transitions={fade:function(f,g,e){g.not(":eq(0)").hide();e.cssBefore={opacity:0,display:"block"};e.cssAfter={display:"none"};e.animOut={opacity:0};e.animIn={opacity:1}},fadeout:function(f,g,e){e.before.push(function(k,i,j,h){d(k).css("zIndex",j.slideCount+(h===true?1:0));d(i).css("zIndex",j.slideCount+(h===true?0:1))});g.not(":eq(0)").hide();e.cssBefore={opacity:1,display:"block",zIndex:1};e.cssAfter={display:"none",zIndex:0};e.animOut={opacity:0}}};d.fn.cycle.ver=function(){return a};d.fn.cycle.defaults={animIn:{},animOut:{},fx:"fade",after:null,before:null,cssBefore:{},cssAfter:{},delay:0,fit:0,height:"auto",metaAttr:"cycle",next:null,pause:0,prev:null,speed:1000,slideExpr:null,sync:1,timeout:4000}})(jQuery);;
(function(a){a(function(){var b={};b.player=(function(){var d=a("a[href^=/player/]"),c=function(i){i.preventDefault();i.cancelBubble=true;var g=a(this).attr("href"),h=window.location.href;if(window.location.pathname==="/"){radio_window=window.open(g+"&move=true","radio","width=332,height=680,top=0,bottom=0")}else{radio_window=window.open(g,"radio","width=332,height=680,top=0,bottom=0")}},f=function(){d.click(c)},e=(function(){if(d.length){f()}})()})();b.logos=(function(){var d=a("#ss"),c={timeout:16000},f=function(h){return(Math.floor(Math.random()*h+1))},e=function(){for(var h=1;h<14;h++){d.append('<img src="/sites/all/themes/newspro/images/logos/'+f(13)+""+f(9)+'.png" width="80" height="101" style="float:left;">')}d.cycle(c)},g=(function(){e()})()})();b.utils=(function(){var d=function(f,g,e,h){a.ajax({url:f,dataType:g,cache:e,success:h,error:function(i,k,j){log(k);log(j)}})},c=function(f,e){a.each(f,function(g,h){e=e.replace("{{"+g+"}}",h)});return e};return{loadAsset:d}})();b.paths=(function(){var c="/sites/all/themes/newspro/js/";return{scripts:c}})();b.gallery=(function(){var l=a(".text-content").find("#gallery"),c,g,u=b.utils,o=b.paths,k,i,h,n,s=[],d='<a href="http://www.danreid.co.uk/" target="_blank"><img id="gallery_copyright" src="/sites/all/themes/newspro/images/gallery_copyright.png" alt="All images taken exclusively for I Like Music. All images owned by I Like Music & Dan Reid Photography. Do not copy." width="570" height="71"></a>',w=function(){c.toggleFullscreen()},e=function(){a(".galleria-container").append('<span id="fullscreen" />');g=a("#fullscreen");g.click(w);t()},f=function(){l.galleria(k);c=Galleria.get(0);Galleria.ready(e)},p=function(A,B,z){var x=a(A).find("image"),y="";a.each(x,function(D,E){var C=a(this);s.push({image:C.find("src").text(),title:description=C.find("description").text(),description:title=C.find("title").text()})});f()},q=function(){u.loadAsset(i,"xml",false,p)},j=function(){Galleria.loadTheme(n);q()},v=function(){u.loadAsset(h,"script",true,j)},t=function(){l.after(d)},m=function(){k={width:648,height:400,dataSource:s,showInfo:false};i=l.data("source");h=o.scripts+"galleria/galleria-1.2.6.min.js";n=o.scripts+"galleria/themes/classic/galleria.classic.min.js";v()},r=(function(){if(l.length){m()}})()})()});window.log=function(){log.history=log.history||[];log.history.push(arguments);if(this.console){console.log(Array.prototype.slice.call(arguments))}}})(jQuery);;

