function treeclass_toggleNode(node,level) 
{
	setnavigationcontrol(node.innerText,level);
	
	node=node.parentNode
			
	var nodeArray = node.childNodes;
	for(i=0; i < nodeArray.length; i++)
	{
	  node = nodeArray[i];
	  if (node.tagName && node.tagName.toLowerCase() == 'div')
	    node.style.display = (node.style.display == 'block') ? 'none' : 'block';
	            
	}

	for(i=0; i < nodeArray.length; i++)
	{
	  node = nodeArray[i];
	  if ((node.tagName) && (node.tagName.toLowerCase() == 'img') && (node.id.toLowerCase() == 'button') )
	    node.src = (node.src.indexOf('plus.gif') > 0) ? '/images/minus.gif' : '/images/plus.gif';
	}
}

	//NON USATA      
  function nn_openNode(node)
  {
    var nodeArray = node.childNodes;
    for(i=0; i < nodeArray.length; i++)
    {
      node = nodeArray[i];
      if (node.tagName && node.tagName.toLowerCase() == 'div')
        node.style.display = 'block';
    }
  }

	//NON USATA      
  function nn_closeNode(node)
  {
    var nodeArray = node.childNodes;
    for(i=0; i < nodeArray.length; i++)
    {
      node = nodeArray[i];
      if (node.tagName && node.tagName.toLowerCase() == 'div')
        node.style.display = 'none';
    }
  }

	//NON USATA     
  function nn_showNode(node)
  {
    if (!node) return;
    if (!node.parentNode) return;
    node = node.parentNode;
    while (node.tagName.toLowerCase() == 'div')
    {
      openNode(node);
      node = node.parentNode;
    }
  }

function treeclass_viewlist(obj,target) {
	debugger;
	setnavigationcontrol(obj.innerText,3)
		
	document.body.style.cursor="wait";

	var newLink = '';
	var args = document.location.href.split('&');

	for (var i=0;i<args.length;i++)
	{
		var pair = args[i].split('=');
		name = unescape(pair[0]);

		if((name != 'qu') && (name != 'list') && (name != 'presentation') && (name != 'id')&& (name != 'action') && (name != 'count') && (name != 'item') ){
			if (i > 0)
				newLink += '&';
			newLink += pair[0] + '=' + pair[1];
		}
	}
	document.location= newLink + "&list=1&qu=" + encodeURI(target);
}

function treeclass_viewChoose(mytext,target) {
	setnavigationcontrol(mytext,1)

	document.body.style.cursor="wait";

	var newLink = '';
	var args = document.location.href.split('&');

	for (var i=0;i<args.length;i++)
	{
		var pair = args[i].split('=');
		name = unescape(pair[0]);

		if((name != 'qu') && (name != 'list') && (name != 'presentation') && (name != 'id')&& (name != 'action') && (name != 'count') && (name != 'item') && (name != 'Carrello') && (name != 'tipo')){
			if (i > 0)
				newLink += '&';
			newLink += pair[0] + '=' + pair[1];
		}
	}
	document.location= newLink + "&qu=" + encodeURI(target) + "&list=2";
}

function treeclass_viewPresentation(target,id)
{
	setnavigationcontrol("",1)
	
	document.body.style.cursor="wait";

	var newLink = '';
	var args = document.location.href.split('&');

	for (var i=0;i<args.length;i++)
	{
		var pair = args[i].split('=');
		name = unescape(pair[0]);

		if((name != 'id') && (name != 'presentation')&& (name != 'action') && (name != 'count') && (name != 'item')){
			if (i > 0)
				newLink += '&';
			newLink += pair[0] + '=' + pair[1];
		}
	}
	document.location= newLink + "&id=" + encodeURI(id) + "&presentation=1";
}

//================================================================================================

function setnavigationcontrol(label,level)
{
	var obj = document.getElementById('navigation');
	
	if (obj == null)
		return;
	
	switch (level)
	{
	case 0:
		obj.innerText = "";
		break;
		
	case 1:
		obj.innerText = label;
		break;
		
	case 2:
		var pair = obj.innerText.split('>>');
		re = / /g;
		obj.innerText = pair[0].replace(re, "") + '  >>  ' + label;
		break;
	
	case 3:
		var pair = obj.innerText.split('>>');
		re = / /g;
		obj.innerText = pair[0].replace(re, "") + '  >>  ' + pair[1].replace(re, "") + '  >>  ' + label;
		break;
		
	}
	
	SetCookie ("navigation",obj.innerText);
}
//================================================================================================

function SetCookie(sName, sValue)
{
  document.cookie = sName + "=" + escape(sValue); //K201110226 encodeURI(sValue);
}
