
function MCLDPlasma(name) { 
	this.t = 0; 
	this.vitesse=100;
	this.tx = 0; 
	this.ty = 0;
	this.tax = 80; 
	this.tay = 20;
	this.precis = Math.floor(100/this.tax);
	this.posx = 0;
	this.posy = 50;
	this.text_plasma='(c) 2010 -Maxime Schneider, aka -MCLODO this plasma sinus scroll is designed to be used as description text for website';
	this.alpha = [[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],[[0,1,1,1,0],[1,0,0,1,0],[0,0,1,0,1],[0,1,0,1,0],[0,0,1,0,0]],[[0,0,0,0,0],[0,0,1,0,0],[0,1,1,1,0],[0,0,1,0,0],[0,0,0,0,0]],[[0,0,1,0,0],[0,0,1,0,0],[0,0,1,0,0],[0,0,0,0,0],[0,0,1,0,0]],[[0,1,1,0,0],[1,0,0,1,0],[0,0,1,0,0],[0,0,0,0,0],[0,0,1,0,0]],[[0,0,0,1,0],[0,0,1,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,1,0,0],[0,1,0,0,0]],[[0,0,1,0,0],[0,1,0,0,0],[0,1,0,0,0],[0,1,0,0,0],[0,0,1,0,0]],[[0,0,1,0,0],[0,0,0,1,0],[0,0,0,1,0],[0,0,0,1,0],[0,0,1,0,0]],[[0,0,0,0,0],[0,0,1,0,0],[0,0,0,0,0],[0,0,1,0,0],[0,0,0,0,0]],[[0,0,1,1,0],[0,1,0,1,0],[1,0,0,1,0],[0,0,0,1,0],[0,0,1,1,1]],[[0,1,1,1,0],[1,0,0,0,1],[0,0,1,1,0],[0,1,0,0,0],[1,1,1,1,1]],[[0,1,1,1,0],[1,0,0,0,1],[0,0,1,1,0],[1,0,0,0,1],[0,1,1,1,0]],[[0,0,1,1,0],[0,1,0,1,0],[1,1,1,1,1],[0,0,0,1,0],[0,0,0,1,0]],[[0,1,1,1,1],[1,0,0,0,0],[1,1,1,1,0],[0,0,0,0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,0,0,0,1],[0,1,1,1,0]],[[1,0,0,0,1],[1,0,0,0,1],[0,1,0,1,0],[0,1,0,1,0],[0,0,1,0,0]],[[1,0,0,0,1],[1,0,0,0,1],[1,0,0,0,1],[1,0,1,0,1],[0,1,0,1,0]],[[1,0,0,0,1],[1,0,0,0,1],[0,1,1,1,0],[1,0,0,0,1],[1,0,0,0,1]],[[1,0,0,0,1],[0,1,0,1,0],[0,0,1,0,0],[0,0,1,0,0],[0,0,1,0,0]],[[1,1,1,1,1],[0,0,0,1,0],[0,0,1,0,0],[0,1,0,0,0],[1,1,1,1,1]]];
	this.conv = [' ','@','+','!','?','\'',',','(',')',':','1','2','3','4','5','6','7','8','9','0','é','.','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];
	this.youpi = 0;
	this.truf="";
	this.onela=0;
	this.pause1 = '';
	this.plasma=[];
	this.plasma_element=name;
	this.ip=0;
	this.jp=0;
	this.plasma_r=1;
	this.plasma_g=1;
	this.plasma_b=1;
	// defilement du texte
	var alg2=function (obj) {
		try{
		if (obj.onela>obj.text_plasma.length-1) {
			obj.onela=0;
		}
			// defilement des caracteres
			if ((obj.onela>-1) && (obj.text_plasma.length>1)){
				obj.pause1 = obj.text_plasma.substring(obj.onela,obj.onela+1);			
				obj.truf = obj.text_plasma.substring(obj.onela,obj.text_plasma.length);
				obj.truf = obj.truf.concat(obj.text_plasma.substring(0,obj.onela));
				
				if (obj.stopp){
					obj.onela++;
				}
			}
			// lancement de la pause du defilement
			if (obj.pause1=='-') {
				lancepause(obj);
			}
		
		} catch(error) {}
		var myself = obj;
		function callMethod() {
			alg2(myself);
		}

		setTimeout(callMethod,obj.vitesse);
	}
	// calcul et affichage du plasma
	var alg=function(obj) {
		obj.plasma=[];
		obj.tx = obj.tx+2;
		obj.ty = obj.ty + 3;
		while (obj.tx>360*360) {
			obj.tx=obj.tx-360*360;
		}
		while (obj.ty>360*360) {
			obj.ty=obj.ty-360*360;
		}

		for (var i=0;i<obj.tay-1;i++) {
			for (var j=0;j<obj.tax-1;j++) {
				if (j==0) {obj.plasma[i]=[];}
				var j2 = Math.floor(128 + 127 * Math.cos((2*(i + Math.cos(3*j))-(obj.tx))*31 / 360));
				var i2 = Math.floor(128 + 127 * Math.sin(((Math.cos(4*i)*5 + j)-(2 * obj.ty))*31 / 360));
				var k2 = Math.floor(128 + 127 * Math.cos(((i + j)+(3 * obj.tx))*31 / 360));
				var j22 = 2 + (2) * Math.cos((10*(i + 2*j)-(obj.tx*50)) / 360);
				var tempvar=Math.floor(j/6);
				if (obj.truf.length>tempvar) {
					try {var trufo = obj.truf.substring(tempvar,tempvar+1);
				} catch(error) {}}
				else { var trufo = ' ';}
				var youpi = 0;
				for (var zz=0;zz<obj.conv.length;zz++) {
					if (obj.conv[zz]==trufo) {
						youpi = zz;}
				}  
				var ies=i/2;
				// si c'est une lettre
				if ((ies>=j22) & ies<(j22+5) & (j-(tempvar*6))!=5){
					var i5 = Math.floor(ies-j22);  
					// si c'est un trait d'une lettre
					if ( obj.alpha[youpi][i5-(Math.floor(i5/5)*5)][j-(tempvar*6)]==1) {
						if (obj.plasma_r==0 && obj.plasma_g==0 && obj.plasma_b==0) {obj.plasma[i][j]=[255,255,255];} else {
							// affichage d'un point colore
							obj.plasma[i][j]=[(255-i2)*obj.plasma_r,(255-j2)*obj.plasma_g,(255-k2)*obj.plasma_b];
						}
					}else {
						// affichage vide
						obj.plasma[i][j]=[i2*obj.plasma_r,j2*obj.plasma_g,k2*obj.plasma_b];
					};
				} else {
					// affichage vide
					obj.plasma[i][j]=[i2*obj.plasma_r,j2*obj.plasma_g,k2*obj.plasma_b];
				};
			}
		}
		bmp_lib.render(obj.plasma_element, obj.plasma, null);
		
		
		var myself = obj;
		function callMethod() {
			alg(myself);
		}

		setTimeout(callMethod,obj.vitesse);
	}
	// pause du texte
	var lancepause = function (obj){
		obj.stopp = false;
		var myself = obj;
		function callMethod() {
			myself.stopp = true;
		}
		setTimeout(callMethod,10000);
	}


	// changer le texte
	this.setText=function (text) {
	this.text_plasma=text;
	}

	// change les + en %20 dans une chaine de caracteres
	this.decode=function(tChaine) {
		while (true) {
			var i = tChaine.indexOf('+');
			if (i < 0) break;
			tChaine = tChaine.substring(0,i) + '%20' + tChaine.substring(i + 1, tChaine.length);
		}
		return unescape(tChaine)
	}
	// change la couleur du plasma
	this.setRGB=function (r,g,b){
		this.plasma_r=r;
		this.plasma_g=g;
		this.plasma_b=b;
		
	}
	// change la taille de l'image
	this.setSize=function (x,y){
		if (x && y && x>0 && y>0) {
			var tempo=document.getElementById(this.plasma_element);
			tempo.width=x;
			tempo.height=y;
		}
	}
	// init du plasma . arguments pas obligatoires
	this.init=function (text,x,y,r,g,b){
		if (text && text!='') {
		this.setText(text);
		}
		this.setRGB(r,g,b);
		this.stopp = true;
		if (!document.getElementById(this.plasma_element)) {
			if (!x) { x='';}
			if (!y) { y='';}
			document.write('<a title="MCLD SINUS SCROLL (c) 2010 by Maxime SCHNEIDER aka McLodo" style="border : none !important" href="javascript:plasma_credits()"><img alt="MCLD SINUS SCROLL (c) 2010 by Maxime SCHNEIDER aka McLodo" id="'+this.plasma_element+'" src="http://www.instrus-de-rap.fr/ADMIN/logo.jpg" width="'+x+'" height="'+y+'"/></a>');
			var obj=this;
			alg(obj);
			alg2(obj);
		} else if (x && y) {
			this.setSize(x,y);
		}
	}

}

function plasma_credits(){
	alert('(c)2010 MCLODO aka Maxime SCHNEIDER\n\nDownload MCLD Plasma sinus scroll\non www.mclodo.com\n\nCREDITS : \nCODE/DESIGN : MCLODO');
}
	

