var lnhbutton=false;
var rnhbutton=false;
var cnhbutton=false;
var nhstart=1;
var nhend=2;
var nhindex=nhstart;
var timerHandle;

function buttondisable()
{
	lnhbutton=false;
	document.images["nhbutton1"].src= "../../myimage/button/icon-1.gif";
	rnhbutton=false;
	document.images["nhbutton3"].src= "../../myimage/button/icon-2.gif";
}

function buttonenable()
{
	lnhbutton=true;
	document.images["nhbutton1"].src= "../../myimage/button/icon-1b.gif";
	rnhbutton=true;
	document.images["nhbutton3"].src= "../../myimage/button/icon-2b.gif";
}

//---------------------------down---------------------------------------------
function lbuttondown()
{
	var nhprevindex;
	
	if(lnhbutton)
	{
		nhprevindex=nhindex;
		nhindex--;
		
		if(nhindex<nhstart)
		{
			nhindex=nhend;
		}
		
		$(document).ready(function(){
		$("#nh"+nhprevindex).animate({ opacity: "hide" }, "slow");
	  	setTimeout("$(\"#nh\"+nhindex).animate({ opacity: \"show\" }, \"slow\")", 700);
									});
									
	}

	return false;
}

function cbuttondown()
{
	if(cnhbutton==true)
	{
		document.images["nhbutton2"].src= "../../myimage/button/pause.gif";
		cnhbutton=false;
		buttondisable();
		nhplay();
	}
	else
	{
		document.images["nhbutton2"].src= "../../myimage/button/play.gif";
		cnhbutton=true;
		buttonenable();
		nhstop();
	}
}

function rbuttondown()
{
	
		nhprevindex=nhindex;
		nhindex++;
		
		if(nhindex>nhend)
		{
			nhindex=nhstart;
		}
		
		$(document).ready(function(){
		$("#nh"+nhprevindex).animate({ opacity: "hide" }, "slow");
	
	  	setTimeout("$(\"#nh\"+nhindex).animate({ opacity: \"show\" }, \"slow\")", 700);
									});

	
	return false;
}

function autoplay()
{

		nhprevindex=nhindex;
		nhindex++;
		
		if(nhindex>nhend)
		{
			nhindex=nhstart;
		}
		
		$(document).ready(function(){
		$("#nh"+nhprevindex).animate({ opacity: "hide" }, "slow");
	
	  	setTimeout("$(\"#nh\"+nhindex).animate({ opacity: \"show\" }, \"slow\")", 700);
									});

}

function nhplay()
{
	timerHandle= setInterval("autoplay()", 10000  );
}

function nhstop()
{
	clearInterval(timerHandle);
}

