var newsbox_tag=0;
var step=3;

function NewsBox()
{
	var thisobj=document.getElementById("newsbox");
	var d_height=thisobj.offsetHeight; 
	if(newsbox_tag==0)
	{
		StartMoveUp(d_height);
	}
	else
	{
		StartMoveDown(d_height);
	}
}
function StartMoveUp(d_height)
{
	var thisobj=document.getElementById("newsbox");
	var d_up;
	if(thisobj.offsetTop>(0-d_height))
	{
		thisobj.style.top=thisobj.offsetTop-step+"px";
		d_up= setTimeout("StartMoveUp("+d_height+")", 5);
	}
	else
	{
		clearTimeout(d_up);
		thisobj.style.top=(0-d_height)+"px";
		newsbox_tag=1;
		document.getElementById("hit").innerHTML="OPEN";
	}

}
function StartMoveDown(d_height)
{
	var thisobj=document.getElementById("newsbox");
	var d_down;
	if(thisobj.offsetTop<0)
	{
		thisobj.style.top=thisobj.offsetTop+step+"px";
		d_down= setTimeout("StartMoveDown("+d_height+")", 5);
	}
	else
	{
		clearTimeout(d_down);
		thisobj.style.top="0px";
		newsbox_tag=0;
		document.getElementById("hit").innerHTML="CLOSE X";
	}
}
function OnLoadNewsBox()
{
	newsbox_tag=1;
	document.getElementById("hit").innerHTML="OPEN";
	var thisobj=document.getElementById("newsbox");
	thisobj.style.top=(0-thisobj.offsetHeight)+"px";
}
 $(document).ready(function(){
	
	$("#newsbox .details").hide();
	
	window.setTimeout(function(){
		$("#newsbox .details").slideDown("slow",function(){
				$("a#hit").text("CLOSE");	
		});
		
	}, 2000, true);
	
	
    $("a#hit").click(function () {
      $("#newsbox .details").slideToggle("slow", function(){
		if($("a#hit").text()=="CLOSE"){
			$("a#hit").text("OPEN");
		} else {
			$("a#hit").text("CLOSE");	
		}
});
    });


 });

