function EGCumulusAnywhere(EGCAparams)
{
	//EGCA versione 0.1
	//EGCA version 0.1	


	//conf EGW Cumulus
	baseDestURL = ""
	cloudSwfURL = "tagcloud.swf";
	cloudWidth = 200;
	cloudHeight = 200;
	cloudSpeed = 100;

	colTxt01 = "0f0000";
	colTxt02 = "00f000";
	colHover = "f0ff00";
	colBack = "ffffff";
	
	IdDivTagsDefault = "EGCATAGSDEMO=1";



	//elements must be this format "element name|element size|element link"
	//gli elementi devono rispettare questo formato "nome elemento|dimensione elemento|link elemento"
	arrTags = new Array()

	



	hSize = new Array(6)
	hSize[0] = 20; //h1 size
	hSize[1] = 18; //h2 size
	hSize[2] = 16; //h3 size
	hSize[3] = 14; //h4 size
	hSize[4] = 12; //h5 size
	hSize[5] = 10; //h6 size
	hSize[6] = 8; //h7 size

	//fine conf EGW cumulus







	document.write("<object type=\"application/x-shockwave-flash\" data=\""+cloudSwfURL+"\" width=\""+cloudWidth+"\" height=\""+cloudHeight+"\">");


	document.write("<param name=\"movie\" value=\""+cloudSwfURL+"\" >");
	document.write("<param name=\"bgcolor\" value=\"#"+colBack+"\" >");
	document.write("<param name=\"AllowScriptAccess\" value=\"always\" >");
	document.write("<param name=\"wmode\" value=\"transparent\" >");



	document.write("<param name=\"flashvars\" "); 
	document.write("value=\"tcolor=0x"+colTxt01+"&amp;tcolor2=0x"+colTxt02+"&amp;hicolor=0x"+colHover+"&amp;tspeed="+cloudSpeed+"&amp;mode=tags&amp;distr=true&amp;tagcloud=");
	document.write("%3Ctags%3E");

	//display tags from Array
	if (arrTags.length > 0)
	{
		for (i=0;i<arrTags.length;i++)
		{
			tagData = arrTags[i].split("|");
			document.write("%3Ca+href%3D%27%2F"+escape(baseDestURL+tagData[2])+"%27+style%3D%27font-size%3A+"+escape(tagData[1])+"pt%3B%27%3E"+escape(tagData[0])+"%3C%2Fa%3E%0A");
		}
	}
	
	//check if script has params. If not try to handle default DIV element
	//controlla se lo script ha parametri. In caso contrario prova a usare l'elemento di default
	if (EGCAparams == undefined)
	{
		IdDivTags = IdDivTagsDefault;
	}
	else
	{
		IdDivTags = EGCAparams;
	}
	//display tags from Div element
	//mostra tag recuperati dall'elemento DIV
	divToHandle = IdDivTags.split(",");
	for (cDiv = 0;cDiv < divToHandle.length;cDiv++)
	{
		divSetup = divToHandle[cDiv].split("=");
		if (document.getElementById(divSetup[0]) != null)
		{
			
			//tags to remove from cumulus param (CSV)
			//tag da rimuovere dai parametri di cumulus (CSV)
			codeToClean = "<h1>,<h2>,<h3>,<h4>,<h5>,<h6>,<h7>,</h1>,</h2>,</h3>,</h4>,</h5>,</h6>,</h7>,<ul>,</ul>,<li>,</li>,<ol>,</ol>";
			
			//hide element if set to 0
			//nasconde l'elemento se il parametro è 0
			if (divSetup[1] == "0")
			{
				document.getElementById(divSetup[0]).style.display = "none";
			}
			
			EGCADivContent = document.getElementById(divSetup[0]).innerHTML;
			elDIV = EGCADivContent.split("\n");
			encodedTags = ""; 
			for (i=0;i<elDIV.length;i++)
			{
				
				//check il current line has Hx or li and a
				//controlla se la linea corrente ha Hx o li e a
				if ((elDIV[i].indexOf("<h") > -1 || elDIV[i].indexOf("<li") > -1) && elDIV[i].indexOf("<a") > -1)
				{			
				
					elDIV[i] = elDIV[i].split("<a ").join("<a style='font-size:+"+hSize[6]+"pt' ");
				
				
					//assign right size to Hx tags
					//assegna la dimensione giusta ai tag Hx
					for (t=1;t<7;t++)
					{
						if (elDIV[i].indexOf("<h"+t+">") > -1)
						{
							elDIV[i] = elDIV[i].split("+"+hSize[6]+"pt").join("+"+hSize[t-1]+"pt");
						}
						
						if (elDIV[i].indexOf("size=\""+t) > -1)
						{
							elDIV[i] = elDIV[i].split("+0.0pt").join("+"+hSize[t-1]+"pt");
						}
					}
				
				
					encodedTags = encodedTags + elDIV[i];
				
				}	
			}
		
			
			//remove unneeded code
			//elimina codice indesiderato
			elCodeToClean = codeToClean.split(",");
			for (i=0;i<elCodeToClean.length;i++)
			{
				encodedTags = encodedTags.split(elCodeToClean[i]).join("");
			}
			
			document.write(escape(encodedTags));
		}	

	}



	document.write("%3C%2Ftags%3E\"");
	document.write("></object>");
	
}

function startEGCA(sUpOption)
{
	document.onload = EGCumulusAnywhere(sUpOption);
}

