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 ShowHideObj(obj,showhide) {
	if (document.all) { 
		if (showhide=='show') {
			obj.style.visibility='visible';
		} else {
			obj.style.visibility='hidden' ;
		}
	} else {
		obj.visibility=showhide ;
	}
}

var NS4 = (document.layers);
//var IE4 = (document.all);
var IE4 = true

function scroll(objBox,objContent,scrolldir,amount) {

	var objBox
	var contentWidth
	var parentWidth
	var objLeftButton
	var objRightButton
	var scrollmax
	var inited = false

	var scrollamount
	var maxright
	var maxleft
	
	if (objBox && objContent) {
		parentWidth= (IE4) ? objBox.offsetWidth : objBox.parentLayer.clip.width ;
		contentWidth = (IE4) ? objContent.offsetWidth : objBox.document.width ;
		scrollmax = contentWidth - parentWidth
		inited = true
	}


	if (inited) {

		var returnvalue = (isNaN(amount) || amount=='page') // return true unless amount=page, so it should continue the loop

		if (amount=='page') {
			scrollamount = parentWidth * .9
		} else {
			scrollamount = (isNaN(amount)) ? 7 : amount
		}

//		scrollamount= (amount=='page') ? parentWidth * .9 : 7 ;
	
		if (IE4) {
			maxright = contentWidth - parentWidth - (0-objContent.offsetLeft);
			maxleft = (0-objContent.offsetLeft);
		} 

		if (NS4) {
			maxright = contentWidth + objBox.top - parentWidth;
			maxleft =	0 - objBox.top;
		}

		scrollamount = (scrolldir=='right' ? Math.min(scrollamount,maxright) : Math.min(scrollamount,maxleft))
		if (scrolldir=='left') { scrollamount=0-scrollamount}

		if (IE4) { objContent.style.left = (objContent.offsetLeft - scrollamount)+'px';
		} else {
		if (NS4) { objBox.top += scrollamount;}
		}
		maxright-=scrollamount
		maxleft+=scrollamount
	
		//ShowHideObj(objDownButton,(maxdown>0) ? 'show':'hide') 
		//ShowHideObj(objUpButton,(maxup>0) ? 'show':'hide') 
	
		if (scrolldir=='right' && maxright<=0 || scrolldir=='left' && maxleft <=0) {
			returnvalue=false;
		}
	} else { 	// if not inited
		returnvalue = false 
	}
	return returnvalue
}

var iTimerID=null
function stopscroll() {
	if (iTimerID) {
		window.clearTimeout(iTimerID)
	}
}

function startscroll(Box,direction,amount) {
	stopscroll()
	var objBox = MM_findObj(Box+'Box')
	var objContent = MM_findObj(Box+'Content')
	if (scroll(objBox,objContent,direction,amount)) { 
		iTimerID = window.setTimeout('startscroll(\''+Box+'\',\''+direction+'\','+'\''+amount+'\')',75)
//alert('startscroll(\''+Box+'\',\''+direction+'\','+'\''+amount+'\')')
	}
}

function scrolltoactive(Box,iActive) {
	if (iActive > 1) {
		startscroll(Box,'right',(iActive-1)*75)
	}
}