/**
 * Simple JQuery Plugin to remove duplicates in an array
 * Author: Keith Deverell 2008
 * Built with functions by Johan Känngård, http://dev.kanngard.net
 */

var CleanArray = {
    combine: function(data) 
	{
		var tmp = new Array();
		for(var i=0;i<data.length;i++){
			tmp = data[i].categories.concat(tmp);
		}
		
		var tmp = CleanArray.unique(tmp);
		return tmp;
    },

	/**
	 * Removes duplicates in the array 'a'
	 * @author Johan Känngård, http://dev.kanngard.net
	 */
	
	unique: function(a)
	{
		var tmp = new Array(0);
		for(i=0;i<a.length;i++)
		{
			if(!CleanArray.contains(tmp,a[i]))
			{
				tmp.length+=1;
				tmp[tmp.length-1]=a[i];
			}
		}
		return tmp;
	},
	
	/**
	 * Returns true if 's' is contained in the array 'a'
	 * @author Johan Känngård, http://dev.kanngard.net
	 */
	
	contains: function(a,e) 
	{
		for(j=0;j<a.length;j++)if(a[j]==e)return true;
		return false;
	}
}

