"use strict";var debug=true;var jsWhereAreWe;var BusinessDirectory=(function(){function init_browser_reject(){$.reject({reject:{all:false,msie5:true,msie6:true,opera8:true,unknown:false},display:['firefox','chrome','opera','safari','msie'],browserInfo:{firefox:{text:'Firefox 3.6+',url:'http://www.mozilla.com/firefox/'},safari:{text:'Safari 4+',url:'http://www.apple.com/safari/download/'},opera:{text:'Opera 10+',url:'http://www.opera.com/download/'},chrome:{text:'Google Chrome 4+',url:'http://www.google.com/chrome/'},msie:{text:'Internet Explorer 8+',url:'http://www.microsoft.com/windows/Internet-explorer/default.aspx'},gcf:{text:'Google Chrome Frame',url:'http://code.google.com/chrome/chromeframe/',allow:{all:false,msie:true}}},header:'Did you know that your Internet Browser is out of date?',paragraph1:'Your browser is out of date, and may not be compatible with our website. A list of the most popular web browsers can be found below.',paragraph2:'Just click on the icons to get to the download page',close:true,closeMessage:'By closing this window you acknowledge that your experience on this website may be degraded',closeLink:'Close This Window',closeURL:'#',closeESC:true,closeCookie:true,imagePath:'/media/core/images/browsers/',overlayBgColor:'#000',overlayOpacity:0.8,fadeOutTime:'fast'});}
var expanderMode=true,flyOutOpen=false,isIE=$.browser.msie,isIE_Six=false,isIE_Seven=false,flyOutToggle,runAccordian;if(isIE&&$.browser.version==="6.0"){isIE_Six=true;}else{isIE_Six=false;}
if(isIE&&$.browser.version==="7.0"){isIE_Seven=true;}else{isIE_Seven=false;}
flyOutToggle=function(closeSwitch){var $getListChildren,getWidthFlyOutUderbugen,categoryHeaderHeight,categoryResultsBoxHeight,categoryResultsBoxBottomPad,getVertOffsetForFlyout;if(closeSwitch==="close"){$("#bkMenu .listingBlock").animate({width:"170px"},150,"linear",function(){});$("#bkMenu .listingBlock a.fullList").html("Show more").removeClass("laquo").addClass("raquo");flyOutOpen=false;return false;}
if($(this).hasClass("fullListClose")){$(this).css('outline','none');$(this).parent().parent().stop().animate({width:"170px"},500);$('#bkMenu .listingBlock a.fullList').html("Show more").removeClass("laquo").addClass("raquo");flyOutOpen=false;return false;}
if($(this).hasClass("fullList")&&($(this).html()==="Show more")){$(this).css('outline','none');$getListChildren=$(this).siblings('.fullListContainer').children('ul');getWidthFlyOutUderbugen=function(){var total=0;$getListChildren.each(function(){total+=$(this).outerWidth(true);});return Number(total);};categoryHeaderHeight=$(this).siblings('.bkMenuHeader').outerHeight();categoryResultsBoxHeight=$(this).siblings('.displayedResults').outerHeight();categoryResultsBoxBottomPad=$(this).siblings('.displayedResults').css("padding-bottom").replace("px","");getVertOffsetForFlyout=categoryResultsBoxHeight-categoryResultsBoxBottomPad+categoryHeaderHeight;$(this).siblings(".fullListContainer").height($(this).parent().outerHeight()-getVertOffsetForFlyout).width(getWidthFlyOutUderbugen()+20).css("top",getVertOffsetForFlyout+'px');$(this).parent().stop().animate({width:getWidthFlyOutUderbugen()+212+'px'},500);$(this).html("Show less").removeClass("raquo").addClass("laquo");flyOutOpen=true;return false;}
if($(this).hasClass("fullList")&&($(this).html()==="Show less")){$(this).css('outline','none');$(this).parent().stop().animate({width:"170px"},500);$(this).html("Show more").removeClass("laquo").addClass("raquo");flyOutOpen=false;return false;}
return false;};runAccordian=function(){var accordianBlock,smallHeight,newHeight;$(this).css('outline','none');if($(this).parent().parent().hasClass("listingBlock")){if(!($("div:animated").size()>0)){if(flyOutOpen){flyOutToggle("close");}
if(!(isIE)){$(this).parent().parent().switchClass("listingBlock","closedListingBlock",350,"easeInOutQuint",function(){if(!flyOutOpen){$(this).css({width:"170px"});}});}else{$(this).parent().parent().animate({height:"34px",paddingBottom:"1px"},{duration:350,easing:"easeInOutQuint",complete:function(){$(this).removeClass("listingBlock");$(this).addClass("closedListingBlock");}});}}}else{if(!($("div:animated").size()>0)){if(flyOutOpen){flyOutToggle("close");}
if(!(isIE)){if(!(expanderMode)){$("#bkMenu .listingBlock").switchClass("listingBlock","closedListingBlock",350,"easeInOutQuint",function(){if(!flyOutOpen){$(this).css({width:"170px"});}});}
$(this).parent().parent().switchClass("closedListingBlock","listingBlock",550,"easeInOutQuint",function(){});}else{if(!(expanderMode)){$("#bkMenu .listingBlock").animate({height:"34px",paddingBottom:"1px"},350,"easeInOutQuint",function(){$(this).removeClass("listingBlock");$(this).addClass("closedListingBlock");if(!flyOutOpen){$(this).css({width:"170px"});}});}
accordianBlock=$(this).parent().parent();smallHeight=accordianBlock.css('height');accordianBlock.css('height','auto');newHeight=accordianBlock.height();accordianBlock.css('height',smallHeight);accordianBlock.animate({height:newHeight+"px",paddingBottom:"23px"},{duration:350,easing:"easeInOutQuint",complete:function(){accordianBlock.css('height','auto');$(this).removeClass("closedListingBlock");$(this).addClass("listingBlock");if(!flyOutOpen){$(this).css({width:"170px"});}}});}}}
return false;};function init_menu(){$("#bkMenu div.listingBlock a.fullList").css("cursor","pointer").live("click",flyOutToggle);$("#bkMenu div.listingBlock div.fullListContainer a.fullListClose").css("cursor","pointer").live("click",flyOutToggle);$("#bkMenu div.bkMenuHeader h3").css("cursor","pointer").bind("click",runAccordian);};function init_back_link(){if(document.referrer&&($("#back_to_search").length>0)){if(document.referrer.match(new RegExp(location.hostname))){if(document.referrer.match(new RegExp("all-locations"))){$("#back_to_search").attr("href",document.referrer);}}}};function init_category_autocomplete(){var KEYPRESS={DEL:46,TAB:9,RETURN:13,BACKSPACE:8};$("#find-box").autocomplete(categories,{autoFill:false,scrollHeight:300,formatItem:function(row){if(row.parent){return row.name+' <span class="autocomplete-subtext">'+row.parent+'</span>';}else{return row.name;}},formatMatch:function(row){return row.name;},formatResult:function(row){return row.name;}}).result(function(e,item){$('#category_id').val(item.id);}).keyup(function(e){switch(e.which){case KEYPRESS.TAB:case KEYPRESS.RETURN:break;default:$('#category_id').val('');break;}}).blur(function(){if($(this).val()==''){$('#category_id').val('');}});};function init_location_autocomplete(){var KEYPRESS={DEL:46,TAB:9,RETURN:13,BACKSPACE:8};$("#in-box").autocomplete(locations,{autoFill:false,scrollHeight:300,matchContains:"word",formatItem:function(row){if(row.t=='r'){return row.name+' <span class="autocomplete-subtext">Region</span>';}else{return row.name+' <span class="autocomplete-subtext">'+row.po+'</span>';}},formatMatch:function(row){if(row.t=='r'){return row.name;}else{return row.name+' '+row.po;}},formatResult:function(row){return row.name;}}).result(function(e,item){if(item.t=='l'){$('#location_id').val(item.id);$('#region_id').val('');}else{$('#region_id').val(item.id);$('#location_id').val('');}}).keyup(function(e){switch(e.which){case KEYPRESS.TAB:case KEYPRESS.RETURN:break;default:$('#region_id').val('');$('#location_id').val('');break;}}).blur(function(){if($(this).val()==''){$('#region_id').val('');$('#location_id').val('');}});};function init_exampleboxes_hiding(){$("#find-box, #in-box").keyup(function(){if($(this).val().length==1||$(this).val()=="Warwic"||$(this).val()=="Warwick"){$(this).siblings(".ac_examples").fadeOut('20');}else if($(this).val().length==0){$(this).siblings(".ac_examples").fadeIn('200');}});};function init_double_input_boxes(){$('#doubleInputs input[type="text"]').focus(function(){$(this).removeClass("idle").addClass("active");$(this).siblings("label").removeClass("idle").addClass("active");});$('input[type="text"]').blur(function(){$(this).removeClass("active").addClass("idle");$(this).siblings("label").removeClass("active").addClass("idle");});if(jsWhereAreWe=="homepage"){$("#find-box").focus();};};function init_filters(){$('#sortFilterLinks').show();$('#showFilter').change(function(){this.form.submit();});$('#sortFilter').change(function(){this.form.submit();});$('#sortFilterTop').click(function(){$('#sortFilter').val("top");$('#sortFilter').get(0).form.submit();});$('#sortFilterAlphabetical').click(function(){$('#sortFilter').val("alphabetical");$('#sortFilter').get(0).form.submit();});$('#sortFilterProx').click(function(){$('#sortFilter').val("prox");$('#sortFilter').get(0).form.submit();});}
function init(){init_browser_reject();init_menu();init_filters();init_back_link();init_category_autocomplete();init_location_autocomplete();init_double_input_boxes();init_exampleboxes_hiding();$("img:not(.carouselBody img)").lazyload({threshold:250});};return{init:init};}());$(document).ready(function(){jQuery.ajaxSettings.traditional=true;BusinessDirectory.init();try{BusinessDirectoryPage.init();}catch(error){}});
