/* (C) 2008 YOOtheme.com, base.js */

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 1U={1V:5(1G,X,W){4 k=0;4 x=[];4 O=1G.26(" ");4 1E=O.27();4 16=\'\';O.h(5(f,i){16+=\'.1e("\'+f+\'")\'});$1Z(1E).h(5(B,i){25(\'x.24(B\'+16+\');\')});x.h(5(b,i){8(!$1f(b))t;4 m,s;8(b.1J){m=b.1J;s=0;s+=b.1A(\'1o-23\').1h();s+=b.1A(\'1o-21\').1h();m-=s;8(X!=1w){m-=X}}y 8(b.1p.1v){m=b.1p.1v}k=1s.1y(k,m)});8(W!=1w){k=1s.1y(k,W)}x.h(5(b,i){8(!$1f(b))t;8(1R.1Q){b.Q(\'1j\',k+\'1l\')}y{b.Q(\'1T-1j\',k+\'1l\')}})}};4 14=d v({1c:5(n,6){3.r({K:\'a-1k\',1H:1W,1K:1Y,N:0.9,1d:w.1b.1S,C:1C,o:v.22},6);3.15=\'j-2g\',3.13=\'j-2F\',3.12=\'j-2z\',3.P=\'a-2v\';3.1z=\'a-1k\';3.I=\'a-2x\';3.n=$$(n);3.10=d 1r(1t.G);3.c(\'o\',3.6.o);3.L=\'\';4 7=3;4 V=$E(\'#2y\');4 U=$E(\'#2w\');4 S=$E(\'#2t\');4 T=$E(\'#2A\');4 Y=$E(\'#2E\');4 Z=$E(\'#2a\');8(V)V.c(\'l\',5(){7.J(7.P)});8(U)U.c(\'l\',5(){7.J(7.1z)});8(S)S.c(\'l\',5(){7.J(7.I)});8(T)T.c(\'l\',5(){7.u(7.15)});8(Y)Y.c(\'l\',5(){7.u(7.13)});8(Z)Z.c(\'l\',5(){7.u(7.12)})},u:5(j){4 7=3;4 1i=[3.15,3.13,3.12];1i.h(5(R,i){8(R==j){7.10.2f(j)}y{7.10.2e(R)}});H.1u(\'2b\',j,{1F:\'/\'});3.2c(\'o\')},J:5(a){4 7=3;4 1P=3.M(H.1D(\'17\')||3.6.K);4 1N=3.M(a);H.1u(\'17\',a,{1F:\'/\'});3.n.h(5(z,i){4 g=z.2d(\'a\',7.6);g.c(\'1O\',7.1L).c(\'1O\',7.6.o);g.D(1P,1N)})},1L:5(){4 7=3;4 L=H.1D(\'17\')||3.6.K;8(L==3.I){3.n.h(5(z,i){z.Q(\'a\',(7.6.N*2q)+\'%\')})}},M:5(a){8(a==3.P)t 3.6.1H;8(a==3.I)t 2n((2k.2l())*3.6.N);t 3.6.1K}});14.F(d 2D);14.F(d 11);4 1n=d v({1c:5(B,1B,1m,1a,1M,A){3.r({C:1C,1d:w.1b.2m,1q:1x,18:\'\'},1a);4 6=3.6;$$(B).h(5(f,i){4 19=f;8(A&&f.1e(A)){19=f.1e(A)}4 g=d w.2o(19,6);8(!($1f(6.18)&&f.2p(6.18))){f.c(\'2j\',5(e){g.r(6,1a).D(1B)});f.c(\'2i\',5(e){g.r(6,1M).D(1m)})}})}});1n.F(d 11);4 1I=d v({1c:5(6){3.r({1d:w.1b.2h,C:2s,1q:1x,q:[\'#2r\',\'#2u\']},6);4 G=d 1r(1t.G);4 g=G.2B(3.6);4 p=0;4 q=3.6.q;4 2C=1g.1X(3.6.C*2);1g();5 1g(){g.D({\'29-28\':q[p]});8(p+1>=q.20){p=0}y{p++}}}});1I.F(d 11);',62,166,'|||this|var|function|options|obj|if||width|div|addEvent|new||el|fx|each||font|maxHeight|click|divHeight|wrappers|afterSwitch|index|colors|setOptions|divPadding|return|fontSwitch|Class|Fx|matchDivs|else|wrapper|elementFx|element|duration|start||implement|body|Cookie|widthFluid|widthSwitch|widthDefault|widthStyle|getWidthPx|widthFluidPx|selectors|widthThin|setStyle|currentFont|switchWidthFluid|switchFontSmall|switchWidthWide|switchWidthThin|minWidth|divBorder|switchFontMedium|switchFontLarge|htmlbody|Options|fontLarge|fontMedium|YOOStyleSwitcher|fontSmall|script|ytstylewidth|ignoreClass|elfx|enterFx|Transitions|initialize|transition|getElement|chk|animate|toInt|fonts|height|wide|px|leave|YOOMorph|padding|style|wait|Element|Math|document|set|pixelHeight|undefined|false|max|widthWide|getStyle|enter|500|get|elements|path|selector|widthThinPx|YOOBackgroundFx|offsetHeight|widthWidePx|widthSwitchComplete|leaveFx|newWidth|onComplete|curWidth|ie6|window|quadOut|min|YOOBase|matchDivHeight|780|periodical|940|ES|length|bottom|empty|top|push|eval|split|shift|color|background|switchfontlarge|ytstylefont|fireEvent|effect|removeClass|addClass|small|linear|mouseleave|mouseenter|Window|getWidth|expoOut|parseInt|Styles|hasClass|100|FFFFFF|9000|switchwidthfluid|999999|thin|switchwidthwide|fluid|switchwidththin|large|switchfontsmall|effects|timer|Events|switchfontmedium|medium'.split('|'),0,{}))
/* (C) 2008 YOOtheme.com, accordionmenu.js */

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}('5 t=6 v({w:4(q,p,2){0.x({r:\'m\'},2);0.7=q;0.9=p;y(0.2.r){A\'z\':0.j();C;m:0.g()}},g:4(){5 2={};e(!$n(0.2.8)&&!$n(0.2.c)){2={c:-1}}$k(0.7).l(4(3,i){e(3.o(\'s\'))2={c:i}}.u(0));5 B=6 d.Q(0.7,0.9,$N(0.2,2))},j:4(){$k(0.7).l(4(3,i){5 a=3.h(\'a\');5 f=3.h(0.9);5 b=6 d.M(f,{D:d.P.R,L:K});e(!(3.o(\'s\')||0.2.8==\'F\'||0.2.8==i)){b.E()}a.G(\'H\',4(){b.J()})}.u(0))}});t.I(6 O);',54,54,'this||options|tog|function|var|new|togs|display|elms|span|fx|show|Fx|if|ul|createDefault|getElement||createSlide|ES|each|default|defined|hasClass|elements|togglers|accordion|active|YOOAccordionMenu|bind|Class|initialize|setOptions|switch|slide|case|accordionMenu|break|transition|hide|all|addEvent|click|implement|toggle|250|duration|Slide|extend|Options|Transitions|Accordion|linear'.split('|'),0,{}))
var YOOFancyMenu = new Class({
    initialize: function (menu, options) {
        this.setOptions({
            transition: Fx.Transitions.sineInOut,
            duration: 500,
            wait: false,
            onClick: Class.empty,
            opacity: 1,
            mode: 'move',
            slideOffset: 30,
            colorSelector: ['red', 'pink', 'blue', 'green', 'orange', 'yellow', 'lilac', 'turquoise'],
            itemSelector: 'li.level1',
            activeSelector: 'li.active'
        },
        options);
        this.menu = $(menu),
        this.current = this.menu.getElement(this.options.activeSelector);
        this.li = [];
        this.div = [];
        this.menu.getElements(this.options.itemSelector).each(function (item, i) {
            this.createBackground(item, i);
            item.addEvent('click', function (event) {
                this.clickItem(event, item)
            }.bind(this));
            item.addEvent('mouseenter', function () {
                this.mouseenterItem(item, i)
            }.bind(this));
            if (this.options.mode == 'move') {
                item.addEvent('mouseleave', function () {
                    this.mouseleaveItem(this.current, i)
                }.bind(this))
            } else {
                item.addEvent('mouseleave', function () {
                    this.mouseleaveItem(item, i)
                }.bind(this))
            }
        }.bind(this));
        if (this.options.mode == 'move') {
            if (this.current) {
                this.setCurrent(this.current)
            } else {
                var first = this.menu.getElement('li');
                first.addClass('active');
                first.addClass('current');
                this.setCurrent(first)
            }
        }
    },
    createBackground: function (item, i) {
        if (this.options.mode == 'move' && i != 0) return;
        var css = 'fancy ' + 'bg' + (i + 1);
        this.options.colorSelector.each(function (col, i) {
            if (item.hasClass(col)) {
                css += ' bg-' + col
            }
        });
        this.div[i] = new Element('div', {
            'class': 'fancy-container'
        }).adopt(new Element('div', {
            'class': 'fancy-l'
        }), new Element('div', {
            'class': 'fancy-m'
        }), new Element('div', {
            'class': 'fancy-r'
        }));
        this.div[i].fx = this.div[i].effects(this.options);
        this.li[i] = new Element('li', {
            'class': css
        }).adopt(this.div[i]).injectInside(this.menu);
        this.li[i].fx = this.li[i].effects(this.options)
    },
    setCurrent: function (item) {
        this.li[0].setStyles({
            'left': item.offsetLeft,
            'width': item.offsetWidth,
            'visibility': 'visible',
            'opacity': this.options.opacity
        });
        this.current = item
    },
    clickItem: function (event, item) {
        if (!this.current) this.setCurrent(item);
        this.current = item;
        this.options.onClick(new Event(event), item)
    },
    mouseenterItem: function (item, i) {
        switch (this.options.mode) {
        case 'fade':
            this.fadeFx(item, i, true);
            break;
        case 'slide':
            this.slideFx(item, i, true);
            break;
        default:
            this.moveFx(item, 0)
        }
    },
    mouseleaveItem: function (item, i) {
        switch (this.options.mode) {
        case 'fade':
            this.fadeFx(item, i, false);
            break;
        case 'slide':
            this.slideFx(item, i, false);
            break;
        default:
            this.moveFx(item, 0)
        }
    },
    moveFx: function (item, i) {
        if (!this.current) return;
        this.li[i].fx.custom({
            'left': [this.li[i].offsetLeft, item.offsetLeft],
            'width': [this.li[i].offsetWidth, item.offsetWidth]
        })
    },
    fadeFx: function (item, i, show) {
        if (show) {
            this.li[i].fx.setOptions(this.options);
            this.li[i].fx.set({
                'left': item.offsetLeft,
                'width': item.offsetWidth
            });
            this.li[i].fx.custom({
                'opacity': [0, 1]
            })
        } else {
            var dur = this.options.duration * 2;
            this.li[i].fx.setOptions({
                duration: dur
            });
            this.li[i].fx.custom({
                'opacity': [1, 0]
            })
        }
    },
    slideFx: function (item, i, show) {
        var offset = this.options.slideOffset;
        if (show) {
            this.li[i].fx.set({
                'opacity': 1,
                'left': item.offsetLeft,
                'width': item.offsetWidth
            });
            this.div[i].fx.set({
                'margin-top': offset
            });
            this.div[i].fx.custom({
                'margin-top': [offset, 0]
            })
        } else {
            this.div[i].fx.set({
                'margin-top': 0
            });
            this.div[i].fx.custom({
                'margin-top': [0, offset]
            })
        }
    }
});
YOOFancyMenu.implement(new Options);/* (C) 2008 YOOtheme.com, dropdownmenu.js */

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}('2 g=f q({u:6(e,7){9.x({i:\'w\',y:s,B:h.v.A,z:r},7);2 3={\'8\':0,\'a\':0,\'b\':0};t(9.7.i){j\'8\':3={\'8\':0,\'b\':0};m;j\'a\':3={\'a\':0,\'b\':0};m}$$(e).M(6(4){2 1=4.L(\'1\');k(1){2 5=f h.N(1,9.7);2 n=1.O(\'8\',\'a\',\'b\');1.l(3);4.Q({C:6(){2 c=4.K();k(c.J(\'d\')==\'p\')c.o(\'d\',\'E\');5.e.o(\'d\',\'p\');5.D(n)},F:6(){5.G();1.l(3)}})}}.I(9))}});g.H(f P);',53,53,'|ul|var|reset|li|fx|function|options|width|this|height|opacity|parent|overflow|element|new|YOODropdownMenu|Fx|mode|case|if|setStyles|break|styles|setStyle|hidden|Class|false|600|switch|initialize|Transitions|default|setOptions|duration|wait|linear|transition|mouseenter|start|visible|mouseleave|stop|implement|bind|getStyle|getParent|getElement|each|Styles|getStyles|Options|addEvents'.split('|'),0,{}))
/* (C) 2008 YOOtheme.com */

