var interval_ID;
var maxHeight = 0;
var maxHeightMenuTabs = 0;

var actualTop = 0;

function getHeight(id){
	if($(id+'Table')){ 
		maxHeightTable = $(id+'Table').offsetHeight;
	}
	if($(id)) { 
		maxHeightContent = $(id).style.height; 
		maxHeightContent = parseInt(maxHeightContent.replace("px", ""));
	}
}

function initScrollPages(step){
	var divId = "pagesContent";
	getHeight(divId);
	interval_ID = setInterval('startScrollPages("'+divId+'",'+step+');',15);
}

function startScrollPages(divID, step){
	var the_style = getStyleObject(divID);
	if (the_style)
  {
 		if(the_style.top != "")var current_top = parseInt(the_style.top);
		else var current_top = 0;
		
		var new_top = current_top + step;
		if(step > 0 && current_top < 0 ){ 
			if (document.layers) the_style.top = new_top;
			else the_style.top = new_top + "px";
		} 
		if(step < 0 && current_top >= (-maxHeightTable + (maxHeightContent))){
			if (document.layers) the_style.top = new_top;
			else the_style.top = new_top + "px";
		}
  }
}

function stopScrollPages(){
	clearInterval(interval_ID);
}


function loadPages(pageId){
	loadContent(shop.url + '/ecommerce/pages/pageContent.cfm?id='+pageId, 'pageInfo', null, 'loading.gif');
}
