/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */

/**
 * Create a cookie with the given name and value and other optional parameters.
 *
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Set the value of a cookie.
 * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
 * @desc Create a cookie with all available options.
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Create a session cookie.
 * @example $.cookie('the_cookie', null);
 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
 *       used when the cookie was set.
 *
 * @param String name The name of the cookie.
 * @param String value The value of the cookie.
 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
 *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
 *                             If set to null or omitted, the cookie will be a session cookie and will not be retained
 *                             when the the browser exits.
 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
 *                        require a secure protocol (like HTTPS).
 * @type undefined
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */

/**
 * Get the value of a cookie with the given name.
 *
 * @example $.cookie('the_cookie');
 * @desc Get the value of a cookie.
 *
 * @param String name The name of the cookie.
 * @return The value of the cookie.
 * @type String
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};


/*
 * FancyBox - jQuery Plugin
 * Simple and fancy lightbox alternative
 *
 * Examples and documentation at: http://fancybox.net
 * 
 * Copyright (c) 2008 - 2010 Janis Skarnelis
 *
 * Version: 1.3.1 (05/03/2010)
 * Requires: jQuery v1.3+
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */

(function(b){var m,u,x,g,D,i,z,A,B,p=0,e={},q=[],n=0,c={},j=[],E=null,s=new Image,G=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,S=/[^\.]\.(swf)\s*$/i,H,I=1,k,l,h=false,y=b.extend(b("<div/>")[0],{prop:0}),v=0,O=!b.support.opacity&&!window.XMLHttpRequest,J=function(){u.hide();s.onerror=s.onload=null;E&&E.abort();m.empty()},P=function(){b.fancybox('<p id="fancybox_error">The requested content cannot be loaded.<br />Please try again later.</p>',{scrolling:"no",padding:20,transitionIn:"none",transitionOut:"none"})},
K=function(){return[b(window).width(),b(window).height(),b(document).scrollLeft(),b(document).scrollTop()]},T=function(){var a=K(),d={},f=c.margin,o=c.autoScale,t=(20+f)*2,w=(20+f)*2,r=c.padding*2;if(c.width.toString().indexOf("%")>-1){d.width=a[0]*parseFloat(c.width)/100-40;o=false}else d.width=c.width+r;if(c.height.toString().indexOf("%")>-1){d.height=a[1]*parseFloat(c.height)/100-40;o=false}else d.height=c.height+r;if(o&&(d.width>a[0]-t||d.height>a[1]-w))if(e.type=="image"||e.type=="swf"){t+=r;
w+=r;o=Math.min(Math.min(a[0]-t,c.width)/c.width,Math.min(a[1]-w,c.height)/c.height);d.width=Math.round(o*(d.width-r))+r;d.height=Math.round(o*(d.height-r))+r}else{d.width=Math.min(d.width,a[0]-t);d.height=Math.min(d.height,a[1]-w)}d.top=a[3]+(a[1]-(d.height+40))*0.5;d.left=a[2]+(a[0]-(d.width+40))*0.5;if(c.autoScale===false){d.top=Math.max(a[3]+f,d.top);d.left=Math.max(a[2]+f,d.left)}return d},U=function(a){if(a&&a.length)switch(c.titlePosition){case "inside":return a;case "over":return'<span id="fancybox-title-over">'+
a+"</span>";default:return'<span id="fancybox-title-wrap"><span id="fancybox-title-left"></span><span id="fancybox-title-main">'+a+'</span><span id="fancybox-title-right"></span></span>'}return false},V=function(){var a=c.title,d=l.width-c.padding*2,f="fancybox-title-"+c.titlePosition;b("#fancybox-title").remove();v=0;if(c.titleShow!==false){a=b.isFunction(c.titleFormat)?c.titleFormat(a,j,n,c):U(a);if(!(!a||a==="")){b('<div id="fancybox-title" class="'+f+'" />').css({width:d,paddingLeft:c.padding,
paddingRight:c.padding}).html(a).appendTo("body");switch(c.titlePosition){case "inside":v=b("#fancybox-title").outerHeight(true)-c.padding;l.height+=v;break;case "over":b("#fancybox-title").css("bottom",c.padding);break;default:b("#fancybox-title").css("bottom",b("#fancybox-title").outerHeight(true)*-1);break}b("#fancybox-title").appendTo(D).hide()}}},W=function(){b(document).unbind("keydown.fb").bind("keydown.fb",function(a){if(a.keyCode==27&&c.enableEscapeButton){a.preventDefault();b.fancybox.close()}else if(a.keyCode==
37){a.preventDefault();b.fancybox.prev()}else if(a.keyCode==39){a.preventDefault();b.fancybox.next()}});if(b.fn.mousewheel){g.unbind("mousewheel.fb");j.length>1&&g.bind("mousewheel.fb",function(a,d){a.preventDefault();h||d===0||(d>0?b.fancybox.prev():b.fancybox.next())})}if(c.showNavArrows){if(c.cyclic&&j.length>1||n!==0)A.show();if(c.cyclic&&j.length>1||n!=j.length-1)B.show()}},X=function(){var a,d;if(j.length-1>n){a=j[n+1].href;if(typeof a!=="undefined"&&a.match(G)){d=new Image;d.src=a}}if(n>0){a=
j[n-1].href;if(typeof a!=="undefined"&&a.match(G)){d=new Image;d.src=a}}},L=function(){i.css("overflow",c.scrolling=="auto"?c.type=="image"||c.type=="iframe"||c.type=="swf"?"hidden":"auto":c.scrolling=="yes"?"auto":"visible");if(!b.support.opacity){i.get(0).style.removeAttribute("filter");g.get(0).style.removeAttribute("filter")}b("#fancybox-title").show();c.hideOnContentClick&&i.one("click",b.fancybox.close);c.hideOnOverlayClick&&x.one("click",b.fancybox.close);c.showCloseButton&&z.show();W();b(window).bind("resize.fb",
b.fancybox.center);c.centerOnScroll?b(window).bind("scroll.fb",b.fancybox.center):b(window).unbind("scroll.fb");b.isFunction(c.onComplete)&&c.onComplete(j,n,c);h=false;X()},M=function(a){var d=Math.round(k.width+(l.width-k.width)*a),f=Math.round(k.height+(l.height-k.height)*a),o=Math.round(k.top+(l.top-k.top)*a),t=Math.round(k.left+(l.left-k.left)*a);g.css({width:d+"px",height:f+"px",top:o+"px",left:t+"px"});d=Math.max(d-c.padding*2,0);f=Math.max(f-(c.padding*2+v*a),0);i.css({width:d+"px",height:f+
"px"});if(typeof l.opacity!=="undefined")g.css("opacity",a<0.5?0.5:a)},Y=function(a){var d=a.offset();d.top+=parseFloat(a.css("paddingTop"))||0;d.left+=parseFloat(a.css("paddingLeft"))||0;d.top+=parseFloat(a.css("border-top-width"))||0;d.left+=parseFloat(a.css("border-left-width"))||0;d.width=a.width();d.height=a.height();return d},Q=function(){var a=e.orig?b(e.orig):false,d={};if(a&&a.length){a=Y(a);d={width:a.width+c.padding*2,height:a.height+c.padding*2,top:a.top-c.padding-20,left:a.left-c.padding-
20}}else{a=K();d={width:1,height:1,top:a[3]+a[1]*0.5,left:a[2]+a[0]*0.5}}return d},N=function(){u.hide();if(g.is(":visible")&&b.isFunction(c.onCleanup))if(c.onCleanup(j,n,c)===false){b.event.trigger("fancybox-cancel");h=false;return}j=q;n=p;c=e;i.get(0).scrollTop=0;i.get(0).scrollLeft=0;if(c.overlayShow){O&&b("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"});
x.css({"background-color":c.overlayColor,opacity:c.overlayOpacity}).unbind().show()}l=T();V();if(g.is(":visible")){b(z.add(A).add(B)).hide();var a=g.position(),d;k={top:a.top,left:a.left,width:g.width(),height:g.height()};d=k.width==l.width&&k.height==l.height;i.fadeOut(c.changeFade,function(){var f=function(){i.html(m.contents()).fadeIn(c.changeFade,L)};b.event.trigger("fancybox-change");i.empty().css("overflow","hidden");if(d){i.css({top:c.padding,left:c.padding,width:Math.max(l.width-c.padding*
2,1),height:Math.max(l.height-c.padding*2-v,1)});f()}else{i.css({top:c.padding,left:c.padding,width:Math.max(k.width-c.padding*2,1),height:Math.max(k.height-c.padding*2,1)});y.prop=0;b(y).animate({prop:1},{duration:c.changeSpeed,easing:c.easingChange,step:M,complete:f})}})}else{g.css("opacity",1);if(c.transitionIn=="elastic"){k=Q();i.css({top:c.padding,left:c.padding,width:Math.max(k.width-c.padding*2,1),height:Math.max(k.height-c.padding*2,1)}).html(m.contents());g.css(k).show();if(c.opacity)l.opacity=
0;y.prop=0;b(y).animate({prop:1},{duration:c.speedIn,easing:c.easingIn,step:M,complete:L})}else{i.css({top:c.padding,left:c.padding,width:Math.max(l.width-c.padding*2,1),height:Math.max(l.height-c.padding*2-v,1)}).html(m.contents());g.css(l).fadeIn(c.transitionIn=="none"?0:c.speedIn,L)}}},F=function(){m.width(e.width);m.height(e.height);if(e.width=="auto")e.width=m.width();if(e.height=="auto")e.height=m.height();N()},Z=function(){h=true;e.width=s.width;e.height=s.height;b("<img />").attr({id:"fancybox-img",
src:s.src,alt:e.title}).appendTo(m);N()},C=function(){J();var a=q[p],d,f,o,t,w;e=b.extend({},b.fn.fancybox.defaults,typeof b(a).data("fancybox")=="undefined"?e:b(a).data("fancybox"));o=a.title||b(a).title||e.title||"";if(a.nodeName&&!e.orig)e.orig=b(a).children("img:first").length?b(a).children("img:first"):b(a);if(o===""&&e.orig)o=e.orig.attr("alt");d=a.nodeName&&/^(?:javascript|#)/i.test(a.href)?e.href||null:e.href||a.href||null;if(e.type){f=e.type;if(!d)d=e.content}else if(e.content)f="html";else if(d)if(d.match(G))f=
"image";else if(d.match(S))f="swf";else if(b(a).hasClass("iframe"))f="iframe";else if(d.match(/#/)){a=d.substr(d.indexOf("#"));f=b(a).length>0?"inline":"ajax"}else f="ajax";else f="inline";e.type=f;e.href=d;e.title=o;if(e.autoDimensions&&e.type!=="iframe"&&e.type!=="swf"){e.width="auto";e.height="auto"}if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick=false;e.enableEscapeButton=false;e.showCloseButton=false}if(b.isFunction(e.onStart))if(e.onStart(q,p,e)===false){h=false;
return}m.css("padding",20+e.padding+e.margin);b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){b(this).replaceWith(i.children())});switch(f){case "html":m.html(e.content);F();break;case "inline":b('<div class="fancybox-inline-tmp" />').hide().insertBefore(b(a)).bind("fancybox-cleanup",function(){b(this).replaceWith(i.children())}).bind("fancybox-cancel",function(){b(this).replaceWith(m.children())});b(a).appendTo(m);F();break;case "image":h=false;b.fancybox.showActivity();
s=new Image;s.onerror=function(){P()};s.onload=function(){s.onerror=null;s.onload=null;Z()};s.src=d;break;case "swf":t='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+e.width+'" height="'+e.height+'"><param name="movie" value="'+d+'"></param>';w="";b.each(e.swf,function(r,R){t+='<param name="'+r+'" value="'+R+'"></param>';w+=" "+r+'="'+R+'"'});t+='<embed src="'+d+'" type="application/x-shockwave-flash" width="'+e.width+'" height="'+e.height+'"'+w+"></embed></object>";m.html(t);
F();break;case "ajax":a=d.split("#",2);f=e.ajax.data||{};if(a.length>1){d=a[0];if(typeof f=="string")f+="&selector="+a[1];else f.selector=a[1]}h=false;b.fancybox.showActivity();E=b.ajax(b.extend(e.ajax,{url:d,data:f,error:P,success:function(r){if(E.status==200){m.html(r);F()}}}));break;case "iframe":b('<iframe id="fancybox-frame" name="fancybox-frame'+(new Date).getTime()+'" frameborder="0" hspace="0" scrolling="'+e.scrolling+'" src="'+e.href+'"></iframe>').appendTo(m);N();break}},$=function(){if(u.is(":visible")){b("div",
u).css("top",I*-40+"px");I=(I+1)%12}else clearInterval(H)},aa=function(){if(!b("#fancybox-wrap").length){b("body").append(m=b('<div id="fancybox-tmp"></div>'),u=b('<div id="fancybox-loading"><div></div></div>'),x=b('<div id="fancybox-overlay"></div>'),g=b('<div id="fancybox-wrap"></div>'));if(!b.support.opacity){g.addClass("fancybox-ie");u.addClass("fancybox-ie")}D=b('<div id="fancybox-outer"></div>').append('<div class="fancy-bg" id="fancy-bg-n"></div><div class="fancy-bg" id="fancy-bg-ne"></div><div class="fancy-bg" id="fancy-bg-e"></div><div class="fancy-bg" id="fancy-bg-se"></div><div class="fancy-bg" id="fancy-bg-s"></div><div class="fancy-bg" id="fancy-bg-sw"></div><div class="fancy-bg" id="fancy-bg-w"></div><div class="fancy-bg" id="fancy-bg-nw"></div>').appendTo(g);
D.append(i=b('<div id="fancybox-inner"></div>'),z=b('<a id="fancybox-close"></a>'),A=b('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),B=b('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>'));z.click(b.fancybox.close);u.click(b.fancybox.cancel);A.click(function(a){a.preventDefault();b.fancybox.prev()});B.click(function(a){a.preventDefault();b.fancybox.next()});if(O){x.get(0).style.setExpression("height",
"document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'");u.get(0).style.setExpression("top","(-20 + (document.documentElement.clientHeight ? document.documentElement.clientHeight/2 : document.body.clientHeight/2 ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop )) + 'px'");D.prepend('<iframe id="fancybox-hide-sel-frame" src="javascript:\'\';" scrolling="no" frameborder="0" ></iframe>')}}};
b.fn.fancybox=function(a){b(this).data("fancybox",b.extend({},a,b.metadata?b(this).metadata():{})).unbind("click.fb").bind("click.fb",function(d){d.preventDefault();if(!h){h=true;b(this).blur();q=[];p=0;d=b(this).attr("rel")||"";if(!d||d==""||d==="nofollow")q.push(this);else{q=b("a[rel="+d+"], area[rel="+d+"]");p=q.index(this)}C();return false}});return this};b.fancybox=function(a,d){if(!h){h=true;d=typeof d!=="undefined"?d:{};q=[];p=d.index||0;if(b.isArray(a)){for(var f=0,o=a.length;f<o;f++)if(typeof a[f]==
"object")b(a[f]).data("fancybox",b.extend({},d,a[f]));else a[f]=b({}).data("fancybox",b.extend({content:a[f]},d));q=jQuery.merge(q,a)}else{if(typeof a=="object")b(a).data("fancybox",b.extend({},d,a));else a=b({}).data("fancybox",b.extend({content:a},d));q.push(a)}if(p>q.length||p<0)p=0;C()}};b.fancybox.showActivity=function(){clearInterval(H);u.show();H=setInterval($,66)};b.fancybox.hideActivity=function(){u.hide()};b.fancybox.next=function(){return b.fancybox.pos(n+1)};b.fancybox.prev=function(){return b.fancybox.pos(n-
1)};b.fancybox.pos=function(a){if(!h){a=parseInt(a,10);if(a>-1&&j.length>a){p=a;C()}if(c.cyclic&&j.length>1&&a<0){p=j.length-1;C()}if(c.cyclic&&j.length>1&&a>=j.length){p=0;C()}}};b.fancybox.cancel=function(){if(!h){h=true;b.event.trigger("fancybox-cancel");J();e&&b.isFunction(e.onCancel)&&e.onCancel(q,p,e);h=false}};b.fancybox.close=function(){function a(){x.fadeOut("fast");g.hide();b.event.trigger("fancybox-cleanup");i.empty();b.isFunction(c.onClosed)&&c.onClosed(j,n,c);j=e=[];n=p=0;c=e={};h=false}
if(!(h||g.is(":hidden"))){h=true;if(c&&b.isFunction(c.onCleanup))if(c.onCleanup(j,n,c)===false){h=false;return}J();b(z.add(A).add(B)).hide();b("#fancybox-title").remove();g.add(i).add(x).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");i.css("overflow","hidden");if(c.transitionOut=="elastic"){k=Q();var d=g.position();l={top:d.top,left:d.left,width:g.width(),height:g.height()};if(c.opacity)l.opacity=1;y.prop=1;b(y).animate({prop:0},{duration:c.speedOut,easing:c.easingOut,
step:M,complete:a})}else g.fadeOut(c.transitionOut=="none"?0:c.speedOut,a)}};b.fancybox.resize=function(){var a,d;if(!(h||g.is(":hidden"))){h=true;a=i.wrapInner("<div style='overflow:auto'></div>").children();d=a.height();g.css({height:d+c.padding*2+v});i.css({height:d});a.replaceWith(a.children());b.fancybox.center()}};b.fancybox.center=function(){h=true;var a=K(),d=c.margin,f={};f.top=a[3]+(a[1]-(g.height()-v+40))*0.5;f.left=a[2]+(a[0]-(g.width()+40))*0.5;f.top=Math.max(a[3]+d,f.top);f.left=Math.max(a[2]+
d,f.left);g.css(f);h=false};b.fn.fancybox.defaults={padding:10,margin:20,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.3,overlayColor:"#666",titleShow:true,titlePosition:"outside",titleFormat:null,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",
easingIn:"swing",easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,onStart:null,onCancel:null,onComplete:null,onCleanup:null,onClosed:null};b(document).ready(function(){aa()})})(jQuery);

