window.onload = initialize;

function initialize()
{
	// initialize the DHTML History framework
    dhtmlHistory.initialize();
    // subscribe to DHTML history change events
    dhtmlHistory.addListener(historyChange);
	
}

function historyChange(url,complexObject)
{	if(complexObject.options.parameters && complexObject.options.parameters.split('=')[0]=="mainlink")
			url=url.split('?')[0];//remove the parameters added in mainlink
	container=complexObject.container;
	options=complexObject.options;
	if (url == "")
       {
	      window.location.href=window.location.href;//refresh the page
       }
    else
       {			 
			new Ajax.Updater(container,url,options);
       }
	return false;
}

