	var left_pos= -495;
	var center_pos = -388;
	var current_pos= center_pos;
	
	var min_width=0;
	var max_width=240;
	var current_width=min_width;

function move_body_left(){
	if (current_pos > left_pos || current_width < max_width){
		if (current_pos > left_pos){
			if (current_pos-25 > left_pos){
				current_pos = current_pos - 25;
			} else {
				current_pos=left_pos;
			}
			document.getElementById("main_cont").style.marginLeft=current_pos+"px";
		}
		if (current_width < max_width){
			current_width = current_width + 15;
			document.getElementById("video_panel").style.width=current_width+"px";
		}
		setTimeout("move_body_left()", 1);
	}
	document.getElementById('btnRightPanel').innerHTML="<a href='javascript:;' onclick='javascript:move_body_center();'><img onmouseover='this.style.left=\"37px\";' onmouseout='this.style.left=\"38px\";' src='/images/left_chev.png' border=0 style='position:absolute;left:38px;'/></a>";

}
function move_body_center(){
	if (current_width > min_width || current_pos < center_pos){
		if (current_width > min_width){
			current_width = current_width - 15;
			document.getElementById("video_panel").style.width=current_width+"px";
		}
		if (current_pos < center_pos && current_width<=min_width){
			current_pos = current_pos + 25;
			document.getElementById("main_cont").style.marginLeft=current_pos+"px";
		}
		setTimeout("move_body_center()", 1);
	}
	document.getElementById('btnRightPanel').innerHTML="<a href='javascript:;' onclick='javascript:move_body_left();'><img onmouseover='this.style.left=\"37px\";' onmouseout='this.style.left=\"36px\";' src='/images/right_chev.png' border=0 style='position:absolute;left:36px;'/></a>";
	document.getElementById('videoDisplay').style.visibility="hidden";
	document.getElementById('videoDisplay').style.disply="none";
}
/*
function collapse()
{
if (height>min) {
height -= 1;
document.getElementById("targetDiv").style.height = height;
document.getElementById("btnExpandCollapse").disabled = true;
window.setTimeout("collapse()", 1);
}
else {
setButtonValue("Expand");
document.getElementById("targetDiv").style.visibility = “hidden";
}
}


function expand()
{
if (document.getElementById("targetDiv").style.visibility == “hidden")
document.getElementById("targetDiv").style.visibility = “visible";
if (height<max){
height += 1;
document.getElementById("targetDiv").style.height = height;
document.getElementById("btnExpandCollapse").disabled = true;
window.setTimeout("expand()", 1);
}
else {
setButtonValue("Collapse");
}
}
*/

var http = createRequestObject();
function createRequestObject() {
	var objAjax;
	var browser = navigator.appName;
	if(browser == "Microsoft Internet Explorer"){
		objAjax = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		objAjax = new XMLHttpRequest();
	}
	return objAjax;
}

function submit_comment(){
	if (document.getElementById("add_comment").value==""){
		alert("Type your comment and name in the box");
	} else {
	var strComment=document.getElementById("add_comment").value;
		if(http.readyState == 4 || http.readyState == 0) {
			http.open('get', 'includes/submit_comment.php?comment='+strComment+'&'+Math.random(), true);
			http.onreadystatechange = handleSubmitComment;
			http.send(null);
		}
	}
}

function handleSubmitComment(){
	if(http.readyState == 4){
		if (http.responseText=="1") {
			document.getElementById("add_comment").value="Thanks for your comments! x";
			document.getElementById("add_comment").disabled=true;
			document.getElementById("comment_btn").innerHTML="<img border='0' src='images/tick_icon.png' />";
		} else {
			alert("Sorry, there was a problem. Please try again later");
		}
	}
}

function getNews(action){
		var story_no=parseInt(document.getElementById('current_story').innerHTML);
		var max=document.getElementById('max_id').value;
		if (action=='prev'){
			if (story_no < max){
				document.getElementById('current_story').innerHTML=parseInt(story_no)+1;
				story_no=story_no+1;
			} else {
				return;
			}
		} else if (action=='next'){
			if (story_no != 1){
				document.getElementById('current_story').innerHTML=parseInt(story_no)-1;
				story_no=story_no-1;
			} else {
				return;
			}
		}
		if(http.readyState == 4 || http.readyState == 0) {
			http.open('get', 'includes/get_news.php?story_no='+story_no+'&'+Math.random(), true);
			http.onreadystatechange = handleGetNews;
			http.send(null);
		}
}

function handleGetNews(){
	if (http.readyState == 4){
		var string=http.responseText;
		arr=string.split("|");
		document.getElementById('news_subtitle').innerHTML=arr[0];
		document.getElementById('news_story').innerHTML=arr[1];
		document.getElementById('news_small_panel').innerHTML="<img src='news_images/"+arr[2]+"' />";
	}
}

var ourInterval;
var origColor = "#F3F9F1";
var overColor = "#36FF00";
var scrollSpeed = 50;
var scrollHeight = 5;

function scrollStart(direction, divID, elementID){
//document.getElementById(elementID).style.backgroundColor = overColor;
ourInterval = setInterval("scroll"+direction+"('"+divID+"')", scrollSpeed);
}
function scrollEnd(which){
//document.getElementById(which).style.backgroundColor = origColor;
clearInterval(ourInterval);
}
function scrollUp(which){
document.getElementById(which).scrollTop = document.getElementById(which).scrollTop - scrollHeight;
}
function scrollDown(which){
document.getElementById(which).scrollTop = document.getElementById(which).scrollTop + scrollHeight;
}

function makehtml(text) {
var textneu = text.replace(/&/,"&amp;");
textneu = textneu.replace(/</,"&lt;");
textneu = textneu.replace(/>/,"&gt;");
textneu = textneu.replace(/\r\n/,"<br>");
textneu = textneu.replace(/\n/,"<br>");
textneu = textneu.replace(/\r/,"<br>");
return(textneu);
}
