/*
 * Thickbox 2.1 - jQuery plugin for displaying content in a box above the page
 * 
 * Copyright (c) 2006, 2007 Cody Lindley (http://www.codylindley.com)
 *
 * Licensed under the MIT License:
 *   http://www.opensource.org/licenses/mit-license.php
 */

// on page load call TB_init
$(document).ready(TB_init);

// add thickbox to href elements that have a class of .thickbox
function TB_init(){
	$("a.thickbox").click(function(event){
		// stop default behaviour
		event.preventDefault();
		// remove click border
		this.blur();
	
		// get caption: either title or name attribute
		var caption = this.title || this.name || "";
		
		// get rel attribute for image groups
		var group = this.rel || false;
		
		// display the box for the elements href
		TB_show(caption, this.href, group);
	});
}

// called when the user clicks on a thickbox link
function TB_show(caption, url, rel) {

	// create iframe, overlay and box if non-existent
	if ( !$("#TB_HideSelect").length ) {
		$("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
		$("#TB_overlay").click(TB_remove);
	}
	// TODO replace or check if event is already assigned
	$(window).scroll(TB_position);
	
	// TODO replace
	TB_overlaySize();
	
	// TODO create loader only once, hide and show on demand
	$("body").append("<div id='TB_load'><img src='/s/p/loadingAnimation.gif' /></div>");
	TB_load_position();
	
	// check if a query string is involved
	var baseURL = url.match(/(.+)?/)[1] || url;

	// regex to check if a href refers to an image
	var imageURL = /\.(jpe?g|png|gif|bmp)/gi;

	// check for images
	if ( baseURL.match(imageURL) ) {
		var dummy = { caption: "", url: "", html: "" };
		
		var prev = dummy,
			next = dummy,
			imageCount = "";
			
		// if an image group is given
		if ( rel ) {
			function getInfo(image, id, label) {
				return {
					caption: image.title,
					url: image.href,
					html: "<span id='TB_" + id + "'>&nbsp;&nbsp;<a href='#'>" + label + "</a></span>"
				}
			}
		
			// find the anchors that point to the group
			var imageGroup = $("a[@rel="+rel+"]").get();
			var foundSelf = false;
			
			// loop through the anchors, looking for ourself, saving information about previous and next image
			for (var i = 0; i < imageGroup.length; i++) {
				var image = imageGroup[i];
				var urlTypeTemp = image.href.match(imageURL);
				
				// look for ourself
				if ( image.href == url ) {
					foundSelf = true;
					imageCount = "Image " + (i + 1) + " of "+ (imageGroup.length);
				} else {
					// when we found ourself, the current is the next image
					if ( foundSelf ) {
						next = getInfo(image, "next", "Next &gt;");
						// stop searching
						break;
					} else {
						// didn't find ourself yet, so this may be the one before ourself
						prev = getInfo(image, "prev", "&lt; Prev");
					}
				}
			}
		}
		
		imgPreloader = new Image();
		imgPreloader.onload = function() {
			imgPreloader.onload = null;

			// Resizing large images
			var pagesize = TB_getPageSize();
			var x = pagesize[0] - 150;
			var y = pagesize[1] - 150;
			var imageWidth = imgPreloader.width;
			var imageHeight = imgPreloader.height;
			if (imageWidth > x) {
				imageHeight = imageHeight * (x / imageWidth); 
				imageWidth = x; 
				if (imageHeight > y) { 
					imageWidth = imageWidth * (y / imageHeight); 
					imageHeight = y; 
				}
			} else if (imageHeight > y) { 
				imageWidth = imageWidth * (y / imageHeight); 
				imageHeight = y; 
				if (imageWidth > x) { 
					imageHeight = imageHeight * (x / imageWidth); 
					imageWidth = x;
				}
			}
			// End Resizing
			
			// TODO don't use globals
			TB_WIDTH = imageWidth + 30;
			TB_HEIGHT = imageHeight + 60;
			
			// TODO empty window content instead
			$("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + imageCount + prev.html + next.html + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a></div>");
			
			$("#TB_closeWindowButton").click(TB_remove);
			
			function buildClickHandler(image) {
				return function() {
					$("#TB_window").remove();
					$("body").append("<div id='TB_window'></div>");
					TB_show(image.caption, image.url, rel);
					return false;
				};
			}
			var goPrev = buildClickHandler(prev);
			var goNext = buildClickHandler(next);
			if ( prev.html ) {
				$("#TB_prev").click(goPrev);
			}
			
			if ( next.html ) {		
				$("#TB_next").click(goNext);
			}
			
			// TODO use jQuery, maybe with event fix plugin, or just get the necessary parts of it
			document.onkeydown = function(e) {
				if (e == null) { // ie
					keycode = event.keyCode;
				} else { // mozilla
					keycode = e.which;
				}
				switch(keycode) {
				case 27:
					TB_remove();
					break;
				case 190:
					if( next.html ) {
						document.onkeydown = null;
						goNext();
					}
					break;
				case 188:
					if( prev.html ) {
						document.onkeydown = null;
						goPrev();
					}
					break;
				}
			}
			
			// TODO don't remove loader etc., just hide and show later
			TB_position();
			$("#TB_load").remove();
			$("#TB_ImageOff").click(TB_remove);
			
			// for safari using css instead of show
			// TODO is that necessary? can't test safari
			$("#TB_window").css({display:"block"});
		}
		imgPreloader.src = url;
		
	} else { //code to show html pages
		
		var queryString = url.match(/\?(.+)/)[1];
		var params = TB_parseQuery( queryString );
		
		TB_WIDTH = (params['width']*1) + 30;
		TB_HEIGHT = (params['height']*1) + 40;

		var ajaxContentW = TB_WIDTH - 30,
			ajaxContentH = TB_HEIGHT - 45;
		
		if(url.indexOf('TB_iframe') != -1){				
			urlNoQuery = url.split('TB_');		
			$("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a></div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' onload='TB_showIframe()'> </iframe>");
		} else {
			$("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>close</a></div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");
		}
				
		$("#TB_closeWindowButton").click(TB_remove);
		
			if(url.indexOf('TB_inline') != -1){	
				$("#TB_ajaxContent").html($('#' + params['inlineId']).html());
				TB_position();
				$("#TB_load").remove();
				$("#TB_window").css({display:"block"}); 
			}else if(url.indexOf('TB_iframe') != -1){
				TB_position();
				if(frames['TB_iframeContent'] == undefined){//be nice to safari
					$("#TB_load").remove();
					$("#TB_window").css({display:"block"});
					$(document).keyup( function(e){ var key = e.keyCode; if(key == 27){TB_remove()} });
				}
			}else{
				$("#TB_ajaxContent").load(url, function(){
					TB_position();
					$("#TB_load").remove();
					$("#TB_window").css({display:"block"}); 
				});
			}
		
	}
	
	$(window).resize(TB_position);
	
	document.onkeyup = function(e){ 	
		if (e == null) { // ie
			keycode = event.keyCode;
		} else { // mozilla
			keycode = e.which;
		}
		if(keycode == 27){ // close
			TB_remove();
		}	
	}
		
}

//helper functions below

function TB_showIframe(){
	$("#TB_load").remove();
	$("#TB_window").css({display:"block"});
}

function TB_remove() {
 	$("#TB_imageOff").unbind("click");
	$("#TB_overlay").unbind("click");
	$("#TB_closeWindowButton").unbind("click");
	$("#TB_window").fadeOut("fast",function(){$('#TB_window,#TB_overlay,#TB_HideSelect').remove();});
	$("#TB_load").remove();
	return false;
}

function TB_position() {
	var pagesize = TB_getPageSize();	
	var arrayPageScroll = TB_getPageScrollTop();
	var style = {width: TB_WIDTH, left: (arrayPageScroll[0] + (pagesize[0] - TB_WIDTH)/2), top: (arrayPageScroll[1] + (pagesize[1]-TB_HEIGHT)/2)};
	$("#TB_window").css(style);
}

function TB_overlaySize(){
	if (window.innerHeight && window.scrollMaxY || window.innerWidth && window.scrollMaxX) {	
		yScroll = window.innerHeight + window.scrollMaxY;
		xScroll = window.innerWidth + window.scrollMaxX;
		var deff = document.documentElement;
		var wff = (deff&&deff.clientWidth) || document.body.clientWidth || window.innerWidth || self.innerWidth;
		var hff = (deff&&deff.clientHeight) || document.body.clientHeight || window.innerHeight || self.innerHeight;
		xScroll -= (window.innerWidth - wff);
		yScroll -= (window.innerHeight - hff);
	} else if (document.body.scrollHeight > document.body.offsetHeight || document.body.scrollWidth > document.body.offsetWidth){ // all but Explorer Mac
		yScroll = document.body.scrollHeight;
		xScroll = document.body.scrollWidth;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		yScroll = document.body.offsetHeight;
		xScroll = document.body.offsetWidth;
  	}
	$("#TB_overlay").css({"height": yScroll, "width": xScroll});
	$("#TB_HideSelect").css({"height": yScroll,"width": xScroll});
}

function TB_load_position() {
	var pagesize = TB_getPageSize();
	var arrayPageScroll = TB_getPageScrollTop();
	$("#TB_load")
		.css({left: (arrayPageScroll[0] + (pagesize[0] - 100)/2), top: (arrayPageScroll[1] + ((pagesize[1]-100)/2)) })
		.css({display:"block"});
}

function TB_parseQuery ( query ) {
	// return empty object
	if( !query )
		return {};
	var params = {};
	
	// parse query
	var pairs = query.split(/[;&]/);
	for ( var i = 0; i < pairs.length; i++ ) {
		var pair = pairs[i].split('=');
		if ( !pair || pair.length != 2 )
			continue;
		// unescape both key and value, replace "+" with spaces in value
		params[unescape(pair[0])] = unescape(pair[1]).replace(/\+/g, ' ');
   }
   return params;
}

function TB_getPageScrollTop(){
	var yScrolltop;
	var xScrollleft;
	if (self.pageYOffset || self.pageXOffset) {
		yScrolltop = self.pageYOffset;
		xScrollleft = self.pageXOffset;
	} else if (document.documentElement && document.documentElement.scrollTop || document.documentElement.scrollLeft ){	 // Explorer 6 Strict
		yScrolltop = document.documentElement.scrollTop;
		xScrollleft = document.documentElement.scrollLeft;
	} else if (document.body) {// all other Explorers
		yScrolltop = document.body.scrollTop;
		xScrollleft = document.body.scrollLeft;
	}
	arrayPageScroll = new Array(xScrollleft,yScrolltop) 
	return arrayPageScroll;
}

function TB_getPageSize(){
	var de = document.documentElement;
	var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
	var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight
	arrayPageSize = new Array(w,h) 
	return arrayPageSize;
}


/**
 * Interface Elements for jQuery
 * utility function
 * 
 * http://interface.eyecon.ro
 * 
 * Copyright (c) 2006 Stefan Petre
 * Dual licensed under the MIT (MIT-LICENSE.txt) 
 * and GPL (GPL-LICENSE.txt) licenses.
 *   
 *
 */
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}('a.1u={1c:f(e,s){6 l=0;6 t=0;6 v=0;6 C=0;6 w=a.3(e,\'Y\');6 h=a.3(e,\'Z\');6 g=e.V;6 i=e.W;Q(e.R){l+=e.O+(e.7?4(e.7.F)||0:0);t+=e.P+(e.7?4(e.7.D)||0:0);c(s){v+=e.S.m||0;C+=e.S.j||0}e=e.R}l+=e.O+(e.7?4(e.7.F)||0:0);t+=e.P+(e.7?4(e.7.D)||0:0);C=t-C;v=l-v;8{x:l,y:t,1d:v,1f:C,w:w,h:h,g:g,i:i}},1g:f(e){6 x=0;6 y=0;6 T=1h;5=e.11;c(a(e).3(\'p\')==\'J\'){E=5.n;K=5.q;5.n=\'12\';5.p=\'13\';5.q=\'15\';T=1i}1=e;Q(1){x+=1.O+(1.7&&!a.14.10?4(1.7.F)||0:0);y+=1.P+(1.7&&!a.14.10?4(1.7.D)||0:0);1=1.R}1=e;Q(1&&1.1s.1n()!=\'9\'){x-=1.m||0;y-=1.j||0;1=1.S}c(T){5.p=\'J\';5.q=K;5.n=E}8{x:x,y:y}},1q:f(e){6 w=a.3(e,\'Y\');6 h=a.3(e,\'Z\');6 g=0;6 i=0;5=e.11;c(a(e).3(\'p\')!=\'J\'){g=e.V;i=e.W}k{E=5.n;K=5.q;5.n=\'12\';5.p=\'13\';5.q=\'15\';g=e.V;i=e.W;5.p=\'J\';5.q=K;5.n=E}8{w:w,h:h,g:g,i:i}},18:f(e){c(e){w=e.A;h=e.B}k{u=2.d;w=X.M||G.M||(u&&u.A)||2.9.A;h=X.N||G.N||(u&&u.B)||2.9.B}8{w:w,h:h}},1a:f(e){c(e){t=e.j;l=e.m;w=e.U;h=e.L;I=0;H=0}k{c(2.d&&2.d.j){t=2.d.j;l=2.d.m;w=2.d.U;h=2.d.L}k c(2.9){t=2.9.j;l=2.9.m;w=2.9.U;h=2.9.L}I=G.M||2.d.A||2.9.A||0;H=G.N||2.d.B||2.9.B||0}8{t:t,l:l,w:w,h:h,I:I,H:H}},1j:f(e,o){1=a(e);t=1.3(\'1k\')||\'\';r=1.3(\'1l\')||\'\';b=1.3(\'1m\')||\'\';l=1.3(\'1o\')||\'\';c(o)8{t:4(t)||0,r:4(r)||0,b:4(b)||0,l:4(l)};k 8{t:t,r:r,b:b,l:l}},1r:f(e,o){1=a(e);t=1.3(\'1t\')||\'\';r=1.3(\'1v\')||\'\';b=1.3(\'1w\')||\'\';l=1.3(\'1x\')||\'\';c(o)8{t:4(t)||0,r:4(r)||0,b:4(b)||0,l:4(l)};k 8{t:t,r:r,b:b,l:l}},1y:f(e,o){1=a(e);t=1.3(\'D\')||\'\';r=1.3(\'16\')||\'\';b=1.3(\'19\')||\'\';l=1.3(\'F\')||\'\';c(o)8{t:4(t)||0,r:4(r)||0,b:4(b)||0,l:4(l)||0};k 8{t:t,r:r,b:b,l:l}},1z:f(z){x=z.17||(z.1b+(2.d.m||2.9.m))||0;y=z.1e||(z.1p+(2.d.j||2.9.j))||0;8{x:x,y:y}}};',62,98,'|el|document|css|parseInt|es|var|currentStyle|return|body|jQuery||if|documentElement||function|wb||hb|scrollTop|else||scrollLeft|visibility|toInteger|display|position||||de|sl||||event|clientWidth|clientHeight|st|borderTopWidth|oldVisibility|borderLeftWidth|self|ih|iw|none|oldPosition|scrollHeight|innerWidth|innerHeight|offsetLeft|offsetTop|while|offsetParent|parentNode|restoreStyle|scrollWidth|offsetWidth|offsetHeight|window|width|height|opera|style|hidden|block|browser|absolute|borderRightWidth|pageX|getClient|borderBottomWidth|getScroll|clientX|getPos|sx|pageY|sy|getPosition|false|true|getMargins|marginTop|marginRight|marginBottom|toLowerCase|marginLeft|clientY|getSize|getPadding|tagName|paddingTop|iUtil|paddingRight|paddingBottom|paddingLeft|getBorder|getPointer'.split('|'),0,{}))
/**
 * Interface Elements for jQuery
 * FX
 * 
 * http://interface.eyecon.ro
 * 
 * Copyright (c) 2006 Stefan Petre
 * Dual licensed under the MIT (MIT-LICENSE.txt) 
 * and GPL (GPL-LICENSE.txt) licenses.
 *   
 *
 */
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}('v.Y=D(1B,X,H,19){A z=1j;z.19=/2o|2p|1N|1P|1O|1Q|1Y|1W|24/.1h(19)?19:\'2n\';z.o={f:X.f||3j,18:X.18,14:X.14};z.k=1B;A y=z.k.1f;z.a=D(){6(X.14)X.14.26(1B,[z.M]);6(H=="T"){6(z.M==1)z.M=0.2D;6(3z.2E)y.27="28(T="+z.M*29+")";u y.T=z.M}u 6(E(z.M))y[H]=E(z.M)+"S";y.1H="2F"};z.2d=D(){d 1b(v.Q(z.k,H))};z.1t=D(){A r=1b(v.2G(z.k,H));d r&&r>-2l?r:z.2d()};z.1s=D(1F,1U){z.1D=(1V 23()).1X();z.M=1F;z.a();z.1p=2I(D(){z.14(1F,1U)},13)};z.2i=D(p){6(!z.k.N)z.k.N={};z.k.N[H]=1j.1t();z.1s(0,z.k.N[H]);6(H!="T")y[H]="2K"};z.16=D(){6(!z.k.N)z.k.N={};z.k.N[H]=1j.1t();z.o.16=V;z.1s(z.k.N[H],0)};6(v.1J.1u&&!z.k.1G.2N)y.2L="1";6(!z.k.2M)z.k.1Z=v.Q(z.k,"1g");y.1g="1S";z.14=D(h,1E){A t=(1V 23()).1X();6(t>z.o.f+z.1D){2O(z.1p);z.1p=2P;z.M=1E;z.a();6(z.k.17)z.k.17[H]=V;A 1m=V;21(A i 22 z.k.17){6(z.k.17[i]!==V)1m=15}6(1m){y.1g=z.k.1Z;6(z.o.16)y.1H=\'1M\';6(z.o.16){21(A p 22 z.k.17){y[p]=z.k.N[p]+(p=="T"?"":"S");6(p==\'2f\'||p==\'1T\')v.2R(z.k,p)}}}6(1m&&z.o.18&&z.o.18.2S==2T)z.o.18.26(z.k)}u{A n=t-1j.1D;A p=n/z.o.f;z.M=v.Y.2m(p,n,h,(1E-h),z.o.f,z.19);z.a()}}};v.2g=D(e){6(/2V|3d|2W|2X|2Y|39|38|30|31|32|33|34|35|36|37|3a|3b/i.1h(e.1q))d 15;u d V};v.Y.3c=D(e,R){c=e.3e;P=c.1f;P.J=R.J;P.1y=R.O.t;P.1A=R.O.l;P.1x=R.O.b;P.1z=R.O.r;P.K=R.K+\'S\';P.L=R.L+\'S\';e.1K.2c(c,e);e.1K.3f(e)};v.Y.3g=D(e){6(!v.2g(e))d 15;A t=v(e);A G=e.1f;A 1I=15;w={};w.J=t.Q(\'J\');w.1v=v.2h.3i(e);w.O=v.2h.3k(e);1L=e.1G?e.1G.20:t.Q(\'3l\');6(t.Q(\'1H\')==\'1M\'){2k=t.Q(\'2j\');t.2i();1I=V}w.K=E(t.Q(\'K\'))||0;w.L=E(t.Q(\'L\'))||0;6(1I){t.16();G.2j=2k}A 1R=\'3n\'+E(C.3o()*2l);A U=3p.3q(/3r|2b|3s|3t|3v|3w|3x|3y|2q|2r|2s|2t|2u|2v/i.1h(e.1q)?\'2w\':e.1q);v.2x(U,\'2y\',1R);2z=v(U).2A(\'2B\');A F=U.1f;A K=0;A L=0;6(w.J==\'1r\'||w.J==\'1C\'){K=w.K;L=w.L}F.K=K+\'S\';F.L=L+\'S\';F.J=w.J!=\'1r\'&&w.J!=\'1C\'?\'1r\':w.J;F.2f=w.1v.2H+\'S\';F.1T=w.1v.2J+\'S\';F.1y=w.O.t;F.1z=w.O.r;F.1x=w.O.b;F.1A=w.O.l;F.1g=\'1S\';6(v.1J.1u){F.20=1L}u{F.2Q=1L}6(v.1J=="1u"){G.27="28(T="+0.2a*29+")"}G.T=0.2a;e.1K.2c(U,e);U.2Z(e);G.1y=\'12\';G.1z=\'12\';G.1x=\'12\';G.1A=\'12\';G.J=\'1C\';G.3h=\'1M\';G.K=\'12\';G.L=\'12\';d{w:w,3m:v(U)}};v.Y.2m=D(p,n,h,8,f,I){6(I==\'2n\'){d((-C.3u(p*C.1a)/2)+0.5)*8+h}6(I==\'2o\'){d 8*(n/=f)*n*n+h}6(I==\'2p\'){d-8*((n=n/f-1)*n*n*n-1)+h}6(I==\'1N\'){6((n/=f/2)<1)d 8/2*n*n*n*n+h;d-8/2*((n-=2)*n*n*n-2)+h}6(I==\'1O\'){6((n/=f)<(1/2.j)){d 8*(7.B*n*n)+h}u 6(n<(2/2.j)){d 8*(7.B*(n-=(1.5/2.j))*n+.j)+h}u 6(n<(2.5/2.j)){d 8*(7.B*(n-=(2.25/2.j))*n+.1e)+h}u{d 8*(7.B*(n-=(2.1o/2.j))*n+.1n)+h}}6(I==\'1P\'){q=f-n;6((q/=f)<(1/2.j)){m=8*(7.B*q*q)}u 6(q<(2/2.j)){m=8*(7.B*(q-=(1.5/2.j))*q+.j)}u 6(q<(2.5/2.j)){m=8*(7.B*(q-=(2.25/2.j))*q+.1e)}u{m=8*(7.B*(q-=(2.1o/2.j))*q+.1n)}d 8-m+h}6(I==\'1Q\'){6(n<f/2){q=n*2;6((q/=f)<(1/2.j)){m=8*(7.B*q*q)}u 6(q<(2/2.j)){m=8*(7.B*(q-=(1.5/2.j))*q+.j)}u 6(q<(2.5/2.j)){m=8*(7.B*(q-=(2.25/2.j))*q+.1e)}u{m=8*(7.B*(q-=(2.1o/2.j))*q+.1n)}d(8-m+h)*.5+h}u{n=n*2-f;6((n/=f)<(1/2.j)){m=8*(7.B*n*n)+h}u 6(n<(2/2.j)){m=8*(7.B*(n-=(1.5/2.j))*n+.j)+h}u 6(n<(2.5/2.j)){m=8*(7.B*(n-=(2.25/2.j))*n+.1e)+h}u{m=8*(7.B*(n-=(2.1o/2.j))*n+.1n)+h}d m*.5+8*.5+h}}6(I==\'1W\'){6((n/=f)==1)d h+8;d 8*C.1k(2,-10*n)*C.1i((n*f-(f*.3)/4)*(2*C.1a)/(f*.3))+8+h}6(I==\'1Y\'){6(n==0)d b;6((n/=f)==1)d h+8;d-(8*C.1k(2,10*(n-=1))*C.1i((n*f-(f*.3)/4)*(2*C.1a)/(f*.3)))+h}6(I==\'24\'){6(n==0)d h;6((n/=f)==1)d h+8;v(\'#1h\').2U(p+\'<2b />\'+n);6(p<1)d-.5*(8*C.1k(2,10*(n-=1))*C.1i((n*f-(f*.1d)/4)*(2*C.1a)/(f*.1d)))+h;d 8*C.1k(2,-10*(n-=1))*C.1i((n*f-(f*.1d)/4)*(2*C.1a)/(f*.1d))*.5+8+h}};v.Y.2C=D(1l){6(x=/2e\\(\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*\\)/.1c(1l))d{r:E(x[1]),g:E(x[2]),b:E(x[3])};u 6(x=/2e\\(\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*,\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*,\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*\\)/.1c(1l))d{r:1b(x[1])*2.1w,g:1b(x[2])*2.1w,b:1b(x[3])*2.1w};u 6(x=/#([a-11-W-9])([a-11-W-9])([a-11-W-9])/.1c(1l))d{r:E("Z"+x[1]+x[1]),g:E("Z"+x[2]+x[2]),b:E("Z"+x[3]+x[3])};u 6(x=/#([a-11-W-9]{2})([a-11-W-9]{2})([a-11-W-9]{2})/.1c(c))d{r:E("Z"+x[1]),g:E("Z"+x[2]),b:E("Z"+x[3])};u d 15}',62,222,'||||||if||delta|||||return||duration||firstNum||75|el||||||nm||||else|jQuery|oldStyle|result|||var|5625|Math|function|parseInt|wrs|es|prop|type|position|top|left|now|orig|margins|cs|css|old|px|opacity|wr|true|F0|options|fx|0x||fA|0px||step|false|hide|curAnim|complete|transition|PI|parseFloat|exec|45|9375|style|overflow|test|sin|this|pow|color|done|984375|625|timer|nodeName|relative|custom|cur|msie|sizes|55|marginBottom|marginTop|marginRight|marginLeft|elem|absolute|startTime|lastNum|from|currentStyle|display|restoreStyle|browser|parentNode|oldFloat|none|easeboth|bounceout|bouncein|bounceboth|wid|hidden|width|to|new|elasticout|getTime|elasticin|oldOverflow|styleFloat|for|in|Date|elasticboth||apply|filter|alpha|100|999|br|insertBefore|max|rgb|height|fxCheckTag|iUtil|show|visibility|oldVisibility|10000|transitions|original|easein|easeout|button|form|table|ul|dl|ol|div|attr|id|wrapEl|addClass|fxWrapper|parseColor|9999|ActiveXObject|block|curCSS|hb|setInterval|wb|1px|zoom|oldOverlay|hasLayout|clearInterval|null|cssFloat|setAuto|constructor|Function|html|tr|tbody|caption|thead|appendChild|colgroup|th|body|header|script|frame|frameset|option|col|tfoot|optgroup|meta|destroyWrapper|td|firstChild|removeChild|buildWrapper|listStyle|getSize|400|getMargins|float|wrapper|w_|random|document|createElement|img|input|hr|cos|select|textarea|object|iframe|window'.split('|'),0,{}))

