
function svgEle( obj ){

	this.obj = obj;
	
	this.obj.svg_pos = { x:0, y:0, r: 0 };
	this.obj.svg_overPos = { x:0, y:0, r: 0 };
	this.obj.svg_over = false;
	this.obj.svg_forceOver = false;
	
	this.init = function( params )
	{
		if( params.svg_pos )
			this.obj.svg_pos = params.svg_pos;
		if( params.svg_overPos )
		{
			this.obj.svg_overPos = params.svg_overPos;
			this.obj.svg_over = true;
		}
		
		if( params.text )
		{
			var t = this.obj.getElementsByTagName( 'text' );
			if( t[0] ) 
				t[0].appendChild(document.createTextNode( params.text ));
		}
		
		if( params.href )
		{
			var a = this.obj.getElementsByTagName( 'a' );
			if( a[0] ) 
				a[0].setAttribute('xlink:href', params.href );
		}
		if( params.forceOver )
			this.obj.svg_forceOver = true;
		
		this.obj.svg_place = function()
		{
			if( this.svg_forceOver ) 
				return this.svg_placeOver(); // active le mode over !
				
			this.setAttribute('transform', 'translate( '+this.svg_pos.x+','+this.svg_pos.y+' ) rotate( '+this.svg_pos.r+' ) ' );
			var els = this.getElementsByTagName( '*' );
			for( var i=0; i< els.length;i++)
			{
				if( els[i].className.baseVal == 'over'  ) els[i].setAttribute( 'opacity', '0' );
				if( els[i].className.baseVal == 'noover'  ) els[i].setAttribute( 'opacity', '1' );
			}
		}
		this.obj.svg_placeOver = function()
		{
			this.setAttribute('transform', 'translate( '+this.svg_overPos.x+','+this.svg_overPos.y+' ) rotate( '+this.svg_overPos.r+' ) ' );
			var els = this.getElementsByTagName( '*' );
			for( var i=0; i< els.length;i++)
			{
				if( els[i].className.baseVal == 'over'  ) els[i].setAttribute( 'opacity', '1' );
				if( els[i].className.baseVal == 'noover'  ) els[i].setAttribute( 'opacity', '0' );
			}
		}
		
		this.obj.svg_over = function()
		{
			this.svg_placeOver();
		}
		this.obj.svg_out = function()
		{
			this.svg_place();
		}
		if( this.obj.svg_over )
		{
			
			OBJ.eventAdd( this.obj, 'mouseover', this.obj.svg_over );
			OBJ.eventAdd( this.obj, 'mouseout', this.obj.svg_out );
			
			
			
		}
		this.obj.svg_place();
	}




}

