

/************************* the scrolll function **********************************************/

var slowStep = 4;
var fastStep = 7;
var stepSize = slowStep;
var scrollInterval;
var intervalSpeed = 10;

function scrollDown() {
	
	var content = document.getElementById('content');
	var y = content.scrollTop;
	var h = content.scrollHeight - content.offsetHeight;

	if(y < h) {
		content.scrollTop = y + stepSize;
	} else {
		stopScroll();
		document.getElementById('arrowdown').style.display = "none";
	}

}


function scrollUp() {
	var content = document.getElementById('content');
	var y = content.scrollTop;

	if(y > 0) {
		content.scrollTop = y - stepSize;
	} else {
		stopScroll();
		document.getElementById('arrowup').style.display = "none";
	}

}


function startScrollUp() {
	
	if(scrollInterval != null) {
		clearInterval(scrollInterval);
	}
	
	stepSize = slowStep;
	scrollInterval = setInterval("scrollUp()", intervalSpeed);
	document.getElementById('arrowdown').style.display = "block";
	
}

function startScrollDown() {
	
	if(scrollInterval != null) {
		clearInterval(scrollInterval);
	}

	stepSize = slowStep;
	scrollInterval = setInterval("scrollDown()", intervalSpeed);
	document.getElementById('arrowup').style.display = "block";

}


function stopScroll() {

	clearInterval(scrollInterval);
	scrollInterval = null;

}

function stepUp() {

	stepSize = fastStep;
	
}

function stepDown() {

	stepSize = slowStep;
	
}

function init() {
	var content = document.getElementById('content');
	var y = content.scrollTop;
	var h = content.scrollHeight - content.offsetHeight;
	


	if(y != 0) {
		document.getElementById('arrowup').style.display = "block";
	}
	
	if((y != h) && (h > 0)) {
		document.getElementById('arrowdown').style.display = "block";
	}

}




var req;
function getAjaxObject() {
	req = false;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = false;
        	}
		}
    }
    
    return req;
}