var timer_fast_catalogue_open = 0;
var timer_fast_catalogue_close = 0;

//##################################################################################################

function FastCatalogue_ResetTimers()
{
	if( timer_fast_catalogue_close != 0 )
	clearInterval(timer_fast_catalogue_close);
	timer_fast_catalogue_close = 0;
	
	if( timer_fast_catalogue_open != 0 )
	clearInterval(timer_fast_catalogue_open);
	timer_fast_catalogue_open = 0;
}

//##################################################################################################

function OnMouseOverCatalogueButton()
{
	FastCatalogue_ResetTimers();
	
	timer_fast_catalogue_open = setInterval(function(){
		clearInterval(timer_fast_catalogue_open);
		$j('#fast_catalogue_container').slideDown(400);
	},300);
}
function OnMouseOutCatalogueButton()
{
	FastCatalogue_ResetTimers();
	
	timer_fast_catalogue_close = setInterval(function(){
		clearInterval(timer_fast_catalogue_close);
		$j('#fast_catalogue_container').slideUp(400);
	},500);	
}

function OnMouseOverCatalogueContainer()
{
	FastCatalogue_ResetTimers();
	
	timer_fast_catalogue_open = setInterval(function(){
		clearInterval(timer_fast_catalogue_open);
		$j('#fast_catalogue_container').slideDown(400);
	},300);
}
function OnMouseOutCatalogueContainer()
{
	FastCatalogue_ResetTimers();
	
	timer_fast_catalogue_close = setInterval(function(){
		clearInterval(timer_fast_catalogue_close);
		$j('#fast_catalogue_container').slideUp(400);
	},500);	
}

//##################################################################################################

function Catalogue_VisHid_Children( id , obj_title , type_view_children , type_list )
{	
	if( id <= 0 )
	return false;
	if( obj_title == undefined )
	return false;
	if( type_view_children < 1 || type_view_children > 3 )
	return false;
		
	var minus = Element.previous(obj_title);
	if( minus == undefined )
	return false;
	var plus = Element.previous(minus);
	if( plus == undefined )
	return false;
	
	var obj_children = Element.next(obj_title);	
	
	if( obj_children != undefined )
	{
		if( obj_children.style.display == 'none' )
		{
			obj_children.style.display = 'block';
			plus.style.display = 'none';
			minus.style.display = 'inline';
		}
		else
		{
			obj_children.style.display = 'none';
			plus.style.display = 'inline';
			minus.style.display = 'none';
		}
		
		return true;
	}
	else
	{
		if( type_view_children == 3 )
		{
			Element.insert( obj_title , {after: '<br/><img src="/images/ajax-load.gif" width="90" height="10" />'});
			new Ajax.Request( '/catalogues/act/ajax_get_category_children/?id='+id+'&type_list='+type_list,
			{
				method:'get',
				onSuccess: function(transport)
				{
					Element.remove( Element.next(obj_title) );
					Element.remove( Element.next(obj_title) );
					Element.insert( obj_title , {after: transport.responseText});
					
					plus.style.display = 'none';
					minus.style.display = 'inline';
				},
				onFailure: function(){}
			}
			);
			
			return true;
		}
		else
		{
			return false;
		}
	}
}

//##################################################################################################

