//
function showItems(tableName)
{
	var tmp = eval ('document.all.Tab_'+tableName);		
	if(typeof(tmp)=='object') {
		var tableStyle= eval (tableName+'.style');	
		tableStyle.display=""
	}	
} 
//
function openCategory(tableName)
{
	if(tableName!="0") { 
		var tableStyle= eval (tableName+'.style');		
		
		/********* update status ***********/		 
		statusTextBox = document.getElementById("categorybar_catalogOpenStatus");		
		statusValue = statusTextBox.value;				
		var index = statusValue.indexOf(tableName) + tableName.length;				
		signal =  statusValue.charAt(index);													 
		if(signal == 'F')
		{						
			statusValue = statusValue.replace(tableName+'F',tableName+'T');				
		}
		else
		{	
			statusValue = statusValue.replace(tableName+'T',tableName+'F');			
		}
		statusTextBox.value = statusValue;
		/*********** ***** ***** *************/				
				
		
		Ajax();				
						
		if (tableStyle.display=="none")
		{
			tableStyle.display=''			
		}
		else
		{
			tableStyle.display="none"		 
		}
		
		changeImagePlus(tableName);
		
	}
}
//
function openSubCategory(tableName)
{
	if(tableName!="0") {
		var tableStyle= eval (tableName+'.style');							
				
		/********* update status ***********/		
		statusTextBox = document.getElementById("categorybar_categoryOpenStatus");		
		statusValue = statusTextBox.value;				
		var index = statusValue.indexOf(tableName) + tableName.length;				
		signal =  statusValue.charAt(index);													 
		if(signal == 'F')
		{						
			statusValue = statusValue.replace(tableName+'F',tableName+'T');				
		}
		else
		{	
			statusValue = statusValue.replace(tableName+'T',tableName+'F');			
		}
		statusTextBox.value = statusValue;
		/*********** ***** ***** *************/	
				
		
		Ajax();
		 
		 
		if (tableStyle.display=="none")
		{
			tableStyle.display=''
		}
		else
		{
			tableStyle.display="none"		 
		}
		
		changeImagePlus(tableName);
		
	}
}



		function Ajax()
		{	
			var xmlhttp = false;															
						
			if (window.XMLHttpRequest)			// Mozilla, Safari,...
			{ 
				xmlhttp = new XMLHttpRequest();				
			} 
			else if (window.ActiveXObject)		// IE
			{ 
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} 
														
			var catalogState = (document.getElementById('categorybar_catalogOpenStatus')).value;												
			var categoryState= (document.getElementById('categorybar_categoryOpenStatus')).value;			
			
			//Replacing Long_SubStrings from catalogState/categoryState
			//in case to send it with the URL
			var Tzimtzum_catalogState1 = catalogState.replace(/categorybar_catalogList__ctl/g,"CBCL");
			var Tzimtzum_catalogState2 = Tzimtzum_catalogState1.replace(/categoryHideTd/g,"CHTD");
			
			var Tzimtzum_categoryState1 = categoryState.replace(/categorybar_catalogList__ctl/g,"CBCL");
			var Tzimtzum_categoryState2 = Tzimtzum_categoryState1.replace(/subCategoryHideTd/g,"CHTD");
			var Tzimtzum_categoryState3 = Tzimtzum_categoryState2.replace(/category/g,"CAT");
			
			url = '/Counter/AjaxServices/SaveTreeState.aspx?CATALOG='+Tzimtzum_catalogState2+'&CATEGORY='+Tzimtzum_categoryState3;
			url = uncache(url);				// Use for GET requests
						
			try
			{
				xmlhttp.open("GET",url ,true);																						
			}
			catch(error)
			{
			}
			
			

			xmlhttp.onreadystatechange = function() 
			{
				if (xmlhttp.readyState==4) 
				{
				//	DEBUG
				//	alert(xmlhttp.responseText);
				}
			}
			try
			{
				xmlhttp.send(null);
			}
			catch(error)
			{
			}
		}
		
		
						
		function uncache(url)
		{		
			var d = new Date();
			var time = d.getTime();

			return url + '&time='+time;
		} 

		
		
		
		
		
		
