fadeTimer = "";

function fadeIn(id) {
	var obj = document.getElementById(id);
	obj.style.display = "block";
	var current = parseInt(obj.style.opacity*100);

	if (current < 100) {
		var step = 10;
		if (current + step > 100) {
			current = 100;	
		}
		else {
			current += step;
		}
		obj.style.opacity = current/100;
		obj.style.filter = "alpha(opacity="+current+")";
		fadeTimer = setTimeout("fadeIn('"+id+"')", 20);
	}
	else {
		obj.style.filter = "alpha(opacity=100)";
	}	
}

function fadeFrom(id, toid) {
	if (IE) {
		document.getElementById(id).style.display = "none";
		document.getElementById(toid).style.display = "block";
	}
	else {
		var obj = document.getElementById(id);
		var current = parseInt(obj.style.opacity*100);
	
		if (current > 0) {
			var step = 10;
			if (current - step < 0) {
				current = 0;	
			}
			else {
				current -= step;
			}
			obj.style.opacity = current/100;
			//obj.style.filter = "alpha(opacity="+current+")";
			
			fadeTimer = setTimeout("fadeFrom('"+id+"', '"+toid+"')", 20);
		}
		else {
			obj.style.display = "none";
			document.getElementById(toid).style.display = "block";
			fadeIn(toid);	
		}
	}
}// JavaScript Document


var scrollTimer = "";

function showScroll() {
	clearTimeout(scrollTimer);
	var obj = document.getElementById("up_scroll");
	var obj2 = document.getElementById("down_scroll");
 	var current = parseInt(obj.style.opacity*100);
	
	if (current < 80) {
		var step = 10;
		
		if (current + step > 80) {
			current = 80;	
		}
		else {
			current += step;	
		}
		
		obj.style.opacity = current/100;
		obj.style.filter = "alpha(opacity="+current+")";
		obj2.style.opacity = current/100;
		obj2.style.filter = "alpha(opacity="+current+")";
		
		scrollTimer = setTimeout("showScroll()", 50);
	}
	else {
		//done	
	}	
}

function hideScroll() {
	clearTimeout(scrollTimer);

	var obj = document.getElementById("up_scroll");
	var obj2 = document.getElementById("down_scroll");
	
 	var current = parseInt(obj.style.opacity*100);
	
	if (current > 0) {
		var step = 10;
		
		if (current - step < 0) {
			current = 0;	
		}
		else {
			current -= step;	
		}
		
		obj.style.opacity = current/100;
		obj.style.filter = "alpha(opacity="+current+")";
		obj2.style.opacity = current/100;
		obj2.style.filter = "alpha(opacity="+current+")";
		
		scrollTimer = setTimeout("hideScroll()", 50);

	}
	else {
		//done	
	}	
}

var scrollingTimer = "";

function stopScroll() {
	clearTimeout(scrollingTimer);
}

function scrollDown() {
	var obj = document.getElementById("text_read_textarea");
	var current = parseInt(obj.style.top.replace("px", ""));
	var difference = 218-obj.offsetHeight;
	difference = difference - 50;

	if (current > difference) {
		var step = 5;
		
		if (current - step < difference) {
			current = difference;	
		}
		else {
			current -= step;	
		}
		
		obj.style.top = current+"px";
		
		scrollingTimer = setTimeout("scrollDown()", 50);
	}
	else {
		//end	
	}
}

function scrollUp() {
	var obj = document.getElementById("text_read_textarea");
	var current = parseInt(obj.style.top.replace("px", ""));
	
	
	if (current < 0) {
		var step = 5;
		
		if (current + step > 0) {
			current = 0;	
		}
		else {
			current += step;	
		}
		
		obj.style.top = current+"px";
		
		scrollingTimer = setTimeout("scrollUp()", 50);

	}
	else {
		//end	
	}
}

