var swfobject=function(){var Z="undefined",P="object",B="Shockwave Flash",h="ShockwaveFlash.ShockwaveFlash",W="application/x-shockwave-flash",K="SWFObjectExprInst",G=window,g=document,N=navigator,f=[],H=[],Q=null,L=null,T=null,S=false,C=false;var a=function(){var l=typeof g.getElementById!=Z&&typeof g.getElementsByTagName!=Z&&typeof g.createElement!=Z&&typeof g.appendChild!=Z&&typeof g.replaceChild!=Z&&typeof g.removeChild!=Z&&typeof g.cloneNode!=Z,t=[0,0,0],n=null;if(typeof N.plugins!=Z&&typeof N.plugins[B]==P){n=N.plugins[B].description;if(n){n=n.replace(/^.*\s+(\S+\s+\S+$)/,"$1");t[0]=parseInt(n.replace(/^(.*)\..*$/,"$1"),10);t[1]=parseInt(n.replace(/^.*\.(.*)\s.*$/,"$1"),10);t[2]=/r/.test(n)?parseInt(n.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof G.ActiveXObject!=Z){var o=null,s=false;try{o=new ActiveXObject(h+".7")}catch(k){try{o=new ActiveXObject(h+".6");t=[6,0,21];o.AllowScriptAccess="always"}catch(k){if(t[0]==6){s=true}}if(!s){try{o=new ActiveXObject(h)}catch(k){}}}if(!s&&o){try{n=o.GetVariable("$version");if(n){n=n.split(" ")[1].split(",");t=[parseInt(n[0],10),parseInt(n[1],10),parseInt(n[2],10)]}}catch(k){}}}}var v=N.userAgent.toLowerCase(),j=N.platform.toLowerCase(),r=/webkit/.test(v)?parseFloat(v.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,i=false,q=j?/win/.test(j):/win/.test(v),m=j?/mac/.test(j):/mac/.test(v);/*@cc_on i=true;@if(@_win32)q=true;@elif(@_mac)m=true;@end@*/return{w3cdom:l,pv:t,webkit:r,ie:i,win:q,mac:m}}();var e=function(){if(!a.w3cdom){return }J(I);if(a.ie&&a.win){try{g.write("<script id=__ie_ondomload defer=true src=//:><\/script>");var i=c("__ie_ondomload");if(i){i.onreadystatechange=function(){if(this.readyState=="complete"){this.parentNode.removeChild(this);V()}}}}catch(j){}}if(a.webkit&&typeof g.readyState!=Z){Q=setInterval(function(){if(/loaded|complete/.test(g.readyState)){V()}},10)}if(typeof g.addEventListener!=Z){g.addEventListener("DOMContentLoaded",V,null)}M(V)}();function V(){if(S){return }if(a.ie&&a.win){var m=Y("span");try{var l=g.getElementsByTagName("body")[0].appendChild(m);l.parentNode.removeChild(l)}catch(n){return }}S=true;if(Q){clearInterval(Q);Q=null}var j=f.length;for(var k=0;k<j;k++){f[k]()}}function J(i){if(S){i()}else{f[f.length]=i}}function M(j){if(typeof G.addEventListener!=Z){G.addEventListener("load",j,false)}else{if(typeof g.addEventListener!=Z){g.addEventListener("load",j,false)}else{if(typeof G.attachEvent!=Z){G.attachEvent("onload",j)}else{if(typeof G.onload=="function"){var i=G.onload;G.onload=function(){i();j()}}else{G.onload=j}}}}}function I(){var l=H.length;for(var j=0;j<l;j++){var m=H[j].id;if(a.pv[0]>0){var k=c(m);if(k){H[j].width=k.getAttribute("width")?k.getAttribute("width"):"0";H[j].height=k.getAttribute("height")?k.getAttribute("height"):"0";if(O(H[j].swfVersion)){if(a.webkit&&a.webkit<312){U(k)}X(m,true)}else{if(H[j].expressInstall&&!C&&O("6.0.65")&&(a.win||a.mac)){D(H[j])}else{d(k)}}}}else{X(m,true)}}}function U(m){var k=m.getElementsByTagName(P)[0];if(k){var p=Y("embed"),r=k.attributes;if(r){var o=r.length;for(var n=0;n<o;n++){if(r[n].nodeName.toLowerCase()=="data"){p.setAttribute("src",r[n].nodeValue)}else{p.setAttribute(r[n].nodeName,r[n].nodeValue)}}}var q=k.childNodes;if(q){var s=q.length;for(var l=0;l<s;l++){if(q[l].nodeType==1&&q[l].nodeName.toLowerCase()=="param"){p.setAttribute(q[l].getAttribute("name"),q[l].getAttribute("value"))}}}m.parentNode.replaceChild(p,m)}}function F(i){if(a.ie&&a.win&&O("8.0.0")){G.attachEvent("onunload",function(){var k=c(i);if(k){for(var j in k){if(typeof k[j]=="function"){k[j]=function(){}}}k.parentNode.removeChild(k)}})}}function D(j){C=true;var o=c(j.id);if(o){if(j.altContentId){var l=c(j.altContentId);if(l){L=l;T=j.altContentId}}else{L=b(o)}if(!(/%$/.test(j.width))&&parseInt(j.width,10)<310){j.width="310"}if(!(/%$/.test(j.height))&&parseInt(j.height,10)<137){j.height="137"}g.title=g.title.slice(0,47)+" - Flash Player Installation";var n=a.ie&&a.win?"ActiveX":"PlugIn",k=g.title,m="MMredirectURL="+G.location+"&MMplayerType="+n+"&MMdoctitle="+k,p=j.id;if(a.ie&&a.win&&o.readyState!=4){var i=Y("div");p+="SWFObjectNew";i.setAttribute("id",p);o.parentNode.insertBefore(i,o);o.style.display="none";G.attachEvent("onload",function(){o.parentNode.removeChild(o)})}R({data:j.expressInstall,id:K,width:j.width,height:j.height},{flashvars:m},p)}}function d(j){if(a.ie&&a.win&&j.readyState!=4){var i=Y("div");j.parentNode.insertBefore(i,j);i.parentNode.replaceChild(b(j),i);j.style.display="none";G.attachEvent("onload",function(){j.parentNode.removeChild(j)})}else{j.parentNode.replaceChild(b(j),j)}}function b(n){var m=Y("div");if(a.win&&a.ie){m.innerHTML=n.innerHTML}else{var k=n.getElementsByTagName(P)[0];if(k){var o=k.childNodes;if(o){var j=o.length;for(var l=0;l<j;l++){if(!(o[l].nodeType==1&&o[l].nodeName.toLowerCase()=="param")&&!(o[l].nodeType==8)){m.appendChild(o[l].cloneNode(true))}}}}}return m}function R(AE,AC,q){var p,t=c(q);if(typeof AE.id==Z){AE.id=q}if(a.ie&&a.win){var AD="";for(var z in AE){if(AE[z]!=Object.prototype[z]){if(z=="data"){AC.movie=AE[z]}else{if(z.toLowerCase()=="styleclass"){AD+=' class="'+AE[z]+'"'}else{if(z!="classid"){AD+=" "+z+'="'+AE[z]+'"'}}}}}var AB="";for(var y in AC){if(AC[y]!=Object.prototype[y]){AB+='<param name="'+y+'" value="'+AC[y]+'" />'}}t.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AD+">"+AB+"</object>";F(AE.id);p=c(AE.id)}else{if(a.webkit&&a.webkit<312){var AA=Y("embed");AA.setAttribute("type",W);for(var x in AE){if(AE[x]!=Object.prototype[x]){if(x=="data"){AA.setAttribute("src",AE[x])}else{if(x.toLowerCase()=="styleclass"){AA.setAttribute("class",AE[x])}else{if(x!="classid"){AA.setAttribute(x,AE[x])}}}}}for(var w in AC){if(AC[w]!=Object.prototype[w]){if(w!="movie"){AA.setAttribute(w,AC[w])}}}t.parentNode.replaceChild(AA,t);p=AA}else{var s=Y(P);s.setAttribute("type",W);for(var v in AE){if(AE[v]!=Object.prototype[v]){if(v.toLowerCase()=="styleclass"){s.setAttribute("class",AE[v])}else{if(v!="classid"){s.setAttribute(v,AE[v])}}}}for(var u in AC){if(AC[u]!=Object.prototype[u]&&u!="movie"){E(s,u,AC[u])}}t.parentNode.replaceChild(s,t);p=s}}return p}function E(k,i,j){var l=Y("param");l.setAttribute("name",i);l.setAttribute("value",j);k.appendChild(l)}function c(i){return g.getElementById(i)}function Y(i){return g.createElement(i)}function O(k){var j=a.pv,i=k.split(".");i[0]=parseInt(i[0],10);i[1]=parseInt(i[1],10);i[2]=parseInt(i[2],10);return(j[0]>i[0]||(j[0]==i[0]&&j[1]>i[1])||(j[0]==i[0]&&j[1]==i[1]&&j[2]>=i[2]))?true:false}function A(m,j){if(a.ie&&a.mac){return }var l=g.getElementsByTagName("head")[0],k=Y("style");k.setAttribute("type","text/css");k.setAttribute("media","screen");if(!(a.ie&&a.win)&&typeof g.createTextNode!=Z){k.appendChild(g.createTextNode(m+" {"+j+"}"))}l.appendChild(k);if(a.ie&&a.win&&typeof g.styleSheets!=Z&&g.styleSheets.length>0){var i=g.styleSheets[g.styleSheets.length-1];if(typeof i.addRule==P){i.addRule(m,j)}}}function X(k,i){var j=i?"visible":"hidden";if(S){c(k).style.visibility=j}else{A("#"+k,"visibility:"+j)}}return{registerObject:function(l,i,k){if(!a.w3cdom||!l||!i){return }var j={};j.id=l;j.swfVersion=i;j.expressInstall=k?k:false;H[H.length]=j;X(l,false)},getObjectById:function(l){var i=null;if(a.w3cdom&&S){var j=c(l);if(j){var k=j.getElementsByTagName(P)[0];if(!k||(k&&typeof j.SetVariable!=Z)){i=j}else{if(typeof k.SetVariable!=Z){i=k}}}}return i},embedSWF:function(n,u,r,t,j,m,k,p,s){if(!a.w3cdom||!n||!u||!r||!t||!j){return }r+="";t+="";if(O(j)){X(u,false);var q=(typeof s==P)?s:{};q.data=n;q.width=r;q.height=t;var o=(typeof p==P)?p:{};if(typeof k==P){for(var l in k){if(k[l]!=Object.prototype[l]){if(typeof o.flashvars!=Z){o.flashvars+="&"+l+"="+k[l]}else{o.flashvars=l+"="+k[l]}}}}J(function(){R(q,o,u);if(q.id==u){X(u,true)}})}else{if(m&&!C&&O("6.0.65")&&(a.win||a.mac)){X(u,false);J(function(){var i={};i.id=i.altContentId=u;i.width=r;i.height=t;i.expressInstall=m;D(i)})}}},getFlashPlayerVersion:function(){return{major:a.pv[0],minor:a.pv[1],release:a.pv[2]}},hasFlashPlayerVersion:O,createSWF:function(k,j,i){if(a.w3cdom&&S){return R(k,j,i)}else{return undefined}},createCSS:function(j,i){if(a.w3cdom){A(j,i)}},addDomLoadEvent:J,addLoadEvent:M,getQueryParamValue:function(m){var l=g.location.search||g.location.hash;if(m==null){return l}if(l){var k=l.substring(1).split("&");for(var j=0;j<k.length;j++){if(k[j].substring(0,k[j].indexOf("="))==m){return k[j].substring((k[j].indexOf("=")+1))}}}return""},expressInstallCallback:function(){if(C&&L){var i=c(K);if(i){i.parentNode.replaceChild(L,i);if(T){X(T,true);if(a.ie&&a.win){L.style.display="block"}}L=null;T=null;C=false}}}}}();

$(document).ready(function(){init_home();init_modules();init_edu_modules();init_yt_scroller();init_corners();init_flash();if($("#ev_list_left").length){init_event_listings()}init_ajax();if($("#search_results")||$(".linklist")){init_search_res()}if($.browser.msie==true){init_menu();try{document.execCommand('BackgroundImageCache',false,true)}catch(e){}}});function init_corners(){add_corner("#home_banner",["nw","ne"]);add_corner("#home_modules>li",["nw","ne","sw","se"]);add_corner("#right_modules>li",["nw","ne"]);add_corner("#right_modules>li",["sw","se"]);add_corner("#search_results>li",["nw","ne","sw","se"]);add_corner(".linklist>li",["nw","ne","sw","se"]);add_corner("#ajax_holder",["nw","ne","sw","se"]);add_corner(".box_info",["nw","ne","sw","se"]);add_corner("#member_mods .mod_content",["nw","ne","sw","se"]);add_corner("#shop_search",["nw","ne","sw","se"]);add_corner("#yt_selector",["nw","ne"]);add_corner(".education_modules>li",["nw","ne","sw","se"])};function init_flash(){};function init_time(){var a=new Date();var b=a.getHours();var c;if(b>=18||b<4)c="Good evening";else if(b<12&&b>=4)c="Good morning";else if(b>=12&&b<18)c="Good afternoon";$("h2#content_heading").html(c)};function init_menu(){$("#nav li.sec").add("#adv").add("#breadcrumbs ul li").mouseover(function(){$(this).addClass("sfHover")});$("#nav li.sec").add("#adv").add("#breadcrumbs ul li").mouseout(function(){$(this).removeClass("sfHover")})}function add_corner(a,b){for(i=0;i<b.length;i++){if(b[i][0]=='n'){$(a).prepend("<div class='"+b[i]+"_corner'></div>")}else{$(a).append("<div class='"+b[i]+"_corner'></div>")}}};function init_ajax(){if($("#ajax_div").length){run_ajax({'scope':$("#ajax_div").attr("className")},'#ajax_div')}if($(".ind").length){run_ajax({'scope':'members','action':'ind'},'.ind')}if($(".ens").length){run_ajax({'scope':'members','action':'ens'},'.ens')}if($(".corp").length){run_ajax({'scope':'members','action':'corp'},'.corp')}};function run_ajax(a,b){if(!b){b='#ajax_div'}$(b).load("/function/browser/loader.php",a,function(){if(b=='.ind'){document.getElementById('ind').scrollTop=Math.floor(Math.random()*1200)}})};function copy_term(a,b){if($("#"+a).attr("value"))$("#"+a).attr("value",jQuery.trim($("#"+a).attr("value")+" "+jQuery.trim(b)));else $("#"+a).attr("value",jQuery.trim(b))};function init_search_res(){if((!$.browser.msie)||$.browser.version>6){$("#search_results>li,.linklist>li").not($('.inactive')).mouseover(function(){$(">li",$(this).parent()).not($(this)).addClass("faded")});$("#search_results,.linklist").mouseout(function(){$("li",$(this)).removeClass("faded")})}$("#search_results>li,.linklist>li").click(function(){window.location.href=$("a:first",this).attr("href")})};function init_modules(){$("#right_modules>li>h4,").each(function(){$(this).click(function(){if($(this).next().is(":hidden")){$("#right_modules>li>h4").next().children().hide();$("#right_modules>li.sel>h4").next().slideUp("normal",function(){$(this).parent().removeClass("sel")});$(this).next().slideDown("normal",function(){$(this).parent().addClass("sel");$("#right_modules>li.sel .mod_content").add($("#right_modules>li.sel .mod_content").children()).show()})}else{$(this).next().children().hide();$(this).next().slideUp("normal");$("#right_modules>li.sel").removeClass("sel")}return false})});$("#right_modules .mod_content").hide();$("#right_modules>li.sel .mod_content").show()};var top_val=new Object();var left_val=new Object();var x_spr=new Object();var y_spr=new Object();var w_spr=new Object();var h_spr=new Object();var default_region='Select a region';var active_button='';var active_area='';function init_event_listings(){preload_sprites();init_map_vars();init_map_events();init_button_events()};function preload_sprites(){sprites=new Image();sprites.src='/assets/blue/img/event_sprites.gif';sprites.onload=image_loaded};function image_loaded(){$('#loading_screen').hide();$("#ev_list_left,#ev_list_right").show()};function init_loading_screen(){$("#ev_list").prepend("<div id='loading_screen'></div>");$('#loading_screen').css({float:"left",width:"100%",textAlign:"center",position:"absolute",top:"0",left:"0"});$('#loading_screen').prepend('<p>Loading Events map... please wait</p>')};function init_map_vars(){top_val['orkney']=3;left_val['orkney']=1;x_spr['orkney']=0;y_spr['orkney']=-825;w_spr['orkney']=270;h_spr['orkney']=109;top_val['shetland']=3;left_val['shetland']=1;x_spr['shetland']=0;y_spr['shetland']=-825;w_spr['shetland']=270;h_spr['shetland']=109;top_val['western']=132;left_val['western']=6;x_spr['western']=-100;y_spr['western']=-400;w_spr['western']=73;h_spr['western']=132;top_val['highland']=127;left_val['highland']=30;x_spr['highland']=0;y_spr['highland']=-550;w_spr['highland']=181;h_spr['highland']=268;top_val['aberdeen']=203;left_val['aberdeen']=172;x_spr['aberdeen']=0;y_spr['aberdeen']=-200;w_spr['aberdeen']=92;h_spr['aberdeen']=83;top_val['dundee']=259;left_val['dundee']=122;x_spr['dundee']=0;y_spr['dundee']=-290;w_spr['dundee']=118;h_spr['dundee']=88;top_val['central']=309;left_val['central']=126;x_spr['central']=-100;y_spr['central']=-200;w_spr['central']=62;h_spr['central']=49;top_val['glasgow']=307;left_val['glasgow']=114;x_spr['glasgow']=0;y_spr['glasgow']=-400;w_spr['glasgow']=83;h_spr['glasgow']=99;top_val['south']=343;left_val['south']=96;x_spr['south']=0;y_spr['south']=-950;w_spr['south']=158;h_spr['south']=110;top_val['edinburgh']=331;left_val['edinburgh']=166;x_spr['edinburgh']=-120;y_spr['edinburgh']=-290;w_spr['edinburgh']=77;h_spr['edinburgh']=47};function init_map_events(){$("#map area").mouseover(function(){$("#map_region_name").html(this.alt)}).mouseout(function(){$("#map_region_name").html(default_region)}).click(function(){if(active_area!=this.id){$("#map area").not($(this)).removeClass("sel");$(this).addClass("sel");$("#map_region_highlight").html("&nbsp;").css({position:"absolute",top:top_val[this.id]+"px",left:left_val[this.id]+"px",width:w_spr[this.id]+"px",height:h_spr[this.id]+"px",display:"none",backgroundImage:"url(/assets/blue/img/event_sprites.gif)",backgroundPosition:x_spr[this.id]+'px '+y_spr[this.id]+'px',zIndex:"20"}).fadeIn();$('#panel_region_name').html(this.alt);default_region=this.alt;active_area=this.id;updateLinks()}return false})};function init_button_events(){$('#genre_buttons li a').mouseover(function(){$(this).css({opacity:"1",filter:"alpha(opacity=100"})}).mouseout(function(){$(this).css({opacity:"0.6",filter:"alpha(opacity=60"})}).click(function(){$("#genre_buttons li a").not($(this)).removeClass("sel");if(!$(this).hasClass("sel")){$(this).addClass("sel")}else{$(this).removeClass("sel")}updateLinks();return false})};function updateLinks(){$("#link_scroller").slideUp("slow",function(){$("#link_scroller").load('/event_listings/event_links.php',{"area":$("#map area.sel").attr("id"),"genre":$("#genre_buttons li a.sel").attr("id")},function(){$("#link_scroller").slideDown("slow",function(){$(this).css("height","330px")})})})};function fetchData(){var a='/event_listings/event_links.php';var b='area='+active_area+'&genre='+active_button;document.getElementById('link_data').innerHTML='&nbsp;';var c=new Ajax.Updater({success:'link_data'},a,{method:'get',parameters:b,onFailure:reportError,onComplete:restoreLinks})};function NewWindow(a,b,w,h,c,d){if(c=="random"){myleft=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;mytop=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100}if(c=="center"){myleft=(screen.width)?(screen.width-w)/2:100;mytop=(screen.height)?(screen.height-h)/2:100}else if((c!='center'&&c!="random")||c==null){myleft=0;mytop=20}settings="width="+w+",height="+h+",top="+mytop+",left="+myleft+",scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes";win=window.open(a,b,settings);win.focus()};function check_form(){var a=0;var b="Errors have occured during process of your form!\nPlease make the following corrections:\n\n";var c=document.getElementById('del[name]').value;var d=document.getElementById('del[email]').value;var e=document.getElementById('del[tel]').value;var f=document.getElementById('del[address]').value;var g=document.getElementById('del[town]').value;var h=document.getElementById('del[postcode]').value;var i=document.getElementById('del[marketing]').value;var j=document.getElementById('del[marketing_other]').value;if(document.process){if((i==5&&j=='')||(i==0)){b=b+"* The 'Other...' entry must be completed if specified.\n";a=1}if(c==""||c.length<3){b=b+"* The 'Name' entry must have at least 3 characters.\n";a=1}if(d==""||d.length<6){b=b+"* The 'E-Mail Address' entry must have at least 6 characters.\n";a=1}if(e==""||e.length<7){b=b+"* The 'Telephone Number' entry must have at least 7 characters.\n";a=1}if(f==""||f.length<5){b=b+"* The 'Address' entry must have at least 5 characters.\n";a=1}if(g==""){b=b+"* The 'Town' entry must be completed.\n";a=1}if(h==""||h.length<1){b=b+"* The 'Post Code' entry must have at least 3 characters.\n";a=1}}if(a==1){alert(b);return false}else{return true}};

function init_home(){$("a.fancybox").fancybox({'hideOnContentClick': false,'autoscale':true});}

function init_edu_modules(){$(".education_modules>li>h4,").each(function(){$(this).click(function(){if($(this).next().is(":hidden")){$(".education_modules>li>h4").next().children().hide();$(".education_modules>li.sel>h4").next().slideUp("normal",function(){$(this).parent().removeClass("sel")});$(this).next().slideDown("normal",function(){$(this).parent().addClass("sel");$(".education_modules>li.sel .mod_content").add($(".education_modules>li.sel .mod_content").children()).show()})}else{$(this).next().children().hide();$(this).next().slideUp("normal");$(".education_modules>li.sel").removeClass("sel")}return false})});$(".education_modules .mod_content").hide();$(".education_modules>li.sel .mod_content").show()};

function init_yt_scroller() {

  $("#yt_scroller a").click(function(){ 

      $("#yt_movie_object").attr("data",$(this).attr("href"));

      $("#yt_movie_param").attr("value",$(this).attr("href"));

      return false;

    })
    $("#banner_switcher li:eq(0)").add("#banners li:eq(0)").addClass("active");
    $("#banner_switcher li").hover(function() {
      if (!$(this).hasClass("active")) {
        $("#banner_switcher .active").removeClass("active");
        $(this).addClass("active");
        var ix = $("#banner_switcher li").index(this);
        $("#banners li").removeClass("active");
        $("#banners li:eq("+ix+")").addClass("active");
        $(".legend").hide();
      }
    },function(){});
    $("#banners li").hover(function() {
      $(this).children(".legend").slideDown("slow");
    },function() {
  });
  $("#ed_banner_switcher li a").click(function() {
    var ix = $("#ed_banner_switcher li a").index(this);
    if ($("#ed_banners li:eq("+ix+")").hasClass("active")==false) {
      $("#ed_banners li.active").add($("#ed_banner_switcher li.active")).removeClass("active");
      $("#ed_banners li:eq("+ix+")").add($("#ed_banner_switcher li:eq("+ix+")")).addClass("active");
    }
  });
  $(".fb").fancybox({height:445,width:562});
  $(".fb_sc").fancybox({height:83,width:562});
}
function redirect_yt(url) {

  $("#yt_movie_wrapper").html('<object width="510" height="429"><param name="movie" value="'+url+'"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="'+url+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="510" height="429"></embed></object>');

}
