/**
 * jGrowl 1.1.2
 *
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Written by Stan Lemon <stanlemon@mac.com>
 * Last updated: 2008.08.17
 */
;(function($){$.jGrowl=function(m,o){if($("#jGrowl").size()==0){$("<div id=\"jGrowl\"></div>").addClass($.jGrowl.defaults.position).appendTo("body");}
$("#jGrowl").jGrowl(m,o);};$.fn.jGrowl=function(m,o){if($.isFunction(this.each)){var _6=arguments;return this.each(function(){var _7=this;if($(this).data("jGrowl.instance")==undefined){$(this).data("jGrowl.instance",new $.fn.jGrowl());$(this).data("jGrowl.instance").startup(this);}
if($.isFunction($(this).data("jGrowl.instance")[m])){$(this).data("jGrowl.instance")[m].apply($(this).data("jGrowl.instance"),$.makeArray(_6).slice(1));}else{$(this).data("jGrowl.instance").notification(m,o);}});}};$.extend($.fn.jGrowl.prototype,{defaults:{header:"",sticky:false,position:"top-right",glue:"after",theme:"default",corners:"10px",check:500,life:3000,speed:"normal",easing:"swing",closer:true,closerTemplate:"<div>[ close all ]</div>",log:function(e,m,o){},beforeOpen:function(e,m,o){},open:function(e,m,o){},beforeClose:function(e,m,o){},close:function(e,m,o){},animateOpen:{opacity:"show"},animateClose:{opacity:"hide"}},element:null,interval:null,notification:function(_17,o){var _19=this;var o=$.extend({},this.defaults,o);o.log.apply(this.element,[this.element,_17,o]);var _1a=$("<div class=\"jGrowl-notification\"><div class=\"close\">&times;</div><div class=\"header\">"+o.header+"</div><div class=\"message\">"+_17+"</div></div>").data("jGrowl",o).addClass(o.theme).children("div.close").bind("click.jGrowl",function(){$(this).unbind("click.jGrowl").parent().trigger("jGrowl.beforeClose").animate(o.animateClose,o.speed,o.easing,function(){$(this).trigger("jGrowl.close").remove();});}).parent();(o.glue=="after")?$("div.jGrowl-notification:last",this.element).after(_1a):$("div.jGrowl-notification:first",this.element).before(_1a);$(_1a).bind("mouseover.jGrowl",function(){$(this).data("jGrowl").pause=true;}).bind("mouseout.jGrowl",function(){$(this).data("jGrowl").pause=false;}).bind("jGrowl.beforeOpen",function(){o.beforeOpen.apply(_19.element,[_19.element,_17,o]);}).bind("jGrowl.open",function(){o.open.apply(_19.element,[_19.element,_17,o]);}).bind("jGrowl.beforeClose",function(){o.beforeClose.apply(_19.element,[_19.element,_17,o]);}).bind("jGrowl.close",function(){o.close.apply(_19.element,[_19.element,_17,o]);}).trigger("jGrowl.beforeOpen").animate(o.animateOpen,o.speed,o.easing,function(){$(this).data("jGrowl").created=new Date();}).trigger("jGrowl.open");if($.fn.corner!=undefined){$(_1a).corner(o.corners);}
if($("div.jGrowl-notification:parent",this.element).size()>1&&$("div.jGrowl-closer",this.element).size()==0&&this.defaults.closer!=false){$(this.defaults.closerTemplate).addClass("jGrowl-closer").addClass(this.defaults.theme).appendTo(this.element).animate(this.defaults.animateOpen,this.defaults.speed,this.defaults.easing).bind("click.jGrowl",function(){$(this).siblings().children("div.close").trigger("click.jGrowl");if($.isFunction(_19.defaults.closer)){_19.defaults.closer.apply($(this).parent()[0],[$(this).parent()[0]]);}});}},update:function(){$(this.element).find("div.jGrowl-notification:parent").each(function(){if($(this).data("jGrowl")!=undefined&&$(this).data("jGrowl").created!=undefined&&($(this).data("jGrowl").created.getTime()+$(this).data("jGrowl").life)<(new Date()).getTime()&&$(this).data("jGrowl").sticky!=true&&($(this).data("jGrowl").pause==undefined||$(this).data("jGrowl").pause!=true)){$(this).children("div.close").trigger("click.jGrowl");}});if($(this.element).find("div.jGrowl-notification:parent").size()<2){$(this.element).find("div.jGrowl-closer").animate(this.defaults.animateClose,this.defaults.speed,this.defaults.easing,function(){$(this).remove();});}},startup:function(e){this.element=$(e).addClass("jGrowl").append("<div class=\"jGrowl-notification\"></div>");this.interval=setInterval(function(){jQuery(e).data("jGrowl.instance").update();},this.defaults.check);if($.browser.msie&&parseInt($.browser.version)<7){$(this.element).addClass("ie6");}},shutdown:function(){$(this.element).removeClass("jGrowl").find("div.jGrowl-notification").remove();clearInterval(this.interval);}});$.jGrowl.defaults=$.fn.jGrowl.prototype.defaults;})(jQuery);


