var fi=fi||{};fi.common=fi.common||{};
if(!Modernizr.hashchange)fi.common.Navigation=function(){var historyEnabled=false};else{fi.common.Navigation=new function(){var _numSteps=0;var _stateTimeout=null;var _startLocation=null;var _onStateChanged=function(event){var self=this;clearTimeout(_stateTimeout);_stateTimeout=setTimeout(_onStateChangedTimeout,200,event)};var _onStateChangedTimeout=function(event){if(_startLocation&&_startLocation===window.location.href){_startLocation=null;return}api.historyState=History.getState();api.pathSegments=
api.getPathSegments();$(api).trigger(fi.common.Navigation.STATE_CHANGED)};var api={};api.state=History.getState();api.historyEnabled=false;api.init=function(){_startLocation=window.location.href;if(History.enabled!==false){api.historyEnabled=true;History.Adapter.bind(window,"statechange",$.proxy(_onStateChanged,this))}};api.navigate=function(title,location,state){window.History.pushState(state||{},title,location);_numSteps++};api.back=function(){if(_numSteps>0)window.History.back();else api.navigate("",
_startLocation.replace(/#[\w-]+$/,""))};api.isCurrentURL=function(path,ignoreHash){if(typeof ignoreHash==="undefined")ignoreHash=true;var location=unescape(window.location.href).replace(/index.html\?[\w\&\-]+\=\d+$/i,"").replace("index.html","");if(ignoreHash){location=location.replace(/^["']|["']$/g,"");location=location.replace(/#[\w-]+$/,"")}var template="[^w-]${path}/?$";var pattern=new RegExp(template.replace(/\${path}/,path),"i");return pattern.test(location)};api.processLink=function(link){var $link=
$(link);api.navigate($link.attr("title"),$link.attr("href"))};api.parseURL=function(url){url=unescape(url);var cut=url.replace(/^(http(s)?:\/\/)?[^\/]+\/?/i,"");var parse={protocol:url.match(/^(http(s)?):\/\//i),domain:url.match(/^(http(s)?:\/\/)?([^\/:]+)/i),query:url.match(/\?([\w\+\-\=&]+)/),port:url.match(/\w:(\d{1,5})/),hash:url.match(/#([\w\-\/]+)/),path:cut.match(/^\/?([\w\-\/\.]+)/)};var result={protocol:parse.protocol?parse.protocol[1]:null,domain:parse.domain?parse.domain[3]:null,query:parse.query?
parse.query[1]:null,port:parse.port?parse.port[1]:null,hash:parse.hash?parse.hash[1]:null,path:parse.path?parse.path[1]:null,url:url};if(result.path)result.pathSegments=result.path.replace(/^\/|\/$/g,"").split("/");if(result.hash)result.hashSegments=result.hash.replace(/^\/|\/$/g,"").split("/");if(result.query){result.params={};var regex=/([\w\+\-]+)\=([\w\+\-]+)/g;var param=regex.exec(result.query);while(param){result.params[param[1]]=param[2];param=regex.exec(result.query)}}return result};api.getParsedURL=
function(){return api.parseURL(History.getState().url)};api.getPathSegments=function(){var location=window.location;path=location.hash.length<2?location.pathname:location.hash;path=location.pathname;path=path.replace(/^\W+|\W+$|\/?([\w\-]+\=[\w\-]+)$/g,"").replace("/index.html","");path=path.split("/");var filteredPaths=[];$.each(path,function(idx,item){if(item!="adwords"&&item!="watchthisspace"&&item!=="content")filteredPaths.push(item)});return filteredPaths};api.getContentPath=function(path){if($.isArray(path)===
true)path=path.join("/");path="/"+path+"/content/";return path.replace(/\/+/g,"/")};return api};fi.common.Navigation.STATE_CHANGED="statechange";$(document).ready(function(){fi.common.Navigation.init()})};
