// Copyright 2009–2010 Creative Spark, <http://www.creativespark.co.uk/>
(function(){var b="h1 span, h2, h3.major, p.feature, #call-us, blockquote, .key-feature li a span.tagline span span, .key-image-feature li span.tagline span span, .specification-bar dl *, .event-details p strong, #navigation a, #breadcrumbs a, .pagination a, .pagination span {visibility:hidden;}";var a=document.createElement("style");a.setAttribute("id","cufonfoucfix");a.setAttribute("type","text/css");Browser.Engine.trident?a.styleSheet.cssText=b:a.appendText(b);document.head.appendChild(a)})();window.addEvent("domready",function(){document.getElement("body").addClass("scripted");if(Browser.Plugins.Flash.version>=8){(function(){var a=new URI(window.location.href);$("header").adopt(new Swiff("/flash/header.swf",{id:"header-flash",width:676,height:149,params:{wMode:"transparent"},vars:{}}))})();(function(){var a=function(c){var b=c.get("class").split(" ");b=b.filter(function(d){return(d.indexOf("video-")==0)});return(b.length==1?"/videos/"+b[0].substring(6)+".flv":false)};

$$(".video").each(function(b){var c=b.get("html");b.set({html:"",styles:{"text-indent":0}}).adopt(new Swiff("/videos/video-player-" + b.get("class").substring(6) + ".swf",{width:440,height:290,params:{wMode:"window"}}))})})();

(function(){$$(".flash-banner div").each(function(c){var b=c.getParent();var a=b.retrieve("url");var d=new URI("/external/").set("data",{linkurl:b.retrieve("link"),bannerid:b.retrieve("bannerid")}).toString();c.set({html:"",styles:{"text-indent":0}}).adopt(new Swiff(a,{width:c.getStyle("width").toInt(),height:c.getStyle("height").toInt(),params:{wMode:"opaque"},vars:{clickTAG:d,clickTag:d,ClickTAG:d,ClickTag:d}}))})})()}if($$(".key-feature").length){(function(){var a=4500;var b=".key-feature li a:hover span.title";var c=".key-feature li span.title";$$(".key-feature").each(function(e){var j;var g=0;var f=e.getElements("li").length-1;var h=function(k){if(!$defined(k)){k=g}e.getElements("li a").each(function(l,n){l.getElement("span.title").morph((n==k?b:c));var m=l.getElement("img");if(n==k){m.set("tween",{link:"cancel",onComplete:function(){e.setStyle("background-image","url("+this.element.get("src")+")")}}).tween("opacity",1)}else{m.set("tween",{link:"cancel",onComplete:$empty}).tween("opacity",0)}});g=k+1;if(g>f){g=0}};var i=function(k){$clear(j);h(k)};var d=function(){$clear(j);j=h.periodical(a)};e.addEvent("mouseout",d).getElements("li a").each(function(k,l){k.addEvent("mouseover",function(){i(l)}).getElements("img").setStyles({opacity:0,visiblity:"visible"})});e.getElements("li a").each(function(k,m){k.getElement("span.title").morph((m==0?b:c));var l=k.getElement("img");l.setStyle("opacity",(m==0?1:0));if(m==0){e.setStyle("background-image","url("+l.get("src")+")")}});g=1;d()})})()}if($$(".key-image-feature").length){(function(){var a=4500;$$(".key-image-feature").each(function(c){var g;var e=0;var d=c.getElements("li").length-1;var f=function(h){if(!$defined(h)){h=e}c.getElements("li").each(function(j,l){var k=j.getElement("img");if(l==h){k.set("tween",{link:"cancel",onComplete:function(){c.setStyle("background-image","url("+this.element.get("src")+")")}}).tween("opacity",1)}else{k.set("tween",{link:"cancel",onComplete:$empty}).tween("opacity",0)}});e=h+1;if(e>d){e=0}};var b=function(){$clear(g);g=f.periodical(a)};c.getElements("li img").each(function(h,j){h.setStyle("opacity",(j==0?1:0));if(j==0){c.setStyle("background-image","url("+h.get("src")+")")}});e=1;b()})})()}if($$(".multi-story").length){(function(){$$(".multi-story").each(function(e){if((e.getParents("div.panel"))[0].hasClass("panel6")){var b=e.getElements("li");var a=e.getElements("img");e.setStyle("background-image","url("+a[0].get("src")+")");var c=new Fx.Elements(a,{link:"cancel",duration:600,transition:"quad:in:out"});b.each(function(k,j){k.addEvent("mouseenter",function(l){c.onComplete=function(){e.setStyle("background-image","url("+a[j].get("src")+")");a[j].setStyle("left",200)};var i={};i[j]={left:(e.getStyle("background-image")=="url("+a[j].get("src")+")"?200:0)};b.each(function(m,n){if(m!=k){i[n]={left:200}}});c.start(i)})})}else{var h=43;var d=172;var g=e.getElements("li");var f=new Fx.Elements(g,{link:"cancel",duration:600,transition:"quad:in:out"});g.each(function(k,j){k.addEvent("mouseenter",function(m){var l={};l[j]={height:[k.getStyle("height").toInt(),d]};var i=0;g.each(function(n,o){if(n!=k){if(n.getStyle("height").toInt()!=h){l[o]={height:h}}}});f.start(l)})})}})})()}if($$("ul.ticker-tape").length){(function(){var a=4500;$$("ul.ticker-tape").each(function(d){var c=d.getElements("li");if(c.length<2){return}var b=-32;(function(){c[0].tween("margin-top",b);b=b-32;if(b<=c.length*-32){b=0}}).periodical(a)})})()}if($("googlemap")){(function(){if(GBrowserIsCompatible()){var b=$("googlemap");var c=new Element("div",{id:"googlemapbox"});var f=new URI(b.get("href"));var d=f.get("data").ll.split(",");c.replaces($("googlemap"));var e=new GMap2(c);e.setCenter(new GLatLng(d[0],d[1]),15);e.setUIToDefault();var a=new GLatLng(53.476598,-2.246339);e.addOverlay(new GMarker(a))}})()}

$extend(Selectors.Pseudo, {
    visible: function() {
        if (this.getStyle('display') != 'none' && this.hasClass('bannerad')) {
            return this;
        }
    }
});


if ($$('div.bannergroup').length) {
		(function(){
			var pauseLength = 60000;

			$$('div.bannergroup').each(function(bangroup){
				var items = bangroup.getElements('div');
				if (items.length < 2) {
					return;
				}
				
				

				(function(){
				
					var activeItem = bangroup.getElement('div:visible');
					var toShow;
					if(activeItem.getNext('div')){
					
					toShow = activeItem.getNext('div');
					
					}else{
					
					toShow = bangroup.getFirst('div');
					
					}
					
					activeItem.setStyle("display", "none");
					toShow.setStyle("display", "block");		
						
				}).periodical(pauseLength);
			});
		})();
	}
	
if ($('dblrotate')) {

$('dblrotate').getElements('img').tween('opacity', 0);
$('dblrotate').getFirst('img').tween('opacity', 1);

var fxFunc = function(){

var items = $('dblrotate').getElements('img');

items.each(function(el){
					
		if(el.get("opacity") == "1"){
		
			el.tween('opacity', 0);
			if(el.getNext('img')){
			
			el.getNext('img').tween('opacity', 1);
			}else{
				
				$('dblrotate').getFirst('img').tween('opacity', 1);

			}
			
		}
		
		
					
});
	
}

fxFunc.periodical(6000);

	}

	
$$('#map-container AREA').addEvent('mouseover', function(){

	var regionMap = '.'+this.get('id')+'-map';
	var regionList = '.'+this.get('id')+'-list';
	$$(regionMap).setStyle('display', 'inline');
	
	// Check if a click event has occured and only change the Region hover state accodringly
					$$(regionList).setStyle('display', 'inline');
	
	
				var regionList = '.'+this.get('id')+'-list';
				$$('#practice-container div').setStyle('display', 'none');
				$$(regionList).setStyle('display', 'block');
				
				
	
});

$$('#map-container AREA').addEvent('mouseout', function(){
				
				var regionMap = '.'+this.get('id')+'-map';
				var regionList = '.'+this.get('id')+'-list';

				// Check if a click event has occured and only change the Region hover state accodringly
				
					$$(regionMap).setStyle('display', 'none');
				

				// Check if a click event has occured and only change the Region hover state accodringly
				
					$$(regionList).setStyle('display', 'none');
					$$('#practice-container div.intro').setStyle('display', 'inline');
				

				
				
	
});

});
