window.dhtmlHistory.create({
        toJSON: function(o) {
                return JSON.stringify(o);
        }
        , fromJSON: function(s) {
                return JSON.parse(s);
        }
});


	dhtmlHistory.initialize();
	dhtmlHistory.addListener(hm);
	historyStorage.reset();	

	var ajaxer = new ajas();
	
	var muu = document.URL;
	
	if(muu.indexOf("#") > 0)
	{
		var daz = muu.split("#");
		if(daz[1].length > 0)
		{
			try{
				//Cargar modulo abierto
				new ajas().request('central.php?q='+daz[1],{history:true,uid:daz[1]});
				//dhtmlHistory.add(daz[1] , 'contentDiv,central.php?q='+daz[1]);
				}
			catch(e)
			{
				//TODO, hacerlo bien
				setTimeout(function () { ajaxer.request('central.php?q='+daz[1]); },2000);
			}
		}
		else
		{
			new ajas().request('start.php',{history:true,uid:'inicio/'});
			//dhtmlHistory.add('inicio/' , 'contentDiv,start.php');
		}
	}
	else
	{
	
		//Agregar modulo por defecto
		new ajas().request('start.php',{history:true,uid:'inicio/'});
		//dhtmlHistory.add('inicio/' , 'contentDiv,start.php');
	}	
	
	
	

function hm(newLocation, historyData) {
	
	
	if(historyData != null)
	{
		
		var historyMsg = (typeof historyData == "object" && historyData != null
			? historyStorage.toJSON(historyData)
			: historyData
		);
		document.ajaxer.request(historyData);
	}
	
	
};
