(function($){function History()
{this._curHash='';this._callback=function(hash){};};$.extend(History.prototype,{init:function(callback){this._callback=callback;this._curHash=location.hash;if($.browser.msie){if(this._curHash==''){this._curHash='#';}
$("body").prepend('<iframe id="jQuery_history" style="display: none;"></iframe>');var iframe=$("#jQuery_history")[0].contentWindow.document;iframe.open();iframe.close();iframe.location.hash=this._curHash;}
else if($.browser.safari){this._historyBackStack=[];this._historyBackStack.length=history.length;this._historyForwardStack=[];this._isFirst=true;this._dontCheck=false;}
this._callback(this._curHash.replace(/^#/,''));setInterval(this._check,100);},add:function(hash){this._historyBackStack.push(hash);this._historyForwardStack.length=0;this._isFirst=true;},_check:function(){if($.browser.msie){var ihistory=$("#jQuery_history")[0];var iframe=ihistory.contentDocument||ihistory.contentWindow.document;var current_hash=iframe.location.hash;if(current_hash!=$.history._curHash){location.hash=current_hash;$.history._curHash=current_hash;$.history._callback(current_hash.replace(/^#/,''));}}else if($.browser.safari){if(!$.history._dontCheck){var historyDelta=history.length-$.history._historyBackStack.length;if(historyDelta){$.history._isFirst=false;if(historyDelta<0){for(var i=0;i<Math.abs(historyDelta);i++)$.history._historyForwardStack.unshift($.history._historyBackStack.pop());}else{for(var i=0;i<historyDelta;i++)$.history._historyBackStack.push($.history._historyForwardStack.shift());}
var cachedHash=$.history._historyBackStack[$.history._historyBackStack.length-1];if(cachedHash!=undefined){$.history._curHash=location.hash;$.history._callback(cachedHash);}}else if($.history._historyBackStack[$.history._historyBackStack.length-1]==undefined&&!$.history._isFirst){if(location.hash.indexOf('#')>=0){$.history._callback(location.hash.split('#')[1]);}else{$.history._callback('');}
$.history._isFirst=true;}}}else{var current_hash=location.hash;if(current_hash!=$.history._curHash){$.history._curHash=current_hash;$.history._callback(current_hash.replace(/^#/,''));}}},isKonqueror:function(){return/KHTML|Konqueror/.test(navigator.userAgent);},load:function(hash,form){var newhash;if($.browser.safari){newhash=hash;}else{newhash=(this.isKonqueror()?'':'#')+hash;location.hash=newhash;}
this._curHash=newhash;if($.browser.msie){var ihistory=$("#jQuery_history")[0];var iframe=ihistory.contentWindow.document;iframe.open();iframe.close();iframe.location.hash=newhash;this._callback(hash,true,form);}
else if($.browser.safari){this._dontCheck=true;this.add(hash);var fn=function(){$.history._dontCheck=false;};window.setTimeout(fn,200);this._callback(hash,true,form);location.hash=newhash;}
else{this._callback(hash,true,form);}}});$(document).ready(function(){$.history=new History();});})(jQuery);function pageload(hash,freshLoad,form){if(form){data=$('#'+form).formSerialize();type='post';}else{data=null;type='get'}
if(hash){if(freshLoad==null){$.ajax({url:hash,cache:false,type:type,data:data,beforeSend:function(){onReady=false;colorChange=false;},success:function(html){$("#content").html(html).addClass("ajaxified");}});}else{$("#content").fadeTo("slow",0.25);$.ajax({url:hash,cache:false,type:type,data:data,beforeSend:function(){onReady=false;colorChange=false;},success:function(html){$("#content").html(html).addClass("ajaxified");$("#content").fadeTo("normal",1);}});}}else{if($("#content").hasClass("ajaxified")){$.ajax({url:"<?php e(env('REQUEST_URI')); ?>",cache:false,success:function(html){$("#content").html(html).addClass("ajaxified");}});}}}
$(document).ready(function(){$.history.init(pageload);$("#loading").ajaxStart(function(){$(this).css("left",($(window).width()/2)-200).show();});$("#loading").ajaxStop(function(){$(this).hide();});$("a[rel='history']").live('click',function(){$.history.load('/'+this.pathname.replace(/^\//,'').replace(/(index|default).[a-zA-Z]{3,4}$/,'').replace(/\/$/,''));if(jQuery.inArray("navlist",$(this).parents().map(function(){return this.id;}).get())){$("#header ul#navlist li.active,#footer ul#navlist li.active,#header ul#navlist li a.active,#footer ul#navlist li a.active").removeClass('active');if($(this).parents().hasClass("subnav")){$(this).addClass("active");$(this).parent().parent().parent().parent().addClass("active");}else{$(this).parent().addClass("active");}}
$.ajax({type:"POST",url:'/blairs/cake/menu_items/getMenu/',data:{"data[path]":$(this).attr('href')},dataType:"xml",success:function(xml){$(xml).find('menu').each(function(){$(this).find('parent').each(function(){$("a[href="+$(this).text()+"]").addClass("active");})})}});return false;});$("input[rel^='history']").click(function(){form=$(this).attr('rel').split(':')[1];hash=$('#'+form).attr('action');$.history.load(hash,form);return false;});});