/**
 * sfCalendar
 *
 * @version: 1.5
 * @author SimpleFlame http://www.simpleflame.com/
 *
 * Required settings:
 *  display   - provide number of items displayed at once
 *
 * Other settings:
 *  label       - calendar heading 
 *  months      - labels for month names
 *  monthsShort - shortname labels for month names
 *  days        - labels for day names
 *  daysShort   - shortname labels for day names
 *  cityFilter  - should a dropdown with cities be visible
 */ 
(function($){

	var sfCalendar = function(el){
		this.$root = $(el);

		this.settings = {
			'label' : 'Events List',
			'months' : ['January','February','March','April','May','June','July','August','September','October','November','December'],
			'monthsShort' : ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
			'days' : ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],
			'daysShort' : ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],
			'defaultView' : 'today'
		};

		var options = arguments[1] || {};
		this.settings = $.extend(this.settings, options);

		this.items = this.parseData();

		this.structure();
		this.listing();
		this.calendar( );

		this.navigation();	

		if (this.settings.cityFilter === true) {
			this.cityFilter();
		}
		
		this.tagsList();
		
		this.init();
	};

	/*
	 * In order to compare dates we have to make sure that values match to to the millisecond,
	 * so every date has to be normalized.
	 * You can pass true as the second parameter to set to the end of the day
	 */
	sfCalendar.prototype.normalizeDate = function(date){
		if (!arguments[1]) {
			date.setHours(0);
			date.setMinutes(0);
			date.setSeconds(0);					
			date.setMilliseconds(0);		
		}
		else { //end of the day
			date.setHours(23);
			date.setMinutes(59);			
			date.setSeconds(59);			
			date.setMilliseconds(999);						
		}
		return date;
	};

	/*
	 * General structure of calendar listing
	 */
	sfCalendar.prototype.structure = function(){
		//custom main wrapper provided by user
		if (this.settings.mainWrapper) {
			this.$main = $(this.settings.mainWrapper);
		}
		else {
			this.$main = $('<div class="main"/>');	
			this.$root.append(this.$main);			
		}		

		this.$period = $('<h3 />');		
		this.$events = $('<div class="wrapper"/>');		
		if (this.settings.label) {
			this.$main.append('<h2>'+this.settings.label+'</h2>');
		}

		this.$main.append(this.$period, this.$events);
		
		//custom aside wrapper provided by user
		if (this.settings.asideWrapper) {
			this.$aside = $(this.settings.asideWrapper);
		}
		else {
			this.$aside = $('<div class="aside"/>');	
			this.$root.append(this.$aside);
		}
	};

	/*
	 * Explodes a comma separated string into an array of trimmed strings
	 */
	sfCalendar.prototype.parseTags = function(str){
		var tags = str.split(',');
		return $.map(tags,function(tag){
			tag = $.trim(tag); //removes whitespace
			return tag ? tag : null; //removes empty tags
		});
	};

	/*
	 * Reads events data from html
	 */
	sfCalendar.prototype.parseData = function(){
		var 
			items = [],
			self = this,
			tags = [],
			cities = [];

		var monthIndexes = {};	
		$.each(this.settings.monthsShort,function(index, item){
			monthIndexes[item] = index;
		});	

		this.$root.find('.data .item').each(function(eventIndex, item){


			var 
				location = $.trim($(this).find('.location').text()),
				itemTags = self.parseTags($(this).find('.tags').text()),
				description = $(this).find('.description').html(),
				time = $(this).find('.time').html(),
				title = $(this).find('.title').html(),
				thumb = $(this).find('.thumb').html(),
				city = $.trim($(this).find('.city').html()),
				locationDescription = $(this).find('.locationDescription').html(),
				regForm = $(this).find('.registration-form').html();
                                FreeForm = $(this).find('.freecall-form').html();

			//append item tags to global array
			$.each(itemTags, function(index, item){
				if ($.inArray(item, tags) === -1) {
					tags[tags.length] = item;					
				}
			});
			
			if (city && $.inArray(city, cities) === -1) {
				cities[cities.length] = city;
			}

			var startDateArr = $(this).find('.date .start').text().split('-');
			var startDate = new Date();			
			startDate.setFullYear(startDateArr[2], monthIndexes[startDateArr[1]], startDateArr[0]);
			startDate = self.normalizeDate(startDate);

			var eventDates = [startDate];

			var endDate = null;

			if ($(this).find('.date .end').length > 0 && $.trim($(this).find('.date .end').text()) !== '') {
				var endDateArr = $(this).find('.date .end').text().split('-');
				endDate = new Date();			
				endDate.setFullYear(endDateArr[2], monthIndexes[endDateArr[1]], endDateArr[0]);
				endDate = self.normalizeDate(endDate);				

				var startTime = startDate.getTime();
				var endTime = endDate.getTime();
				var oneDayMilliseconds = 60*60*24*1000;				
				var diffDays = (endTime - startTime)/oneDayMilliseconds;

				var tDate;

				for (var i = 1; i <= diffDays; i++){
					tDate = new Date();					
					tDate.setTime(startTime + i * oneDayMilliseconds);
					eventDates[eventDates.length] = tDate;
				}

			}

			$.each(eventDates,function(index, date){
				var event = {
					id : eventIndex, //unique id for add - simply index in the array of all events  
					description : description,
					location : location,
					time : time,
					tags : itemTags,
					date : date,
					startDate : startDate,
					endDate : endDate,
					title : title,
					thumb : thumb,
					city : city,
					locationDescription: locationDescription,
					regForm : regForm,
                                        FreeForm : FreeForm
				};			

				items[items.length] = event;				
			});

		});	

		this.tags = tags;
		this.activeTags = [];
		
		cities.sort();
		this.cities = cities;
		this.activeCity = null;

		//we no longer need data list
		this.$root.find('.data').remove();

		//sort items by date
		items.sort(function(a,b){
			if (a.date < b.date) {
				return 1;
			}
			if (a.date > b.date) {
				return -1;
			}
			return 0;
		});

		return items;
	};

	/* 
	 * Basically checks if any item tag is in the array of currently active tabs
	 */
	sfCalendar.prototype.isEventInActiveTags = function(item) {
		if (this.activeTags.length === 0) {
			return true;
		}

		var 
			self = this,
			flag = false;

		$.each(item.tags, function(index, tag){
			if ($.inArray(tag, self.activeTags) > -1) {
				flag = true;
				return false; //break out from the loop
			}
		});

		return flag;
	};
	
	/*
	 * Check if event is in active cities
	 */
	sfCalendar.prototype.isEventInActiveCity = function(item) {
		if (this.activeCity === null) {
			return true;
		}
		
		if (this.cities[this.activeCity] === item.city) {
			return true;
		}
		
		return false;
	};

	sfCalendar.prototype.checkFilters = function(item){
		if (this.isEventInActiveTags(item) === false) {
			return false;
		}		
		if (this.isEventInActiveCity(item) === false) {
			return false;
		}		
		
		return true;
	};
	
	/*
	 * Filters item set to return only these from a given month
	 */
	sfCalendar.prototype.fetchEventsForMonth = function(date){
		var 
			self = this,
			month = date.getMonth(),
			year = date.getFullYear();

		return $.grep(this.items, function(item){
			if (self.checkFilters(item) === false) {
				return false;
			}	
			return (item.date.getMonth() === month && item.date.getFullYear() === year);
		});
	};


	/* 
	 * Return events for a particular day
	 */	
	sfCalendar.prototype.fetchEventsForDay = function(date){
		var 
			self = this,
			month = date.getMonth(),
			year = date.getFullYear(),
			day = date.getDate();

		return $.grep(this.items, function(item){
			if (self.checkFilters(item) === false) {
				return false;
			}	
			return (item.date.getMonth() === month && item.date.getFullYear() === year && item.date.getDate() === day);
		});
	};

	/*
	 * Returns all events between a particular date
	 */
	sfCalendar.prototype.fetchEventsForPeriod = function(startDate, endDate){
		var 
			self = this;

		startDate = this.normalizeDate(startDate);
		endDate = this.normalizeDate(endDate, true); //second parameter this will set at the very last moment of the day		

		return $.grep(this.items, function(item){
			if (self.checkFilters(item) === false) {
				return false;
			}						
			return (item.date.valueOf() >= startDate.valueOf() && item.date.valueOf() <= endDate.valueOf());
		});
	};

	sfCalendar.prototype.fetchEventsFiltered = function(){
		var output = $.grep(this.items, $.proxy(function(item){
			return this.checkFilters(item);
		},this));
		
		return output.reverse();
	}
	/**
	 * Builds month navigation
	 */
	sfCalendar.prototype.navigation = function(){
		var 
			self = this,
			months = self.settings.months,
			startDate = arguments[0] || new Date();			

		//tabs
		this.$navigation = $('<p class="nav"/>').click(function(e){
			if (e.target.nodeName.toLowerCase() !== 'a') {
				return true;
			}

			e.preventDefault();
			var date = $(e.target).data('date');

			//rebuild tabs with new Date as a starter						
			self.navigation(date);
			self.rebuildCalendar(date);
			self.repopulateCalendar(date);			

			//reactive current selection
			$(document).trigger('eventbox.setMonth', [date]);
		});

		//builds previous and next links 
		var createLink = function(offset, className){
			var
				newDate = new Date(),
				newMonth = startDate.getMonth() + offset,
				newYear = startDate.getFullYear();

			if (newMonth < 0) {
				newMonth = newMonth + 12;
				newYear = newYear - 1;
			}
			//next year
			else if (newMonth > 11){
				newMonth = newMonth - 12;
				newYear = newYear + 1;
			}				

			newDate.setFullYear(newYear,newMonth,1);
			return $('<a href="#" class="' + className + '">' + months[newMonth] + '</a>').data('date',newDate);
		};

		var 
			$prev = createLink(-1, 'prev'),
			$next = createLink(1, 'next');

		this.$navigation.append($prev, document.createTextNode(' '+months[startDate.getMonth()]+' '+startDate.getFullYear()), $next);			

		//cleanup from previous navigation
		this.$aside.find('.nav').unbind('click').remove();

		//readd tabs
		this.$aside.prepend(this.$navigation);	
	};

	/* 
	 * Initializes listing 
	 */
	sfCalendar.prototype.listing = function(){
		var self = this;

		var updateListing = function(dataItems) {
			var 
				days = self.settings.days,
				months = self.settings.monthsShort;

			self.$events.empty(); //remove previous items

			//no results for given month
			if (dataItems.length === 0) {
				self.$events.append('<p class="empty">No events to show</p>');
				return;
			}

			var previousDate = null;

			$.each(dataItems, function(index, item){

				var isNewDate = false;

				//create a new date wrapper
				if (previousDate === null || previousDate.toString() !== item.date.toString()) {
					isNewDate = true;

					var 
						$wrapper = $('<div class="day"/>'),
						day = item.date.getDate();

					if (day < 10) {
						day = '0'+day;
					}
					$wrapper.append('<h4>'+months[item.date.getMonth()]+' <span>'+day+'</span></h4>');
					$wrapper.append('<p class="weekday">'+days[item.date.getDay()]+'</p>');

					self.$events.append($wrapper);
					previousDate = item.date;
				}

				var el = $('<div class="event"/>');

				//check if first item
				if (isNewDate === true) {
					el.addClass('event-first');
				}
				//title
				if (item.title) {
					el.append('<h5>'+ item.title + '</h5>');
				}

				if (item.city) {
					el.append('<p class="meta"><span>City:</span> ' + item.city);
				}
				
				if (item.endDate === null){
					el.append('<p class="meta"><span>Date:</span> ' + self.settings.months[item.startDate.getMonth()] + ' ' + item.startDate.getDate() + ', ' + item.startDate.getFullYear() + '</p>');
				}				
				else {
					el.append('<p class="meta"><span>Date:</span> ' + self.settings.months[item.startDate.getMonth()] + ' ' + item.startDate.getDate() + ', ' + item.startDate.getFullYear() + ' to ' + self.settings.months[item.endDate.getMonth()] + ' ' + item.endDate.getDate() + ', ' + item.endDate.getFullYear() + '</p>');
				}
				
				el.append('<p class="meta">' + item.time + '</p>');

				if (item.locationDescription) {
					el.append('<div class="location-description"><p class="meta"><span>Locations:</span></p>' + item.locationDescription + '</p></div>');
				}
				
				if (item.description) {
					el.append('<div class="event-desc"><p class="meta"><span>Event description</span></p>' + item.description + '</div>');
				}
				
				if (item.thumb) {
					el.append('<p class="thumb">'+ item.thumb + '</p>');
				}
				
				if (item.regForm && $.inArray('private', item.tags) === -1 && $.inArray('Private', item.tags) === -1){
					el.append(item.regForm);
					el.addClass('has-registration-form')
				}

if (item.FreeForm && $.inArray('free', item.tags) === -1 && $.inArray('Free', item.tags) === -1){
					el.append(item.FreeForm);
					el.addClass('has-freecall-form')
				}


				self.$events.find('.day:last').append(el);

				if (item.location && google.maps) {			

					var id = 'event-map-'+item.id;

					var geocoder = new google.maps.Geocoder();

					var showMap = function(){
						var location = $(arguments[0][0]).data('location');
						var container = $($('#'+id)).get(0);

						var map = new google.maps.Map(container, {
					    zoom: 14,
					    mapTypeId: google.maps.MapTypeId.ROADMAP			
						});

						geocoder.geocode( { 'address' : location }, function(results, status){

			        if (status == google.maps.GeocoderStatus.OK) {
			          map.setCenter(results[0].geometry.location);
			          var marker = new google.maps.Marker({
			              map: map, 
			              position: results[0].geometry.location
			          });
			        } else {
			          alert("Geocode was not successful for the following reason: " + status);
			        }									
						});						
					};
				
					var $mapTrigger = $('<a/>', { 
						href: '#'+id, 
						text : 'Map it!',
						data : {
							location : item.location
						}
					}).fancybox({
						frameWidth : 640,
						frameHeight : 450,
						onComplete : showMap,
						autoscale: false,
						content: $('<div />',{
							id: id,
							"class" : "gmap-container",
							css : {
								width: 640,
								height: 450
							}
						})
					});

					var $mapWrapper = $('<p class="map"/>').append($mapTrigger);
					el.append($mapWrapper);
					el.addClass('has-map')
				}
			});			
		};

		//update listing when date is change in the calendar
		$(document).bind('eventbox.setDay', function(event,date){
			self.$period.html('<span>Day:</span> ' + self.settings.months[date.getMonth()] + ' ' + date.getDate() + ', ' + date.getFullYear());
			updateListing(self.fetchEventsForDay(date));
		});

		$(document).bind('eventbox.setMonth', function(event,date){
			self.$period.html('<span>Month:</span> ' + self.settings.months[date.getMonth()] + ' ' + date.getFullYear());			
			updateListing(self.fetchEventsForMonth(date));
		});

		$(document).bind('eventbox.setWeek', function(event,startDate,endDate){
			self.$period.html('<span>Week:</span> ' + self.settings.months[startDate.getMonth()] + ' ' + startDate.getDate() + ' - '+ self.settings.months[endDate.getMonth()] + ' ' + endDate.getDate() + ', ' + startDate.getFullYear());						
			updateListing(self.fetchEventsForPeriod(startDate,endDate));
		});						
		
		$(document).bind('eventbox.allEvents',function(event){
			self.$period.html('<span>Events</span>');
			updateListing(self.fetchEventsFiltered());
		});
	};

	sfCalendar.prototype.cityFilter = function(){
		var
			self = this,
			$cityFilter = $('<select class="city-filter"/>');
			
		$cityFilter.append('<option value="-1"></option>');
		
		$.each(this.cities, function(index){
			var option = $('<option value="'+ index + '">' + this + '</option>');
			$cityFilter.append(option);
		});
		
		$cityFilter.change(function(){
			
			self.activeCity = parseInt($(this).val(), 10) === -1 ? null : parseInt($(this).val(),10);
			
			//update calendar widget
			self.repopulateCalendar(self.$calendar.data('date'));

			//refresh current selection
			
			if (self.activeCity === null) {
				var event = self.$calendar.data('selection');			
				$(document).trigger(event.type, event.data);			
			}
			else {			
				$(document).trigger('eventbox.allEvents');							
			}
		});
		
		this.$aside.append($cityFilter);
	};
		
	/*
	 * Tags filter list
	 */
	sfCalendar.prototype.tagsList = function(){
		var 
			self = this,
			$tagsList = $('<ul class="filter" />');		

		//function launched on checkbox click
		var triggerClick = function(e){
			var data = [];

			$tagsList.find('input:checked').each(function(){
				data[data.length] = $(this).data('tag');
			});

			self.activeTags = data;

			//update calendar widget
			self.repopulateCalendar(self.$calendar.data('date'));

			//refresh current selection
			if (self.activeTags.length === 0) {
				var event = self.$calendar.data('selection');			
				$(document).trigger(event.type, event.data);							
			}
			else {
				$(document).trigger('eventbox.allEvents');				
			}
		};

		$.each(this.tags, function(index, item){
			var
				$li = $('<li><label for="event-filter-'+index+'"> '+item+'</label></li>'),
				$checkbox = $('<input type="checkbox" id="event-filter-'+index+'" />').data('tag',item);

			$checkbox.click(triggerClick);

			$li.find('label').prepend($checkbox);
			$tagsList.append($li);
		});

		this.$aside.append($tagsList);			
	};

	/*
	 * Builds calendar widget
	 */
	sfCalendar.prototype.calendar = function(){
		var self = this;
		this.$calendar = $('<div class="calendar"/>');

		//catches clicks on the whole calendar widget
		this.$calendar.click(function(e){
			if (e.target.nodeName.toLowerCase() !== 'a') {
				return;
			}
			e.preventDefault();

			var $target = $(e.target);

			//month cell click
			if ($target.hasClass('month')) {
				$(document).trigger('eventbox.setMonth',[$target.data('date')]);
			}
			//week cell click
			else if ($target.hasClass('week')) {
				$(document).trigger('eventbox.setWeek',[$target.data('date.start'), $target.data('date.end')]);
			}
			//day cell click
			else {
				$(document).trigger('eventbox.setDay',[$target.data('date')]);
			}
		});

		//selecting whole month
		$(document).bind('eventbox.setMonth',function(event, date){	
			date = self.normalizeDate(date);

			self.$calendar.data('selection',{
				'type' : 'eventbox.setMonth',
				'data' : [date]
			});						

			if (date.valueOf() === self.$calendar.data('date').valueOf()) {
				self.$calendar.find('td a').addClass('selected');
			}
		});

		//selecting only one week
		$(document).bind('eventbox.setWeek',function(event, startDate, finishDate){
			self.$calendar.data('selection',{
				'type' : 'eventbox.setWeek',
				'data' : [startDate, finishDate]
			});			

			self.$calendar.find('td a').removeClass('selected');

			self.$calendar.find('tbody th a').each(function(){
				if ($(this).data('date.start').valueOf() === startDate.valueOf()) {
					$(this).parents('tr').find('td a').addClass('selected');
				}
			});
		});		

		//selecting a particular day
		$(document).bind('eventbox.setDay', function(event, date){

			self.$calendar.data('selection',{
				'type' : 'eventbox.setDay',
				'data' : [date]
			});

			self.$calendar.find('td a').removeClass('selected');

			self.$calendar.find('tbody td a').each(function(){
				if ($(this).data('date').valueOf() === date.valueOf()) {
					$(this).addClass('selected');
				}
			});
		});

		var now = new Date();

		this.rebuildCalendar(now);
		this.repopulateCalendar(now);
		this.$aside.append(this.$calendar);		
	};

	/*
	 * Fetches events for current month and marks them in the calendar
	 */
	sfCalendar.prototype.repopulateCalendar = function(date){
		var 
			tdate, weekday,
			self = this,
			dataItems = self.fetchEventsForMonth(date);

		tdate = date;
		tdate.setDate(1);
		weekday = tdate.getDay();

		this.$calendar.find('a.event').removeClass('event');

		$.each(dataItems, function(){
			var day = this.date.getDate() + weekday - 1; //we add weekday as it's the offset at the beginning of the calendar
			self.$calendar.find('td').eq(day).find('a').addClass('event');
		});				
	};

	/*
	 * Creates HTML for calendar widget
	 */ 
	sfCalendar.prototype.rebuildCalendar = function(date){

		date.setDate(1); //reset to the first day of passed month
		date = this.normalizeDate(date);

		var 
			weekday, rows, $row, $cell, $trigger, daysLimit, dayDate,
			counter = 0,
			displayedDay = 1,
			daysInMonth = [31,28,31,30,31,30,31,31,30,31,30,31],

			$table = $('<table summary="Calendar for ' + parseInt(date.getMonth() + 1, 10) + '.'+ date.getFullYear() +'"><thead/><tbody/></table>'),
			selectWeekStartDate, selectWeekEndDate;

		//cleanup
		this.$calendar.empty(); //remove previous items
		this.$calendar.data('date',date);

		if (date.getFullYear() % 4 === 0) {
			daysInMonth[1] = 29;
		}

		//weekday of the first day of current month
		weekday = date.getDay();
		daysLimit = daysInMonth[date.getMonth()] + weekday;
		rows = Math.ceil(daysLimit / 7);

		//header row
		$row = $('<tr />');
		$trigger = $('<a href="#" class="month">M</a>').data('date',date); //month changing trigger
		$cell = $('<th scope="col"/>');
		$row.append($cell.append($trigger));

		//day names
		$.each(this.settings.daysShort, function(){
			$row.append('<th scope="col">'+this+'</th>');
		});

		$table.find('thead').append($row);

		var firstDayOfMonth = false;

		for (var i = 0; i < rows; i++) {
			//week selecting row
			$row = $('<tr />');

			//cells
			for (var j = 0; j < 7; j++) {
				$cell = $('<td class="col' + parseInt(j+1,10) + '"/>');

				//existing day in month
				if (counter >= weekday && counter < daysLimit) {

					dayDate = new Date(date.getFullYear(),date.getMonth(),displayedDay,0,0,0);

					//look for the first day in month/week
					if (firstDayOfMonth === false || j === 0) {
						selectWeekStartDate = dayDate;
					}
					firstDayOfMonth = true;

					//look for the last day of the week
					if (j === 6 || counter + 1 === daysLimit) { 
						selectWeekEndDate = dayDate;
					}

					$trigger = $('<a href="#">'+ displayedDay +'</a>').data('date', dayDate);
					$cell.append($trigger);
					displayedDay++;
				}
				else {
					$cell.html('&nbsp;');
				}

				counter++;
				$row.append($cell);
			}

			//week selection trigger			
			$cell = $('<th scope="row"/>');
			$trigger = $('<a href="#" class="week">W</a>').data('date.start',selectWeekStartDate).data('date.end',selectWeekEndDate);			
			$row.prepend($cell.append($trigger));

			$table.find('tbody').append($row);
		}

		this.$calendar.append($table);
	};

	sfCalendar.prototype.init = function(){
		
		var now = this.normalizeDate(new Date());					
		
		//active today's date
		switch (this.settings.defaultView) {
			case 'month':
				now.setDate(1);
				$(document).trigger('eventbox.setMonth',[ now ]);
			break;
			default:
				$(document).trigger('eventbox.setDay',[ now ]);				
			break;				
		}
		
	};
	
	$.fn.sfCalendar = function(options){
		return $(this).each(function(){
			return new sfCalendar(this,options);
		});
	};

})(jQuery);


