// <![CDATA[
			
	/*
	*	McNally Robinson 2007 - layout v2
	*	@author: alex.smoljanovic@thewebshop.ca
	*/
	
	
	function ct_clickednode( catid, changeall )
	{
			
		var el,
			paramex = 'refresh=true';
			
		if( changeall/* not a child node */ )
		{
			el = 'cat-tree';		
			paramex = 'refresh=true';
		}
		else
		{
			el ='cat-tree-active-cat';
			paramex = 'refresh=false';
		}
		
		var elCat = null,
			elStatus = null;
		
		try
		{
			elCat = findObj('navigation-container');
			elStatus = findObj('cat-tree-status');
		}	catch(e){}
		
		
		
		new Ajax.Updater(
			el, 
			cat_tree_uri+"treerpc.php?txtCatID="+ catid + "&" + paramex,
			{
				onLoading:function(request){
					try{	elCat.className = 'cat-tree-waiter';			}catch(e){}
					try{	elStatus.className = 'cat-tree-status-visible';	}catch(e){}
				},
				onComplete:function(request){
					try{	elCat.className = '';							}catch(e){}
					try{	elStatus.className = 'cat-tree-status-hidden';	}catch(e){}
					try
					{
						//if( changeall )
						//	blk_el( findObj('cat-tree-selected'), 700, new Array('cat-tree-opened', 'cat-tree-opened-blink') );
							// blink the newly opend cat.. (sub root)
							
					}catch(e)
					{
						
					}
				},
				onError:function(v){
					//well, we had a boo boo... so lets just reload the page with out changing content and sync the nav :) 
					window.location = "?txtCatID="+ catid;
				},
				parameters:
					"txtCatID="+ catid + "&" + paramex,
					insertion:Element.update , 
					asynchronous:true
			}
	
		);
		
		return false; /* block <a>nchors raiseEvent behavior since we don't want to reload the page anymore ... */

	}
	
	
	var _blk_target,
		_blk_timeout,
		_blk_classes,
		_blk_flagz,
		_blk_flagbool,
		_blk_htimeout;
		
	function blk_el( target, timeout, /*[]*/classes )
	{
		_blk_target=target;
		_blk_timeout=timeout;
		_blk_classes=classes;
		
		_blk_flagz = 5; /* iteration counter */
		_blk_flagbool = false;
		
		if( _blk_htimeout )
			_blk_htimeout = clearTimeout( _blk_htimeout );	
			
		_blk_htimeout = setTimeout(	'blk_imp()', _blk_timeout );
		
	}
	
	
	function blk_imp()
	{
		_blk_flagbool = !_blk_flagbool;
		_blk_target.className = _blk_classes[ _blk_flagbool ? 1 : 0 ];
		
		if( _blk_flagz > 0 )
			_blk_htimeout = setTimeout(	'blk_imp()', _blk_timeout );
		
		_blk_flagz--;
	}
			
// ]]>