	var COLORS = new Array("black","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen");
	
	function isHexa(s){
		var regexp = /[^0-9a-f]/gi;
		return !regexp.test(s);
	}

	function isColor(c){
		if(c[0]=='#') c = c.substr(1,c.length-1);
		if(IsInArray(COLORS,c)) return c;
		else if(isHexa(c)) return "#"+c;
		return false;
	}

	function IsInArray(a,e){
		for(var i=0;i<a.length;i++) if(a[i] == e) return true;
		return false;
	}

	function randInt(min,max){
		return (min + Math.round(Math.random()*max));
	}	

	function randDec(min,max){
		return min + Math.random()*max;
	}

	function randColor(alone){
		var maxC = 16777215; // equivalent of FFFFFF
		return (!alone?"#":"")+d2h(randInt(0,maxC));				
	}
	
	function antiMailSpam(){
		$("a.mail").each(function(){
			var href = $(this).attr('href');
			var isMailto = false;
			if(href!='') isMailto = href.indexOf('mailto:')!=-1;
			if(isMailto){
				href = href.replace('|','@');
				var text = $(this).text().replace('|','@');
				$(this).attr('href',href);
				$(this).text(text);				
			}
		});
	}

	function d2h(d) {return d.toString(16);}
	function h2d(h) {return parseInt(h,16);} 
