var jSING={utils:{getTargetID:function(item){var href=item.attr("href"),bits=href.split(/\//),id=bits[bits.length-1];if(id.charAt(0)=="#"){return id}else{return null}},getUrlAttr:function(key){key=key.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var regexS="[\\?&]"+key+"=([^&#]*)",regex=new RegExp(regexS),results=regex.exec(window.location.href);if(results==null){return""}else{return results[1]}}},navigation:{superfish:function(){var path="current";var navContainer=$("ul#site_nav");if(navContainer.length){var current_nav=navContainer.attr("class").match(/nav_[a-z]*/);if(current_nav==null||current_nav[0]=="nav_"){$("ul#site_nav li#nav_news").addClass(path)
}else{$("ul#site_nav li#"+current_nav[0]).addClass(path);$("ul#site_nav li#"+current_nav[0]+" > ul.secondary_nav").css("display","block")}$("ul#site_nav").superfish({pathClass:path,hoverClass:"hover",pathLevels:2,delay:1500,speed:"fastest",autoArrows:true,dropShadows:false})}},navPosition:function(){var wrapper_offset=$("#page_wrapper").offset(),nav_offset=844+wrapper_offset.left;$("ul.tertiary_nav").each(function(){var offset=$(this).offset();if(offset.left>nav_offset){$(this).addClass("shift_left")}});$("ul.quaternary_nav").each(function(){var offset=$(this).offset();if(offset.left>nav_offset){$(this).addClass("pop_left")
}})},init:function(){this.navPosition();this.superfish()}},login:{globalFormToggle:function(){var self=this;self.loginLink.click(function(e){e.preventDefault();self.globalSiteLogin.toggle()})},globalFormClose:function(){var self=this;self.closeLink.click(function(e){e.preventDefault();self.globalSiteLogin.hide()})},showGlobalLoadingIndicator:function(){var self=this,f=self.loginForm;self.loader.hide();f.fadeOut(200,function(){self.loader.insertAfter(f).fadeIn(200)})},hideGlobalLoadingIndicator:function(){var self=this;self.loader.fadeOut(200,function(){self.loginForm.fadeIn(200)})},showGlobalLoginError:function(){var self=this;
$('<div id="login_error">Please enter a correct username and password. Note that both fields are case-sensitive.</div>').appendTo(self.loginForm)},globalLoginSuccess:function(){if(window.location.pathname=="/accounts/logout/"){window.location="/"}else{window.location.reload()}},globalAjaxSubmit:function(){var self=this,f=self.loginForm;f.submit(function(e){e.preventDefault();self.showGlobalLoadingIndicator();$.ajax({type:"POST",url:self.loginFormAjaxAction,data:f.serialize(),success:function(results){if(results.search("wiggidy")!=-1){self.globalLoginSuccess()}else{self.hideGlobalLoadingIndicator();
self.showGlobalLoginError()}}})})},config:function(){var self=this;self.loginLink=$("#site_services_login");self.closeLink=$("#global_login_close");self.loginForm=$("#loginform1");self.loginFormAction=self.loginForm.attr("action");self.loginFormAjaxAction=self.loginFormAction.replace("/login/","/ajax_login/");self.loader=$('<div id="global_login_loading"><img src="'+jSINGconf.theme.CORP_MEDIA_URL+'/img/ajax-loader-video.gif" alt="Logging in" /><span class="logging_in">Logging in...</span></div>')},init:function(){var self=this;self.globalSiteLogin=$("#global_site_login");if(self.globalSiteLogin.length){self.config();
self.globalFormToggle();self.globalAjaxSubmit();self.globalFormClose()}}},carousels:{utils:{pauseAutoScrollOnHover:function(carousel){carousel.clip.hover(function(){carousel.stopAuto()},function(){carousel.startAuto()})}},alertBarCarousel:{doAlertBarCarousel:function(carousel){var controls="<div id='alert_bar_controls'><a href='#alert_bar_carousel' class='alert_bar_control alert_bar_prev'>Previous</a><div id='alert_bar_counter'><span id='alert_bar_counter_current'>1</span> of <span id='alert_bar_counter_total'>"+carousel.size()+"</span></div><a href='#alert_bar_carousel' class='alert_bar_control alert_bar_next'>Next</a></div>";
$("#alert_bar_clipper").prepend(controls);$("#alert_bar_controls a.alert_bar_prev").bind("click",function(){carousel.prev();carousel.startAuto(0);return false});$("#alert_bar_controls a.alert_bar_next").bind("click",function(){carousel.next();carousel.startAuto(0);return false});jSING.carousels.utils.pauseAutoScrollOnHover(carousel)},alertBarOnSlide:function(carousel,item,current_page,state){$("#alert_bar_counter_current").text(current_page)},init:function(){var alertBar=$("#alert_bar_carousel");if(alertBar.children().size()>1){alertBar.jcarousel({vertical:true,auto:6,animation:250,easing:"swing",scroll:1,wrap:"both",initCallback:this.doAlertBarCarousel,itemFirstInCallback:this.alertBarOnSlide,buttonNextHTML:null,buttonPrevHTML:null})
}}},skyboxCarousel:{doSkyboxCarousel:function(carousel){var pages=$("#skybox_carousel").children().size();var controls_list=$("#skybox_controls ul"),controls="<a href='#skybox_carousel' class='carousel_control carousel_prev' title='See previous group of skyboxes'>Previous</a><a href='#skybox_carousel' class='carousel_control carousel_next' title='See next group of skyboxes'>Next</a>";controls_list.after(controls);for(i=1;i<=pages;i++){controls_list.append("<li><a href='#skybox_wrapper' id='page"+i+"' title='Jump to Skybox page "+i+"'>"+i+"</a></li>")}$("#skybox_controls ul li:first-child").addClass("current");
$("#skybox_controls li").bind("click",function(){carousel.scroll($.jcarousel.intval($(this).text()));$("#skybox_controls li").each(function(){if($(this).hasClass("current")){$(this).removeClass("current")}});$(this).toggleClass("current");return false});$("#skybox_controls .carousel_next").bind("click",function(){carousel.next();jSING.apptap.execAppTapEvent(this,"Event64",false);return false});$("#skybox_controls .carousel_prev").bind("click",function(){carousel.prev();jSING.apptap.execAppTapEvent(this,"Event64",false);return false})},skyboxOnSlide:function(carousel,item,current_page,state){$("#skybox_controls ul li a").each(function(){if($(this).attr("id")=="page"+current_page){$(this).parent().addClass("current")
}else{$(this).parent().removeClass("current")}})},init:function(){var skyboxes=$("#skybox_carousel");if(skyboxes.children().size()>1){skyboxes.jcarousel({initCallback:this.doSkyboxCarousel,scroll:1,wrap:"both",buttonNextHTML:null,buttonPrevHTML:null,itemFirstInCallback:this.skyboxOnSlide})}}},posterCarousel:{doPosterCarousel:function(carousel){var pages=$("#poster").children().size(),controls_list=$("#poster_controls ul"),controls="<a href='#poster' class='carousel_control carousel_prev' title='See previous poster content'>Previous</a><a href='#poster' class='carousel_control carousel_next' title='See next poster content'>Next</a>";
controls_list.after(controls);for(i=1;i<=pages;i++){controls_list.append("<li><a href='#poster' id='page"+i+"' + title='See poster page: "+i+"'>"+i+"</a></li>")}$("#poster_controls ul li:first-child").addClass("current");$("#poster_controls li").bind("click",function(){carousel.scroll($.jcarousel.intval($(this).text()));$("#poster_controls li").each(function(){if($(this).hasClass("current")){$(this).removeClass("current")}});$(this).toggleClass("current");carousel.startAuto(0);return false});$("#poster_controls a.carousel_prev").bind("click",function(){carousel.prev();carousel.startAuto(0);jSING.apptap.execAppTapEvent(this,"Event65",false);
return false});$("#poster_controls a.carousel_next").bind("click",function(){carousel.next();carousel.startAuto(0);jSING.apptap.execAppTapEvent(this,"Event65",false);return false});jSING.carousels.utils.pauseAutoScrollOnHover(carousel)},posterOnSlide:function(carousel,item,current_page,state){$("#poster_controls ul li a").each(function(){if($(this).attr("id")=="page"+current_page){$(this).parent().addClass("current")}else{$(this).parent().removeClass("current")}})},init:function(){var poster=$("#poster");if(poster.children().size()>1){poster.jcarousel({auto:8,animation:250,easing:"linear",scroll:1,wrap:"both",initCallback:this.doPosterCarousel,itemFirstInCallback:this.posterOnSlide,buttonNextHTML:null,buttonPrevHTML:null})
}}},inlineCarousels:{doInlineGalleries:function(carousel){var re=/\d+/,photoGallery=carousel.container.parent(".inline_carousel_wrapper"),photoGalleryWrapper=photoGallery.parents(".inline_carousel").eq(0),photoGalleryUL=photoGallery.find("ul.story_gallery").eq(0),photoGalleryItemsTotal=re.exec(photoGalleryUL.attr("class"))[0],id=re.exec(photoGallery.attr("id"))[0];if(photoGallery.hasClass("fullwidth")){var inlineControls="<div class='gallery_controls'><a href='#'	 id='gallery_"+id+"_prev' class='carousel_control carousel_prev'>Previous</a><a href='#' id='gallery_"+id+"_next' class='carousel_control carousel_next'>Next</a></div>",inlineControlsPredecessor=photoGalleryWrapper.find("h4").eq(0)
}else{var inlineControls="<div class='controls_wrapper'><div class='gallery_controls_sidebar'><a href='#'	 id='gallery_"+id+"_prev' class='carousel_control carousel_prev'>Previous</a> <span class='gallery_index'><span class='gallery_index_current'>1</span> of <span class='gallery_index_total'>"+photoGalleryItemsTotal+"</span></span> <a href='#' id='gallery_"+id+"_next' class='carousel_control carousel_next'>Next</a></div></div>",inlineControlsPredecessor=photoGalleryUL}inlineControlsPredecessor.after(inlineControls);$("a#gallery_"+id+"_next").bind("click",function(){carousel.next();return false
});$("a#gallery_"+id+"_prev").bind("click",function(){carousel.prev();return false})},inlineGalleryFirstInCallback:function(carousel,item,idx,state){if(!carousel.container.parent(".inline_carousel_wrapper").hasClass("fullwidth")){if($(item).hasClass("gallery_inline_prompt")){idx="--"}carousel.container.find(".gallery_index_current").eq(0).html(idx)}},init:function(){var self=this,inlineCarousels=$(".inline_carousel");if(inlineCarousels.length){var galleryPrompts=$(".gallery_inline_prompt a");galleryPrompts.css({opacity:0.8});galleryPrompts.hover(function(){$(this).css({opacity:0.9})},function(){$(this).css({opacity:0.8})
});$(".inline_carousel_wrapper ul.story_gallery").each(function(){var photoGallery=$(this);if(photoGallery.parents(".story_gallery_wrapper").eq(0).hasClass("fullwidth")){var scrollNum=4}else{var scrollNum=1}photoGallery.jcarousel({initCallback:self.doInlineGalleries,animation:"fast",easing:"linear",scroll:scrollNum,wrap:"both",itemFirstInCallback:self.inlineGalleryFirstInCallback,buttonNextHTML:null,buttonPrevHTML:null})})}}},init:function(){var self=this;self.alertBarCarousel.init();self.skyboxCarousel.init();self.posterCarousel.init();self.inlineCarousels.init()}},tabs:{doTabs:function(){$(".tab_wrapper").tabs()
},ieClearReorderArrows:function(getPathing){$(".combined_sections_bucket_tabs li").children("a").click(function(){$("#combined_sections .bucket").children("a.reorder").remove()})},init:function(){var self=this;self.doTabs();self.ieClearReorderArrows()}},ajax:{createQuery:function(selectField){var query="";var requestQuery=jSING.utils.getUrlAttr("q");if(requestQuery){query+="q="+requestQuery+"&"}selectField.each(function(i){if($(this).val()!=""){query+=$(this).attr("name")+"="+$(this).val()+"&"}});return query.substring(0,query.length-1)},searchFilter:function(url){var self=this;$("input#search_button").remove();
var selectField=$("#browse_search_form .vSelectField"),loadingDiv=$("#main_loader"),pageLinks=$("#results_list li ul.paginated_arrows li a");loadingDiv.ajaxStart(function(){$(this).show().next().fadeTo("medium",0.25)});loadingDiv.ajaxStop(function(){$(this).hide().next().fadeTo("medium",1)});self.createQuery(selectField);selectField.change(function(){var query=self.createQuery(selectField);$.ajax({type:"GET",url:url,data:query,dataType:"html",success:function(results){$("ul#results_list.browse_list").html(results)}})});pageLinks.live("click",function(){var query=self.createQuery(selectField);query+="&page="+$(this).attr("id");
$.ajax({type:"GET",url:url,data:query,dataType:"html",success:function(results){$("ul#results_list.browse_list").html(results)}});return false})}},calendars:{config:{ajaxMonthURL:"/calendar/event/_async_month_calendar/"},ajaxRequest:function(url,query,resultsSelector,callback){var self=this,callback=callback||function(){return null};$.ajax({type:"GET",url:url,data:query,dataType:"html",success:function(results){$(resultsSelector).html(results);callback()}})},monthNav:function(resultsSelector){var self=this;$("td.month_nav a").click(function(){query=$(this).attr("value");self.ajaxRequest(self.config.ajaxMonthURL,query,resultsSelector,function(){self.monthNav(resultsSelector)
});return false})},calTabsSecondary:function(containerSelector,resultsSelector){var self=this,query="";containerSelector=containerSelector||"#sidebar_events",resultsSelector=resultsSelector||"#calendar_results",loader=$(containerSelector+"_loader");$(containerSelector+" li.cal_tab_last a").click(function(){loader.ajaxStart(function(){$(this).show();$(resultsSelector).fadeTo("medium",0.25)});loader.ajaxStop(function(){$(this).hide();$(resultsSelector).fadeTo("medium",1)});$(this).parent().siblings().removeClass("ui-tabs-selected");$(this).parent().addClass("ui-tabs-selected");self.ajaxRequest(self.config.ajaxMonthURL,"",resultsSelector,function(){self.monthNav(resultsSelector)
});return false})},filterQuery:function(){var query="";var date=$("#events_browse ul.cal_tab_header li.ui-tabs-selected:first").eq(0).children("a:first").attr("value");$("#browse_search_form .vSelectField").each(function(i){var field=$(this),fieldVal=field.val();if(fieldVal!=""){if(query!=""){query+="&"}query+=field.attr("name")+"="+fieldVal}});return query+"&start_date="+date},handleCalendarSelect:function(){var self=this;$("#browse_search_form .vSelectField").change(function(){$("#filter_load").ajaxStart(function(){$(this).show();$(this).next().fadeTo("medium",0.25)});$("#filter_load").ajaxStop(function(){$(this).hide();
$(this).next().fadeTo("medium",1)});query=self.filterQuery()+"&framing=event_filter_list";self.ajaxRequest("/events/",query,"ul.browse_list")})},calTabsPrimary:function(){var self=this,resultsSelector="#events_browse .search_results_wrapper";var query;$("input#search_button").remove();$("#events_browse ul.cal_tab_header li a").click(function(){$("#events_browse .ajax_loader").ajaxStart(function(){$(this).show();$(this).next().fadeTo("medium",0.25)});$("#events_browse .ajax_loader").ajaxStop(function(){$(this).hide();$(this).next().fadeTo("medium",1)});$(this).parent().siblings().removeClass("ui-tabs-selected");
$(this).parent().addClass("ui-tabs-selected");if($(this).hasClass("browse_cal")){self.ajaxRequest(self.config.ajaxMonthURL,query,resultsSelector,function(){self.monthNav(resultsSelector)})}else{query="start_date="+$(this).attr("value")+"&framing=event_day_list";self.ajaxRequest("/events/",query,"#events_browse .search_results_wrapper",function(){self.handleCalendarSelect();$("input#search_button").remove()})}return false});self.handleCalendarSelect()},init:function(){jSING.calendars.calTabsSecondary()}},comments:{firstLoad:true,commentsContainer:$("#comments.comments_enabled"),commentsWrapper:$("#comment_wrapper"),commentsListContainer:$("#comment_list"),commentsAd:$("#comments_ad"),commentsLoader:$('<div id="comments_loader" style="position: absolute; width: 575px; margin: 14px auto; text-align: center; font-size: .75em; color: #666;"><img src="'+jSINGconf.theme.CORP_MEDIA_URL+'/img/ajax-loader.gif" alt="Loading comments" /><p>Loading comments</p></div>'),commentsPagination:$(".comments_paginated_arrows"),commentsPaginationContainers:$(".pagination_comments"),commentsTitlebar:$("#comments .titlebar:first"),commentsCountStorage:$(".comment_count_storage"),commentsPageSelectors:$(".comments_pages_select"),handlePagination:function(){var self=this;
$(".comments_paginated_arrows li a").live("click",function(e){e.preventDefault();self.loadCommentsData(this.href.replace("/list/","/json/"))});$("select.comments_pages_select").live("change",function(){if(!self.firstLoad){self.loadCommentsData($(this).val())}});self.commentsLoader.hide().insertBefore(self.commentsListContainer)},updatePagination:function(paginationHTML){var self=this;self.commentsPaginationContainers.each(function(){$(this).html(paginationHTML)})},updateCommentCounts:function(destinationSelector,commentCount){var destinationSelector=destinationSelector||".dynamic_comment_count",commentCount=commentCount||$("#comment_wrapper .comment_list_wrapper:first").attr("id").match(/\d+/)[0]*1;
$(destinationSelector).each(function(){$(this).text(commentCount)})},loadCommentsData:function(commentsURL){var self=this;$.scrollTo(self.commentsContainer,200);self.commentsListContainer.fadeTo(100,0.2,function(){self.commentsLoader.fadeIn(200);$.getJSON(commentsURL,function(results){var renderedData=results.rendered_data.replace(self.whitespaceRegEx,"");self.changePage($.parseJSON(renderedData))})})},removeComments:function(){$(".comment_wrapper").remove()},renderComments:function(commentList){var self=this,commentsCount=commentList.length,commentsBeforeAdHTML="",commentsAfterAdHTML="";if(self.commentsAdIndex!=-1){var hasAd=true,breakpoint=self.commentsAdIndex
}else{var hasAd=false,breakpoint=commentsCount}for(var i=0;i<breakpoint;i++){commentsBeforeAdHTML+=commentList[i]}self.removeComments();var commentsBeforeAd=$(commentsBeforeAdHTML);commentsBeforeAd.prependTo(self.commentsListContainer);if(hasAd){for(var i=breakpoint;i<commentsCount;i++){commentsAfterAdHTML+=commentList[i]}var commentsAfterAd=$(commentsAfterAdHTML);commentsAfterAd.appendTo(self.commentsListContainer)}self.commentsLoader.fadeOut(100,function(){self.commentsListContainer.fadeTo(100,1)})},changePage:function(commentsData){var self=this;self.renderComments(commentsData.commentList);
self.updatePagination(commentsData.paginationHTML);self.updateCommentCounts(null,commentsData.commentCount)},getComment:function(){fromGet=function(){return jSING.utils.getUrlAttr("comments_id")};fromHash=function(){if(window.location.hash){var re_exec=/c[\d]+/.exec(window.location.hash);if(re_exec){return re_exec[0].replace("c","")}else{return null}}else{return null}};return function(){var self=this,commentId=fromGet()||fromHash()||null;if(commentId){$.scrollTo($("#c"+commentId),200)}}()},initNonPublicCommentLinks:function(){$("p.comment-not-public-warning a").live("click",function(event){event.preventDefault();
var link=$(this),href=jSING.utils.getTargetID(link),commentDiv=$(href);link.parent().fadeOut("fast",function(){commentDiv.fadeIn()})})},hideComments:function(setCookie){var self=this,setCookie=setCookie||false;self.commentsContainer.addClass("hidecomments");self.commentsToggleLink.text("Show");self.commentsWanted=false;if(setCookie){$.cookie("hidecomments","out",{expires:730,path:"/"})}},showComments:function(){var self=this;self.commentsContainer.removeClass("hidecomments");self.commentsToggleLink.text("Hide");self.commentsWanted=true;$.cookie("hidecomments",null,{path:"/"})},handleCommentsToggle:function(){var self=this;
self.commentsToggleLink.click(function(event){event.preventDefault();if(self.commentsToggleLink.text()=="Hide"){self.hideComments(true)}else{self.showComments()}})},getCommentsVisibilityCookie:function(){if($.cookie("hidecomments")&&$.cookie("hidecomments")=="out"){return false}return true},hideUnwantedComments:function(){var self=this;if(!self.commentsWanted){self.hideComments()}},insertToggleLink:function(){var self=this;if(self.commentsWanted){var toggleText="Hide"}else{var toggleText="Show"}self.commentsToggleUL=$('<ul class="deeplinks"><li><a href="#comments" id="comments_toggle">'+toggleText+"</a></li></ul>");
self.commentsToggleUL.appendTo(self.commentsTitlebar);self.commentsToggleLink=$("#comments_toggle")},selectInputRefresh:function(){var self=this;self.commentsPageSelectors.each(function(){var select=$(this),selected=select.children(":selected:first"),selectedIndex=selected.index();if(selectedIndex==0){select.trigger("change")}})},init:function(){var self=this;if(self.commentsContainer.length){self.commentsWanted=self.getCommentsVisibilityCookie();self.selectInputRefresh();self.insertToggleLink();self.hideUnwantedComments();self.whitespaceRegEx=/[\t\r\n]/g;self.commentsAdIndex=self.commentsAd.index();
self.handlePagination();if(self.firstLoad){self.getComment()}self.initNonPublicCommentLinks();self.handleCommentsToggle();self.firstLoad=false}}},maps:{handleStaticMaps:function(){var self=this,staticMaps=$(".mapwindow_static"),re=/\d+/;if(staticMaps.length){staticMaps.each(function(){var staticMap=$(this),mapID=re.exec(staticMap.attr("id"))[0],yahooMapInfo=jSINGconf.maps.yahooMapList[mapID];self.yahooMap(yahooMapInfo.id,yahooMapInfo.lat,yahooMapInfo["long"],yahooMapInfo.name,yahooMapInfo.address,yahooMapInfo.city,yahooMapInfo.state,yahooMapInfo.width,yahooMapInfo.height)})}},handleMapLinks:function(){var self=this,mapLinks=$(".browse_list_maplink"),loaderImage=jSINGconf.ajax.loaderImageURL,loader=$('<div class="ajax_loader" style="display: block; height: 32px;"><img src="'+loaderImage+'" alt="Loading map" width="32" height="32" /></div>'),re=/\d+/;
mapLinks.live("click",function(e){e.preventDefault();var mapLink=$(this),mapID=re.exec(mapLink.attr("id"))[0];var yahooMapDiv=$("#mapwindow_"+mapID);if(!yahooMapDiv.length){var yahooMapLink=jSINGconf.maps.yahooMapList[mapID],yahooMapDiv=$('<div id="mapwindow_'+mapID+'" class="list_map"></div>');yahooMapDiv.append(loader);mapLink.after(yahooMapDiv);self.yahooMap(yahooMapLink.id,yahooMapLink.lat,yahooMapLink["long"],yahooMapLink.name,yahooMapLink.address,yahooMapLink.city,yahooMapLink.state,yahooMapLink.width,yahooMapLink.height);loader.remove()}yahooMapDiv.slideToggle()})},yahooMap:function(id,latitude,longitude,name,address,city,zip,width,height){var mapsize=new YSize(width,height),mapDiv=document.getElementById("mapwindow_"+id),map=new YMap(mapDiv,YAHOO_MAP_REG,mapsize);
map.addZoomShort();map.disableKeyControls();map.removeZoomScale();var geopoint=new YGeoPoint(latitude,longitude),newMarker=new YMarker(geopoint);var markerMarkup="<div style='padding: 3px 7px; font-family: Verdana; font-size: 0.8em; width: 175px;'><strong>"+name+"</strong><br/>"+address+"<br/>"+city+" "+zip+"</div>";YEvent.Capture(newMarker,EventsList.MouseClick,function(){newMarker.openSmartWindow(markerMarkup)});map.addOverlay(newMarker);map.drawZoomAndCenter(geopoint,5)},init:function(){var self=this;self.handleStaticMaps();self.handleMapLinks()}},reordering:{config:{reorderableItemsSelector:"",adIndex:0,adSelector:"",reorderCookieName:"",containerSelector:""},getNormalizedHeight:function(item,margin){var h1=item.outerHeight(true),h2=item.outerHeight(false);
if(h1==h2){return h1+margin}return h1},showReorder:function(){if(!preventReorder){margin=21;itemA=$(this);itemAID=itemA.attr("id");itemAIndex=reorderableItems.index(itemA);itemAHeight=jSING.reordering.getNormalizedHeight(itemA,margin);itemAName=itemA.find(".titlebar h3").eq(0).text();function reorderItems(thisLink,direction){preventReorder=true;function swap(itemA,direction){adCheck=0;switch(direction){case"up":itemBIndex=itemAIndex-1;itemB=$(reorderableItems.get(itemBIndex));itemBYModifier="+=";itemAYModifier="-=";if(adIndex>0){adCheck=adIndex}break;case"down":itemBIndex=itemAIndex+1;itemB=$(reorderableItems.get(itemBIndex));
itemBYModifier="-=";itemAYModifier="+=";if(adIndex>0){adCheck=adIndex-1}break}itemBHeight=jSING.reordering.getNormalizedHeight(itemB,margin);adHeight=0;if(adIndex>0&&itemAIndex==adCheck){ad=$(adSelector);if(ad.length){if(ad.length>1){ad=ad.eq(0)}adHeight=jSING.reordering.getNormalizedHeight(ad,margin);adY=ad.offset().top;adModifier=""}}itemAY2=itemAYModifier+(itemBHeight+adHeight).toString()+"px";itemBY2=itemBYModifier+(itemAHeight+adHeight).toString()+"px";itemA.animate({top:itemAY2},400,"swing");itemB.animate({top:itemBY2},200,"swing");if(adHeight){switch(direction){case"up":adY2=itemAHeight-itemBHeight;
break;case"down":adY2=itemBHeight-itemAHeight;break}if(adY2>=0){adModifier="+="}else{if(adY2<0){adY2*=-1;adModifier="-="}}adChange=adModifier+adY2.toString()+"px";ad.animate({top:adChange},300,"swing")}reorderableItems[itemAIndex]=itemB[0];reorderableItems[itemBIndex]=itemA[0];order="";reorderableItems.each(function(){order=order+this.id+","});order=order.substring(0,order.length-1);$.cookie(reorderCookieName,order,{expires:730});preventReorder=false;return reorderableItems}itemA.children("a.reorder").remove();swap(itemA,direction);return reorderableItems}function linkHTML(direction,itemAName){return'<a href="#'+itemAID+'" id="reorder_'+direction+"_"+itemAID+'" class="reorder reorder_'+direction+'" title="Click to move '+itemAName+" "+direction+' on the page">Move '+itemAName+" "+direction+"</a>"
}function initArrow(direction,itemAName){arrowHTML=linkHTML(direction,itemAName);arrow=$(arrowHTML).css("opacity","0").click(function(e){e.preventDefault();jSING.apptap.execAppTapEvent(this,"Event63",false);reorderItems($(this),direction)});switch(direction){case"up":arrow.prependTo(itemA).css("opacity","1");break;case"down":arrow.appendTo(itemA).css("opacity","1");break}}$("a.reorder").remove();if(itemAIndex!=0){initArrow("up",itemAName)}if(itemAIndex!=(reorderableItems.length-1)){initArrow("down",itemAName)}}preventReorder=false},hideReorder:function(){preventReorder=false;$(this).children("a.reorder").each(function(){reorderLink=$(this);
reorderLink.animate({opacity:0},100,function(){reorderLink.remove()})})},init:function(reorderableItemsSelector,containerSelector,adSelector,adIndex,reorderCookieName){preventReorder=false;reorderableItemsSelector=reorderableItemsSelector;containerSelector=containerSelector;adSelector=adSelector;adIndex=adIndex;reorderCookieName=reorderCookieName;reorderableItems=$(reorderableItemsSelector);if($.cookie(reorderCookieName)){var itemIDs=$.cookie(reorderCookieName).split(",")||[];var itemsList=reorderableItems;var itemsContainer=$(containerSelector).eq(0);var itemsLength=itemIDs.length-1;if(!adIndex){var breakPoint=itemsLength
}else{var breakPoint=adIndex-1}function cookieItemReorder(i,insertion){var item=$("#"+itemIDs[i]);if(item.length){switch(insertion){case"prepend":item.prependTo(itemsContainer);break;case"append":item.appendTo(itemsContainer);break}}}for(var i=breakPoint;i>=0;i--){cookieItemReorder(i,"prepend")}if(adIndex){for(var i=breakPoint+1;i<=itemsLength;i++){cookieItemReorder(i,"append")}}reorderableItems=$(reorderableItemsSelector)}var hoverConfig={sensitivity:15,interval:0,over:jSING.reordering.showReorder,timeout:125,out:jSING.reordering.hideReorder};reorderableItems.hoverIntent(hoverConfig)}},fonts:{setFontSize:function(fontLinks,fontSizeName,link){fontLinks.filter(".active").removeClass("active");
var deleteCookie=false,articleBody=$("#article_body");switch(fontSizeName){case"small":articleBody.addClass("article_body_small").removeClass("article_body_large");break;case"large":articleBody.addClass("article_body_large").removeClass("article_body_small");break;default:articleBody.removeClass("article_body_small article_body_large");deleteCookie=true}if(link){link.addClass("active")}else{$("a#font_"+fontSizeName).addClass("active")}if(deleteCookie==true){$.cookie("storyFontSizeName",null,{path:"/"})}else{$.cookie("storyFontSizeName",fontSizeName,{expires:730,path:"/"})}},init:function(){var self=this,fontLinks=$(".story_tools .story_font a");
if(fontLinks.length>0){var fontSizeName=$.cookie("storyFontSizeName")||"default";self.setFontSize(fontLinks,fontSizeName,null);fontLinks.click(function(event){event.preventDefault();var link=$(this),fontSizeName=link.attr("id").split("_")[1];self.setFontSize(fontLinks,fontSizeName,link)})}}},photos:{thumbnails:{hoverOpacity:function(){$("ul.media_list, ul.media_thumbs, ul.story_gallery").children().hover(function(){$(this).siblings().stop().fadeTo(100,0.33)},function(){$(this).siblings().stop().fadeTo(400,1)})},init:function(){var self=this;self.hoverOpacity()}},sizeToggle:{toggle:null,item:null,itemSmall:null,itemLarge:null,handleToggle:function(){var self=this;
self.toggle.click(function(e){e.preventDefault();var t=$(this);if(!t.hasClass("loading_media")){if(t.hasClass("see_larger")){self.initSwap("larger")}else{self.initSwap("smaller")}}})},initSwap:function(direction){var self=this;switch(direction){case"larger":if(!self.itemLarge){self.itemLarge=self.item.clone();self.itemSmall=self.item.clone();self.item.fadeTo(300,0.33);self.toggle.addClass("loading_media").html("Loading&hellip;");self.itemLarge.attr("src",self.itemLarge.attr("src").replace("_t300.","_t607.")).load(function(){self.itemLarge.attr("width","607").removeClass("media_tall");self.doSwap(direction)
}).error(function(){self.toggle.removeClass("loading_media").html("Error:<br />The image could not be loaded. Please try again:<br />See smaller");self.itemLarge=null})}else{self.doSwap(direction)}break;case"smaller":if(!self.itemSmall){self.itemSmall=self.item.clone();self.itemLarge=self.item.clone();self.item.fadeTo(300,0.33);self.toggle.html("Loading&hellip;");self.itemSmall.attr("src",self.itemSmall.attr("src").replace("_t607.","_t300.")).load(function(){self.itemSmall.attr("width","300").addClass("media_tall");self.doSwap(direction)}).error(function(){self.toggle.removeClass("loading_media").html("Error:<br />The image could not be loaded. Please try again:<br />See smaller");
self.itemSmall=null})}else{self.doSwap(direction)}break}},doSwap:function(direction){var self=this,oldItem=self.item;switch(direction){case"larger":var newItem=self.itemLarge.clone();self.toggle.attr("class","see_smaller").html("See smaller");break;case"smaller":var newItem=self.itemSmall.clone();self.toggle.attr("class","see_larger").html("See larger");break}self.toggle.removeClass("loading_media");oldItem.replaceWith(newItem);self.item=newItem},init:function(){var self=this;self.toggle=$("#media_size_toggle");if(self.toggle.length){self.item=$("#media");self.handleToggle()}}},init:function(){var self=this;
self.thumbnails.init();self.sizeToggle.init()}},apptap:{getEventPath:function(trigger){if(path[-1]!="/"){path+="/"}return path+trigger.attr("href")},registerAppTapEvent:function(selector,eventName,isMacro,jsEventName,live){var self=this,isMacro=isMacro||false,jsEventName=jsEventName||"click",live=live||true;if(live){$(selector).live(jsEventName,function(){self.execAppTapEvent(this,eventName,isMacro)})}else{$(selector)[jsEventName](function(){self.execAppTapEvent(this,eventName,isMacro)})}},execAppTapEvent:function(trigger,eventName,isMacro){var self=this,trigger=$(trigger),title=trigger.attr("title");
sendEvent(trigger,eventName,title);if(isMacro){retarget(self.getEventPath(trigger),title)}},init:function(){var self=this;self.registerAppTapEvent("#content_wrapper .macro_tab_header li a","Event60",true,"click",false);self.registerAppTapEvent("#content_wrapper :not('#secondary_content') .tab_header:not('.macro_tab_header') li a","Event61",false,"click",false);self.registerAppTapEvent("#secondary_content .tab_header li a","Event62",false,"click",false);self.registerAppTapEvent("#most_popular a","Event22",false);self.registerAppTapEvent("#page_wrapper a.comment_count","Event23",false);self.registerAppTapEvent("#alert_bar_carousel .alert_bark_quicklinks a","Event24",false);
self.registerAppTapEvent("#alert_bar_carousel .alert_bark:not(.alert_bark_quicklinks) a","Event33",false);self.registerAppTapEvent("#content_wrapper div.inline_photogallery .gallery_controls a","Event36",false);self.registerAppTapEvent("#content_wrapper ul.story_gallery li:not(.gallery_inline_prompt) a","Event37",false);self.registerAppTapEvent("#content_wrapper li.gallery_inline_prompt a","Event38",false)}},ratings:{ratingSubmit:function(value,link){var self=this,value=value||0;if(value!=0){var f=$(this.form);if(!f.hasClass("user_rating_form")){f.addClass("user_rating_form")}}else{var f=cancelThisForm;
f.removeClass("user_rating_form")}$.post(f.attr("action"),{rating:value},function(data,textStatus){if(value==0){newData=eval("("+data+")"),newRating=newData.rating,inputs=f.children("input[type=radio].rating-star"),input=inputs.filter("[value="+newRating+"]"),overallInput=$(input[0]);overallInput.attr("checked","checked");inputs.attr("class","rating-star");f.find("span.star-rating-control").remove();self.init(inputs,f)}})},init:function(inputObjects,cancelScope){var self=this;inputObjects.rating({callback:self.ratingSubmit});$(".star-rating-readonly").click(function(){alert("Please login to rate content")
});cancelScope.find("div.rating-cancel a").click(function(){cancelThisForm=$($(this).parents("form")[0])})}},cellar:{doCellarLinks:function(dlSelector,promptText,showText,hideText){var dl=$(dlSelector),dtSelector=dlSelector+"_prompt",ddSelector=dlSelector+"_links";if(dl.length){var dt=$(dtSelector),dd=$(ddSelector);dd.hide();dt.append('<a href="'+dlSelector+'">'+promptText+"</a>");var dtToggle=$(dtSelector+" a");dtToggle.click(function(clickEvent){clickEvent.preventDefault();var a=$(this);var t=a.text();dd.toggle();if(t.search(showText)>=0){a.text(t.replace(" "+showText," "+hideText))}else{a.text(t.replace(" "+hideText," "+showText))
}})}},init:function(){var self=this;self.doCellarLinks("#business_directory"," See directory links","See","Hide");self.doCellarLinks("#jobs_by_city","(click to expand)","expand","hide");self.doCellarLinks("#jobs_by_cat","(click to expand)","expand","hide");self.doCellarLinks("#jobs_by_popular","(click to expand)","expand","hide")}},mobile:{showMobilePrompt:function(){var width=jSINGmobile.getBrowserWidth();if($.cookie("preventMobileRedirect")&&!$.cookie("hideMobilePrompt")&&width!=0&&width<=800){var prompt='<div id="mobile_prompt" style="width: 994px; height: 60px; margin: 0 auto 10px;line-height: 60px; font-size: 24px;"><a id="visitMobileSite" href="'+jSINGmobile.getMobileURL()+'" style="margin-left: 15px;">Visit our mobile-optimized site</a><a id="hideMobilePrompt" href="#" style="font-size: 18px; color: #444; margin-left: 15px; text-transform: uppercase">Hide this message</a></div>';
$("#utilities_wrapper").prepend(prompt);$("#hideMobilePrompt").click(function(e){e.preventDefault();$("#mobile_prompt").remove();$.cookie("hideMobilePrompt",1,{expires:365,path:"/"})});$("#visitMobileSite").click(function(){$.cookie("preventMobileRedirect",null,{path:"/"})})}},init:function(){this.showMobilePrompt()}},popmenus:{doPlugin:function(){$.fn.popmenu=function(options){var defaults={menu:".popmenu",activeClass:false,time:1500,speed:"",effect:""};var options=$.extend(defaults,options);var active_menu=null;var timeout;return this.each(function(){var button=$(this);var menu=$(this).next();
button.click(function(e){clearTimeout(timeout);if(menu.is(":hidden")){$(""+options.menu+":visible").each(function(){$(this).hide(options.speed);$(this).prev().removeClass(options.activeClass)});menu.show(options.speed);if(options.activeClass!=false){button.addClass(options.activeClass)}}else{menu.hide(options.speed);if(options.activeClass!=false){button.removeClass(options.activeClass)}}active_menu=menu.index(menu);return false});button.mouseover(function(){clearTimeout(timeout);active_menu=menu.index(menu)});menu.mouseover(function(){clearTimeout(timeout);active_menu=menu.index(menu)});button.mouseout(function(){timeout=setTimeout(function(){if(options.activeClass!=false){button.removeClass(options.activeClass)
}menu.hide(options.speed)},options.time);active_menu=null});menu.mouseout(function(){timeout=setTimeout(function(){if(options.activeClass!=false){button.removeClass(options.activeClass)}menu.hide(options.speed)},options.time);active_menu=null});$(document).click(function(e){if(active_menu==null){$(options.menu+":visible").each(function(){$(this).hide(options.effect,options.speed);$(this).prev().removeClass(options.activeClass)})}})})}},init:function(){var self=this,popMenus=$(".popmenu_button");if(popMenus.length){self.doPlugin();popMenus.popmenu({activeClass:"active"})}}},videoPlayer:{supports_html5_video:function(){if(navigator.userAgent.search(/(ipad)|(iphone)/gi)!=-1){return true
}return false},doEmbedSWF:function(p){var self=this;swfobject.embedSWF(p.embedParams.playerSrc,p.embedParams.containerId,p.embedParams.playerWidth,p.embedParams.playerHeight,"9.0.115",p.installSWFURL,p.flashvars,p.params,p.attrs,self.embedCallback);window[p.playerName]=document.getElementById(p.playerName)},doEmbedHTML5:function(p){var self=this;if(!self.playerContainer){self.playerContainer=$("#"+p.embedParams.containerId)}var videoTag=$('<div id="html5_'+p.embedParams.containerId+'" class="html5player"><video controls="controls" width="'+p.embedParams.playerWidth+'" height="'+p.embedParams.playerHeight+'" poster="'+p.embedParams.videoThumb+'"><source src="'+p.embedParams.videoURL+'" type="video/mp4"></video></div>');
self.playerContainer.replaceWith(videoTag);self.playerContainer=videoTag;var hFive=html5Player.init("html5_"+p.embedParams.containerId,true)},doEmbedVideo:function(p){var self=this;if(self.supports_html5_video()){self.doEmbedHTML5(p)}else{self.doEmbedSWF(p)}},embedPlayers:function(){var self=this;for(var p in jSINGconf.videoPlayers){self.doEmbedVideo(jSINGconf.videoPlayers[p])}},changePlaylistPage:function(slug,pg){var self=this;var itms=$("#"+slug).children("li");var totalPages=itms.length;if(pg<0){pg=0}if(pg>(totalPages-1)){pg=totalPages-1}var curpage=jSINGconf.playlistPlayers[slug]["playlistCurrentPage"];
var obj1=$(itms[curpage]);var obj2=$(itms[pg]);if(pg-curpage<0){$(itms).animate({left:"+=320"},500,function(){})}else{if(pg-curpage>0){$(itms).animate({left:"-=320"},500,function(){})}}jSINGconf.playlistPlayers[slug]["playlistCurrentPage"]=pg;self.updatePlaylistPosition(slug);return false},updatePlaylistPosition:function(slug){var self=this;var pparent=$("#"+slug).parent().parent();var indicator=$(".video_playlist_navigation",pparent).children(".position");var items=$("#"+slug).children("li").children("a").length;if(!jSINGconf.playlistPlayers[slug]["playlistCurrentPage"]){jSINGconf.playlistPlayers[slug]["playlistCurrentPage"]=0
}if(!self.playlistPerPage){self.playlistPerPage=4}var s=(jSINGconf.playlistPlayers[slug]["playlistCurrentPage"]*self.playlistPerPage)+1;var e=s+(self.playlistPerPage-1);if(e>items){e=items}indicator.html("Showing "+s+" - "+e+" of "+items+" videos")},embedCallback:function(e){if(!e.success){var playerContainer=$("#"+e.id);playerContainer.html(playerContainer.data("fallbackHTML"))}},showLoaders:function(){$(".player_container").each(function(){var playerContainer=$(this);playerContainer.data("fallbackHTML",playerContainer.html());playerContainer.html('<img src="'+jSINGconf.theme.CORP_MEDIA_URL+'/img/ajax-loader-video.gif" alt="Loading video" style="margin-top: 20px; text-align: center;"/>')
})},init:function(){var self=this;this.showLoaders();if($("#homepage_video_poster").length){self.initVideoPoster()}if($(".video_playlist").length){self.initVideoPlaylist()}},initVideoPlaylist:function(){var self=this;$(".video_playlist").each(function(){var itms=$(this).children("li");var baseWidth=320;var initial=Number(itms.first().css("left").replace("px",""));var pslug=$(this).attr("id");jSINGconf.playlistPlayers[pslug]["playlistCurrentPage"]=0;self.updatePlaylistPosition(pslug);itms.each(function(index){$(this).css("left",initial+(baseWidth*index))});var pparent=$(this).parent().parent();$(".playlist_link",pparent).click(function(){var bits=$(this).attr("href").split("/");
var slug=bits[bits.length-1];self.doEmbedVideo(jSINGconf.playlistPlayers[pslug]["videos"][slug]);return false});$(".video_playlist_navigation",pparent).children("a").children(".prev").click(function(){return self.changePlaylistPage(pslug,jSINGconf.playlistPlayers[pslug]["playlistCurrentPage"]-1)});$(".video_playlist_navigation",pparent).children("a").children(".next").click(function(){return self.changePlaylistPage(pslug,jSINGconf.playlistPlayers[pslug]["playlistCurrentPage"]+1)});$(this).css("width",(itms.length-1)*baseWidth)})},initVideoPoster:function(){var self=this;$("#homepage_video_poster").click(function(){self.doEmbedVideo(jSINGconf.videoPoster);
return false})}},staffmembers:{dropdownSelect:function(){$("input#search_button").remove();$("#dropdown_select").change(function(){$("#"+this.value).show().siblings().hide()});$("#dropdown_select").change()},init:function(){var self=this;if($("#dropdown_browse").length){self.dropdownSelect()}}},cinemasource:{movieSelect:function(){$(".movieSelect").change(function(){var field=$(this),fieldVal=field.val();movieUrl="/news/entertainment/movies/"+fieldVal+"/0/";window.location.href=window.location.protocol+"//"+window.location.hostname+movieUrl});$(".theaterSelect").change(function(){var field=$(this),fieldVal=field.val();
theaterUrl="/news/entertainment/movies/theaters/"+fieldVal+"/0/";window.location.href=window.location.protocol+"//"+window.location.hostname+theaterUrl})},init:function(){var self=this;if($(".movieSelect").length){self.movieSelect()}}},browsers:{zIndexIE:function(){if($.browser.msie){var zIndexNumber=10000,zList=$("div"),zListLength=zList.length;for(var i=0;i<zListLength;i++){zList[i].style.zIndex=zIndexNumber;zIndexNumber-=10}}},init:function(){this.zIndexIE()}},alertBarkCarousel:{doAlertBarCarousel:function(carousel){var controls='<div id="alert_bark_controls"><a id="alert_bark_prev" class="alert_bark_control alert_bark_prev" href="#alert_bark_carousel">Previous</a><div id="alert_bark_counter"><span id="alert_bark_counter_current">1</span> of <span id="alert_bark_counter_total">'+carousel.size()+'</span></div><a id="alert_bark_next" class="alert_bark_control alert_bark_next" href="#alert_bark_carousel">Next</a></div>';
$("#alert_bark_clipper").after(controls);$("#alert_bark_prev").bind("click",function(){carousel.prev();carousel.startAuto(0);return false});$("#alert_bark_next").bind("click",function(){carousel.next();carousel.startAuto(0);return false});jSING.carousels.utils.pauseAutoScrollOnHover(carousel)},alertBarOnSlide:function(carousel,item,current_page,state){$("#alert_bark_counter_current").text(current_page)},init:function(){var alertBar=$("#alert_bark_carousel");if(alertBar.children().size()>1){alertBar.jcarousel({vertical:false,auto:6,animation:250,easing:"swing",scroll:1,wrap:"both",initCallback:this.doAlertBarCarousel,itemFirstInCallback:this.alertBarOnSlide,buttonNextHTML:null,buttonPrevHTML:null});
$("#alert_bark_wrapper").hover(function(){$("#alert_bark_controls").stop(false,true).fadeTo(100,1)},function(){$("#alert_bark_controls").stop(false,true).hide(150,0)})}}},init:function(pageType){var self=this;self.navigation.init();self.tabs.init();self.carousels.init();self.login.init();self.comments.init();self.photos.init();self.videoPlayer.init();self.popmenus.init();self.calendars.init();self.maps.init();self.mobile.init();self.staffmembers.init();self.cinemasource.init();self.cellar.init();self.ratings.init($("input[type=radio].rating-star"),$("form.rating_form"));self.apptap.init();self.browsers.init();
self.alertBarkCarousel.init()}};jSING.init();