var allUIMenus=[];$.fn.menu=function(b){b=b;var c=new Menu(this,b);allUIMenus.push(c);$(this).mousedown(function(){c.menuOpen||c.showLoading()}).click(function(){c.menuOpen==false?c.showMenu():c.kill();return false})};
function Menu(b,c){var e=this;b=$(b);var d=$('<div class="fg-menu-container ui-widget ui-widget-content ui-corner-all">'+c.content+"</div>");this.menuExists=this.menuOpen=false;c=jQuery.extend({content:null,width:180,maxHeight:180,positionOpts:{posX:"left",posY:"bottom",offsetX:0,offsetY:0,directionH:"right",directionV:"down",detectH:true,detectV:true,linkToFront:false},showSpeed:200,callerOnState:"ui-state-active",loadingState:"ui-state-loading",linkHover:"ui-state-hover",linkHoverSecondary:"li-hover",
crossSpeed:200,crumbDefaultText:"Choose an option:",backLink:true,backLinkText:"Back",flyOut:false,flyOutOnState:"ui-state-default",nextMenuLink:"ui-icon-triangle-1-e",topLinkText:"All",nextCrumbLink:"ui-icon-carat-1-e"},c);var f=function(){$.each(allUIMenus,function(a){allUIMenus[a].menuOpen&&allUIMenus[a].kill()})};this.kill=function(){b.removeClass(c.loadingState).removeClass("fg-menu-open").removeClass(c.callerOnState);d.find("li").removeClass(c.linkHoverSecondary).find("a").removeClass(c.linkHover);
c.flyOutOnState&&d.find("li a").removeClass(c.flyOutOnState);c.callerOnState&&b.removeClass(c.callerOnState);d.is(".fg-menu-ipod")&&e.resetDrilldownMenu();d.is(".fg-menu-flyout")&&e.resetFlyoutMenu();d.parent().hide();e.menuOpen=false;$(document).unbind("click",f);$(document).unbind("keydown")};this.showLoading=function(){b.addClass(c.loadingState)};this.showMenu=function(){f();e.menuExists||e.create();b.addClass("fg-menu-open").addClass(c.callerOnState);d.parent().show().click(function(){e.kill();
return false});d.hide().slideDown(c.showSpeed).find(".fg-menu:eq(0)");e.menuOpen=true;b.removeClass(c.loadingState);$(document).click(f);$(document).keydown(function(a){var g;if(a.which!="")g=a.which;else if(a.charCode!="")g=a.charCode;else if(a.keyCode!="")g=a.keyCode;var i=$(a.target).parents("div").is(".fg-menu-flyout")?"flyout":"ipod";switch(g){case 37:if(i=="flyout"){$(a.target).trigger("mouseout");$("."+c.flyOutOnState).size()>0&&$("."+c.flyOutOnState).trigger("mouseover")}if(i=="ipod"){$(a.target).trigger("mouseout");
$(".fg-menu-footer").find("a").size()>0&&$(".fg-menu-footer").find("a").trigger("click");$(".fg-menu-header").find("a").size()>0&&$(".fg-menu-current-crumb").prev().find("a").trigger("click");$(".fg-menu-current").prev().is(".fg-menu-indicator")&&$(".fg-menu-current").prev().trigger("mouseover")}return false;case 38:if($(a.target).is("."+c.linkHover)){g=$(a.target).parent().prev().find("a:eq(0)");if(g.size()>0){$(a.target).trigger("mouseout");g.trigger("mouseover")}}else d.find("a:eq(0)").trigger("mouseover");
return false;case 39:if($(a.target).is(".fg-menu-indicator"))if(i=="flyout")$(a.target).next().find("a:eq(0)").trigger("mouseover");else if(i=="ipod"){$(a.target).trigger("click");setTimeout(function(){$(a.target).next().find("a:eq(0)").trigger("mouseover")},c.crossSpeed)}return false;case 40:if($(a.target).is("."+c.linkHover)){g=$(a.target).parent().next().find("a:eq(0)");if(g.size()>0){$(a.target).trigger("mouseout");g.trigger("mouseover")}}else d.find("a:eq(0)").trigger("mouseover");return false;
case 27:f();break;case 13:if($(a.target).is(".fg-menu-indicator")&&i=="ipod"){$(a.target).trigger("click");setTimeout(function(){$(a.target).next().find("a:eq(0)").trigger("mouseover")},c.crossSpeed)}}})};this.create=function(){d.css({width:c.width}).appendTo("body").find("ul:first").not(".fg-menu-breadcrumb").addClass("fg-menu");d.find("ul, li a").addClass("ui-corner-all");d.find("ul").attr("role","menu").eq(0).attr("aria-activedescendant","active-menuitem").attr("aria-labelledby",b.attr("id"));
d.find("li").attr("role","menuitem");d.find("li:has(ul)").attr("aria-haspopup","true").find("ul").attr("aria-expanded","false");d.find("a").attr("tabindex","-1");if(d.find("ul").size()>1)c.flyOut?e.flyout(d,c):e.drilldown(d,c);else d.find("a").click(function(){e.chooseItem(this);return false});c.linkHover&&d.find(".fg-menu li a").hover(function(){$(this);$("."+c.linkHover).removeClass(c.linkHover).blur().parent().removeAttr("id");$(this).addClass(c.linkHover).focus().parent().attr("id","active-menuitem")},
function(){$(this).removeClass(c.linkHover).blur().parent().removeAttr("id")});c.linkHoverSecondary&&d.find(".fg-menu li").hover(function(){$(this).siblings("li").removeClass(c.linkHoverSecondary);c.flyOutOnState&&$(this).siblings("li").find("a").removeClass(c.flyOutOnState);$(this).addClass(c.linkHoverSecondary)},function(){$(this).removeClass(c.linkHoverSecondary)});e.setPosition(d,b,c);e.menuExists=true};this.chooseItem=function(a){e.kill();$("#menuSelection").text($(a).text());location.href=$(a).attr("href")}}
Menu.prototype.flyout=function(b,c){var e=this;this.resetFlyoutMenu=function(){b.find("ul ul").removeClass("ui-widget-content").hide()};b.addClass("fg-menu-flyout").find("li:has(ul)").each(function(){var d=b.width(),f,a,g=$(this).find("ul");g.css({left:d,width:d}).hide();$(this).find("a:eq(0)").addClass("fg-menu-indicator").html("<span>"+$(this).find("a:eq(0)").text()+'</span><span class="ui-icon '+c.nextMenuLink+'"></span>').hover(function(){clearTimeout(a);var i=$(this).next();fitVertical(i,$(this).offset().top)||
i.css({top:"auto",bottom:0});fitHorizontal(i,$(this).offset().left+100)||i.css({left:"auto",right:d,"z-index":999});f=setTimeout(function(){i.addClass("ui-widget-content").show(c.showSpeed).attr("aria-expanded","true")},300)},function(){clearTimeout(f);var i=$(this).next();a=setTimeout(function(){i.removeClass("ui-widget-content").hide(c.showSpeed).attr("aria-expanded","false")},400)});$(this).find("ul a").hover(function(){clearTimeout(a);$(this).parents("ul").prev().is("a.fg-menu-indicator")&&$(this).parents("ul").prev().addClass(c.flyOutOnState)},
function(){a=setTimeout(function(){g.hide(c.showSpeed);b.find(c.flyOutOnState).removeClass(c.flyOutOnState)},500)})});b.find("a").click(function(){e.chooseItem(this);return false})};
Menu.prototype.drilldown=function(b,c){var e=this,d=b.find(".fg-menu"),f=$('<ul class="fg-menu-breadcrumb ui-widget-header ui-corner-all ui-helper-clearfix"></ul>'),a=$('<li class="fg-menu-breadcrumb-text">'+c.crumbDefaultText+"</li>"),g=$('<li class="'+(c.backLink?"fg-menu-prev-list":"fg-menu-all-lists")+'"><a href="#" class="'+(c.backLink?"ui-state-default ui-corner-all":"")+'">'+(c.backLink?'<span class="ui-icon ui-icon-triangle-1-w"></span>':"")+(c.backLink?c.backLinkText:c.topLinkText)+"</a></li>");
b.addClass("fg-menu-ipod");c.backLink?f.addClass("fg-menu-footer").appendTo(b).hide():f.addClass("fg-menu-header").prependTo(b);f.append(a);var i=function(h){h.height()>c.maxHeight&&h.addClass("fg-menu-scroll");h.css({height:c.maxHeight})},j=function(h){h.removeClass("fg-menu-scroll").removeClass("fg-menu-current").height("auto")};this.resetDrilldownMenu=function(){$(".fg-menu-current").removeClass("fg-menu-current");d.animate({left:0},c.crossSpeed,function(){$(this).find("ul").each(function(){$(this).hide();
j($(this))});d.addClass("fg-menu-current")});$(".fg-menu-all-lists").find("span").remove();f.empty().append(a);$(".fg-menu-footer").empty().hide();i(d)};d.addClass("fg-menu-content fg-menu-current ui-widget-content ui-helper-clearfix").css({width:b.width()}).find("ul").css({width:b.width(),left:b.width()}).addClass("ui-widget-content").hide();i(d);d.find("a").each(function(){$(this).next().is("ul")?$(this).addClass("fg-menu-indicator").each(function(){$(this).html("<span>"+$(this).text()+'</span><span class="ui-icon '+
c.nextMenuLink+'"></span>')}).click(function(){var h=$(this).next(),k=$(this).parents("ul:eq(0)"),l=k.is(".fg-menu-content")?0:parseFloat(d.css("left"));l=Math.round(l-parseFloat(b.width()));var o=$(".fg-menu-footer");j(k);i(h);d.animate({left:l},c.crossSpeed);h.show().addClass("fg-menu-current").attr("aria-expanded","true");var q=function(m){var n=$(".fg-menu-current"),p=n.parents("ul:eq(0)");n.hide().attr("aria-expanded","false");j(n);i(p);p.addClass("fg-menu-current").attr("aria-expanded","true");
if(p.hasClass("fg-menu-content")){m.remove();o.hide()}};if(c.backLink){if(o.find("a").size()==0){o.show();$('<a href="#"><span class="ui-icon ui-icon-triangle-1-w"></span> <span>Back</span></a>').appendTo(o).click(function(){var m=$(this),n=parseFloat(d.css("left"))+b.width();d.animate({left:n},c.crossSpeed,function(){q(m)});return false})}}else{if(f.find("li").size()==1){f.empty().append(g);g.find("a").click(function(){e.resetDrilldownMenu();return false})}$(".fg-menu-current-crumb").removeClass("fg-menu-current-crumb");
h=$(this).find("span:eq(0)").text();h=$('<li class="fg-menu-current-crumb"><a href="javascript://" class="fg-menu-crumb">'+h+"</a></li>");h.appendTo(f).find("a").click(function(){if($(this).parent().is(".fg-menu-current-crumb"))e.chooseItem(this);else{var m=-($(".fg-menu-current").parents("ul").size()-1)*180;d.animate({left:m},c.crossSpeed,function(){q()});$(this).parent().addClass("fg-menu-current-crumb").find("span").remove();$(this).parent().nextAll().remove()}return false});h.prev().append(' <span class="ui-icon '+
c.nextCrumbLink+'"></span>')}return false}):$(this).click(function(){e.chooseItem(this);return false})})};
Menu.prototype.setPosition=function(b,c,e){var d={refX:c.offset().left,refY:c.offset().top,refW:c.getTotalWidth(),refH:c.getTotalHeight()},f,a,g=$('<div class="positionHelper"></div>');g.css({position:"absolute",left:d.refX,top:d.refY,width:d.refW,height:d.refH});b.wrap(g);switch(e.positionOpts.posX){case "left":f=0;break;case "center":f=d.refW/2;break;case "right":f=d.refW}switch(e.positionOpts.posY){case "top":a=0;break;case "center":a=d.refH/2;break;case "bottom":a=d.refH}f+=e.positionOpts.offsetX;
a+=e.positionOpts.offsetY;if(e.positionOpts.directionV=="up"){b.css({top:"auto",bottom:a});e.positionOpts.detectV&&!fitVertical(b)&&b.css({bottom:"auto",top:a})}else{b.css({bottom:"auto",top:a});e.positionOpts.detectV&&!fitVertical(b)&&b.css({top:"auto",bottom:a})}if(e.positionOpts.directionH=="left"){b.css({left:"auto",right:f});e.positionOpts.detectH&&!fitHorizontal(b)&&b.css({right:"auto",left:f})}else{b.css({right:"auto",left:f});e.positionOpts.detectH&&!fitHorizontal(b)&&b.css({left:"auto",right:f})}e.positionOpts.linkToFront&&
c.clone().addClass("linkClone").css({position:"absolute",top:0,right:"auto",bottom:"auto",left:0,width:c.width(),height:c.height()}).insertAfter(b)};function sortBigToSmall(b,c){return c-b}jQuery.fn.getTotalWidth=function(){return $(this).width()+parseInt($(this).css("paddingRight"))+parseInt($(this).css("paddingLeft"))+parseInt($(this).css("borderRightWidth"))+parseInt($(this).css("borderLeftWidth"))};
jQuery.fn.getTotalHeight=function(){return $(this).height()+parseInt($(this).css("paddingTop"))+parseInt($(this).css("paddingBottom"))+parseInt($(this).css("borderTopWidth"))+parseInt($(this).css("borderBottomWidth"))};function getScrollTop(){return self.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop}function getScrollLeft(){return self.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft}
function getWindowHeight(){var b=document.documentElement;return self.innerHeight||b&&b.clientHeight||document.body.clientHeight}function getWindowWidth(){var b=document.documentElement;return self.innerWidth||b&&b.clientWidth||document.body.clientWidth}function fitHorizontal(b,c){var e=parseInt(c)||$(b).offset().left;return e+$(b).width()<=getWindowWidth()+getScrollLeft()&&e-getScrollLeft()>=0}
function fitVertical(b,c){var e=parseInt(c)||$(b).offset().top;return e+$(b).height()<=getWindowHeight()+getScrollTop()&&e-getScrollTop()>=0}
Number.prototype.pxToEm=String.prototype.pxToEm=function(b){b=jQuery.extend({scope:"body",reverse:false},b);var c=this==""?0:parseFloat(this),e;e=function(){var d=document.documentElement;return self.innerWidth||d&&d.clientWidth||document.body.clientWidth};e=b.scope=="body"&&$.browser.msie&&(parseFloat($("body").css("font-size"))/e()).toFixed(1)>0?(parseFloat($("body").css("font-size"))/e()).toFixed(3)*16:parseFloat(jQuery(b.scope).css("font-size"));return b.reverse==true?(c*e).toFixed(2)+"px":(c/
e).toFixed(2)+"em"};(function(b){var c=b.browser.msie&&parseInt(b.browser.version)===6&&typeof window.XMLHttpRequest!=="object",e=b.browser.msie&&parseInt(b.browser.version)===7,d=null,f=[];b.modal=function(a,g){return b.modal.impl.init(a,g)};b.modal.close=function(){b.modal.impl.close()};b.modal.focus=function(a){b.modal.impl.focus(a)};b.modal.setContainerDimensions=function(){b.modal.impl.setContainerDimensions()};b.modal.setPosition=function(){b.modal.impl.setPosition()};b.modal.update=function(a,g){b.modal.impl.update(a,
g)};b.fn.modal=function(a){return b.modal.impl.init(this,a)};b.modal.defaults={appendTo:"body",focus:true,opacity:50,overlayId:"simplemodal-overlay",overlayCss:{},containerId:"simplemodal-container",containerCss:{},dataId:"simplemodal-data",dataCss:{},minHeight:null,minWidth:null,maxHeight:null,maxWidth:null,autoResize:false,autoPosition:true,zIndex:1E3,close:true,closeHTML:'<a class="modalCloseImg" title="Close"></a>',closeClass:"simplemodal-close",escClose:true,overlayClose:false,position:null,
persist:false,modal:true,onOpen:null,onShow:null,onClose:null};b.modal.impl={d:{},init:function(a,g){if(this.d.data)return false;d=b.browser.msie&&!b.boxModel;this.o=b.extend({},b.modal.defaults,g);this.zIndex=this.o.zIndex;this.occb=false;if(typeof a==="object"){a=a instanceof jQuery?a:b(a);this.d.placeholder=false;if(a.parent().parent().size()>0){a.before(b("<span></span>").attr("id","simplemodal-placeholder").css({display:"none"}));this.d.placeholder=true;this.display=a.css("display");if(!this.o.persist)this.d.orig=
a.clone(true)}}else if(typeof a==="string"||typeof a==="number")a=b("<div></div>").html(a);else{alert("SimpleModal Error: Unsupported data type: "+typeof a);return this}this.create(a);this.open();b.isFunction(this.o.onShow)&&this.o.onShow.apply(this,[this.d]);return this},create:function(a){f=this.getDimensions();if(this.o.modal&&c)this.d.iframe=b('<iframe src="javascript:false;"></iframe>').css(b.extend(this.o.iframeCss,{display:"none",opacity:0,position:"fixed",height:f[0],width:f[1],zIndex:this.o.zIndex,
top:0,left:0})).appendTo(this.o.appendTo);this.d.overlay=b("<div></div>").attr("id",this.o.overlayId).addClass("simplemodal-overlay").css(b.extend(this.o.overlayCss,{display:"none",opacity:this.o.opacity/100,height:this.o.modal?f[0]:0,width:this.o.modal?f[1]:0,position:"fixed",left:0,top:0,zIndex:this.o.zIndex+1})).appendTo(this.o.appendTo);this.d.container=b("<div></div>").attr("id",this.o.containerId).addClass("simplemodal-container").css(b.extend(this.o.containerCss,{display:"none",position:"fixed",
zIndex:this.o.zIndex+2})).append(this.o.close&&this.o.closeHTML?b(this.o.closeHTML).addClass(this.o.closeClass):"").appendTo(this.o.appendTo);this.d.wrap=b("<div></div>").attr("tabIndex",-1).addClass("simplemodal-wrap").css({height:"100%",outline:0,width:"100%"}).appendTo(this.d.container);this.d.data=a.attr("id",a.attr("id")||this.o.dataId).addClass("simplemodal-data").css(b.extend(this.o.dataCss,{display:"none"})).appendTo("body");this.setContainerDimensions();this.d.data.appendTo(this.d.wrap);
if(c||d)this.fixIE()},bindEvents:function(){var a=this;b("."+a.o.closeClass).bind("click.simplemodal",function(g){g.preventDefault();a.close()});a.o.modal&&a.o.close&&a.o.overlayClose&&a.d.overlay.bind("click.simplemodal",function(g){g.preventDefault();a.close()});b(document).bind("keydown.simplemodal",function(g){if(a.o.modal&&g.keyCode===9)a.watchTab(g);else if(a.o.close&&a.o.escClose&&g.keyCode===27){g.preventDefault();a.close()}});b(window).bind("resize.simplemodal",function(){f=a.getDimensions();
a.o.autoResize?a.setContainerDimensions():a.o.autoPosition&&a.setPosition();if(c||d)a.fixIE();else if(a.o.modal){a.d.iframe&&a.d.iframe.css({height:f[0],width:f[1]});a.d.overlay.css({height:f[0],width:f[1]})}})},unbindEvents:function(){b("."+this.o.closeClass).unbind("click.simplemodal");b(document).unbind("keydown.simplemodal");b(window).unbind("resize.simplemodal");this.d.overlay.unbind("click.simplemodal")},fixIE:function(){var a=this.o.position;b.each([this.d.iframe||null,!this.o.modal?null:this.d.overlay,
this.d.container],function(g,i){if(i){var j=i[0].style;j.position="absolute";if(g<2){j.removeExpression("height");j.removeExpression("width");j.setExpression("height",'document.body.scrollHeight > document.body.clientHeight ? document.body.scrollHeight : document.body.clientHeight + "px"');j.setExpression("width",'document.body.scrollWidth > document.body.clientWidth ? document.body.scrollWidth : document.body.clientWidth + "px"')}else{var h;if(a&&a.constructor===Array){g=a[0]?typeof a[0]==="number"?
a[0].toString():a[0].replace(/px/,""):i.css("top").replace(/px/,"");g=g.indexOf("%")===-1?g+' + (t = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"':parseInt(g.replace(/%/,""))+' * ((document.documentElement.clientHeight || document.body.clientHeight) / 100) + (t = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"';if(a[1]){h=typeof a[1]==="number"?a[1].toString():a[1].replace(/px/,"");
h=h.indexOf("%")===-1?h+' + (t = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) + "px"':parseInt(h.replace(/%/,""))+' * ((document.documentElement.clientWidth || document.body.clientWidth) / 100) + (t = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) + "px"'}}else{g='(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (t = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"';
h='(document.documentElement.clientWidth || document.body.clientWidth) / 2 - (this.offsetWidth / 2) + (t = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) + "px"'}j.removeExpression("top");j.removeExpression("left");j.setExpression("top",g);j.setExpression("left",h)}}})},focus:function(a){var g=this;a=a&&b.inArray(a,["first","last"])!==-1?a:"first";var i=b(":input:enabled:visible:"+a,g.d.wrap);setTimeout(function(){i.length>0?i.focus():g.d.wrap.focus()},
10)},getDimensions:function(){var a=b(window);return[b.browser.opera&&b.browser.version>"9.5"&&b.fn.jquery<"1.3"||b.browser.opera&&b.browser.version<"9.5"&&b.fn.jquery>"1.2.6"?a[0].innerHeight:a.height(),a.width()]},getVal:function(a,g){return a?typeof a==="number"?a:a==="auto"?0:a.indexOf("%")>0?parseInt(a.replace(/%/,""))/100*(g==="h"?f[0]:f[1]):parseInt(a.replace(/px/,"")):null},update:function(a,g){if(!this.d.data)return false;this.d.origHeight=this.getVal(a,"h");this.d.origWidth=this.getVal(g,
"w");this.d.data.hide();a&&this.d.container.css("height",a);g&&this.d.container.css("width",g);this.setContainerDimensions();this.d.data.show();this.o.focus&&this.focus();this.unbindEvents();this.bindEvents()},setContainerDimensions:function(){var a=c||e,g=this.d.origHeight?this.d.origHeight:b.browser.opera?this.d.container.height():this.getVal(a?this.d.container[0].currentStyle.height:this.d.container.css("height"),"h");a=this.d.origWidth?this.d.origWidth:b.browser.opera?this.d.container.width():
this.getVal(a?this.d.container[0].currentStyle.width:this.d.container.css("width"),"w");var i=this.d.data.outerHeight(true),j=this.d.data.outerWidth(true);this.d.origHeight=this.d.origHeight||g;this.d.origWidth=this.d.origWidth||a;var h=this.o.maxHeight?this.getVal(this.o.maxHeight,"h"):null,k=this.o.maxWidth?this.getVal(this.o.maxWidth,"w"):null;h=h&&h<f[0]?h:f[0];k=k&&k<f[1]?k:f[1];var l=this.o.minHeight?this.getVal(this.o.minHeight,"h"):"auto";g=g?this.o.autoResize&&g>h?h:g<l?l:g:i?i>h?h:this.o.minHeight&&
l!=="auto"&&i<l?l:i:l;h=this.o.minWidth?this.getVal(this.o.minWidth,"w"):"auto";a=a?this.o.autoResize&&a>k?k:a<h?h:a:j?j>k?k:this.o.minWidth&&h!=="auto"&&j<h?h:j:h;this.d.container.css({height:g,width:a});this.d.wrap.css({overflow:i>g||j>a?"auto":"visible"});this.o.autoPosition&&this.setPosition()},setPosition:function(){var a,g;a=f[0]/2-this.d.container.outerHeight(true)/2;g=f[1]/2-this.d.container.outerWidth(true)/2;if(this.o.position&&Object.prototype.toString.call(this.o.position)==="[object Array]"){a=
this.o.position[0]||a;g=this.o.position[1]||g}this.d.container.css({left:g,top:a})},watchTab:function(a){if(b(a.target).parents(".simplemodal-container").length>0){this.inputs=b(":input:enabled:visible:first, :input:enabled:visible:last",this.d.data[0]);if(!a.shiftKey&&a.target===this.inputs[this.inputs.length-1]||a.shiftKey&&a.target===this.inputs[0]||this.inputs.length===0){a.preventDefault();this.focus(a.shiftKey?"last":"first")}}else{a.preventDefault();this.focus()}},open:function(){this.d.iframe&&
this.d.iframe.show();if(b.isFunction(this.o.onOpen))this.o.onOpen.apply(this,[this.d]);else{this.d.overlay.show();this.d.container.show();this.d.data.show()}this.o.focus&&this.focus();this.bindEvents()},close:function(){var a=this;if(!a.d.data)return false;a.unbindEvents();if(b.isFunction(a.o.onClose)&&!a.occb){a.occb=true;a.o.onClose.apply(a,[a.d])}else{if(a.d.placeholder){var g=b("#simplemodal-placeholder");if(a.o.persist)g.replaceWith(a.d.data.removeClass("simplemodal-data").css("display",a.display));
else{a.d.data.hide().remove();g.replaceWith(a.d.orig)}}else a.d.data.hide().remove();a.d.container.hide().remove();a.d.overlay.hide();a.d.iframe&&a.d.iframe.hide().remove();setTimeout(function(){a.d.overlay.remove();a.d={}},10)}}}})(jQuery);String.prototype.parseURL=function(){return this.replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&\?\/.=]+/g,function(b){return b.link(b)})};String.prototype.parseUsername=function(){return this.replace(/[@]+[A-Za-z0-9-_]+/g,function(b){var c=b.replace("@","");return b.link("http://twitter.com/"+c)})};String.prototype.parseHashtag=function(){return this.replace(/[#]+[A-Za-z0-9-_]+/g,function(b){var c=b.replace("#","%23");return b.link("http://search.twitter.com/search?q="+c)})};
function parseUri(b){var c=parseUri.options;b=c.parser[c.strictMode?"strict":"loose"].exec(b);for(var e={},d=14;d--;)e[c.key[d]]=b[d]||"";e[c.q.name]={};e[c.key[12]].replace(c.q.parser,function(f,a,g){if(a)e[c.q.name][a]=g});return e}
parseUri.options={strictMode:false,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}};
function typeOf(b){var c=typeof b;if(c==="object")if(b){if(typeof b.length==="number"&&!b.propertyIsEnumerable("length")&&typeof b.splice==="function")c="array"}else c="null";return c}var regex=/\{([\w\-\.\[\]]+)\}/gi;function parseFormat(b,c){currString=b;if(c)currString=c.replace(regex,function(e,d){return eval("currString."+d)});return currString}
function bindData(b,c,e){var d="";if(b.error)d=b.error.description;else{b=b.query.results;var f,a;for(a in b)if(b.hasOwnProperty(a)){f=b[a];break}if(f)if(f.length!==undefined)for(a=0;a<f.length;a++)d+=parseFormat(f[a],c);else d+=parseFormat(f,c);else d="No related information found."}$(e).html(d)}function bindDataTemplate(b,c){var e="";e+=parseFormat(b,c);return e}
function bindFBData(b,c,e){var d="";if(b.query===undefined||b.query.results===null||b.query.results.json===null)b=null;else{b=b.query.results.json.data;b=b===null?null:typeOf(b)==="object"?[b]:b}var f,a;if(b)for(var g=0;g<b.length;g++){c=b[g];f=c.type;a='<li><div class="yui3-g"><div class="yui3-u-1-8"><img class="fb-pic" src="http://graph.facebook.com/'+c.from.id+'/picture" /></div><div class="yui3-u-7-8">';if(f==="status")a=a.concat('<a href="http://www.facebook.com/profile.php?id='+c.from.id+'" class="fb-name">'+
c.from.name+"</a> "+c.message);else if(f==="photo"||f==="video"||f==="link"){if(c.caption&&c.caption.length>160)c.caption=c.caption.substr(0,160)+" ...";a=a.concat('<div class="yui3-g"><div class="yui3-u-17-24"><a href="http://www.facebook.com/profile.php?id='+c.from.id+'" id="'+c.from.id+'" class="fb-name fb-iframe">'+c.from.name+"</a> posted a "+c.type+'<br/><img class="fb-icon" src="'+c.icon+'" /> <a class="fb-post-name" href="'+c.link+'">'+c.name+"</a>");if(c.caption)a=a.concat(' <p class="fb-caption"> from '+
c.caption+"</p>");if((f==="video"||f==="link")&&c.description)a=a.concat("<p>"+c.description.substr(0,160)+"</p>");a=c.picture?a.concat('</div><div class="yui3-u-7-24"><img class="fb-picture" src="'+c.picture+'" /></div>'):a.concat('</div><div class="yui3-u-7-24">&nbsp;</div>')}d=d.concat(a+"</div></div></div></li>")}else d="No "+c+" related post found.";$(e).html("<ul>"+d+"</ul>")}
function fbYQLSearch(b,c){$.yql("select * from facebook.graph where q='#{search}' and type='post' limit 8",{search:b},function(e){bindFBData(e,b,c)})}
function flickrYQLSearch(b,c,e){$.yql("select * from flickr.photos.search where tags='#{tags}' and text='#{text}' and safe_search='1' and sort='relevance' limit 9",{search:b,tags:b,text:b},function(d){e==="m"?bindData(d,'<a class="fb-flickr" href="http://farm{farm}.static.flickr.com/{server}/{id}_{secret}_b.jpg" title="{title}"><img src="http://farm{farm}.static.flickr.com/{server}/{id}_{secret}_m.jpg" alt=""/></a> ',c):bindData(d,'<a class="fb-flickr" href="http://farm{farm}.static.flickr.com/{server}/{id}_{secret}.jpg" title="{title}"><img src="http://farm{farm}.static.flickr.com/{server}/{id}_{secret}_s.jpg" alt=""/></a> ',
c)})}function markupTweets(b){$(b).each(function(){html=$(this).html();html=html.parseURL().parseUsername().parseHashtag();$(this).html(html)})}function markupTwitterUserImage(b){$(b).each(function(){user=$(this).html();html='<img src="http://api.twitter.com/1/users/profile_image/'+user+'" title="'+user+'" /> '+user;$(this).html(html)})}
function twitterYQLSearch(b,c){$.yql("select * from twitter.search where q='#{search}' and lang='en' limit 8",{search:b},function(e){bindData(e,'<li><a href="http://twitter.com/{from_user}" title="{from_user}"><img src="{profile_image_url}" width="16" height="16" alt="" /> <strong>{from_user}</strong></a> <span class="tweet-text">{text}</span></li>',c);markupTweets(".tweet-text")})}
function deliciousYQLSearch(b,c){for(var e=b.split(" "),d="",f="",a="",g=0;g<e.length;){switch(g){case 0:d=e[0];break;case 1:f=e[1];break;case 2:a=e[2]}g++}$.yql("select * from delicious.feeds where tag='#{tag}' and tag2='#{tag2}' and tag3='#{tag3}' limit 8",{tag:d,tag2:f,tag3:a},function(i){bindData(i,'<li><a class="fb-iframe" href="{link}">{title}</a><div>Shared by <a class="fb-iframe" href="http://www.delicious.com/{creator}">{creator}</a></div></li>',c)})}
function updateFavIcon(b,c){c.attr("src",b)}function updateFavIcons(b,c,e){var d,f,a,g;$(b).each(function(){d=$(this).find(c).attr("href");f=parseUri(d);a="http://"+f.host+"/favicon.ico";g=$(this).find(e);updateFavIcon(a,g)})}function insertGoogleFavIcons(){updateFavIcons(".google-item",".google-url",".google-favicon")}function insertBingFavIcons(){updateFavIcons(".bing-item",".bing-url",".bing-favicon")}function insertYahooFavIcons(){updateFavIcons(".yahoo-item",".yahoo-url",".yahoo-favicon")}
function splitSearchTags(b){b=b.split(" ");for(var c=0;c<b.length;)c++}function drawPieChart(b,c,e){var d=new google.visualization.DataTable;d.addColumn("string",e);d.addColumn("number","Tweet Count");d.addRows(c);(new google.visualization.PieChart(document.getElementById(b))).draw(d,{title:e,legend:"right",width:600,height:300,titleFontSize:12})}
function drawColumnChart(b,c,e){var d=new google.visualization.DataTable;d.addColumn("string",b);for(var f=0;f<e.length;++f)d.addColumn("number",e[f][0]);d.addRows(e.length);for(f=0;f<e.length;++f)for(var a=1;a<e[f].length;++a)d.setValue(a-1,f+1,0);for(f=0;f<e.length;++f){d.setValue(f,0,e[f][0]);d.setValue(f,f+1,e[f][1])}(new google.visualization.ColumnChart(document.getElementById(c))).draw(d,{title:b,width:600,height:300,legend:"none",titleFontSize:12,isStacked:true})}
function renderPeriod(b,c){switch(c){case "a":drawColumnChart(b,"chart-1",data_a);$("#month-view, #week-view").addClass("hidden");$("#all-time-view").removeClass("hidden");$("#chart-tip").html("Showing tweets for All Time.");break;case "m":drawColumnChart(b,"chart-1",data_m);$("#all-time-view, #week-view").addClass("hidden");$("#month-view").removeClass("hidden");$("#chart-tip").html("Showing tweets for Last Month.");break;case "w":drawColumnChart(b,"chart-1",data_w);$("#month-view, #all-time-view").addClass("hidden");
$("#week-view").removeClass("hidden");$("#chart-tip").html("Showing tweets for Last Week.");break;default:drawColumnChart(b,"chart-1",data_a);$("#month-view, #week-view").addClass("hidden");$("#all-time-view").removeClass("hidden");$("#chart-tip").html("Showing tweets for All Time.")}};

