/* jQuery-Plugin pngFix v1.1 */
eval(function(p,a,c,k,e,r){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--)r[e(c)]=k[c]||e(c);k=[function(e){return r[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}('(s($){3.1s.1k=s(j){j=3.1a({12:\'1m.1j\'},j);8 k=(n.P=="r 10 Z"&&U(n.v)==4&&n.v.E("14 5.5")!=-1);8 l=(n.P=="r 10 Z"&&U(n.v)==4&&n.v.E("14 6.0")!=-1);o(3.17.16&&(k||l)){3(2).L("1r[@m$=.M]").z(s(){3(2).7(\'q\',3(2).q());3(2).7(\'p\',3(2).p());8 a=\'\';8 b=\'\';8 c=(3(2).7(\'K\'))?\'K="\'+3(2).7(\'K\')+\'" \':\'\';8 d=(3(2).7(\'A\'))?\'A="\'+3(2).7(\'A\')+\'" \':\'\';8 e=(3(2).7(\'C\'))?\'C="\'+3(2).7(\'C\')+\'" \':\'\';8 f=(3(2).7(\'B\'))?\'B="\'+3(2).7(\'B\')+\'" \':\'\';8 g=(3(2).7(\'R\'))?\'1d:\'+3(2).7(\'R\')+\';\':\'\';8 h=(3(2).1c().7(\'1b\'))?\'19:18;\':\'\';o(2.9.y){a+=\'y:\'+2.9.y+\';\';2.9.y=\'\'}o(2.9.t){a+=\'t:\'+2.9.t+\';\';2.9.t=\'\'}o(2.9.w){a+=\'w:\'+2.9.w+\';\';2.9.w=\'\'}8 i=(2.9.15);b+=\'<x \'+c+d+e+f;b+=\'9="13:11;1q-1p:1o-1n;O:W-V;N:1l;\'+g+h;b+=\'q:\'+3(2).q()+\'u;\'+\'p:\'+3(2).p()+\'u;\';b+=\'J:I:H.r.G\'+\'(m=\\\'\'+3(2).7(\'m\')+\'\\\', D=\\\'F\\\');\';b+=i+\'"></x>\';o(a!=\'\'){b=\'<x 9="13:11;O:W-V;\'+a+h+\'q:\'+3(2).q()+\'u;\'+\'p:\'+3(2).p()+\'u;\'+\'">\'+b+\'</x>\'}3(2).1i();3(2).1h(b)});3(2).L("*").z(s(){8 a=3(2).T(\'N-S\');o(a.E(".M")!=-1){8 b=a.X(\'1g("\')[1].X(\'")\')[0];3(2).T(\'N-S\',\'1f\');3(2).Q(0).Y.J="I:H.r.G(m=\'"+b+"\',D=\'F\')"}});3(2).L("1e[@m$=.M]").z(s(){8 a=3(2).7(\'m\');3(2).Q(0).Y.J=\'I:H.r.G\'+\'(m=\\\'\'+a+\'\\\', D=\\\'F\\\');\';3(2).7(\'m\',j.12)})}1t 3}})(3);',62,92,'||this|jQuery||||attr|var|style|||||||||||||src|navigator|if|height|width|Microsoft|function|padding|px|appVersion|margin|span|border|each|class|alt|title|sizingMethod|indexOf|scale|AlphaImageLoader|DXImageTransform|progid|filter|id|find|png|background|display|appName|get|align|image|css|parseInt|block|inline|split|runtimeStyle|Explorer|Internet|relative|blankgif|position|MSIE|cssText|msie|browser|hand|cursor|extend|href|parent|float|input|none|url|after|hide|gif|pngFix|transparent|blank|line|pre|space|white|img|fn|return'.split('|'),0,{}))

/* jQuery.ScrollTo v1.4 */
;(function(h){var m=h.scrollTo=function(b,c,g){h(window).scrollTo(b,c,g)};m.defaults={axis:'y',duration:1};m.window=function(b){return h(window).scrollable()};h.fn.scrollable=function(){return this.map(function(){var b=this.parentWindow||this.defaultView,c=this.nodeName=='#document'?b.frameElement||b:this,g=c.contentDocument||(c.contentWindow||c).document,i=c.setInterval;return c.nodeName=='IFRAME'||i&&h.browser.safari?g.body:i?g.documentElement:this})};h.fn.scrollTo=function(r,j,a){if(typeof j=='object'){a=j;j=0}if(typeof a=='function')a={onAfter:a};a=h.extend({},m.defaults,a);j=j||a.speed||a.duration;a.queue=a.queue&&a.axis.length>1;if(a.queue)j/=2;a.offset=n(a.offset);a.over=n(a.over);return this.scrollable().each(function(){var k=this,o=h(k),d=r,l,e={},p=o.is('html,body');switch(typeof d){case'number':case'string':if(/^([+-]=)?\d+(px)?$/.test(d)){d=n(d);break}d=h(d,this);case'object':if(d.is||d.style)l=(d=h(d)).offset()}h.each(a.axis.split(''),function(b,c){var g=c=='x'?'Left':'Top',i=g.toLowerCase(),f='scroll'+g,s=k[f],t=c=='x'?'Width':'Height',v=t.toLowerCase();if(l){e[f]=l[i]+(p?0:s-o.offset()[i]);if(a.margin){e[f]-=parseInt(d.css('margin'+g))||0;e[f]-=parseInt(d.css('border'+g+'Width'))||0}e[f]+=a.offset[i]||0;if(a.over[i])e[f]+=d[v]()*a.over[i]}else e[f]=d[i];if(/^\d+$/.test(e[f]))e[f]=e[f]<=0?0:Math.min(e[f],u(t));if(!b&&a.queue){if(s!=e[f])q(a.onAfterFirst);delete e[f]}});q(a.onAfter);function q(b){o.animate(e,j,a.easing,b&&function(){b.call(this,r,a)})};function u(b){var c='scroll'+b,g=k.ownerDocument;return p?Math.max(g.documentElement[c],g.body[c]):k[c]}}).end()};function n(b){return typeof b=='object'?b:{top:b,left:b}}})(jQuery);

/* jQuery Scripts */
$(document).ready(function(){
	$("div.myfestivaluser-stats").hide();
	$('a.show:first').addClass('selectedUser');
	$('div.myfestivaluser-stats:first').show("slow");
	$("div#calendar-container a").click(function(){
		$("div#calendar-container a").removeClass("today");
		$(this).addClass("today");
		var linkval = "/cfc/test.cfm"+$(this).attr("href");
		$('#whatsoncontent').fadeOut(500, function(){
			$(this).load(linkval, function(){
				$(this).fadeIn(500);
			});
		});
		return false;
	})
	.end();

	$('a.show_hide').click(function(){
		//$('#'+$(this).attr('id')+'-'+$(this).attr('rel')).slideToggle("fast");
		$(this).parent().children('.dl-box').slideToggle('fast');
		return false;
	});
	
	$('li a.show_hide').click(function(){
		//$('#'+$(this).attr('id')+'-'+$(this).attr('rel')).slideToggle("fast");
		$(this).parent().parent().children('#event-'+$(this).attr('rel')).slideToggle('fast');
		$('#book-'+$(this).attr('rel')).slideToggle('fast');
		return false;
	});
	
	
	$('a.show').click(function(){
	$("div.myfestivaluser-stats").hide("slow");
	$("div.user-list a").removeClass("selectedUser");
	$(this).addClass("selectedUser");
	$('#'+$(this).attr('id')+'-'+$(this).attr('rel')).show("slow");
		return false;
	});
	
	$('a.close-box').click(function(){
		$(this).parents('div.dl-box').slideToggle("medium");
		return false;
	});
	
	$('a.eventInfoToggle').click(function(){
		$(this).toggleClass('bold');
		$('#'+$(this).attr('rel')).slideToggle("medium");
		return false;
	});
	
	$('#av_container').css('display','none'); // hide av container
	$('#a_container').css('display','none'); // hide av container
	
	$('a.rosetrailer_trigger').click(function() {
		var event_id = $(this).attr('rel');
		$('#av_container').css({ position: 'absolute', top: '250px', left: '350px' });
		$('#av_container').fadeIn(250);
		$('#av_embedd').empty();
		$('#av_embedd').flash(
			{
				src: 'http://media.perthweb.com.au/festival/2009/warofroses/'+event_id+'.swf', 
				width: 320,
				height: 300
			},
			{ version: 8 }
		);
		//return false;
	});
	
	
	$('a.artisttalk_trigger').click(function() {
		var event_id = $(this).attr('rel');
		$('#av_container').css({ position: 'absolute', top: '250px', left: '350px' });
		$('#av_container').fadeIn(250);
		$('#av_embedd').empty();
		$('#av_embedd').flash(
			{
				src: 'http://media.perthweb.com.au/festival/2009/artisttalk/'+event_id+'.swf', 
				width: 320,
				height: 300
			},
			{ version: 8 }
		);
		//return false;
	});
	

	$('a.v_trigger').click(function() {
		var event_id = $(this).attr('rel');
		$('#av_container').css({ position: 'absolute', top: '250px', left: '350px' });
		$('#av_container').fadeIn(250);
		$('#av_embedd').empty();
		$('#av_embedd').flash(
			{
				src: 'http://media.perthweb.com.au/festival/2009/film/'+event_id+'.swf', 
				width: 320,
				height: 300
			},
			{ version: 8 }
		);
		//return false;
	});
	
	$('a.rose_trigger').click(function() {
		var event_id = $(this).attr('rel');
		$('#av_container').css({ position: 'absolute', top: '300px', left: '400px' });
		$('#av_container').fadeIn(250);
		$('#av_embedd').empty();
		$('#av_embedd').flash(
			{
				src: 'http://media.perthweb.com.au/festival/2009/film/'+event_id+'.swf', 
				width: 320,
				height: 300
			},
			{ version: 8 }
		);
		//return false;
	});
	
	
	$('a.rose_trigger2').click(function() {
		var event_id = $(this).attr('rel');
		$('#av_container').css({ position: 'absolute', top: '300px', left: '400px' });
		$('#av_container').fadeIn(250);
		$('#av_embedd').empty();
		$('#av_embedd').flash(
			{
				src: 'http://media.perthweb.com.au/festival/2009/artisttalk/warartisttalk_v.swf', 
				width: 320,
				height: 300
			},
			{ version: 8 }
		);
		//return false;
	});
	
	
	$('a.a_trigger').click(function() {
		var event_id = $(this).attr('rel');
		$('#a_container').css({ position: 'absolute', top: '250px', left: '350px' });
		$('#a_container').fadeIn(250);
		$('#a_embedd').empty();
		$('#a_embedd').flash(
			{
				src: 'http://media.perthweb.com.au/festival/2009/audio/'+event_id+'.swf', 
				width: 325,
				height: 180
			},
			{ version: 8 }
		);
		//return false;
	});
	
	$('#av_close').click(function(){
		$('#av_container').fadeOut(250);
		$('#av_embedd').empty();
		return false;
	});
	
	$('#a_close').click(function(){
		$('#a_container').fadeOut(250);
		$('#a_embedd').empty();
		return false;
	});

	$('a.venuetrigger').click(function(){
		$('#venue-'+$(this).attr('rel')).slideToggle("medium");
		$.scrollTo('#content', {duration:500});
		return false;
	});
	
	$('a.plantrigger').click(function(){
		$('#plan-'+$(this).attr('rel')).slideToggle("medium");
		$.scrollTo('#content', {duration:500});
		return false;
	});
	
	/* ---------- Artist Popup ---------- */
	
	$('#artistpopup-close').click(function(){
		$('#artistpopup').fadeOut(250);
		$('#artistpopupcontent').empty();
		return false;
	});
	
	$("a.artistpopup").click(function(){
		linkval = $(this).attr("href");
		scrolled = $(document).scrollTop();
		$('#artistpopup').addClass('artistpopup-active');
		if(scrolled>230) {
			$('#artistpopup').css({ position: 'absolute', top: (scrolled-180)+'px' });
		} else {
			$('#artistpopup').css({ position: 'absolute', top: '50px' });
		}
		$('#artistpopup').fadeOut(100, function(){
			$('#artistpopupcontent').load(linkval, function(){
				$('#artistpopup').fadeIn(300);
			});
		});
		return false;
	});
	
	$(document).pngFix( { blankgif:'/_inc/img/blank.gif' } ); // fix PNGs in IE 5.5 & 6.0

});