﻿var BrowserHistoryIndex=0;

/*instantiate our history object*/
window.dhtmlHistory.create({
	debugMode: false//set this to false, or just don't pass in an options bundle, to see real-world, non-debug conditions 
});


//****************************************************************************
//*call back function when users presses back/forward button on the broser
//*@param newLocation: the key of the hash table
//*@param historyData: the value of the hash
//*****************************************************************************
 function historyChange(newLocation, historyData) {
   //repeat the search
    if(historyData==undefined)
        return;
   switch (historyData.section)
   {
   	case 0:
   		var keyFromHistory = historyData.key;
   		mapManager.EmulateSelectedPaneFind(keyFromHistory, -1);
        
   		break;
   	case 1:
   	    mapManager.EmulateSelectedPaneFind(historyData.key, historyData.where, -1);
   	    
   	    break;
   }
   
	
};

         
            
//****************************************************************************
//*adds search string and related information in the browser history
//*
//*@param searchSection the section where the user interacted, 0 means Find On a Map, 
//          1 means Find  a buseiness, 2 means Get Driving direction
//*****************************************************************************
addSearchHistory=function(searchSection,key,where){
var searchObject={"section":searchSection, "key":key, "where":where };
   
dhtmlHistory.add(BrowserHistoryIndex+"",searchObject);
BrowserHistoryIndex++;

}