/**
 * (v) Equal Height plugin v. 1.11
 */

(function($){$.fn.equalHeights=function(){$(window).resize($.proxy(function(){var tallest=0;$(this).css('min-height',0);$(this).each(function(){if($(this).outerHeight()>tallest){tallest=$(this).outerHeight();}});$(this).each(function(){var padding=$(this).outerHeight()-$(this).height();var height=tallest-padding;$(this).css({'min-height':height});if($.browser.msie&&parseInt($.browser.version,10)==6)$(this).height(height);});},this)).triggerHandler('resize');return this;};})(jQuery);


/**
 * SimpleFlame Content rotator
 * Version 0.2 (28.04.2009)
 * Possible effects to use :
 *  - if UI effects have been added: 'blind', 'bounce', 'clip', 'drop', 'explode', 'fold', 'highlight', 'puff', 'pulsate', 'scale', 'shake', 'size', 'slide', 'transfer'
 *  - basic effects from jQuery: fadeIn, fadeOut, show, hide, slideUp, slideDown
 */
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(){6 9=5(R,h){2.3={\'d\':\'z\',\'c\':\'M\',\'S\':1e,\'l\':p,\'t\':\'1r\',\'17\':{},\'C\':\'19\',\'m\':\'1k\',\'Q\':{},\'H\':\'19\'};7.1m(2.3,h);2.$g=7(R);2.12()};9.j.12=5(){2.$g.o(\'w-b\');2.$x=7(\'<1l Z="w-1j" />\');2.$g.1n(2.$x);2.$x.I(2.$g);2.$s=7(\'<1o Z="w-s" />\');2.$x.I(2.$s);2.$b=2.$g.1q(2.3.d);2.$e=2.$b.v(2.$b.1p(\'.\'+2.3.c));8(2.$e<0){2.$e=0}6 4=2;2.$b.o(\'w-d\').X(5(v,d){6 q=7(\'<z><a 1s="#">\'+1c(v+1,10)+\'</a></z>\');4.$s.I(q);q.U(\'a\').G(\'d\',d).1h(\'1g\',{4:4},4.q)});2.y(2.$e,p);8(2.3.l){2.l()}};9.j.q=5(D){D.1d();6 4=D.G.4;4.P();4.$O=p;6 k=4.$b.v(7(2).G(\'d\'));4.y(k)};9.j.y=5(k){6 11=1I[1]||14;6 c=2.3.c;6 i=2.$b.L(2.$e);6 f=2.$b.L(k);6 E=5(){i.N(c)};6 A=5(){f.o(c).Y(\'16\',10)};6 J=[\'1H\',\'1G\',\'1K\',\'1N\',\'1M\',\'1t\',\'1L\',\'1J\',\'1E\',\'1F\',\'1w\',\'1v\',\'1u\',\'1y\'];8(11===p){i.N(c).F();f.o(c).B()}n{8(7.1a(2.3.m,J)>-1){i.F(2.3.m,2.3.Q,2.3.H,E)}n 8(7.13(i[2.3.m])){i[2.3.m](2.3.H,E)}n{15"1b F 18"}f.Y(\'16\',1C);8(7.1a(2.3.t,J)>-1){f.B(2.3.t,2.3.17,2.3.C,A)}n 8(7.13(f[2.3.t])){f[2.3.t](2.3.C,A)}n{15"1b B 18"}}2.$s.U(\'a\').N(\'M\').L(k).o(\'M\');2.$e=k};9.j.l=5(){2.$O=14;6 4=2;2.$g.1A(5(){4.P()});2.$g.1B(5(){4.K()});2.K()};9.j.K=5(){8(2.$O===p){V}6 4=2;2.$T=W.1D(5(){6 u=4.$e+1;8(u===4.$b.1z){u=0}4.y(u)},2.3.S)};9.j.P=5(){8(2.3.l){W.1x(2.$T)}};7.1f.9=5(h){h=h||{};V 2.X(5(){6 r=1i 9(2,h)})}})();',62,112,'||this|settings|self|function|var|jQuery|if|sfRotator||items|activeClass|item|current|newItem|container|options|oldItem|prototype|position|autorotate|effectOut|else|addClass|true|trigger||controls|effectIn|next|index|sf|wrapper|activate|li|onShow|show|speedIn|event|onHide|hide|data|speedOut|append|effects|startAutorotate|eq|active|removeClass|rotationTerminated|stopAutorotate|optionsOut|el|duration|rotationInterval|find|return|window|each|css|class||instant|build|isFunction|false|throw|zIndex|optionsIn|transition|normal|inArray|Unsupported|parseInt|preventDefault|5000|fn|click|bind|new|rotator|fadeOut|div|extend|before|ul|filter|children|fadeIn|href|fold|slide|size|shake|clearInterval|transfer|length|mouseenter|mouseleave|100|setInterval|pulsate|scale|bounce|blind|arguments|puff|clip|highlight|explode|drop'.split('|'),0,{}));

/*
 * jQuery UI Effects 1.7.1
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/
 */
jQuery.effects||(function(d){d.effects={version:"1.7.1",save:function(g,h){for(var f=0;f<h.length;f++){if(h[f]!==null){g.data("ec.storage."+h[f],g[0].style[h[f]])}}},restore:function(g,h){for(var f=0;f<h.length;f++){if(h[f]!==null){g.css(h[f],g.data("ec.storage."+h[f]))}}},setMode:function(f,g){if(g=="toggle"){g=f.is(":hidden")?"show":"hide"}return g},getBaseline:function(g,h){var i,f;switch(g[0]){case"top":i=0;break;case"middle":i=0.5;break;case"bottom":i=1;break;default:i=g[0]/h.height}switch(g[1]){case"left":f=0;break;case"center":f=0.5;break;case"right":f=1;break;default:f=g[1]/h.width}return{x:f,y:i}},createWrapper:function(f){if(f.parent().is(".ui-effects-wrapper")){return f.parent()}var g={width:f.outerWidth(true),height:f.outerHeight(true),"float":f.css("float")};f.wrap('<div class="ui-effects-wrapper" style="font-size:100%;background:transparent;border:none;margin:0;padding:0"></div>');var j=f.parent();if(f.css("position")=="static"){j.css({position:"relative"});f.css({position:"relative"})}else{var i=f.css("top");if(isNaN(parseInt(i,10))){i="auto"}var h=f.css("left");if(isNaN(parseInt(h,10))){h="auto"}j.css({position:f.css("position"),top:i,left:h,zIndex:f.css("z-index")}).show();f.css({position:"relative",top:0,left:0})}j.css(g);return j},removeWrapper:function(f){if(f.parent().is(".ui-effects-wrapper")){return f.parent().replaceWith(f)}return f},setTransition:function(g,i,f,h){h=h||{};d.each(i,function(k,j){unit=g.cssUnit(j);if(unit[0]>0){h[j]=unit[0]*f+unit[1]}});return h},animateClass:function(h,i,k,j){var f=(typeof k=="function"?k:(j?j:null));var g=(typeof k=="string"?k:null);return this.each(function(){var q={};var o=d(this);var p=o.attr("style")||"";if(typeof p=="object"){p=p.cssText}if(h.toggle){o.hasClass(h.toggle)?h.remove=h.toggle:h.add=h.toggle}var l=d.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(h.add){o.addClass(h.add)}if(h.remove){o.removeClass(h.remove)}var m=d.extend({},(document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle));if(h.add){o.removeClass(h.add)}if(h.remove){o.addClass(h.remove)}for(var r in m){if(typeof m[r]!="function"&&m[r]&&r.indexOf("Moz")==-1&&r.indexOf("length")==-1&&m[r]!=l[r]&&(r.match(/color/i)||(!r.match(/color/i)&&!isNaN(parseInt(m[r],10))))&&(l.position!="static"||(l.position=="static"&&!r.match(/left|top|bottom|right/)))){q[r]=m[r]}}o.animate(q,i,g,function(){if(typeof d(this).attr("style")=="object"){d(this).attr("style")["cssText"]="";d(this).attr("style")["cssText"]=p}else{d(this).attr("style",p)}if(h.add){d(this).addClass(h.add)}if(h.remove){d(this).removeClass(h.remove)}if(f){f.apply(this,arguments)}})})}};function c(g,f){var i=g[1]&&g[1].constructor==Object?g[1]:{};if(f){i.mode=f}var h=g[1]&&g[1].constructor!=Object?g[1]:(i.duration?i.duration:g[2]);h=d.fx.off?0:typeof h==="number"?h:d.fx.speeds[h]||d.fx.speeds._default;var j=i.callback||(d.isFunction(g[1])&&g[1])||(d.isFunction(g[2])&&g[2])||(d.isFunction(g[3])&&g[3]);return[g[0],i,h,j]}d.fn.extend({_show:d.fn.show,_hide:d.fn.hide,__toggle:d.fn.toggle,_addClass:d.fn.addClass,_removeClass:d.fn.removeClass,_toggleClass:d.fn.toggleClass,effect:function(g,f,h,i){return d.effects[g]?d.effects[g].call(this,{method:g,options:f||{},duration:h,callback:i}):null},show:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))){return this._show.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"show"))}},hide:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))){return this._hide.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"hide"))}},toggle:function(){if(!arguments[0]||(arguments[0].constructor==Number||(/(slow|normal|fast)/).test(arguments[0]))||(arguments[0].constructor==Function)){return this.__toggle.apply(this,arguments)}else{return this.effect.apply(this,c(arguments,"toggle"))}},addClass:function(g,f,i,h){return f?d.effects.animateClass.apply(this,[{add:g},f,i,h]):this._addClass(g)},removeClass:function(g,f,i,h){return f?d.effects.animateClass.apply(this,[{remove:g},f,i,h]):this._removeClass(g)},toggleClass:function(g,f,i,h){return((typeof f!=="boolean")&&f)?d.effects.animateClass.apply(this,[{toggle:g},f,i,h]):this._toggleClass(g,f)},morph:function(f,h,g,j,i){return d.effects.animateClass.apply(this,[{add:h,remove:f},g,j,i])},switchClass:function(){return this.morph.apply(this,arguments)},cssUnit:function(f){var g=this.css(f),h=[];d.each(["em","px","%","pt"],function(j,k){if(g.indexOf(k)>0){h=[parseFloat(g),k]}});return h}});d.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(g,f){d.fx.step[f]=function(h){if(h.state==0){h.start=e(h.elem,f);h.end=b(h.end)}h.elem.style[f]="rgb("+[Math.max(Math.min(parseInt((h.pos*(h.end[0]-h.start[0]))+h.start[0],10),255),0),Math.max(Math.min(parseInt((h.pos*(h.end[1]-h.start[1]))+h.start[1],10),255),0),Math.max(Math.min(parseInt((h.pos*(h.end[2]-h.start[2]))+h.start[2],10),255),0)].join(",")+")"}});function b(g){var f;if(g&&g.constructor==Array&&g.length==3){return g}if(f=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(g)){return[parseInt(f[1],10),parseInt(f[2],10),parseInt(f[3],10)]}if(f=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(g)){return[parseFloat(f[1])*2.55,parseFloat(f[2])*2.55,parseFloat(f[3])*2.55]}if(f=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(g)){return[parseInt(f[1],16),parseInt(f[2],16),parseInt(f[3],16)]}if(f=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(g)){return[parseInt(f[1]+f[1],16),parseInt(f[2]+f[2],16),parseInt(f[3]+f[3],16)]}if(f=/rgba\(0, 0, 0, 0\)/.exec(g)){return a.transparent}return a[d.trim(g).toLowerCase()]}function e(h,f){var g;do{g=d.curCSS(h,f);if(g!=""&&g!="transparent"||d.nodeName(h,"body")){break}f="backgroundColor"}while(h=h.parentNode);return b(g)}var a={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]};d.easing.jswing=d.easing.swing;d.extend(d.easing,{def:"easeOutQuad",swing:function(g,h,f,j,i){return d.easing[d.easing.def](g,h,f,j,i)},easeInQuad:function(g,h,f,j,i){return j*(h/=i)*h+f},easeOutQuad:function(g,h,f,j,i){return -j*(h/=i)*(h-2)+f},easeInOutQuad:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h+f}return -j/2*((--h)*(h-2)-1)+f},easeInCubic:function(g,h,f,j,i){return j*(h/=i)*h*h+f},easeOutCubic:function(g,h,f,j,i){return j*((h=h/i-1)*h*h+1)+f},easeInOutCubic:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h+f}return j/2*((h-=2)*h*h+2)+f},easeInQuart:function(g,h,f,j,i){return j*(h/=i)*h*h*h+f},easeOutQuart:function(g,h,f,j,i){return -j*((h=h/i-1)*h*h*h-1)+f},easeInOutQuart:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h*h+f}return -j/2*((h-=2)*h*h*h-2)+f},easeInQuint:function(g,h,f,j,i){return j*(h/=i)*h*h*h*h+f},easeOutQuint:function(g,h,f,j,i){return j*((h=h/i-1)*h*h*h*h+1)+f},easeInOutQuint:function(g,h,f,j,i){if((h/=i/2)<1){return j/2*h*h*h*h*h+f}return j/2*((h-=2)*h*h*h*h+2)+f},easeInSine:function(g,h,f,j,i){return -j*Math.cos(h/i*(Math.PI/2))+j+f},easeOutSine:function(g,h,f,j,i){return j*Math.sin(h/i*(Math.PI/2))+f},easeInOutSine:function(g,h,f,j,i){return -j/2*(Math.cos(Math.PI*h/i)-1)+f},easeInExpo:function(g,h,f,j,i){return(h==0)?f:j*Math.pow(2,10*(h/i-1))+f},easeOutExpo:function(g,h,f,j,i){return(h==i)?f+j:j*(-Math.pow(2,-10*h/i)+1)+f},easeInOutExpo:function(g,h,f,j,i){if(h==0){return f}if(h==i){return f+j}if((h/=i/2)<1){return j/2*Math.pow(2,10*(h-1))+f}return j/2*(-Math.pow(2,-10*--h)+2)+f},easeInCirc:function(g,h,f,j,i){return -j*(Math.sqrt(1-(h/=i)*h)-1)+f},easeOutCirc:function(g,h,f,j,i){return j*Math.sqrt(1-(h=h/i-1)*h)+f},easeInOutCirc:function(g,h,f,j,i){if((h/=i/2)<1){return -j/2*(Math.sqrt(1-h*h)-1)+f}return j/2*(Math.sqrt(1-(h-=2)*h)+1)+f},easeInElastic:function(g,i,f,m,l){var j=1.70158;var k=0;var h=m;if(i==0){return f}if((i/=l)==1){return f+m}if(!k){k=l*0.3}if(h<Math.abs(m)){h=m;var j=k/4}else{var j=k/(2*Math.PI)*Math.asin(m/h)}return -(h*Math.pow(2,10*(i-=1))*Math.sin((i*l-j)*(2*Math.PI)/k))+f},easeOutElastic:function(g,i,f,m,l){var j=1.70158;var k=0;var h=m;if(i==0){return f}if((i/=l)==1){return f+m}if(!k){k=l*0.3}if(h<Math.abs(m)){h=m;var j=k/4}else{var j=k/(2*Math.PI)*Math.asin(m/h)}return h*Math.pow(2,-10*i)*Math.sin((i*l-j)*(2*Math.PI)/k)+m+f},easeInOutElastic:function(g,i,f,m,l){var j=1.70158;var k=0;var h=m;if(i==0){return f}if((i/=l/2)==2){return f+m}if(!k){k=l*(0.3*1.5)}if(h<Math.abs(m)){h=m;var j=k/4}else{var j=k/(2*Math.PI)*Math.asin(m/h)}if(i<1){return -0.5*(h*Math.pow(2,10*(i-=1))*Math.sin((i*l-j)*(2*Math.PI)/k))+f}return h*Math.pow(2,-10*(i-=1))*Math.sin((i*l-j)*(2*Math.PI)/k)*0.5+m+f},easeInBack:function(g,h,f,k,j,i){if(i==undefined){i=1.70158}return k*(h/=j)*h*((i+1)*h-i)+f},easeOutBack:function(g,h,f,k,j,i){if(i==undefined){i=1.70158}return k*((h=h/j-1)*h*((i+1)*h+i)+1)+f},easeInOutBack:function(g,h,f,k,j,i){if(i==undefined){i=1.70158}if((h/=j/2)<1){return k/2*(h*h*(((i*=(1.525))+1)*h-i))+f}return k/2*((h-=2)*h*(((i*=(1.525))+1)*h+i)+2)+f},easeInBounce:function(g,h,f,j,i){return j-d.easing.easeOutBounce(g,i-h,0,j,i)+f},easeOutBounce:function(g,h,f,j,i){if((h/=i)<(1/2.75)){return j*(7.5625*h*h)+f}else{if(h<(2/2.75)){return j*(7.5625*(h-=(1.5/2.75))*h+0.75)+f}else{if(h<(2.5/2.75)){return j*(7.5625*(h-=(2.25/2.75))*h+0.9375)+f}else{return j*(7.5625*(h-=(2.625/2.75))*h+0.984375)+f}}}},easeInOutBounce:function(g,h,f,j,i){if(h<i/2){return d.easing.easeInBounce(g,h*2,0,j,i)*0.5+f}return d.easing.easeOutBounce(g,h*2-i,0,j,i)*0.5+j*0.5+f}})})(jQuery);;/*
 * jQuery UI Effects Blind 1.7.1
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/Blind
 *
 * Depends:
 *	effects.core.js
 */
