
/**
 * Custom button state handler for enabling/disabling button state. 
 * Called when the carousel has determined that the previous button
 * state should be changed.
 * Specified to the carousel as the configuration
 * parameter: prevButtonStateHandler
 **/
var handlePrevButtonState = function(type, args) {

	var enabling = args[0];
	var leftImage = args[1];
	if(enabling) {
		leftImage.src = "images/left-enabled.gif";	
	} else {
		leftImage.src = "images/left-disabled.gif";	
	}
	
};

/**
 * Custom button state handler for enabling/disabling button state. 
 * Called when the carousel has determined that the next button
 * state should be changed.
 * Specified to the carousel as the configuration
 * parameter: nextButtonStateHandler
 **/
var handleNextButtonState = function(type, args) {

	var enabling = args[0];
	var rightImage = args[1];
	
	if(enabling) {
		rightImage.src = "images/right-enabled.gif";
	} else {
		rightImage.src = "images/right-disabled.gif";
	}
	
};


/**
 * You must create the carousel after the page is loaded since it is
 * dependent on an HTML element (in this case 'mycarousel'.) See the
 * HTML code below.
 **/
var carousel; // for ease of debugging; globals generally not a good idea
var pageLoad = function() 
{
	carousel = new YAHOO.extension.Carousel("mycarousel", 
		{
			numVisible:        4,
			animationSpeed:    0.6,
			animationMethod:    YAHOO.util.Easing.backBoth,
			scrollInc:         3,
			navMargin:         20,
			prevElement:     "prev-arrow",
			nextElement:     "next-arrow",
			size:              19,
			prevButtonStateHandler:   handlePrevButtonState,
			nextButtonStateHandler:   handleNextButtonState
		}
	);
	//carousel.setProperty("autoPlay", 3000);

};

YAHOO.util.Event.addListener(window, 'load', pageLoad);


function show_forex()
{
	for (i=0;i<=12;i++)
	{
		if( vCosts[ i ] != '' && vCosts[ i ] != '-')
		{
			document.write("<tr>");
			document.write("<td>" + vForexs[i] + "</td>");
			document.write("<td align='right'>" + vCosts[i] + "</td>");						
			document.write("</tr>");
		}
	}

}	

function ShowWeatherBox( selectedValue )
{
	var weatherDesk = document.getElementById("weatherDesk");
	weatherDesk.innerHTML = "<table><tr><td><img src='http://www.zing.vn/news/images/weather/"+ weather[selectedValue][3] +"' ></td><td>" + "<span class=degree>" + weather[selectedValue][2] + "</span></td></tr></table>";
	weatherDesk.innerHTML += "<b>" +weather[selectedValue][4] + "</b><br>";
	weatherDesk.innerHTML += "Độ ẩm: <b>" + weather[selectedValue][5] + "</b><br><br>";
	weatherDesk.innerHTML += weather[selectedValue][6] + "<br>";		
}