var YOOTools = {
		
	start: function() {
		
		/* Set Background */
		var now    = new Date();
		var hours  = now.getHours();
		var day    = '';
		var suffix = '';
		
		if (window.getHeight() < 800) {
			suffix = '-small';
		}
		
		if (hours >= 10 && hours < 17) {
			$('page').addClass('noon noon' + suffix);
			day = 'noon';
		} else if (hours >= 17 && hours < 22) {
			$('page').addClass('evening evening' + suffix);
			day = 'evening';
		} else if (hours >= 22 || hours < 5) {
			$('page').addClass('night night' + suffix);
			day = 'night';
		} else if (hours >= 5 && hours < 10) {
			$('page').addClass('morning morning' + suffix);
			day = 'morning';
		}

		/* Match height of div tags */
		YOOTools.setDivHeight();

		/* Accordion menu */
		new YOOAccordionMenu('div#middle ul.menu li.toggler', 'ul.accordion', { accordion: 'slide' });

		/* Fancy menu */
		new YOOFancyMenu($E('ul', 'menu'), { mode: 'move', transition: Fx.Transitions.Expo.easeOut, duration: 700 });

		/* Dropdown menu */
		new YOODropdownMenu('div#menu li.parent', { mode: 'height', transition: Fx.Transitions.Expo.easeOut });

		/* Morph: main menu (tab) */
		var enterColor = '#ffffaa';
		var leaveColor = '#ffffff';

		var menuEnter = { 'color': enterColor };
		var menuLeave = { 'color': leaveColor };

		new YOOMorph('div#menu li.level1', menuEnter, menuLeave,
			{ transition: Fx.Transitions.linear, duration: 300 },
			{ transition: Fx.Transitions.sineIn, duration: 700 }, '.level1');
					
		var enterColor = '#ffdc6e';
		var leaveColor = '#ffffff';

		var menuEnter = { 'color': enterColor };
		var menuLeave = { 'color': leaveColor };

		new YOOMorph('div#menu li.level1', menuEnter, menuLeave,
			{ transition: Fx.Transitions.linear, duration: 300 },
			{ transition: Fx.Transitions.sineIn, duration: 700 }, 'span.sub');

		/* Morph: main menu (drop down) */
		switch (day) {
			case "evening":		var enterColor = '#08192f';
								var leaveColor = '#11325f';
								break;
								
			case "night":		var enterColor = '#10171b';
								var leaveColor = '#212e36';
								break;
								
			case "morning":		var enterColor = '#0c182b';
								var leaveColor = '#193157';
								break;
			
			case "noon":
			default: 			var enterColor = '#152b56';
					 			var leaveColor = '#193775';
		  }

		var menuEnter = { 'background-color': enterColor };
		var menuLeave = { 'background-color': leaveColor };
		
		new YOOMorph('div#menu li.level2 a, div#menu li.level2 span.separator', menuEnter, menuLeave,
			{ transition: Fx.Transitions.linear, duration: 100 },
			{ transition: Fx.Transitions.sineIn, duration: 700 });

		var enterColor = '#ffffaa';
		var leaveColor = '#ffffff';

		var menuEnter = { 'color': enterColor };
		var menuLeave = { 'color': leaveColor };
		
		new YOOMorph('div#menu li.level2 a, div#menu li.level2 span.separator', menuEnter, menuLeave,
			{ transition: Fx.Transitions.linear, duration: 100 },
			{ transition: Fx.Transitions.sineIn, duration: 700 });

		/* Morph: sub menu */
		var enterColor = '#000000';
		var leaveColor = '#646464';
		
		var submenuEnter = { 'color': enterColor};
		var submenuLeave = { 'color': leaveColor};

		new YOOMorph('div#middle ul.menu a, div#middle ul.menu span.separator', submenuEnter, submenuLeave,
			{ transition: Fx.Transitions.expoOut, duration: 100, ignoreClass: 'current' },
			{ transition: Fx.Transitions.sineIn, duration: 700 });

		/* Style switcher */
		new YOOStyleSwitcher($ES('.wrapper'), { 
			widthDefault: YtSettings.widthDefault,
			widthThinPx: YtSettings.widthThinPx,
			widthWidePx: YtSettings.widthWidePx,
			widthFluidPx: YtSettings.widthFluidPx,
			afterSwitch: YOOTools.setDivHeight,
			transition: Fx.Transitions.expoOut,
			duration: 500
		});		
		
		/* Smoothscroll */
		new SmoothScroll({ duration: 500, transition: Fx.Transitions.Expo.easeOut });
	},

	/* Include script */
	include: function(library) {
		$ES('script').each(function(s, i){
			var src  = s.getProperty('src');
			var path = '';
			if (src && src.match(/yoo_tools\.js(\?.*)?$/)) path = src.replace(/yoo_tools\.js(\?.*)?$/,'');
			if (src && src.match(/template\.js\.php(\?.*)?$/)) path = src.replace(/template\.js\.php(\?.*)?$/,'');
			if (path != '') document.write('<script language="javascript" src="' + path + library + '" type="text/javascript"></script>');
		});
	},

	/* Match height of div tags */
	setDivHeight: function() {
		YOOBase.matchDivHeight('div.topbox div.deepest', 0, 40);
		YOOBase.matchDivHeight('div.bottombox div.deepest', 0, 40);
		YOOBase.matchDivHeight('div.maintopbox div.deepest', 0, 40);
		YOOBase.matchDivHeight('div.mainbottombox div.deepest', 0, 40);
		YOOBase.matchDivHeight('div.contenttopbox div.deepest', 0, 40);
		YOOBase.matchDivHeight('div.contentbottombox div.deepest', 0, 40);
	}

};

/* Add functions on window load */
window.addEvent('domready', YOOTools.start);

/* Load IE6 fix */
if (window.ie6) {
	YOOTools.include('addons/ie6fix.js');
	YOOTools.include('yoo_ie6fix.js');
}