(function(a){a.effects.blind=function(b){return this.queue(function(){var d=a(this),c=["position","top","left"];var h=a.effects.setMode(d,b.options.mode||"hide");var g=b.options.direction||"vertical";a.effects.save(d,c);d.show();var j=a.effects.createWrapper(d).css({overflow:"hidden"});var e=(g=="vertical")?"height":"width";var i=(g=="vertical")?j.height():j.width();if(h=="show"){j.css(e,0)}var f={};f[e]=h=="show"?i:0;j.animate(f,b.duration,b.options.easing,function(){if(h=="hide"){d.hide()}a.effects.restore(d,c);a.effects.removeWrapper(d);if(b.callback){b.callback.apply(d[0],arguments)}d.dequeue()})})}})(jQuery);;/*
 * jQuery UI Effects Bounce 1.7.1
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/Bounce
 *
 * Depends:
 *	effects.core.js
 */
(function(a){a.effects.bounce=function(b){return this.queue(function(){var e=a(this),l=["position","top","left"];var k=a.effects.setMode(e,b.options.mode||"effect");var n=b.options.direction||"up";var c=b.options.distance||20;var d=b.options.times||5;var g=b.duration||250;if(/show|hide/.test(k)){l.push("opacity")}a.effects.save(e,l);e.show();a.effects.createWrapper(e);var f=(n=="up"||n=="down")?"top":"left";var p=(n=="up"||n=="left")?"pos":"neg";var c=b.options.distance||(f=="top"?e.outerHeight({margin:true})/3:e.outerWidth({margin:true})/3);if(k=="show"){e.css("opacity",0).css(f,p=="pos"?-c:c)}if(k=="hide"){c=c/(d*2)}if(k!="hide"){d--}if(k=="show"){var h={opacity:1};h[f]=(p=="pos"?"+=":"-=")+c;e.animate(h,g/2,b.options.easing);c=c/2;d--}for(var j=0;j<d;j++){var o={},m={};o[f]=(p=="pos"?"-=":"+=")+c;m[f]=(p=="pos"?"+=":"-=")+c;e.animate(o,g/2,b.options.easing).animate(m,g/2,b.options.easing);c=(k=="hide")?c*2:c/2}if(k=="hide"){var h={opacity:0};h[f]=(p=="pos"?"-=":"+=")+c;e.animate(h,g/2,b.options.easing,function(){e.hide();a.effects.restore(e,l);a.effects.removeWrapper(e);if(b.callback){b.callback.apply(this,arguments)}})}else{var o={},m={};o[f]=(p=="pos"?"-=":"+=")+c;m[f]=(p=="pos"?"+=":"-=")+c;e.animate(o,g/2,b.options.easing).animate(m,g/2,b.options.easing,function(){a.effects.restore(e,l);a.effects.removeWrapper(e);if(b.callback){b.callback.apply(this,arguments)}})}e.queue("fx",function(){e.dequeue()});e.dequeue()})}})(jQuery);;/*
 * jQuery UI Effects Clip 1.7.1
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/Clip
 *
 * Depends:
 *	effects.core.js
 */