/**
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* 
* hoverIntent is currently available for use in all personal or commercial 
* projects under both MIT and GPL licenses. This means that you can choose 
* the license that best suits your project, and use it accordingly.
*
* @author    Brian Cherne <brian@cherne.net>
*/
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}
if(p==this){return false;}
var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}
if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);


/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * $LastChangedDate: 2007-06-19 20:25:28 -0500 (Tue, 19 Jun 2007) $
 * $Rev: 2111 $
 *
 * Version 2.1
 */
(function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie&&parseInt($.browser.version)<=6){s=$.extend({top:'auto',left:'auto',width:'auto',height:'auto',opacity:true,src:'javascript:false;'},s||{});var prop=function(n){return n&&n.constructor==Number?n+'px':n;},html='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+'style="display:block;position:absolute;z-index:-1;'+(s.opacity!==false?'filter:Alpha(Opacity=\'0\');':'')+'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+'"/>';return this.each(function(){if($('> iframe.bgiframe',this).length==0)this.insertBefore(document.createElement(html),this.firstChild);});}return this;};if(!$.browser.version)$.browser.version=navigator.userAgent.toLowerCase().match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)[1];})(jQuery);


/*
 * Superfish v1.4.8 - jQuery menu widget
 * Copyright (c) 2008 Joel Birch
 *
 * Dual licensed under the MIT and GPL licenses:
 * 	http://www.opensource.org/licenses/mit-license.php
 * 	http://www.gnu.org/licenses/gpl.html
 */
;(function($){$.fn.superfish=function(op){var sf=$.fn.superfish,c=sf.c,$arrow=$(['<span class="',c.arrowClass,'"> &#187;</span>'].join('')),over=function(){var $$=$(this),menu=getMenu($$);clearTimeout(menu.sfTimer);$$.showSuperfishUl().siblings().hideSuperfishUl();},out=function(){var $$=$(this),menu=getMenu($$),o=sf.op;clearTimeout(menu.sfTimer);menu.sfTimer=setTimeout(function(){o.retainPath=($.inArray($$[0],o.$path)>-1);$$.hideSuperfishUl();if(o.$path.length&&$$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);}},o.delay);},getMenu=function($menu){var menu=$menu.parents(['ul.',c.menuClass,':first'].join(''))[0];sf.op=sf.o[menu.serial];return menu;},addArrow=function($a){$a.addClass(c.anchorClass).append($arrow.clone());};return this.each(function(){var s=this.serial=sf.o.length;var o=$.extend({},sf.defaults,op);o.$path=$('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){$(this).addClass([o.hoverClass,c.bcClass].join(' ')).filter('li:has(ul)').removeClass(o.pathClass);});sf.o[s]=sf.op=o;$('li:has(ul)',this)[($.fn.hoverIntent&&!o.disableHI)?'hoverIntent':'hover'](over,out).each(function(){if(o.autoArrows)addArrow($('>a:first-child',this));}).not('.'+c.bcClass).hideSuperfishUl();var $a=$('a',this);$a.each(function(i){var $li=$a.eq(i).parents('li');$a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);});});o.onInit.call(this);}).each(function(){var menuClasses=[c.menuClass];if(sf.op.dropShadows&&!($.browser.msie&&$.browser.version<7))menuClasses.push(c.shadowClass);$(this).addClass(menuClasses.join(' '));});};var sf=$.fn.superfish;sf.o=[];sf.op={};sf.IE7fix=function(){var o=sf.op;if($.browser.msie&&$.browser.version>6&&o.dropShadows&&o.animation.opacity!=undefined)
this.toggleClass(sf.c.shadowClass+'-off');};sf.c={bcClass:'sf-breadcrumb',menuClass:'sf-js-enabled',anchorClass:'sf-with-ul',arrowClass:'sf-sub-indicator',shadowClass:'sf-shadow'};sf.defaults={hoverClass:'sfHover',pathClass:'overideThisToUse',pathLevels:1,delay:800,animation:{opacity:'show'},speed:'normal',autoArrows:true,dropShadows:true,disableHI:false,onInit:function(){},onBeforeShow:function(){},onShow:function(){},onHide:function(){}};$.fn.extend({hideSuperfishUl:function(){var o=sf.op,not=(o.retainPath===true)?o.$path:'';o.retainPath=false;var $ul=$(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass).find('>ul').hide().css('visibility','hidden');o.onHide.call($ul);return this;},showSuperfishUl:function(){var o=sf.op,sh=sf.c.shadowClass+'-off',$ul=this.addClass(o.hoverClass).find('>ul:hidden').css('visibility','visible');sf.IE7fix.call($ul);o.onBeforeShow.call($ul);$ul.animate(o.animation,o.speed,function(){sf.IE7fix.call($ul);o.onShow.call($ul);});return this;}});})(jQuery);


/*
 * simplyScroll 1.0.3 - a scroll-tastic jQuery plugin
 *
 * http://logicbox.net/jquery/simplyscroll
 * http://logicbox.net/blog/simplyscroll-jquery-plugin
 * http://plugins.jquery.com/project/simplyScroll
 *
 * Copyright (c) 2009 Will Kelly - http://logicbox.net
 *
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * Last revised: 21/02/2009 00:34
 */
(function($){$.fn.simplyScroll=function(o){return this.each(function(){new $.simplyScroll(this,o);});};var defaults={className:'simply-scroll',frameRate:24,speed:1,horizontal:true,autoMode:'off',loopOverload:0,pauseOnHover:true,localJsonSource:'',flickrFeed:'',jsonImgWidth:240,jsonImgHeight:180};$.simplyScroll=function(el,o){var self=this;this.o=$.extend({},defaults,o||{});this.auto=this.o.autoMode!=="off"?true:false;this.$list=$(el);this.$list.addClass('simply-scroll-list').wrap('<div class="simply-scroll-clip"></div>').parent().wrap('<div class="'+this.o.className+' simply-scroll-container"></div>');if(!this.o.auto){this.$list.parent().parent().prepend('<div class="simply-scroll-forward"></div>').prepend('<div class="simply-scroll-back"></div>');}
if(this.o.flickrFeed){$.getJSON(this.o.flickrFeed+"&format=json&jsoncallback=?",function(data){json=[];$.each(data.items,function(i,item){json.push({"src":item.media.m,"title":item.title,"link":item.link});});self.renderData(json);});}else if(this.o.localJsonSource){$.getJSON(this.o.localJsonSource,function(json){self.renderData(json);});}else{$(window).load(function(){self.init();});}};$.simplyScroll.fn=$.simplyScroll.prototype={};$.simplyScroll.fn.extend=$.simplyScroll.extend=$.extend;$.simplyScroll.fn.extend({init:function(){this.$items=this.$list.children();this.$clip=this.$list.parent();this.$container=this.$clip.parent();if(!this.o.horizontal){this.itemMax=this.$items.eq(0).height();this.clipMax=this.$clip.height();this.dimension='height';this.moveBackClass='simply-scroll-btn-up';this.moveForwardClass='simply-scroll-btn-down';}else{this.itemMax=this.$items.eq(0).width();this.clipMax=this.$clip.width();this.dimension='width';this.moveBackClass='simply-scroll-btn-left';this.moveForwardClass='simply-scroll-btn-right';}
this.posMin=0;this.posMax=this.$items.length*this.itemMax;this.$list.css(this.dimension,this.posMax+'px');if(this.o.autoMode=='loop'){var addItems=Math.ceil(this.clipMax/this.itemMax)+this.o.loopOverload;this.$items.slice(0,addItems).clone(true).appendTo(this.$list);this.posMax+=(this.clipMax-this.o.speed);this.$list.css(this.dimension,this.posMax+(this.itemMax*addItems)+'px');}
this.interval=null;this.intervalDelay=Math.floor(1000/this.o.frameRate);while(this.itemMax%this.o.speed!==0){this.o.speed--;if(this.o.speed===0){this.o.speed=1;break;}}
var self=this;this.trigger=null;this.funcMoveBack=function(){self.trigger=this;self.moveBack();};this.funcMoveForward=function(){self.trigger=this;self.moveForward();};this.funcMoveStop=function(){self.moveStop();};this.funcMoveResume=function(){self.moveResume();};if(this.auto){if(this.o.pauseOnHover){this.$clip.hover(this.funcMoveStop,this.funcMoveResume);}
this.moveForward();}else{this.$btnBack=$('.simply-scroll-back',this.$container).addClass('simply-scroll-btn'+' '+this.moveBackClass+' '+'disabled').hover(this.funcMoveBack,this.funcMoveStop);this.$btnForward=$('.simply-scroll-forward',this.$container).addClass('simply-scroll-btn'+' '+this.moveForwardClass).hover(this.funcMoveForward,this.funcMoveStop);}},moveForward:function(){var self=this;this.movement='forward';if(this.trigger!==null){this.$btnBack.removeClass('disabled');}
self.interval=setInterval(function(){if(!self.o.horizontal&&self.$clip[0].scrollTop<(self.posMax-self.clipMax)){self.$clip[0].scrollTop+=self.o.speed;}else if(self.o.horizontal&&self.$clip[0].scrollLeft<(self.posMax-self.clipMax)){self.$clip[0].scrollLeft+=self.o.speed;}else if(self.o.autoMode=='loop'){self.resetPos();}else{self.moveStop(self.movement);}},self.intervalDelay);},moveBack:function(){var self=this;this.movement='back';if(this.trigger!==null){this.$btnForward.removeClass('disabled');}
self.interval=setInterval(function(){if(!self.o.horizontal&&self.$clip[0].scrollTop>0){self.$clip[0].scrollTop-=self.o.speed;}else if(self.o.horizontal&&self.$clip[0].scrollLeft>0){self.$clip[0].scrollLeft-=self.o.speed;}else if(self.o.autoMode=='loop'){self.resetPos();}else{self.moveStop(self.movement);}},self.intervalDelay);},moveStop:function(moveDir){clearInterval(this.interval);if(this.trigger!==null){if(typeof moveDir!="undefined"){$(this.trigger).addClass('disabled');}
this.trigger=null;}
if(this.auto){if(this.o.autoMode=='bounce'){moveDir=='forward'?this.moveBack():this.moveForward();}}},moveResume:function(){this.movement=='forward'?this.moveForward():this.moveBack();},resetPos:function(){if(!this.o.horizontal){this.$clip[0].scrollTop=0;}else{this.$clip[0].scrollLeft=0;}},renderData:function(json){if(json.length>0){var self=this;$.each(json,function(i,item){$("<img/>").attr({src:item.src,title:item.title,alt:item.title,width:self.o.jsonImgWidth,height:self.o.jsonImgHeight}).appendTo(self.$list);});this.init();}}});})(jQuery);


;(function($) {


	$.repeater = {
		defaults: {
			limit: 0,
			formFields: 'input.append-item, select.append-item, button.append-item, textarea.append-item'
		}
	};

	$.fn.repeater = function(options) {
		var opts = $.extend($.repeater.defaults, options);
		var count = 0;
		return this.each(function() {
			++count;
			var $item = $(this);
			$(opts.formFields, this)
				.focus(function(e) {
					if (opts.limit == 0 || count < opts.limit) {
						var $clone = $item.clone(true);
						$(opts.formFields, $clone).val('');
						$item.after($clone);
						$item = $clone;
						++count;
					}
				});
		});
	}

	$.fn.slideshow = function() {
		return this.each(function() {
			$(this).css({ position: 'relative' });
			$('li', this)
				.hide();
			$('li:first', this)
				.show();
			var list = this;
			setInterval(function() {
				var current = $('li:visible', list);
				current.fadeOut('fast', function()
				{
					var next = current.next();
					if (next.length > 0)
						next.fadeIn('slow');
					else
						$('li:first', list).fadeIn('slow');
				});
			}, 5000);
		});
	}

})(jQuery);


;(function($) {

	$.yoando = {};
	
	$.fn.yoandoCalendar = function() {
		return this.each(function() {
			var $elm = $(this);
			var $selected = $('span.selected', $elm);
			var $months = $('ul.months', $elm);
			var todayUrl = $('ul.dropdown', this)[0].onkeypress().today;
			$('ul.months li', $elm)
				.click(function() {
					$selected.text($(this).text());
					var month = $(this)[0].onkeypress();
					var $days = $('ul.days li', $elm).show();
					if ($days.length < month.daysInMonth) {
						for (var i = $days.length + 1, count = month.daysInMonth; i <= count; ++i) {
							var $item = $($days[0]).clone(true);
							$('a', $item).text(i);
							$('ul.days', $elm).append($item);
						}
						$days = $('ul.days li', $elm);
					}
					$days.removeClass('current')
						.each(function(index) {
							index = (index + 1).toString();
							if (1 == index.length)
								index = '0' + index;
							var href = month.baseUrl + index;
							$('a', this).attr('href', href);
							if (href == todayUrl)
								$(this).toggleClass('current');
						});
					for (var i = month.daysInMonth; i < $days.length; ++i)
						$($days[i]).hide();
					$months.hide();
				});
		});
	}

	$(function() {
		$('label.cue').each(function(index, elm) {
			$('#' + $(elm).attr('for'))
				.blur(function(e) {
					if ('' == e.target.value)
						e.target.value = elm.innerHTML;
				})
				.focus(function(e) {
					if (elm.innerHTML == e.target.value)
						e.target.value = '';
				})
				.blur();
		});

		$('#menu .menu').superfish({ speed: 'fast' }).find('ul').bgIframe();
		$('#infobar .event-blocks-events-calendar > ul.dropdown').superfish({ speed: 'fast' }).find('ul').bgIframe();
		$('#infobar .event-blocks-events-calendar').yoandoCalendar();
		$('#infobar .stock-blocks-symbols > ul').simplyScroll({ autoMode: 'loop' });
		$('#top2 .content-blocks-latest-articles > ul').slideshow();
	});

})(jQuery);

