//	window.onload = initialize;
	function initialize() 
	{
	   dhtmlHistory.initialize();
	   dhtmlHistory.addListener(back_foward);

	   var currentLocation = dhtmlHistory.getCurrentLocation();
//	   alert(currentLocation)

	   if (currentLocation == "")
		   currentLocation = "?";
	   else
	   {
		   currentLocation = currentLocation.replace(/section\:/, "");
//		   alert(currentLocation);
		   product_category_id_sub = getURLParamhref_new('product_category_id_sub',currentLocation);
		   if(product_category_id_sub > 0)
		   		tasubpage1('process.php?cid=25&product_category_id_sub='+product_category_id_sub,'ht_right_pages');
		   tasubpage1('process.php?'+currentLocation,'noidung');
	   }
	}
	
	function back_foward(newLocation) 
	{
	   if (newLocation == "") 
	   {
		  cid=getURLParamhref('cid');
		  product_category_id_sub=getURLParamhref('product_category_id_sub');
		  $files = getURLParamhref();
		  newLocation = "cid=100";
		  tasubpage1('process.php?'+newLocation,'noidung');
		  if(product_category_id_sub > 0)
		  	alert(product_category_id_sub);
	   }
	   else
	   {
		   newLocation = newLocation.replace(/section\:/, "");
		   tasubpage1('process.php?'+newLocation,'noidung');
	   }
	}
	
	function makeHistory(url,div)
	{
  	   //window.scrollTo(300,330);		
	  // document.getElementById('thongke_huutoan').style.display = 'none';
	   //document.getElementById('rightpage_huutoan').style.display = '';	
	   		//document.getElementById('news_list_home').style.display = '';
	   		//document.getElementById('rightpage_huutoan').style.display = 'none';
			//document.getElementById('idimages').style.display = 'none';
			
	   var modifiedLocation = url;
	   var historyData = modifiedLocation;
	   dhtmlHistory.add(modifiedLocation,historyData);
	   tasubpage1('process.php?'+url,div);
//	   tasubpage1('process.php?'+url,div);
	}
	
	function makeHistory_images(url,div)
	{
  	   //window.scrollTo(300,330);		
	  // document.getElementById('thongke_huutoan').style.display = 'none';
	   //document.getElementById('rightpage_huutoan').style.display = '';	
	   //		document.getElementById('news_list_home').style.display = '';
	   //		document.getElementById('rightpage_huutoan').style.display = 'none';
			
	   var modifiedLocation = url;
	   var historyData = modifiedLocation;
	   dhtmlHistory.add(modifiedLocation,historyData);
	   tasubpage1('process.php?'+url,div);
//	   tasubpage1('process.php?'+url,div);
	}
	
	
	function makeHistory_new(div,url)
	{
	   window.scrollTo(300,330);	
	   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)
	{
	  // window.scrollTo(300,330);	
	    product_category_id = getURLParamhref_new('product_category_id',url);
	   product_category_id_sub = getURLParamhref_new('product_category_id_sub',url);
	   
	   if(product_category_id_sub=='')
	   {
	  	 product_id=product_category_id;
	   }
	   else
	   {
		    product_id=product_category_id_sub;
		}
	
	   var modifiedLocation = url;
	   var historyData = modifiedLocation;
	   dhtmlHistory.add(modifiedLocation,historyData);
	   

	   		/*document.getElementById('news_list_home').style.display = 'none';
	   		document.getElementById('rightpage_huutoan').style.display = '';
			document.getElementById('idimages').style.display = 'none';*/
	 //  document.getElementById('thongke_huutoan').style.display = '';
	  //	var began_loading = (new Date()).getTime();
   	   tasubpage1('process.php?cid=11&product_category_id_sub='+ product_id,'rightpage_huutoan');
	  // timeload = (((new Date()).getTime() - began_loading))+ 2000;
		//setTimeout('tasubpage1("process.php?"+url,div)',timeload);
	  tasubpage1("process.php?"+url,div);
	}
	
	function makeHistory_page(div,url)
	{
	   window.scrollTo(300,330);	
	    product_category_id = getURLParamhref_new('product_category_id',url);
	   product_category_id_sub = getURLParamhref_new('product_category_id_sub',url);
	   if(product_category_id_sub=='')
	   {
	  	 product_id=product_category_id;
	   }
	   else
	   {
		    product_id=product_category_id_sub;
		}
	
	   var modifiedLocation = url;
	   var historyData = modifiedLocation;
	   dhtmlHistory.add(modifiedLocation,historyData);
	   

		/*if(document.getElementById('news_list_home').style.display == '')
	   		document.getElementById('news_list_home').style.display = 'none';
		if(document.getElementById('rightpage_huutoan').style.display == 'none')
	   		document.getElementById('rightpage_huutoan').style.display = '';*/
	 //  document.getElementById('thongke_huutoan').style.display = '';
	  //	var began_loading = (new Date()).getTime();
   	   tasubpage1('process.php?cid=11&product_category_id_sub='+ product_id,'rightpage_huutoan');
	  // timeload = (((new Date()).getTime() - began_loading))+ 2000;
		//setTimeout('tasubpage1("process.php?"+url,div)',timeload);
	  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/duong/huutoan/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);
	}
	
	
	