
obs={is_small:false,ph:'',init:function(){$("#main").wrap('<div id="inner-wrap" />');$("#inner-wrap").wrap('<div id="outer-wrap" />');this.am_small();$(window).resize(function(){obs.am_small();})
this.search_form();this.check_for_video();this.adjust_linkcol();this.form_validation();$("a[rel='external']").click(function(ev){ev.preventDefault();window.open($(this).attr("href"));})},search_form:function(){if(!Modernizr.input.placeholder){obs.ph=$("#searchbox").attr("placeholder");$("#searchbox").val(obs.ph);$("#searchbox").focus(function(){if($(this).val()==obs.ph)$(this).val("")}).blur(function(){if($(this).val()=="")$(this).val(obs.ph)})}
$("#search-form form").submit(function(){v=$("#searchbox").val();if(v==obs.ph){alert("Please enter a search term");$("#searchbox").focus();return false;}
return true;})},check_for_video:function(){vids=$("#main video");if(!vids.size()){return;}
yepnope({load:'/assets/jwplayer/jwplayer.js',callback:function(){vids.each(function(){h=parseInt($(this).attr("height"))+24;jwplayer($(this).attr("id")).setup({modes:[{type:'html5'},{type:'flash',src:"/assets/jwplayer/player.swf"}],controlbar:"bottom",height:h,menu:false})});}});},adjust_linkcol:function(){if(this.is_small){return;}
$("#sidebar").after('<div id="sidebarmask" />');h=$("#sidebar").height()+20;if(h>40){$("#linkcol").css({paddingTop:h+'px'});}},am_small:function(){this.is_small=($("#header div.wrap").width()==320);},form_validation:function(){if(!$("#freeform").size()){return;}
yepnope({load:'http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js',complete:function(){$("#freeform").validate();}});}};$(function(){obs.init();});(function($){var ver='Lite-1.3';$.fn.cycle=function(options){return this.each(function(){options=options||{};if(this.cycleTimeout)clearTimeout(this.cycleTimeout);this.cycleTimeout=0;this.cyclePause=0;var $cont=$(this);var $slides=options.slideExpr?$(options.slideExpr,this):$cont.children();var els=$slides.get();if(els.length<2){window.console&&console.log('terminating; too few slides: '+els.length);return;}
var opts=$.extend({},$.fn.cycle.defaults,options||{},$.metadata?$cont.metadata():$.meta?$cont.data():{});var meta=$.isFunction($cont.data)?$cont.data(opts.metaAttr):null;if(meta)
opts=$.extend(opts,meta);opts.before=opts.before?[opts.before]:[];opts.after=opts.after?[opts.after]:[];opts.after.unshift(function(){opts.busy=0;});var cls=this.className;opts.width=parseInt((cls.match(/w:(\d+)/)||[])[1])||opts.width;opts.height=parseInt((cls.match(/h:(\d+)/)||[])[1])||opts.height;opts.timeout=parseInt((cls.match(/t:(\d+)/)||[])[1])||opts.timeout;if($cont.css('position')=='static')
$cont.css('position','relative');if(opts.width)
$cont.width(opts.width);if(opts.height&&opts.height!='auto')
$cont.height(opts.height);var first=0;$slides.css({position:'absolute',top:0,left:0}).each(function(i){$(this).css('z-index',els.length-i)});$(els[first]).css('opacity',1).show();if($.browser.msie)els[first].style.removeAttribute('filter');if(opts.fit&&opts.width)
$slides.width(opts.width);if(opts.fit&&opts.height&&opts.height!='auto')
$slides.height(opts.height);if(opts.pause)
$cont.hover(function(){this.cyclePause=1;},function(){this.cyclePause=0;});var txFn=$.fn.cycle.transitions[opts.fx];txFn&&txFn($cont,$slides,opts);$slides.each(function(){var $el=$(this);this.cycleH=(opts.fit&&opts.height)?opts.height:$el.height();this.cycleW=(opts.fit&&opts.width)?opts.width:$el.width();});if(opts.cssFirst)
$($slides[first]).css(opts.cssFirst);if(opts.timeout){if(opts.speed.constructor==String)
opts.speed={slow:600,fast:200}[opts.speed]||400;if(!opts.sync)
opts.speed=opts.speed/2;while((opts.timeout-opts.speed)<250)
opts.timeout+=opts.speed;}
opts.speedIn=opts.speed;opts.speedOut=opts.speed;opts.slideCount=els.length;opts.currSlide=first;opts.nextSlide=1;var e0=$slides[first];if(opts.before.length)
opts.before[0].apply(e0,[e0,e0,opts,true]);if(opts.after.length>1)
opts.after[1].apply(e0,[e0,e0,opts,true]);if(opts.click&&!opts.next)
opts.next=opts.click;if(opts.next)
$(opts.next).bind('click',function(){return advance(els,opts,opts.rev?-1:1)});if(opts.prev)
$(opts.prev).bind('click',function(){return advance(els,opts,opts.rev?1:-1)});if(opts.timeout)
this.cycleTimeout=setTimeout(function(){go(els,opts,0,!opts.rev)},opts.timeout+(opts.delay||0));});};function go(els,opts,manual,fwd){if(opts.busy)return;var p=els[0].parentNode,curr=els[opts.currSlide],next=els[opts.nextSlide];if(p.cycleTimeout===0&&!manual)
return;if(manual||!p.cyclePause){if(opts.before.length)
$.each(opts.before,function(i,o){o.apply(next,[curr,next,opts,fwd]);});var after=function(){if($.browser.msie)
this.style.removeAttribute('filter');$.each(opts.after,function(i,o){o.apply(next,[curr,next,opts,fwd]);});};if(opts.nextSlide!=opts.currSlide){opts.busy=1;$.fn.cycle.custom(curr,next,opts,after);}
var roll=(opts.nextSlide+1)==els.length;opts.nextSlide=roll?0:opts.nextSlide+1;opts.currSlide=roll?els.length-1:opts.nextSlide-1;}
if(opts.timeout)
p.cycleTimeout=setTimeout(function(){go(els,opts,0,!opts.rev)},opts.timeout);};function advance(els,opts,val){var p=els[0].parentNode,timeout=p.cycleTimeout;if(timeout){clearTimeout(timeout);p.cycleTimeout=0;}
opts.nextSlide=opts.currSlide+val;if(opts.nextSlide<0){opts.nextSlide=els.length-1;}
else if(opts.nextSlide>=els.length){opts.nextSlide=0;}
go(els,opts,1,val>=0);return false;};$.fn.cycle.custom=function(curr,next,opts,cb){var $l=$(curr),$n=$(next);$n.css(opts.cssBefore);var fn=function(){$n.animate(opts.animIn,opts.speedIn,opts.easeIn,cb)};$l.animate(opts.animOut,opts.speedOut,opts.easeOut,function(){$l.css(opts.cssAfter);if(!opts.sync)fn();});if(opts.sync)fn();};$.fn.cycle.transitions={fade:function($cont,$slides,opts){$slides.not(':eq(0)').hide();opts.cssBefore={opacity:0,display:'block'};opts.cssAfter={display:'none'};opts.animOut={opacity:0};opts.animIn={opacity:1};},fadeout:function($cont,$slides,opts){opts.before.push(function(curr,next,opts,fwd){$(curr).css('zIndex',opts.slideCount+(fwd===true?1:0));$(next).css('zIndex',opts.slideCount+(fwd===true?0:1));});$slides.not(':eq(0)').hide();opts.cssBefore={opacity:1,display:'block',zIndex:1};opts.cssAfter={display:'none',zIndex:0};opts.animOut={opacity:0};}};$.fn.cycle.ver=function(){return ver;};$.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($){$.fn.ticker=function(options){var opts=$.extend({},$.fn.ticker.defaults,options);if($(this).length==0){if(window.console&&window.console.log){window.console.log('Element does not exist in DOM!');}
else{alert('Element does not exist in DOM!');}
return false;}
var newsID='#'+$(this).attr('id');var tagType=$(this).get(0).tagName;return this.each(function(){var uniqID=getUniqID();var settings={position:0,time:0,distance:0,newsArr:{},play:true,paused:false,contentLoaded:false,dom:{contentID:'#ticker-content-'+uniqID,titleID:'#ticker-title-'+uniqID,titleElem:'#ticker-title-'+uniqID+' SPAN',tickerID:'#ticker-'+uniqID,wrapperID:'#ticker-wrapper-'+uniqID,revealID:'#ticker-swipe-'+uniqID,revealElem:'#ticker-swipe-'+uniqID+' SPAN',controlsID:'#ticker-controls-'+uniqID,prevID:'#prev-'+uniqID,nextID:'#next-'+uniqID,playPauseID:'#play-pause-'+uniqID}};if(tagType!='UL'&&tagType!='OL'&&opts.htmlFeed===true){debugError('Cannot use <'+tagType.toLowerCase()+'> type of element for this plugin - must of type <ul> or <ol>');return false;}
opts.direction=='rtl'?opts.direction='right':opts.direction='left';initialisePage();function countSize(obj){var size=0,key;for(key in obj){if(obj.hasOwnProperty(key))size++;}
return size;};function getUniqID(){var newDate=new Date;return newDate.getTime();}
function debugError(obj){if(opts.debugMode){if(window.console&&window.console.log){window.console.log(obj);}
else{alert(obj);}}}
function initialisePage(){processContent();$(newsID).wrap('<div id="'+settings.dom.wrapperID.replace('#','')+'"></div>');$(settings.dom.wrapperID).children().remove();$(settings.dom.wrapperID).append('<div id="'+settings.dom.tickerID.replace('#','')+'" class="ticker"><div id="'+settings.dom.titleID.replace('#','')+'" class="ticker-title"><span><!-- --></span></div><p id="'+settings.dom.contentID.replace('#','')+'" class="ticker-content"></p><div id="'+settings.dom.revealID.replace('#','')+'" class="ticker-swipe"><span><!-- --></span></div></div>');$(settings.dom.wrapperID).removeClass('no-js').addClass('ticker-wrapper has-js '+opts.direction);$(settings.dom.tickerElem+','+settings.dom.contentID).hide();if(opts.controls){$(settings.dom.controlsID).live('click mouseover mousedown mouseout mouseup',function(e){var button=e.target.id;if(e.type=='click'){switch(button){case settings.dom.prevID.replace('#',''):settings.paused=true;$(settings.dom.playPauseID).addClass('paused');manualChangeContent('prev');break;case settings.dom.nextID.replace('#',''):settings.paused=true;$(settings.dom.playPauseID).addClass('paused');manualChangeContent('next');break;case settings.dom.playPauseID.replace('#',''):if(settings.play==true){settings.paused=true;$(settings.dom.playPauseID).addClass('paused');pauseTicker();}
else{settings.paused=false;$(settings.dom.playPauseID).removeClass('paused');restartTicker();}
break;}}
else if(e.type=='mouseover'&&$('#'+button).hasClass('controls')){$('#'+button).addClass('over');}
else if(e.type=='mousedown'&&$('#'+button).hasClass('controls')){$('#'+button).addClass('down');}
else if(e.type=='mouseup'&&$('#'+button).hasClass('controls')){$('#'+button).removeClass('down');}
else if(e.type=='mouseout'&&$('#'+button).hasClass('controls')){$('#'+button).removeClass('over');}});$(settings.dom.wrapperID).append('<ul id="'+settings.dom.controlsID.replace('#','')+'" class="ticker-controls"><li id="'+settings.dom.playPauseID.replace('#','')+'" class="jnt-play-pause controls"><a href=""><!-- --></a></li><li id="'+settings.dom.prevID.replace('#','')+'" class="jnt-prev controls"><a href=""><!-- --></a></li><li id="'+settings.dom.nextID.replace('#','')+'" class="jnt-next controls"><a href=""><!-- --></a></li></ul>');}
if(opts.displayType!='fade'){$(settings.dom.contentID).mouseover(function(){if(settings.paused==false){pauseTicker();}}).mouseout(function(){if(settings.paused==false){restartTicker();}});}
if(!opts.ajaxFeed){setupContentAndTriggerDisplay();}}
function processContent(){if(settings.contentLoaded==false){if(opts.ajaxFeed){if(opts.feedType=='xml'){$.ajax({url:opts.feedUrl,cache:false,dataType:opts.feedType,async:true,success:function(data){count=0;for(var a=0;a<data.childNodes.length;a++){if(data.childNodes[a].nodeName=='rss'){xmlContent=data.childNodes[a];}}
for(var i=0;i<xmlContent.childNodes.length;i++){if(xmlContent.childNodes[i].nodeName=='channel'){xmlChannel=xmlContent.childNodes[i];}}
for(var x=0;x<xmlChannel.childNodes.length;x++){if(xmlChannel.childNodes[x].nodeName=='item'){xmlItems=xmlChannel.childNodes[x];var title,link=false;for(var y=0;y<xmlItems.childNodes.length;y++){if(xmlItems.childNodes[y].nodeName=='title'){title=xmlItems.childNodes[y].lastChild.nodeValue;}
else if(xmlItems.childNodes[y].nodeName=='link'){link=xmlItems.childNodes[y].lastChild.nodeValue;}
if((title!==false&&title!='')&&link!==false){settings.newsArr['item-'+count]={type:opts.titleText,content:'<a href="'+link+'">'+title+'</a>'};count++;title=false;link=false;}}}}
if(countSize(settings.newsArr<1)){debugError('Couldn\'t find any content from the XML feed for the ticker to use!');return false;}
settings.contentLoaded=true;setupContentAndTriggerDisplay();}});}
else{debugError('Code Me!');}}
else if(opts.htmlFeed){if($(newsID+' LI').length>0){$(newsID+' LI').each(function(i){settings.newsArr['item-'+i]={type:opts.titleText,content:$(this).html()};});}
else{debugError('Couldn\'t find HTML any content for the ticker to use!');return false;}}
else{debugError('The ticker is set to not use any types of content! Check the settings for the ticker.');return false;}}}
function setupContentAndTriggerDisplay(){settings.contentLoaded=true;$(settings.dom.titleElem).html(settings.newsArr['item-'+settings.position].type);$(settings.dom.contentID).html(settings.newsArr['item-'+settings.position].content);if(settings.position==(countSize(settings.newsArr)-1)){settings.position=0;}
else{settings.position++;}
distance=$(settings.dom.contentID).width();time=distance/opts.speed;revealContent();}
function revealContent(){$(settings.dom.contentID).css('opacity','1');if(settings.play){var offset=$(settings.dom.titleID).width()+20;$(settings.dom.revealID).css(opts.direction,offset+'px');if(opts.displayType=='fade'){$(settings.dom.revealID).hide(0,function(){$(settings.dom.contentID).css(opts.direction,offset+'px').fadeIn(opts.fadeInSpeed,postReveal);});}
else if(opts.displayType=='scroll'){}
else{$(settings.dom.revealElem).show(0,function(){$(settings.dom.contentID).css(opts.direction,offset+'px').show();animationAction=opts.direction=='right'?{marginRight:distance+'px'}:{marginLeft:distance+'px'};$(settings.dom.revealID).css('margin-'+opts.direction,'0px').delay(20).animate(animationAction,time,'linear',postReveal);});}}
else{return false;}};function postReveal(){if(settings.play){$(settings.dom.contentID).delay(opts.pauseOnItems).fadeOut(opts.fadeOutSpeed);if(opts.displayType=='fade'){$(settings.dom.contentID).fadeOut(opts.fadeOutSpeed,function(){$(settings.dom.wrapperID).find(settings.dom.revealElem+','+settings.dom.contentID).hide().end().find(settings.dom.tickerID+','+settings.dom.revealID).show().end().find(settings.dom.tickerID+','+settings.dom.revealID).removeAttr('style');setupContentAndTriggerDisplay();});}
else{$(settings.dom.revealID).hide(0,function(){$(settings.dom.contentID).fadeOut(opts.fadeOutSpeed,function(){$(settings.dom.wrapperID).find(settings.dom.revealElem+','+settings.dom.contentID).hide().end().find(settings.dom.tickerID+','+settings.dom.revealID).show().end().find(settings.dom.tickerID+','+settings.dom.revealID).removeAttr('style');setupContentAndTriggerDisplay();});});}}
else{$(settings.dom.revealElem).hide();}}
function pauseTicker(){settings.play=false;$(settings.dom.tickerID+','+settings.dom.revealID+','+settings.dom.titleID+','+settings.dom.titleElem+','+settings.dom.revealElem+','+settings.dom.contentID).stop(true,true);$(settings.dom.revealID+','+settings.dom.revealElem).hide();$(settings.dom.wrapperID).find(settings.dom.titleID+','+settings.dom.titleElem).show().end().find(settings.dom.contentID).show();}
function restartTicker(){settings.play=true;settings.paused=false;postReveal();}
function manualChangeContent(direction){pauseTicker();switch(direction){case'prev':if(settings.position==0){settings.position=countSize(settings.newsArr)-2;}
else if(settings.position==1){settings.position=countSize(settings.newsArr)-1;}
else{settings.position=settings.position-2;}
$(settings.dom.titleElem).html(settings.newsArr['item-'+settings.position].type);$(settings.dom.contentID).html(settings.newsArr['item-'+settings.position].content);break;case'next':$(settings.dom.titleElem).html(settings.newsArr['item-'+settings.position].type);$(settings.dom.contentID).html(settings.newsArr['item-'+settings.position].content);break;}
if(settings.position==(countSize(settings.newsArr)-1)){settings.position=0;}
else{settings.position++;}}});};$.fn.ticker.defaults={speed:0.10,ajaxFeed:false,feedUrl:'',feedType:'xml',displayType:'reveal',htmlFeed:true,debugMode:true,controls:true,titleText:'Latest',direction:'ltr',pauseOnItems:3000,fadeInSpeed:600,fadeOutSpeed:300};})(jQuery);
$(function(){obs.home();})
obs.home=function(){if(typeof $.fn.cycle!="undefined"){$("#main-images").cycle({timeout:6000});}
$('#js-news').ticker();if(!obs.is_small){$("article h1").hover(function(){$("article").addClass("off");$(this).parent("article").removeClass("off").addClass("over");},function(){$("article").removeClass("off over")});}}