(function(a){a.effects.clip=function(b){return this.queue(function(){var f=a(this),j=["position","top","left","height","width"];var i=a.effects.setMode(f,b.options.mode||"hide");var k=b.options.direction||"vertical";a.effects.save(f,j);f.show();var c=a.effects.createWrapper(f).css({overflow:"hidden"});var e=f[0].tagName=="IMG"?c:f;var g={size:(k=="vertical")?"height":"width",position:(k=="vertical")?"top":"left"};var d=(k=="vertical")?e.height():e.width();if(i=="show"){e.css(g.size,0);e.css(g.position,d/2)}var h={};h[g.size]=i=="show"?d:0;h[g.position]=i=="show"?0:d/2;e.animate(h,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(i=="hide"){f.hide()}a.effects.restore(f,j);a.effects.removeWrapper(f);if(b.callback){b.callback.apply(f[0],arguments)}f.dequeue()}})})}})(jQuery);;/*
 * jQuery UI Effects Drop 1.7.1
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/Drop
 *
 * Depends:
 *	effects.core.js
 */
(function(a){a.effects.drop=function(b){return this.queue(function(){var e=a(this),d=["position","top","left","opacity"];var i=a.effects.setMode(e,b.options.mode||"hide");var h=b.options.direction||"left";a.effects.save(e,d);e.show();a.effects.createWrapper(e);var f=(h=="up"||h=="down")?"top":"left";var c=(h=="up"||h=="left")?"pos":"neg";var j=b.options.distance||(f=="top"?e.outerHeight({margin:true})/2:e.outerWidth({margin:true})/2);if(i=="show"){e.css("opacity",0).css(f,c=="pos"?-j:j)}var g={opacity:i=="show"?1:0};g[f]=(i=="show"?(c=="pos"?"+=":"-="):(c=="pos"?"-=":"+="))+j;e.animate(g,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(i=="hide"){e.hide()}a.effects.restore(e,d);a.effects.removeWrapper(e);if(b.callback){b.callback.apply(this,arguments)}e.dequeue()}})})}})(jQuery);;/*
 * jQuery UI Effects Explode 1.7.1
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/Explode
 *
 * Depends:
 *	effects.core.js
 */
