//	window.onload = initialize;
	function initialize() 
	{
	   dhtmlHistory.initialize();
	   dhtmlHistory.addListener(back_foward);

	   var currentLocation = dhtmlHistory.getCurrentLocation();

	   if (currentLocation == "")
		   currentLocation = "?cid=100";
	   else
	   {
		   currentLocation = currentLocation.replace(/section\:/, "");
		   tasubpage1('process.php?'+currentLocation,'phan_giua');
	   }
	}
	
	function back_foward(newLocation) 
	{
	   if (newLocation == "") 
	   {
		  cid=getURLParamhref('cid');
//		  alert("cid="+cid)
		  $files = getURLParamhref();
		  newLocation = "cid=100";
		  tasubpage1('process.php?'+newLocation,'phan_giua');
	   }
	   else
	   {
		   newLocation = newLocation.replace(/section\:/, "");
		   tasubpage1('process.php?'+newLocation,'phan_giua');
	   }
	}
	
	function makeHistory(url,div)
	{
	   window.scrollTo(300,0);	 	
	   var modifiedLocation = url;
	   var historyData = modifiedLocation;
	   dhtmlHistory.add(modifiedLocation,historyData);
	   tasubpage1('process.php?'+url,div);
	}
	
	function makeHistory_new(div,url)
	{
	   window.scrollTo(300,50);
	   var modifiedLocation = url;
	   var historyData = modifiedLocation;
	   dhtmlHistory.add(modifiedLocation,historyData);
	   tapage(div,'process.php?'+url);
	}
	
	function getURLParamhref(strParamName)
	{
		  var strReturn = "";
		  var strHref = window.location.href;

		  if ( strHref.indexOf("?") > -1 )
		  {
				var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
				var aQueryString = strQueryString.split("&");
				for ( var iParam = 0; iParam < aQueryString.length; iParam++ )
				{
					  if (aQueryString[iParam].indexOf(strParamName.toLowerCase() + "=") > -1 )
					  {
							var aParam = aQueryString[iParam].split("=");
							strReturn = aParam[1];
							break;
					  }
				}
		  }
		  return unescape(strReturn);
	}
	
/*	
	function makeHistory_sp(url,div)
	{
	   product_category_id_sub = getURLParamhref_new('product_category_id_sub',url);		
	   var modifiedLocation = url;
	   var historyData = modifiedLocation;
	   dhtmlHistory.add(modifiedLocation,historyData);
	   
	   if(document.getElementById('rightpage_huutoan').style.display == '')
	   		document.getElementById('rightpage_huutoan').style.display = 'none';
	   document.getElementById('thongke_huutoan').style.display = '';

   	   tasubpage1('process.php?cid=11&product_category_id_sub='+product_category_id_sub,'thongke_huutoan');
	   tasubpage1('process.php?'+url,div);
	}
*/	
	function makeHistory_(url,div)
	{
	   var modifiedLocation = url;
	   var historyData = modifiedLocation;
	   dhtmlHistory.add(modifiedLocation,historyData);
	   tasubpage1('process.php?'+url,div);
	}
	
	function getURLParamhref_new(strParamName,urls)
	{
		  var strUrl = "http://192.168.0.8/~ta/ta/index.php";	
		  var strReturn = "";
		  var strHref = strUrl+urls;

		  if ( strHref.indexOf("?") > -1 )
		  {
				var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
				var aQueryString = strQueryString.split("&");
				for ( var iParam = 0; iParam < aQueryString.length; iParam++ )
				{
					  if (aQueryString[iParam].indexOf(strParamName.toLowerCase() + "=") > -1 )
					  {
							var aParam = aQueryString[iParam].split("=");
							strReturn = aParam[1];
							break;
					  }
				}
		  }
		  return unescape(strReturn);
	}
	
	
	
