function getChildNodes(objContainer){
	var returnValue=new Array();
	for(counter=0;counter<objContainer.childNodes.length;counter++){
		if(objContainer.childNodes[counter].tagName!=undefined){
			returnValue.push(objContainer.childNodes[counter]);
		}
	}
	return returnValue;
}

function Scroll( moveTime , delayTime ){
	_MoveTime = moveTime ? moveTime : 100;
	_DelayTime = delayTime ? delayTime :2000;
	var _IntervalId = null;
	var _ElementId = null;
	
	this._start = _start;
	function _start(ElementId){
		_ElementId = ElementId;
		var _obj=document.getElementById(_ElementId);
		_IntervalId = window.setInterval(function(){scrollup(_obj,20,0);},_DelayTime);
	}

	this.scrollup = scrollup;
	function scrollup(o,d,c){
		if(d==c){
			var t=getChildNodes(o)[0].cloneNode(true);;
//			var t=o.firstChild.cloneNode(true);
			o.removeChild(getChildNodes(o)[0]);
			o.appendChild(t);
			t.style.marginTop=getChildNodes(o)[0].style.marginTop='0px';
			o.onmouseover = function(){
				clearInterval(_IntervalId);
				_IntervalId = null;
			}
			o.onmouseout = function(){
				if(_IntervalId == null)
					_IntervalId = window.setInterval(function(){scrollup(document.getElementById(_ElementId),getChildNodes(o)[0].offsetHeight,0);},_DelayTime);
			}
			//alert(_IntervalId);
		}else{
			var s=3,c=c+s,l=(c>=d?c-d:0);
			getChildNodes(o)[0].style.marginTop=-c+l+'px';
			window.setTimeout(function(){scrollup(o,d,c-l)},_MoveTime);
		}
	}
}

function change_featured_products(move_left){
		var moveLeft=move_left?moveLeft:true;
		var numPage=1;
		var highlitedIndex=1;
		while($('ul_featured_products'+(numPage+1))){
			if($('ul_featured_products'+(numPage+1)).style.display!="none"){
				highlitedIndex=numPage+1;
			}
			numPage++;
		}

		var nextHighlightIndex=moveLeft?highlitedIndex-1:highlitedIndex+1;
		nextHighlightIndex=nextHighlightIndex>numPage?1:nextHighlightIndex;
		nextHighlightIndex=nextHighlightIndex<1?numPage:nextHighlightIndex;
		
		for(var counter=1;counter<=numPage;counter++){
			$('ul_featured_products'+counter).style.display="none";
			if(counter==nextHighlightIndex){
				$('ul_featured_products'+counter).style.display="block";
			}
			
		}
		
		if(moveLeft){
			$("a_featured_products_left").blur();
		}else{
			$("a_featured_products_right").blur();
		}
		
	}