(function(a){a.effects.explode=function(b){return this.queue(function(){var k=b.options.pieces?Math.round(Math.sqrt(b.options.pieces)):3;var e=b.options.pieces?Math.round(Math.sqrt(b.options.pieces)):3;b.options.mode=b.options.mode=="toggle"?(a(this).is(":visible")?"hide":"show"):b.options.mode;var h=a(this).show().css("visibility","hidden");var l=h.offset();l.top-=parseInt(h.css("marginTop"),10)||0;l.left-=parseInt(h.css("marginLeft"),10)||0;var g=h.outerWidth(true);var c=h.outerHeight(true);for(var f=0;f<k;f++){for(var d=0;d<e;d++){h.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-d*(g/e),top:-f*(c/k)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:g/e,height:c/k,left:l.left+d*(g/e)+(b.options.mode=="show"?(d-Math.floor(e/2))*(g/e):0),top:l.top+f*(c/k)+(b.options.mode=="show"?(f-Math.floor(k/2))*(c/k):0),opacity:b.options.mode=="show"?0:1}).animate({left:l.left+d*(g/e)+(b.options.mode=="show"?0:(d-Math.floor(e/2))*(g/e)),top:l.top+f*(c/k)+(b.options.mode=="show"?0:(f-Math.floor(k/2))*(c/k)),opacity:b.options.mode=="show"?1:0},b.duration||500)}}setTimeout(function(){b.options.mode=="show"?h.css({visibility:"visible"}):h.css({visibility:"visible"}).hide();if(b.callback){b.callback.apply(h[0])}h.dequeue();a("div.ui-effects-explode").remove()},b.duration||500)})}})(jQuery);;/*
 * jQuery UI Effects Fold 1.7.1
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/Fold
 *
 * Depends:
 *	effects.core.js
 */