/**
 * Interface Elements for jQuery
 * FX - slide
 * 
 * http://interface.eyecon.ro
 * 
 * Copyright (c) 2006 Stefan Petre
 * Dual licensed under the MIT (MIT-LICENSE.txt) 
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 */
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}('4.1d.Z({U:6(1,5,3){d 7.f(\'a\',6(){8 4.2.b(7,1,5,\'E\',\'l\',3)})},1c:6(1,5,3){d 7.f(\'a\',6(){8 4.2.b(7,1,5,\'E\',\'o\',3)})},11:6(1,5,3){d 7.f(\'a\',6(){8 4.2.b(7,1,5,\'E\',\'u\',3)})},12:6(1,5,3){d 7.f(\'a\',6(){8 4.2.b(7,1,5,\'w\',\'l\',3)})},19:6(1,5,3){d 7.f(\'a\',6(){8 4.2.b(7,1,5,\'w\',\'o\',3)})},13:6(1,5,3){d 7.f(\'a\',6(){8 4.2.b(7,1,5,\'w\',\'u\',3)})},14:6(1,5,3){d 7.f(\'a\',6(){8 4.2.b(7,1,5,\'s\',\'l\',3)})},15:6(1,5,3){d 7.f(\'a\',6(){8 4.2.b(7,1,5,\'s\',\'o\',3)})},17:6(1,5,3){d 7.f(\'a\',6(){8 4.2.b(7,1,5,\'s\',\'u\',3)})},18:6(1,5,3){d 7.f(\'a\',6(){8 4.2.b(7,1,5,\'x\',\'l\',3)})},1a:6(1,5,3){d 7.f(\'a\',6(){8 4.2.b(7,1,5,\'x\',\'o\',3)})},1b:6(1,5,3){d 7.f(\'a\',6(){8 4.2.b(7,1,5,\'x\',\'u\',3)})}});4.2.b=6(e,1,5,D,j,3){m(!4.L(e)){4.J(e,\'a\');d M}N z=7;z.9=4(e);z.3=3||\'O\';m(j==\'u\'){j=z.9.r(\'A\')==\'G\'?\'l\':\'o\'}m(!e.B)e.B=z.9.r(\'A\');z.9.P();z.1=1;z.5=5;z.2=4.2.Q(e);z.j=j;z.D=D;z.v=6(){m(z.j==\'o\')z.9.r(\'I\',\'S\');4.2.T(z.2.F.k(0),z.2.c);m(z.j==\'l\'){z.9.r(\'A\',z.9.k(0).B==\'G\'?\'V\':z.9.k(0).B)}t{z.9.r(\'A\',\'G\');z.9.r(\'I\',\'W\')}m(z.5&&z.5.X==Y){z.5.10(z.9.k(0))}4.J(z.9.k(0),\'a\')};16(z.D){y\'E\':z.i=8 4.2(z.9.k(0),4.1(z.1,z.v),\'H\',z.3);z.q=8 4.2(z.2.F.k(0),4.1(z.1),\'K\',z.3);m(z.j==\'l\'){z.i.g(-z.2.c.h.p,0);z.q.g(0,z.2.c.h.p)}t{z.i.g(0,-z.2.c.h.p);z.q.g(z.2.c.h.p,0)}C;y\'w\':z.i=8 4.2(z.9.k(0),4.1(z.1,z.v),\'H\',z.3);m(z.j==\'l\'){z.i.g(z.2.c.h.p,0)}t{z.i.g(0,z.2.c.h.p)}C;y\'s\':z.i=8 4.2(z.9.k(0),4.1(z.1,z.v),\'s\',z.3);z.q=8 4.2(z.2.F.k(0),4.1(z.1),\'R\',z.3);m(z.j==\'l\'){z.i.g(-z.2.c.h.n,0);z.q.g(0,z.2.c.h.n)}t{z.i.g(0,-z.2.c.h.n);z.q.g(z.2.c.h.n,0)}C;y\'x\':z.i=8 4.2(z.9.k(0),4.1(z.1,z.v),\'s\',z.3);m(z.j==\'l\'){z.i.g(z.2.c.h.n,0)}t{z.i.g(0,z.2.c.h.n)}C}};',62,76,'|speed|fx|transition|jQuery|callback|function|this|new|el|interfaceFX|slide|oldStyle|return||queue|custom|sizes|ef|type|get|in|if|wb|out|hb|efx|css|left|else|toggle|complete|down|right|case||display|ifxFirstDisplay|break|direction|up|wrapper|none|top|visibility|dequeue|height|fxCheckTag|false|var|original|show|buildWrapper|width|hidden|destroyWrapper|SlideInUp|block|visible|constructor|Function|extend|apply|SlideToggleUp|SlideInDown|SlideToggleDown|SlideInLeft|SlideOutLeft|switch|SlideToggleLeft|SlideInRight|SlideOutDown|SlideOutRight|SlideToggleRight|SlideOutUp|fn'.split('|'),0,{}))


$(document).ready(function () {
	var $side = $('#side');
	var $ulki = $side.find('h2 + ul');
	//alert($('#side ul').eq(0).css('display'));
	$ulki.each(function() {
		
		if($('li.current',this).size() == 0) {
			$(this).css('display','none');
		}
		
		

	});
	
	$('#side h2').bind('click',function() {
		
		var $tenUl = $(' + ul',this);
		
		if($tenUl.css('display') != 'block') {
			$tenUl.SlideInLeft(500,function() {
				
				$('#side li ul').css({});
			
			$('#side h2 + ul').not(this).each(function() {
				if($(this).css('display') == 'block') {
					$(this).SlideOutUp(500);
				}
			})});
		}
	});
});
