$( document ).ready(
	function()
	{
		var category_link = $( 'a.more_details' );
		var category_description = Array();
		$( category_link ).each(
			function( index, item )
			{
				$( item ).parent().children( '.category-descrption' ).attr( 'rel', index );
				category_description.push( $( item ).parent().children( '.category-descrption' ) );
			}
		);
		var category_current_opened = -1;
		if ( ( category_link.length > 0 ) && ( category_description.length > 0 ) && ( category_link.length == category_description.length ) )
		{
			$( category_link ).each(
				function( index, item )
				{
					$( item ).click(
						function( event )
						{
							event.preventDefault();
							if( category_current_opened != -1 )
							{
								$( category_link[ category_current_opened ] ).html( 'More' ).removeClass('pkg-close');
								$( category_description[ category_current_opened ] ).hide();
							}
							if( category_current_opened != index )
							{
								
								category_current_opened = index;
								$( category_link[ category_current_opened ] ).html( 'Close' ).addClass('pkg-close');
								$( category_description[ category_current_opened ] ).show();
							}
							else
							{
								category_current_opened = -1;
							}
						}
					);
				}
			);
		}
	}
);

