(function( $ ){
var strLocation = window.location.href;
var strHash = window.location.hash;
var strPrevLocation = "";
var strPrevHash = "";
var intIntervalTime = 150;
var fnCleanHash = function( strHash ){
return(
strHash.substring( 1, strHash.length )
);
}
var fnCheckLocation = function(){
if (strLocation != window.location.href){

strPrevLocation = strLocation;
strPrevHash = strHash;
strLocation = window.location.href;
strHash = window.location.hash;

$( window.location ).trigger(
"change",
{
currentHref: strLocation,
currentHash: fnCleanHash( strHash ),
previousHref: strPrevLocation,
previousHash: fnCleanHash( strPrevHash )
}
);

}
}

// Set an interval to check the location changes.
setInterval( fnCheckLocation, intIntervalTime );
}
)( jQuery );
