// JavaScript Document
var Store_History_Cancel_Load=0,Store_location_his="";
addEvent(window,'load',function() {
  dhtmlHistory.initialize();
  dhtmlHistory.addListener(handleload_content);
  load_content(dhtmlHistory.getCurrentLocation());
});
function handleload_content(newLocation) {
	if(!Store_History_Cancel_Load)load_content(newLocation);
	else Store_History_Cancel_Load=0;
//	Store_location_his=newLocation
}
function addHistoryEvent (newLocation) {
	Store_History_Cancel_Load=1;
	dhtmlHistory.add(newLocation);
	load_content(newLocation);
}
function load_content(newLocation){//, historyData
	if (newLocation == null || newLocation == "" )newLocation = "inc/4.main/sites/startpage.php";
	site_counter(newLocation);
	if(newLocation.match(/^store\:/) && storeLoad)storeLoad(newLocation.replace(/^store\:/,""));
	else if(newLocation.match(/^store_s\:/) && storeLoad_solgt)storeLoad_solgt(newLocation.replace(/^store_s\:/,""));
	else load($('main'),newLocation);
};


function site_counter(url){
		if(url.indexOf("store")==0){
			u1=url.match(/^store(_s)?/)[0];
			u2=url.match(/(:|&)(st=\w+)(&|$)?/)[2];
			u3=url.match(/(:|&)(sg=\w+)(&|$)?/);
			url=u1+": "+u2;
			if(u3)url+=" "+u3[2];
		}else{
			aurl=url.split("/");
			url=aurl[aurl.length-2]+": "+aurl[aurl.length-1];
		}
		ajax_request("inc/site_counter/count.php?name="+url);
}