var restarea=51 
var maxspeed=1
var run_new=51
var run_new2=run_new
var endofgallerymsg="<span style='font-size: 11px'>End of Gallery</span>"

function moveleft22(){
			clearTimeout(t);	
		cross_scroll=document.getElementById? document.getElementById("motiongallery2") : document.all.motiongallery
				movestate="top"
		
		//if && (parseInt(cross_scroll.style.left)>=-260)
		
		run_new=run_new-10;
		//alert(run_new + " " + parseInt(cross_scroll.style.left));
		//alert(parseInt(cross_scroll.style.left) + " " + max_run);
	//	crossmain=document.getElementById? document.getElementById("motioncontainer") : document.all.motioncontainer
		actualwidth=document.all? cross_scroll.offsetWidth : document.getElementById("trueContainer2").offsetWidth
		actualheight=document.all? cross_scroll.offsetHeight : document.getElementById("trueContainer2").offsetHeight
		//alert(parseInt(crossmain.style.width));
		if (actualheight==0){ actualheight = cross_scroll.offsetHeight; }
		//alert(actualheight);
		//var new_right=parseInt(actualwidth)-run_new;
		var new_right=parseInt(actualheight)-run_new;
		var all_height = actualheight ;
		new_right=new_right * -1;
		new_right=new_right -10;
		//alert(new_right);
		//alert(cross_scroll.offsetHeight);
		//alert((parseInt(cross_scroll.style.top)+"+"+all_height)+" >=520");
		var cross_scroll_top = parseInt(cross_scroll.style.top);
		if (cross_scroll_top==0) { cross_scroll_top = parseInt(cross_scroll.offsetHeight);}
		//alert((parseInt(cross_scroll_top)+"+"+all_height)+" >=208");
		//if ((run_new>0) && (parseInt(cross_scroll.style.left)>(new_right-10)) )(run_new>0) &&
		if ( (cross_scroll_top>(new_right-10)) && ((cross_scroll_top+all_height) >= 208) )
			{
				 if((parseInt(cross_scroll.style.top)>new_right))// || (run_new>0)
				 	{
					cross_scroll.style.top=(parseInt(cross_scroll.style.top)-10) + "px"
					lefttime=setTimeout("moveleft22()",10)
					}
			}
		else
			{
			//	alert(menuwidth);
				//alert(parseInt(cross_scroll.style.left) + " " + max_run);
				//alert(parseInt(cross_scroll.style.left) + " " + new_right );
					run_new=run_new2;
					clearTimeout(lefttime);
					t=setTimeout("auto_run2()",500000)
		    }
}

function moveright22(){
		clearTimeout(t);	
			cross_scroll=document.getElementById? document.getElementById("motiongallery2") : document.all.motiongallery
			movestate="right"
			//alert(cross_scroll.style.top)
			//alert("dsfsdf");
			//if (parseInt(cross_scroll.style.left)<-2)(run_new>0) && 
			run_new=run_new-10;
			if ((parseInt(cross_scroll.style.top)<-2))
			{
				cross_scroll.style.top=parseInt(cross_scroll.style.top)+10+"px"
				righttime=setTimeout("moveright22()",10)
			}
			else
			{		
				righttime=setTimeout("moveright22()",500000)
				run_new=run_new2;
				clearTimeout(righttime);
				//t=setTimeout("auto_run2()",500000)
			}
}

function auto_run2()
	{
			//alert('test');
			cross_scroll=document.getElementById? document.getElementById("motiongallery2") : document.all.motiongallery
		actualwidth=document.all? cross_scroll.offsetWidth : document.getElementById("trueContainer2").offsetWidth
		//alert(parseInt(crossmain.style.width));
		var new_right=parseInt(actualwidth)-100;
		new_right=new_right * -1;
		new_right=new_right -10;
		//alert(new_right);
		if ((parseInt(cross_scroll.style.left)>(new_right-10)) )
			{
					//alert('test1');
				 
				   t = setTimeout('moveleft22()', 500000);	
			}
		else	
			{
				//alert('test2');
				 t = setTimeout('moveright22()', 500000);
			}
	}

//window.onload=fillup