function Dynamic_Object (result) {
	
	this.id = 'default';
	this.className='default';
	
	this.text = '';
	this.textNext = '';
	
	this.xSpeed = 0;
	this.ySpeed = 0;
	
	this.xEnd = 0;
	this.yEnd = 0;
	
	this.liveFlag = 0;
	this.scrollFlag = 0;
	this.flickrFlag = 0;
	this.fadeFlag = 0;
	
	
	this.color = 'black';
	this.opacity = 1;
	this.fontSize = 10;
	this.backgroundColor = 'transparent';
	this.height='';
	this.width='';
	this.top='';
	this.left='';
	this.position='fixed'; //default to fixed
	//this.clip='rect(0px,0px,0px,0px)';
	this.overflow='hidden'; //hidden auto inheret scroll visible
	this.zIndex=0;
	this.margin='0px 0px 0px 0px';
	this.padding='0px 0px 0px 0px';
	this.textTransform='none';
	this.textAlign='left'; //left right justify center
	this.backgroundImage='none';
	this.backgroundRepeat='repeat';
	this.cursor='pointer';
	this.fontFamily='Helvetica';
	this.visibility='hidden';
	this.parent='body';
	
	this.html='';
	
	this.interval=1000;
	
	this.myIntervals = Array();

	this.category;
	
	//console.log(this.id+"constructed");



	
	if(result.id!=undefined) this.id = result.id;
	if(result.className!=undefined) this.className=result.className;
	
	if(result.text!=undefined) this.text = result.text;
	if(result.textNext!=undefined) this.textNext = '';
	
	if(result.xSpeed!=undefined) this.xSpeed = result.xSpeed;
	if(result.ySpeed!=undefined) this.ySpeed = result.ySpeed;
	

	
	if(result.opacity!=undefined) this.opacity = result.opacity;
	if(result.fontSize!=undefined) this.fontSize = result.fontSize;
	if(result.color!=undefined) this.color = result.color;
	if(result.backgroundColor!=undefined) this.backgroundColor = result.backgroundColor;
	if(result.height!=undefined) this.height= result.height;
	if(result.width!=undefined) this.width= result.width;
	if(result.top!=undefined) this.top=result.top;
	if(result.left!=undefined) this.left=result.left;
	if(result.position!=undefined) this.position=result.position; //default to fixed
	if(result.clip!=undefined) this.clip=result.clip;
	if(result.overflow!=undefined) this.overflow=result.overflow; //hidden auto inheret scroll visible
	if(result.zIndex!=undefined) this.zIndex=result.zIndex;
	if(result.margin!=undefined) this.margin=result.margin;
	if(result.padding!=undefined) this.padding=result.padding;
	if(result.textTransform!=undefined) this.textTransform=result.textTransform;
	if(result.textAlign!=undefined) this.textAlign=result.textAlign;
	if(result.backgroundImage!=undefined) this.backgroundImage=result.backgroundImage;
	if(result.backgroundRepeat!=undefined) this.backgroundRepeat=result.backgroundRepeat;
	if(result.cursor!=undefined) this.cursor=result.cursor;
	if(result.fontFamily!=undefined) this.fontFamily=result.fontFamily;
	if(result.visibility!=undefined) this.visibility=result.visibility;

	if(result.parent!=undefined) this.parent=result.parent;

	if(result.html!=undefined) this.html=result.html;
	if(result.httpRequestURL!=undefined) this.httpRequestURL=result.httpRequestURL; //anything that is http
	
	
	if(result.xEnd!=undefined) this.xEnd = result.xEnd;
	//else this.xEnd = this.left;
	if(result.yEnd!=undefined) this.yEnd = result.yEnd;
	//else this.yEnd = this.top;


	
	this.initialize = function () {
		

		//insert object to html body
		var parent = document.getElementById(this.parent);
		var newDiv = document.createElement('div');
		
		parent.insertBefore(newDiv,parent.firstChild);
	
		newDiv.setAttribute('id',this.id);
		
		newDiv.setAttribute('class',this.className);
		
		this.insertHTML();
		this.setStyle();

		//alert(this.id+" initialized");

		//console.log(this.id+" initialized");

	}
	
	
	
	this.nada = function(){}
	
	this.print = function () 
	{
		alert ('PRINT'+this.id +' '+this.width+' '+this.height+' '+this.backgroundColor+' '+this.margin);
	}
	
	this.switchVisibility = function()
	{
	
		if(this.visibility=='visible')
		{
		 	document.getElementById(this.id).style.visibility='hidden';
			this.visibility='hidden';
		}
		else if(this.visibility=='hidden') 
		{
			document.getElementById(this.id).style.visibility='visible';
			this.visibility='visible';
		}
	}

	this.insertHTML=function(html)
	{
		if(html==null || html==undefined )html=this.html;
		document.getElementById(this.id).innerHTML=html;
		this.html = html;
	}
		
	this.setStyle=function()
	{
	
		//alert(this.id);
		document.getElementById(this.id).style.opacity = this.opacity;
		document.getElementById(this.id).style.fontSize = this.fontSize+'px';
		document.getElementById(this.id).style.color = this.color;
		document.getElementById(this.id).style.backgroundColor = this.backgroundColor;
		document.getElementById(this.id).style.height=this.height+'px';
		document.getElementById(this.id).style.width=this.width+'px';
		document.getElementById(this.id).style.top=this.top+'px';
		document.getElementById(this.id).style.left=this.left+'px';
		document.getElementById(this.id).style.position=this.position;
		document.getElementById(this.id).style.overflow=this.overflow;
		document.getElementById(this.id).style.zIndex=this.zIndex;
		document.getElementById(this.id).style.margin=this.margin;
		document.getElementById(this.id).style.padding=this.padding;
		document.getElementById(this.id).style.textTransform=this.textTransform;
		document.getElementById(this.id).style.textAlign=this.textAlign; //left right justify center
		document.getElementById(this.id).style.backgroundImage=this.backgroundImage;
		document.getElementById(this.id).style.backgroundRepeat=this.backgroundRepeat;
		document.getElementById(this.id).style.cursor=this.cursor;
		document.getElementById(this.id).style.fontFamily=this.fontFamily;
		document.getElementById(this.id).style.visibility=this.visibility;

	}
	
	this.insertHTMLscale=function(html)
	{
		if(html==null || html==undefined )html=this.html;
		document.getElementById(this.id).innerHTML=html;
		this.html = html;
		this.scaleFont(9, 250, 1);
			//_titleObject.scaleFont(9, 250, .5);

	}


	this.scaleFont=function(size, targetHeight, speed)
	{
		document.getElementById(this.id).style.height = 'auto';
		document.getElementById(this.id).style.fontSize = size+'px';
		this.fontSize = size;			
		
		var divHeight = document.getElementById(this.id).offsetHeight;
		//console.log(divHeight+":"+targetHeight);		

		if(divHeight<targetHeight && speed>0)this.scaleFont(size+speed,targetHeight, speed);
		else if(divHeight>targetHeight && speed<0)this.scaleFont(size-speed,targetHeight, speed);
		else if (this.id ==  'SNSignup_author') bottomScroll(this.id,targetHeight);
	}
	
	this.scroll = function () 
	{

		var top = document.getElementById(this.id).offsetTop + this.ySpeed;

		var topMin = -document.getElementById(this.id).offsetHeight;
		var topMax = document.height + document.getElementById(this.id).offsetHeight;
		if (top <= topMin)
		{
		document.getElementById(this.id).style.top = topMax +'px';
		}
		else if (top >= topMax)
		{
		document.getElementById(this.id).style.top = topMin + 'px';
		}
		else
		{
		document.getElementById(this.id).style.top = top +'px';//((left+document.width)%(document.width*2))+'px';
		}	
		
		var left = document.getElementById(this.id).offsetLeft + this.xSpeed;
		var leftMin = -document.getElementById(this.id).offsetWidth;
		var leftMax = document.width;
		if (left <= leftMin)
		{
		document.getElementById(this.id).style.left = document.width + 'px';
		}
		else if (left >= leftMax)
		{
		document.getElementById(this.id).style.left = leftMin + 'px';
		}
		else
		{
		document.getElementById(this.id).style.left = left +'px';//((left+document.width)%(document.width*2))+'px';
		}

	}





	this.slide = function (object, dX, dY, accel) 
	{
	
		this.ySpeed*=accel;
		this.xSpeed*=accel;
		
		//min speeds
		if(this.ySpeed<1)this.ySpeed=1;
		if(this.xSpeed<1)this.xSpeed=1;

		var yDist=dY-document.getElementById(this.id).style.offsetTop;
		
		var yDir;
		if(yDist>0)yDir=-1;
		else yDir=1;
		
		var y = document.getElementById(this.id).offsetTop;

		if (yDir==-1 && y >= dY || yDir==1 && y <= dY)
		{
		document.getElementById(this.id).style.top = (y+this.ySpeed*yDir)+'px';
		}

		var xDist=dX-document.getElementById(this.id).style.offsetLeft;
		var yDir;
		if(xDist>0)xDir=1;
		else xDir=-1;
		var x = document.getElementById(this.id).offsetLeft;

		if (xDir==-1 && x >= dX || xDir==1 && x <= dX)
		{
			document.getElementById(this.id).style.left = (x+this.xSpeed*xDir) + 'px';
		}
		
		if(xDir==-1 && x >= dX || xDir==1 && x <= dX || yDir==-1 && y >= dY || yDir==1 && y <= dY)
		{
			//setTimeout(object.+'slide('+object+','+dX+','+dY+','+accel+')",10);
		}
		
	}
	
	this.slideIn = function ()
	{
	//setTimeout()

	if (document.getElementById(this.id).style.top == this.yEnd)	//hidden
	{
		

	}
	var times = this.top - this.yEnd;
		if(times>0) dir = 1;
		else if (times<0) dir = -1;
		else dir = 0;
		//this.sliding(this.id);
		
		//setInterval("'"+this.sliding(dir)+"'",100);
		console.log("slide"+ this.yEnd +"dir : "+dir);
/*
	if (document.getElementById(this.id).offsetTop <= this.top)
	{
		//setTimeout("'"+this.sliding(-1)+"'",30);
		//setTimeout("'document.getElementById('"+this.id+"').sliding(-1)'",500);

	}
	*/
	
	}
	
	this.sliding = function (_id)
	{
	console.log(_id + this.yEnd);
	if (document.getElementById(_id).offsetTop >= this.yEnd)
	{
	document.getElementById(_id).style.top =document.getElementById(_id).offsetTop-1;
	//console.log("sliding");
	setTimeout("'"+this.sliding(_id)+"'",1000)
	}

	}
}