(function(a){a.effects.fold=function(b){return this.queue(function(){var e=a(this),k=["position","top","left"];var h=a.effects.setMode(e,b.options.mode||"hide");var o=b.options.size||15;var n=!(!b.options.horizFirst);var g=b.duration?b.duration/2:a.fx.speeds._default/2;a.effects.save(e,k);e.show();var d=a.effects.createWrapper(e).css({overflow:"hidden"});var i=((h=="show")!=n);var f=i?["width","height"]:["height","width"];var c=i?[d.width(),d.height()]:[d.height(),d.width()];var j=/([0-9]+)%/.exec(o);if(j){o=parseInt(j[1],10)/100*c[h=="hide"?0:1]}if(h=="show"){d.css(n?{height:0,width:o}:{height:o,width:0})}var m={},l={};m[f[0]]=h=="show"?c[0]:o;l[f[1]]=h=="show"?c[1]:0;d.animate(m,g,b.options.easing).animate(l,g,b.options.easing,function(){if(h=="hide"){e.hide()}a.effects.restore(e,k);a.effects.removeWrapper(e);if(b.callback){b.callback.apply(e[0],arguments)}e.dequeue()})})}})(jQuery);;/*
 * jQuery UI Effects Highlight 1.7.1
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/Highlight
 *
 * Depends:
 *	effects.core.js
 */
(function(a){a.effects.highlight=function(b){return this.queue(function(){var e=a(this),d=["backgroundImage","backgroundColor","opacity"];var h=a.effects.setMode(e,b.options.mode||"show");var c=b.options.color||"#ffff99";var g=e.css("backgroundColor");a.effects.save(e,d);e.show();e.css({backgroundImage:"none",backgroundColor:c});var f={backgroundColor:g};if(h=="hide"){f.opacity=0}e.animate(f,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(h=="hide"){e.hide()}a.effects.restore(e,d);if(h=="show"&&a.browser.msie){this.style.removeAttribute("filter")}if(b.callback){b.callback.apply(this,arguments)}e.dequeue()}})})}})(jQuery);;/*
 * jQuery UI Effects Pulsate 1.7.1
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/Pulsate
 *
 * Depends:
 *	effects.core.js
 */
(function(a){a.effects.pulsate=function(b){return this.queue(function(){var d=a(this);var g=a.effects.setMode(d,b.options.mode||"show");var f=b.options.times||5;var e=b.duration?b.duration/2:a.fx.speeds._default/2;if(g=="hide"){f--}if(d.is(":hidden")){d.css("opacity",0);d.show();d.animate({opacity:1},e,b.options.easing);f=f-2}for(var c=0;c<f;c++){d.animate({opacity:0},e,b.options.easing).animate({opacity:1},e,b.options.easing)}if(g=="hide"){d.animate({opacity:0},e,b.options.easing,function(){d.hide();if(b.callback){b.callback.apply(this,arguments)}})}else{d.animate({opacity:0},e,b.options.easing).animate({opacity:1},e,b.options.easing,function(){if(b.callback){b.callback.apply(this,arguments)}})}d.queue("fx",function(){d.dequeue()});d.dequeue()})}})(jQuery);;/*
 * jQuery UI Effects Scale 1.7.1
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/Scale
 *
 * Depends:
 *	effects.core.js
 */
(function(a){a.effects.puff=function(b){return this.queue(function(){var f=a(this);var c=a.extend(true,{},b.options);var h=a.effects.setMode(f,b.options.mode||"hide");var g=parseInt(b.options.percent,10)||150;c.fade=true;var e={height:f.height(),width:f.width()};var d=g/100;f.from=(h=="hide")?e:{height:e.height*d,width:e.width*d};c.from=f.from;c.percent=(h=="hide")?g:100;c.mode=h;f.effect("scale",c,b.duration,b.callback);f.dequeue()})};a.effects.scale=function(b){return this.queue(function(){var g=a(this);var d=a.extend(true,{},b.options);var j=a.effects.setMode(g,b.options.mode||"effect");var h=parseInt(b.options.percent,10)||(parseInt(b.options.percent,10)==0?0:(j=="hide"?0:100));var i=b.options.direction||"both";var c=b.options.origin;if(j!="effect"){d.origin=c||["middle","center"];d.restore=true}var f={height:g.height(),width:g.width()};g.from=b.options.from||(j=="show"?{height:0,width:0}:f);var e={y:i!="horizontal"?(h/100):1,x:i!="vertical"?(h/100):1};g.to={height:f.height*e.y,width:f.width*e.x};if(b.options.fade){if(j=="show"){g.from.opacity=0;g.to.opacity=1}if(j=="hide"){g.from.opacity=1;g.to.opacity=0}}d.from=g.from;d.to=g.to;d.mode=j;g.effect("size",d,b.duration,b.callback);g.dequeue()})};a.effects.size=function(b){return this.queue(function(){var c=a(this),n=["position","top","left","width","height","overflow","opacity"];var m=["position","top","left","overflow","opacity"];var j=["width","height","overflow"];var p=["fontSize"];var k=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"];var f=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"];var g=a.effects.setMode(c,b.options.mode||"effect");var i=b.options.restore||false;var e=b.options.scale||"both";var o=b.options.origin;var d={height:c.height(),width:c.width()};c.from=b.options.from||d;c.to=b.options.to||d;if(o){var h=a.effects.getBaseline(o,d);c.from.top=(d.height-c.from.height)*h.y;c.from.left=(d.width-c.from.width)*h.x;c.to.top=(d.height-c.to.height)*h.y;c.to.left=(d.width-c.to.width)*h.x}var l={from:{y:c.from.height/d.height,x:c.from.width/d.width},to:{y:c.to.height/d.height,x:c.to.width/d.width}};if(e=="box"||e=="both"){if(l.from.y!=l.to.y){n=n.concat(k);c.from=a.effects.setTransition(c,k,l.from.y,c.from);c.to=a.effects.setTransition(c,k,l.to.y,c.to)}if(l.from.x!=l.to.x){n=n.concat(f);c.from=a.effects.setTransition(c,f,l.from.x,c.from);c.to=a.effects.setTransition(c,f,l.to.x,c.to)}}if(e=="content"||e=="both"){if(l.from.y!=l.to.y){n=n.concat(p);c.from=a.effects.setTransition(c,p,l.from.y,c.from);c.to=a.effects.setTransition(c,p,l.to.y,c.to)}}a.effects.save(c,i?n:m);c.show();a.effects.createWrapper(c);c.css("overflow","hidden").css(c.from);if(e=="content"||e=="both"){k=k.concat(["marginTop","marginBottom"]).concat(p);f=f.concat(["marginLeft","marginRight"]);j=n.concat(k).concat(f);c.find("*[width]").each(function(){child=a(this);if(i){a.effects.save(child,j)}var q={height:child.height(),width:child.width()};child.from={height:q.height*l.from.y,width:q.width*l.from.x};child.to={height:q.height*l.to.y,width:q.width*l.to.x};if(l.from.y!=l.to.y){child.from=a.effects.setTransition(child,k,l.from.y,child.from);child.to=a.effects.setTransition(child,k,l.to.y,child.to)}if(l.from.x!=l.to.x){child.from=a.effects.setTransition(child,f,l.from.x,child.from);child.to=a.effects.setTransition(child,f,l.to.x,child.to)}child.css(child.from);child.animate(child.to,b.duration,b.options.easing,function(){if(i){a.effects.restore(child,j)}})})}c.animate(c.to,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(g=="hide"){c.hide()}a.effects.restore(c,i?n:m);a.effects.removeWrapper(c);if(b.callback){b.callback.apply(this,arguments)}c.dequeue()}})})}})(jQuery);;/*
 * jQuery UI Effects Shake 1.7.1
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/Shake
 *
 * Depends:
 *	effects.core.js
 */
(function(a){a.effects.shake=function(b){return this.queue(function(){var e=a(this),l=["position","top","left"];var k=a.effects.setMode(e,b.options.mode||"effect");var n=b.options.direction||"left";var c=b.options.distance||20;var d=b.options.times||3;var g=b.duration||b.options.duration||140;a.effects.save(e,l);e.show();a.effects.createWrapper(e);var f=(n=="up"||n=="down")?"top":"left";var p=(n=="up"||n=="left")?"pos":"neg";var h={},o={},m={};h[f]=(p=="pos"?"-=":"+=")+c;o[f]=(p=="pos"?"+=":"-=")+c*2;m[f]=(p=="pos"?"-=":"+=")+c*2;e.animate(h,g,b.options.easing);for(var j=1;j<d;j++){e.animate(o,g,b.options.easing).animate(m,g,b.options.easing)}e.animate(o,g,b.options.easing).animate(h,g/2,b.options.easing,function(){a.effects.restore(e,l);a.effects.removeWrapper(e);if(b.callback){b.callback.apply(this,arguments)}});e.queue("fx",function(){e.dequeue()});e.dequeue()})}})(jQuery);;/*
 * jQuery UI Effects Slide 1.7.1
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/Slide
 *
 * Depends:
 *	effects.core.js
 */
(function(a){a.effects.slide=function(b){return this.queue(function(){var e=a(this),d=["position","top","left"];var i=a.effects.setMode(e,b.options.mode||"show");var h=b.options.direction||"left";a.effects.save(e,d);e.show();a.effects.createWrapper(e).css({overflow:"hidden"});var f=(h=="up"||h=="down")?"top":"left";var c=(h=="up"||h=="left")?"pos":"neg";var j=b.options.distance||(f=="top"?e.outerHeight({margin:true}):e.outerWidth({margin:true}));if(i=="show"){e.css(f,c=="pos"?-j:j)}var g={};g[f]=(i=="show"?(c=="pos"?"+=":"-="):(c=="pos"?"-=":"+="))+j;e.animate(g,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){if(i=="hide"){e.hide()}a.effects.restore(e,d);a.effects.removeWrapper(e);if(b.callback){b.callback.apply(this,arguments)}e.dequeue()}})})}})(jQuery);;/*
 * jQuery UI Effects Transfer 1.7.1
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Effects/Transfer
 *
 * Depends:
 *	effects.core.js
 */
