//Scripted for Factory Green Inc.
//(c) 2008 Jonathan Harrison | Genesis Digital Solutions
//V 2.2

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}
//-->


function prodScroll(direction, i) {

//if called from outside the function i will not be defined and will therefore start over at 0
if(!i){i=0;}

//define the name of the DIVs we're working with
var obj = document.getElementById( "inner" );
var obj2 = document.getElementById( "mask" );

//find the left bound
var leftBound = -parseInt(obj.style.width.substring(0,obj.style.width.indexOf('px')))+parseInt(obj2.style.width.substring(0,obj2.style.width.indexOf('px')))+10;

//determine the current margin offset
var margin = (parseInt(obj.style.marginLeft.substring(0,obj.style.marginLeft.indexOf('px'))));

//check posistion on first pass
var leftReached=false;
if(i==0 && margin<=(leftBound)){

leftReached=true;

}

//determine the new margin based on the old margin and the direction
if(direction=='left' && margin!=0){
	var newMargin = margin+10+'px';
	
	
	//loop the subtle movements until we've gone far enough
	if(i<99){
		MM_changeProp('inner','','style.marginLeft',newMargin,'DIV');
		i++;
		setTimeout('prodScroll(\''+direction+'\', '+i+')',5);
	}	
	
	
}else if(direction=='right' && !leftReached){
	var newMargin = margin-10+'px';
	
	
	//loop the subtle movements until we've gone far enough
	if(i<99){
		MM_changeProp('inner','','style.marginLeft',newMargin,'DIV');
		i++;
		setTimeout('prodScroll(\''+direction+'\', '+i+')',5);
	}	
	
	
}


	


//close prodScroll
}