

function analyseState(state){

	var param=state.toQueryParams('&');
	var vers = param["page"];
	
	goPage(vers);

};



//recupere l etat courant de la page
var smbdBookmarkedState = YAHOO.util.History.getBookmarkedState("tpub"); 
//si pas de statut courant, on affiche la page d accueil. (hash home)
var smbdInitialState = smbdBookmarkedState || "page=accueil";

//fonction appelle lors de la modification de l objet history
//apres un .navigate
function smbdStateChangeHandler (state) {

    analyseState(state);
}
//enregistre le module 'tpub', avec son etat initiale et sa fonction a appelle
YAHOO.util.History.register("tpub", smbdInitialState, smbdStateChangeHandler);

//appelle apres l initialisation de history
YAHOO.util.History.onReady(function () {
	
    var smbdCurrentState = YAHOO.util.History.getCurrentState("tpub"); 
    analyseState(smbdCurrentState);

});
	
function go_to(vers){
	YAHOO.util.History.navigate("tpub", "page="+vers);
}

function goPage(vers){
	
	var url = vers+'.html';

	new Ajax.Updater('framePrincipale',url,{
		method:'get',
		contentType:  'application/x-www-form-urlencoded',
	    encoding:     'ISO-8859-1',
		requestHeaders:'Content-Type:text/html; charset=ISO-8859-1',
		onCreate:function(resp){
					if(resp.transport.overrideMimeType)
								resp.transport.overrideMimeType("Content-Type:text/html; charset=ISO-8859-1");	
								
			}	
		}
	);
}