/*SUBNAV ACTIVE STATE*/
function extractPageName(hrefString)
{
	var arr = hrefString.split('/');
	return  (arr.length<2) ? hrefString : arr[arr.length-2].toLowerCase() + arr[arr.length-1].toLowerCase();               
}

function setActiveMenu(arr, crtPage)
{
	for (var i=0; i<arr.length; i++)
	{
		if(extractPageName(arr[i].href) == crtPage)
		{
				arr[i].className = "current";
		}
	}
}

function setPage()
{
	hrefString = document.location.href ? document.location.href : document.location;

	if (document.getElementById("subnav")!=null)
		setActiveMenu(document.getElementById("subnav").getElementsByTagName("a"), extractPageName(hrefString));
} 

$(document).ready(function() {
	$('a.backtotop[href=#top]').click(function(){
		$('html, body').animate({scrollTop:0}, 'slow');
		return false;
	});
	
	$('ul#news').cycle({ 
	    fx:     'fade', 
	    speed:  'slow', 
	    timeout: 8000 
	});

	$('ul#video').cycle({ 
	    fx:     'fade', 
	    speed:  'slow', 
	    timeout: 8000 
	});
});

