function ellipser() {
	var textCaract=initialise("mlg_bienvenue", "baseline");
	appendSpans(textCaract);
	document.getElementById('baseline').style.display="none";
}	
function initialise(parent, divEle) {
	var divParent = document.getElementById(parent);
	var newDiv=document.createElement('div');
	newDiv.setAttribute('id','ellipse');
	div_ellipse = divParent.appendChild(newDiv);
	
	var text=Array;
	var text_length = 0;
	var divIdName=divEle;
	var divId = document.getElementById(divIdName);
	text['text'] = getTexte(divId);
	var lettre = '';
	// analyser le texte
	text_length = text['text'].length;
	var phrase ='';
	text['segment']=360/text_length;
	if(text['segment']<4) {
		for(var i=0; i<text_length; i++) {
			//lettre = text['text'][i];
			lettre = text['text'].charAt(i);
			phrase += lettre;

			switch(lettre) {
				case 'm': case 'M':
					phrase += ' ';
				break;
			}
		}
	}
	else phrase = text['text'];
//	text['font']="Arial";
	text['font']="Verdana";
//	text['font']="Trebuchet";
	text['weight']="normal";
	text['italic']="normal";
	text['blackorwhite']="";
	//var text['rotating']=text[0]+" " ;
//	text['rotating']=text['text']+" - " ;
	text['rotating']=phrase+" - " ;
	text['inclinaison']=22.5; // °
	text['widtha']=620;

	text['widtha']=Math.floor(text['widtha']/2);
//	text['height']=Math.floor(text['widtha']/7);
	text['height']=Math.floor(text['widtha']/4);
	
	text['rotating']=text['rotating'].split("");
	text['segment']=360/text['rotating'].length;
//	text['step'] = 0.05;
	text['step'] = 0.05;
	text['decrement']=0;
	//var windowwidth="";
	//var windowheight="";
	var increment=1;
	text['theight']=0;
	text['twidth']=0;

	return text;
}
function appendSpans(text) {
	var div_ellipse;
	var style;
	var windowwidth=parseInt(get_bodyWidth());
//	var windowheight=parseInt(get_bodyHeight());
	var windowheight=0; // margin défini dans intro.css

	div_ellipse=document.getElementById('ellipse');
	style = { 
			position: "absolute",
			left: (parseInt(windowwidth/2)-10)+"px",
			top: parseInt(windowheight/2)+"px"
/*	, width: parseInt(text['widtha'])+"px",
			height: parseInt(text['height'])+"px"*/
			};
	setStyle(div_ellipse, style);

	text['twidth']=Math.floor(text['widtha']);
	text['theight']=Math.floor(text['height']);

	var spans_ellipse=createSpans(text);
	for(var j=0; j<text['rotating'].length; j++) {
		div_ellipse.appendChild(spans_ellipse[j]);
	}
	rotatetext(text);
}


function rotatetext(text) {
	var style;
	var thisspan;
	var spanLeft; var spanTop; var spanSize; var visible;
	
//	var teinte = 5;
	var teinte = 38;
	var saturation = 100; 
	var luminositeMax=54;
	var lum_rate = luminositeMax/30;
	var luminosite;
	var tab_color=Array;
	var rouge; var vert; var bleu;
	for (i=0; i<text['rotating'].length; i++) {
		visible = "visible";
		thisspan= document.getElementById("span"+i);
		spanLeft = text['twidth']*Math.sin(text['decrement']+i*text['segment']*Math.PI/180);
//	spanLeft = text['twidth']*Math.sin(text['decrement']+((i*text['segment'])*(Math.PI/180) - Math.sin(text['inclinaison'])));
		spanTopEx=text['theight']*Math.cos(text['decrement']+i*text['segment']*Math.PI/180);	
		spanTop=text['theight']*Math.cos(text['decrement']+i*text['segment']*Math.PI/180 - Math.cos(text['inclinaison']));	
//	spanSize = parseInt(((spanTopEx+text['height'])/5)+7);
		spanSize = parseInt(((spanTopEx+text['height'])/5));
		if(spanSize<=10) {
			spanSize=0;
			visible="hidden";
		}
		
		luminosite = parseInt(spanSize*lum_rate);
		//saturation = parseInt(spanSize*2.778);

		tab_color = creer_rvb(teinte,luminosite,saturation);
		rouge=makeHexa(tab_color['R']);
		vert=makeHexa(tab_color['V']);
		bleu=makeHexa(tab_color['B']);
		thiscol = "#"+rouge+vert+bleu ;		/**/
	
		style = { 
			left: parseInt(spanLeft)+"px",
			top: parseInt(spanTop)+"px",
			fontSize: parseInt(spanSize)+"px",
			color: thiscol,
			position: "absolute",
			fontFamily:text['font'],
//			fontWeight:text['weight'],
//			fontStyle:text['italic'],
			visibility: visible
			};
		setStyle(thisspan, style);
	}
	text['decrement']-=text['step'];
	setTimeout( function() { rotatetext(text); }, 20 );
}

//	document.bgColor=text['blackorwhite'];

function createSpans(text) {
	var newSpan=Array;
	for (i=0;i<text['rotating'].length;i++) {
		newSpan[i]=document.createElement("span");
		newSpan[i].setAttribute('id','span'+i);
/*	newSpan[i].setAttribute('class', 'spanstyle');*/
		newSpan[i].innerHTML=text['rotating'][i];
	}
	return newSpan;
}

