if(navigator.appName=="Netscape")
{
	window.onload = initialize();
}
else
{
	window.onload = initialize;
}

function initialize() {
	
   dhtmlHistory.initialize();
  
   dhtmlHistory.addListener(back_foward);
 //  var menu = document.getElementById("menu");
   var currentLocation =dhtmlHistory.getCurrentLocation();
   if (currentLocation == "") 
   {
		cid=getURLParamhref('cid');
	
      currentLocation = "http://master/abidooo/index.php?cid="+cid;
	
	 //	document.location.href='index.php?cid='+cid;
   }
   else
   {
   currentLocation =currentLocation.replace(/section\:/, "");
    div=getURLParam(currentLocation);
	// div='showfriendsex';
    cid=parseInt(getURLcid('cid'));
	 switch(cid)
	 {
		case 39:
		  Abidopage(div,'news_ajax.php?'+currentLocation);
		  break;   
		case 41:
		  Abidopage(div,'bikip_ajax.php?'+currentLocation);
		  break;  
		case 1001:
		case 1013:
		case 1016:
		  Abidopage(div,'friend_ajax.php?'+currentLocation);
		  break;  
		default:
		  Abidopage(div,'includes/process.php?'+currentLocation);
		  break;
	 }
   }
}
function back_foward(newLocation)
{
	//alert(newLocation+' <====');
   if (newLocation == "") 
   {
   	  cid=getURLParamhref('cid');
	 block=cid.split("#");
	//	if(block!=1)
	//	{
		 // newLocation = "cid="+cid;
			if(navigator.appName=="Microsoft Internet Explorer")
			{
		  	document.location.href='index.php?cid=2';
			}
			else
			{
			 //Abidopage('divCustomerInfo','includes/process.php?cid='+block[0]);
			}
	//	}
   }
   else
   {
  	 newLocation = newLocation.replace(/section\:/, "")
   	cid=parseInt(getURLcid('cid'));
 	 div=getURLParam(newLocation);
	// div='showfriendsex';
     switch(cid)
	 {
		case 39:
		  Abidopage(div,'news_ajax.php?'+newLocation);
		  break;   
		case 41:
		  Abidopage(div,'bikip_ajax.php?'+newLocation);
		  break;   
		default:
		  Abidopage(div,'includes/process.php?'+newLocation);
		  break;
	 }
   }
 
}

function goi(url)
{
   var modifiedLocation =url;
   var historyData =modifiedLocation;
   dhtmlHistory.add(modifiedLocation,historyData);
  // alert(url.charAt(4))
	div=getURLParam(url);
	//div='showfriendsex';
    Abidopage(div,'includes/process.php?'+url);
}
function goi_bikip(url)
{
   var modifiedLocation =url;
   var historyData =modifiedLocation;
   dhtmlHistory.add(modifiedLocation,historyData);
  // alert(url.charAt(4))
	div=getURLParam(url);
	//div='showfriendsex';
    Abidopage(div,'bikip_ajax.php?'+url);
}
function goi_news(url)
{
   var modifiedLocation =url;
   var historyData =modifiedLocation;
   dhtmlHistory.add(modifiedLocation,historyData);
  // alert(url.charAt(4))
	div=getURLParam(url);
	//div='showfriendsex';
    Abidopage(div,'news_ajax.php?'+url);
}
function goi_friend(url)
{
   var modifiedLocation =url;
   var historyData =modifiedLocation;
   dhtmlHistory.add(modifiedLocation,historyData);
  // alert(url.charAt(4))
	div=getURLParam(url);
	//div='showfriendsex';
    Abidopage(div,'friend_ajax.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 getURLcid(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 getURLParam(url)
		{
			
		  var strReturn = "";
		  var strHref =url;
		  var div="";
		  if ( strHref.indexOf("cid") > -1 )
		  {
			var strQueryString = strHref.substr(strHref.indexOf("=")).toLowerCase();
			var aQueryString = strQueryString.split("=");
			var aParam = aQueryString[1].split(",");
		  }
		  aParam=parseInt(aParam)
		  switch(aParam)
		  {
			  case 4:
			  case 6:
			  case 8:
			  case 19:
			  case 24:
			  case 26:
			  case 1000:
			  {
			  	div='divCustomerInfo'
				break;
			  }
			  case 39:
			  {
				div='noidung_news'
				break;
			  }
			   case 41:
			  {
				  div='noidung_bikip'
				  break;
			  }
			  case 1001:
			  case 1002:
			  case 1003:
			  case 1004:
			  case 1005:
			  case 1006:
			  case 1007:
			  case 1008:
			  case 1009:
			  case 1010:
			  case 1011:	
			  case 1012:
			  case 1013:
			  case 1014:
			  case 1015:
			  case 1016:
			  case 1017:
			  case 1019:
			  case 1020:
			  case 1021:
			  case 1023:
			  case 1024:
			  case 1025:
			  case 1027:
			  case 1032:
			  case 1033:
			  {
				  div='showfriendsex'
				  break
			  }
			  
		  }
		  return unescape(div);
		} 