(function(a){a.effects.transfer=function(b){return this.queue(function(){var f=a(this),h=a(b.options.to),e=h.offset(),g={top:e.top,left:e.left,height:h.innerHeight(),width:h.innerWidth()},d=f.offset(),c=a('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(b.options.className).css({top:d.top,left:d.left,height:f.innerHeight(),width:f.innerWidth(),position:"absolute"}).animate(g,b.duration,b.options.easing,function(){c.remove();(b.callback&&b.callback.apply(f[0],arguments));f.dequeue()})})}})(jQuery);;


/**
 * Compact labels plugin
 * Takes one option
 *  - labelOpacity [default: true] - set to false to disable label opacity change on empty input focus
 */
(function($){$.fn.compactize=function(options){var defaults={labelOpacity:true};options=$.extend(defaults,options);return this.each(function(){var label=$(this),input=$('#'+label.attr('for'));input.focus(function(){if(options.labelOpacity){if(input.val()===''){label.css('opacity','0.5');}} else{label.hide();}});if(options.labelOpacity){input.keydown(function(){label.hide();label.css('opacity',1);});} input.blur(function(){if(input.val()===''){label.show();} if(options.labelOpacity){label.css('opacity',1);}});window.setTimeout(function(){if(input.val()!==''){label.hide();}},50);});};})(jQuery);


/*
 * hrefID jQuery extention - returns a valid #hash string from link href attribute in Internet Explorer
 */
(function($){$.fn.extend({hrefId:function(){return $(this).attr('href').substr($(this).attr('href').indexOf('#'));}});})(jQuery);

/*
 * Scripts
 *
 */
jQuery(function($) {
 
	var Engine = {
		utils : {
			links : function(){
				$('a[rel*=external]').click(function(e){
					e.preventDefault();
					window.open($(this).attr('href'));						  
				});
			},
			mails : function(){
				$('a[href^=mailto:]').each(function(){
					var mail = $(this).attr('href').replace('mailto:','');
					var replaced = mail.replace('/at/','@');
					$(this).attr('href','mailto:'+replaced);
					if($(this).text() == mail) {
						$(this).text(replaced);
					}
				});
			},
			labels : function(){
				$('.search-a label').compactize();
				$('.newsletter-b label').compactize();
				$('.member-password-a label').compactize();
				$('.shipping-code label').compactize();
			}
		},
		ui : {
			sfrotator : function(){
				$('.list-a').css({'float': 'none'});
				$('.list-a').sfRotator({
					'autorotate' : true
				});
				/*
				$('.list-a').sfRotator( { 
				'autorotate' : false,
				
				'effectIn' : 'slide', 
				'optionsIn' : { 
					'direction' : 'right' 
				}, 
				'speedIn': 'slow',
				
				'effectOut' : 'slide', 
				'optionsOut' : { 
					'direction' : 'left'
				},
				'speedOut': 'slow'
				});
				*/
			},
			equalheights : function(){
				$('div#main').find('.products-a').equalHeights();
			},
			listcolors : function(){
				$('#main ol li:nth-child(2n+1)').css({'background-color': '#edebf4'});
				$('#main ul li:nth-child(2n+1)').css({'background-color': '#edebf4'});
			},
			calendar : function(){
				$('#events-a').sfCalendar({
					label : 'sfCalendar',
					defaultView : 'month',
					asideWrapper : '#events-aside',
					cityFilter : true
				});	
				
				$('.city-filter').before('<p>Refine search by choosing City or Tags</p>')
			}
		},
		fixes : {
			blog : function(){
				// no comments/trackbacks + alternative
				var $comments = $('div.comments-a');
				$comments.each(function(){
					if($(this).find('div.comment').length == 0){
						var fixed = $(this).html().replace('</h2>','</h2><p class="empty">') + '</p>';
						$(this).html(fixed);
					} else {
						$(this).find('div.comment:odd').addClass('alt');
					}
				});
				
				// show/hide comments/trackbacks
				var $links = $('div.post-a p.info a.comments, div.post-a p.info a.trackbacks');
				$links.click(function(){
					$($(this).hrefId()).toggle();
					if($(this).is('.comments')) $($(this).hrefId()).next('div.add-comment-a:first').toggle();
					return false;
				});
			
				// single post (show trackbacks and comments)
				if($('div.post-a').length == 1){
					$('div.comments-a, div.add-comment-a').show();
				}
			},
			
			
			ecom : function(){
				
				// for cart amount in header
				 if ($('#catCartSummary .cartSummaryItem').html() != 'Shopping cart is empty.') {
							   var summary = $('#catCartSummary .cartSummaryItem').text().split(" ");
							   // url = $('#user-options .cart a').attr('href');
							
							   $("li#topnav-shopping-cart a").text("VIEW CART ("+summary[0]+") Items");
							   
						  }else{
							  
							  $("li#topnav-shopping-cart a").text("VIEW CART (0) Items");
							  
						  }  
				
				// product detail
				if(typeof(productDetailRewrite) !== 'undefined') { 
					
						$("td.productPopletsItem").css("margin-left","5px"); // add margin to poplet
						$("td.productPopletsItem:first").css("margin-left","0px");   // bump first poplet
						
						$("td.productPopletsItem:nth-child(5)").css("margin-left","0px"); // bump first poplet 5th
						
						$("div#main-container h2:first").text($("h3.prodTitle").text()); // product title
						
						// related products
						if($("div#relatedProdContainer table.productTable").length === 1){
						   $("div#relatedProdContainer").show();
						}
						
					
				}
				
				
				// not product detail
				if(typeof(productDetailRewrite) === 'undefined') { // not product detail and perhaps cat
					
					$("ul.catalogueList").show(); // show sub cats
					
					if($(".catalogueItemNotFound").length === 1){ // if none hide subcats
    					$("ul.catalogueList").hide();
					}
					
					// show name of cat
					var catTitle = $("h2.catTitle").text();
					if(catTitle){
						$("div#main-container h2:first").text($("h2.catTitle").text());
					}
					
				}
				
				
				
			},// ecom 
			
			homepageOddClass : function(){ // adds odd class for on/off of class for events
				$(".box-a-see-belinda-live ul li:even").addClass("odd");	
			},
			
			loginPeep : function(){
				$(".alert-b a, .alert-c a").click(function(){
					$("div.member-area-signup, div.member-area-login, div.member-area-lostpwd, p.alert-c, p.alert-b").slideToggle();
					return false;
				});	
			},// loginPeep
			
			fakeCrumbs : function(){
				if(window.location.href.indexOf("OrderRetrievev2") != -1){
					$("div.breadcrumbs").html("<p><a href='/'>Home</a> | <a href='/products'>Products</a> |&nbsp;&nbsp;View Cart</p>");			
				}
				
				if(window.location.href.indexOf("products") != -1){
					$("div.breadcrumbs").html("<p><a href='/'>Home</a> | <a href='/products'>Products</a></p>");			
				}
				
			},//fakeCartCrumbs
			
			subNavAction : function(){
				// side nav collapse
				if($(".nav-d ul li.selected")){
				 $(".nav-d ul li.selected ul").show();
				}	
			},// subNavAction
			
			firstClass : function(){
				$("ul#nav_542610 li:first, div.nav-b li:first").addClass("first");	
			},
			
			cart : function(){
				if(window.location.href.indexOf("OrderRetrievev2") != -1){
					$("td.removeLink a").each(function(){
						$(this).addClass("remove");
					});	
					
					$("body").attr("id","");
				}
			},
			
			checkout : function(){
				$("p.price-a").text($("input#Amount").val());	
				
				// -----------------------------------------------------
				// This will copy over the shipping address value to the 
				// billing address.  Make sure the checkbox Id is "SameAsShipping"
				//
				// * Update - changed to check length and clear fields on unchecked
				// -----------------------------------------------------	
				$("#SameAsShipping").bind("change", function(e){
					
					var n = $("#SameAsShipping:checked").length
						if(n == 0){
							
							$("#BillingAddress").val('');
							$("#BillingCity").val('');
							$("#BillingState").val('');
							$("#BillingZip").val('');
							$("#BillingPhone").val('');
						}else{
							
							
							$("#BillingAddress").val($("#ShippingAddress").val());
							$("#BillingCity").val($("#ShippingCity").val());
							$("#BillingState").val($("#ShippingState").val());
							$("#BillingZip").val($("#ShippingZip").val());
							$("#BillingPhone").val($("#ShippingPhone").val());
						}
				
				});
				
				 if ($('input#Amount').val() === '0.00') {
									$('#PaymentMethodType_9').attr('checked','checked');
									   $('#credit-card-information').css('display','none');    
									   // alert($('input#Amount').val());    
									   }else{
										
										//console.log('nope not zero');
									}
				

				
				
			},
			
			leftColNavBg : function(){
				if(window.location.href.indexOf("services") != -1){
					$(".nav-d ul:first").css("background","none");
				}
			}, // leftColNavBg
			
			showLeftCol : function(){
				if(window.location.href.indexOf("events") -1){
					$("div#side div.box-a").show();	
				}
			},
			
			eventsHumanCheck : function(){
				
				jQuery("div.day").each(function(){
					jQuery(this).find("button.eventSubmit").click(function(){
						var inputValue = jQuery("input#persons").val();
						if(inputValue == "" || inputValue == "0"){
							alert("Sorry you must enter how many people are attending");
							return false;
							console.log(inputValue);
						}else{
							return;
						}
					});
				});

				
			},// eventsHumanCheck
			
			eventsApp : function(){
				
				$.cookie('theEvent',null);
				$.cookie('howMany',null);
				$.cookie('howMuch',null);
				
				//console.log($.cookie('theEvent'));
				//console.log($.cookie('howMany'));
				
				$("div#events-a div.day").each(function(){
					
					var theEvent = $(this).find("div.eventIDContainer").text();
					var howMuch = $(this).find("div.eventCostContainer").text();
														
														
					$(this).find(".eventSubmit").click(function(){
					
						$.cookie('theEvent',theEvent);
						$.cookie('howMuch',howMuch);
						
						return true;
					
					 });
				});

			
			} // eventsApp
		}	
	};

	Engine.utils.links();
	Engine.utils.mails();
	Engine.utils.labels();
	Engine.ui.sfrotator();
	Engine.ui.equalheights();
	Engine.ui.listcolors();
	Engine.ui.calendar();
	Engine.fixes.blog();	
	Engine.fixes.ecom();
	Engine.fixes.homepageOddClass();
	Engine.fixes.loginPeep();
	Engine.fixes.fakeCrumbs();
	Engine.fixes.subNavAction();
	Engine.fixes.firstClass();
	Engine.fixes.cart();
	Engine.fixes.checkout();
	Engine.fixes.leftColNavBg();
	Engine.fixes.showLeftCol();
	//Engine.fixes.eventsHumanCheck();
	Engine.fixes.eventsApp();
	

	
});
