/** 
* Jquery cookie plugin 
**/
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('j.5=u(9,a,2){6(h a!=\'v\'){2=2||{};6(a===m){a=\'\';2.3=-1}4 3=\'\';6(2.3&&(h 2.3==\'n\'||2.3.k)){4 7;6(h 2.3==\'n\'){7=w C();7.B(7.z()+(2.3*A*o*o*E))}l{7=2.3}3=\'; 3=\'+7.k()}4 8=2.8?\'; 8=\'+2.8:\'\';4 b=2.b?\'; b=\'+2.b:\'\';4 c=2.c?\'; c\':\'\';d.5=[9,\'=\',q(a),3,8,b,c].t(\'\')}l{4 g=m;6(d.5&&d.5!=\'\'){4 e=d.5.x(\';\');D(4 i=0;i<e.f;i++){4 5=j.r(e[i]);6(5.p(0,9.f+1)==(9+\'=\')){g=y(5.p(9.f+1));s}}}F g}};',42,42,'||options|expires|var|cookie|if|date|path|name|value|domain|secure|document|cookies|length|cookieValue|typeof||jQuery|toUTCString|else|null|number|60|substring|encodeURIComponent|trim|break|join|function|undefined|new|split|decodeURIComponent|getTime|24|setTime|Date|for|1000|return'.split('|'),0,{}))

/**
* Styleswitch stylesheet switcher built on jQuery
**/
$(document).ready(function() {
	var c = $.cookie('style');
	if (c) switchStylestyle(c);
});

function switchStylestyle(styleName) {
	//$('link[@rel*=style][@title]').each(function(i) {
	$('link[rel*=style][title]').each(function(i) {
		this.disabled = true;
		if (this.getAttribute('title') == styleName) this.disabled = false;
	});
	$.cookie('style',styleName, {expires: 365});
}

/**
* Initialise Widgets 
**/
jQuery(function(){
	if ($.cookie('style') != "textonly") {

			// drop down menu
			$(function(){
			    $("ul.dropdown li").hover(function(){
				$(this).addClass("hover");
				/*$('ul:first',this).css('display', 'block');*/
				$('ul:first',this).fadeIn();
			    }, function(){
				$(this).removeClass("hover");
				$('ul:first',this).css('display', 'none');
			    });
			    $("ul.dropdown li ul li:has(ul)").find("a:first").append(" &raquo; ");
			});

			$(".csc-frame-07").each(function(){
				$(this).wrapInner("<div class='csc-frame-07-inner'></div>");
				cscHeader07 = $("h2", this).clone().get(0);
				$("h2", this).remove();
				$(this).prepend(cscHeader07);
			});

			$(".csc-frame-07-inner").hide();
			$(".csc-frame-07 h2").click(function(){
			    $(".csc-frame-07-inner").slideUp("normal");
			    $(".concertina-open").removeClass("concertina-open");
			    $(this).parent().addClass("concertina-open");
			    $(this).siblings().slideDown("normal",function(){});
			});

			$(".csc-frame-08").each(function(){
				$(this).wrapInner("<div class='csc-frame-08-inner'></div>");
				cscHeader08 = $("h2", this).clone().get(0);
				$("h2", this).remove();
				$(this).prepend(cscHeader08);
			});

			$(".csc-frame-08-inner").hide();
			$(".csc-frame-08 h2").click(function(){
			    $(this).siblings().slideToggle("normal");
			    if( $(this).parent().hasClass("toggle-open") ){
				$(this).parent().removeClass("toggle-open");
			    } else {
				$(this).parent().addClass("toggle-open");
			    }	
			});


	}
});



