var currentIndexFrame = 1;
// how many 1.html, 2.html files are there
var maxIndexFrame = 2;
// how long to show the current file in milliseconds
var nextFrameTimeout = 9000;
// how fast to scroll (lower number is faster)
var reduceMarginTimeout = 20;

var autoScrollEnabled = 0;
var timerId = 0;

if (autoScrollEnabled == 1)
	setTimeout("nextFrame()", nextFrameTimeout);

function nextFrame()
{
   var theFoot = document.getElementById("foot");
	 var curSrc = theFoot.src;
	 var nextFrame = currentIndexFrame + 1;
	 if (nextFrame > maxIndexFrame)
	    nextFrame = 1;
 
	 curSrc = curSrc.replace("/" + currentIndexFrame + "_" + currentLanguage + ".html", "/" + nextFrame + "_" + currentLanguage + ".html");
	 currentIndexFrame = nextFrame; 
	 theFoot.src = curSrc;
	 theFoot.style.marginLeft = "1000px";
	 setTimeout("reduceMargin()", reduceMarginTimeout);
}

function reduceMargin()
{
	 var thePrice = document.getElementById("price");
	 var priceColor = "Red";
   var theFoot = document.getElementById("foot");
	 var marg = theFoot.style.marginLeft;
	 marg = marg.replace("px", "");
	 if (marg > 500)
	 {
	 	  marg -= 20;
	 	  priceColor = "Green";
	 } else if (marg > 300)
	 {
	 	 marg -= 20;
	 	 priceColor = "Blue";
	 }
	 else marg -= 5;
	 theFoot.style.marginLeft = marg + "px";
	 thePrice.style.color = priceColor;
	 if (marg >= 5)
	    timerId = setTimeout("reduceMargin()", reduceMarginTimeout);
	 else
	    timerId = setTimeout("nextFrame()", nextFrameTimeout);
}

function toggleAutoScroll()
{
	if (autoScrollEnabled == 1)
		autoScrollEnabled = 0;
	else
		autoScrollEnabled = 1;
	
	if (autoScrollEnabled = 1)
	{
	   nextFrame();
	   return;
	}
	clearTimeout(timerId);
  var theFoot = document.getElementById("foot");
  theFoot.style.marginLeft = "0px";
}

function toggleLayer( whichLayer )
{
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}

