function timeout() {
	DD_roundies.addRule('.roundedCornersMenu', '4px');
	alert('doin');
}


$(function() {
	
	var pathname = window.location.pathname;
	var pathArray = pathname.split( '/' );
	
	
	// tuotanto: pathArray[1]
	
	$('#navs').children().each(function() {
		if (pathArray[1].length > 0) {
			if ($(this).find('a').attr('id') == pathArray[1]) {
				$(this).find('a').css('backgroundColor','#c68700');
				$(this).find('a').css('color','#ffffff');
				$(this).find('a').css('cursor','default');
				
			} 
		}
	});
	
	$('#sboxs').children().each(function() {
		//$(this).find('img').addClass('pngpic');
		//$(this).find('#overlay').addClass('pngpic');
		$(this).hover(function() {
			//$(this).find('#overlay').addClass("hover");	
			$(this).find('#overlay').css('backgroundImage','url(images/fp_sbox_bottom_hover.png)');
			$(this).find('#overlay p').css('color', '#eca100');
		}, function() {
			//$(this).find('#overlay').removeClass("hover");			
			$(this).find('#overlay').css('backgroundImage','url(images/fp_sbox_bottom.png)');
			$(this).find('#overlay p').css('color', '#734e00');
		});
	});
	
	/*
	$('#sidebar ul li').each(function() {
		$(this).hover(function() {
			$(this).css('backgroundColor', '#eca100');
			$(this).find('a').css('color', '#ffffff');
		}, function() {
			$(this).css('backgroundColor', '');
			$(this).find('a').css('color', '#885e04');
			});		
	});
	*/
	$("#footer .nappi").click(function() {
	    $('#footer .sites').slideToggle();
		return false;
	}); 
	
	//$('.quicklink #qlbox').hide();
	$('.internal_readmore #internal_box').hide();
	
	$('.internal_readmore .internal_readmore_toggle').click(function() {
		$('.internal_readmore #internal_box').slideToggle("fast", function () {adjustLayout();});
		return false;
	});
		
	xAddEventListener(window, "resize", adjustLayout, false);
	adjustLayout();
	
	
	
	$(".toggleBtn").click(function(){
           //e.preventDefault();  prevent the anchor tag from sending the user off to the link that is href
			if($("#slideMenu").hasClass('closed')){
				$("#slideMenu").animate({right:-50}, 500, function(){
					$(this).removeClass('closed').addClass('opened');
					$("a#toggleLink").removeClass('toggleBtn').addClass('toggleBtnHighlight');
				});
			}//if close
 
			$('#slideMenu').bind("mouseleave",function(){
				$("#slideMenu").animate({right:-485}, 500, function(){
					$(this).removeClass('opened').addClass('closed');
					$("a#toggleLink").removeClass('toggleBtnHighlight').addClass('toggleBtn');
				});
			});//bind close
	});//toggleBtn click close
 
 	/*
	$("a.anchorLink").click(function () {	
		elementClick = $(this).attr("href");
		destination = $(elementClick).offset().top;
		$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, 1000 );
		return false;
	})
 */
 
	/* Mouse Enter Event (that is mouseover event)
	$(".toggleBtn").bind("mouseenter",function(e){
                        e.preventDefault(); // prevent the anchor tag from sending the user off to the link that is href
			if($("#slideMenu").hasClass('closed')){
				$("#slideMenu").animate({left:0}, 500, function(){
					$(this).removeClass('closed').addClass('opened');
					$("a#toggleLink").removeClass('toggleBtn').addClass('toggleBtnHighlight');
				});
			}//if close
 
			$('#slideMenu').bind("mouseleave",function(){
				$("#slideMenu").animate({left:-300}, 500, function(){
					$(this).removeClass('opened').addClass('closed');
					$("a#toggleLink").removeClass('toggleBtnHighlight').addClass('toggleBtn');
				});
			});//bind close
	});//toggleBtn click close*/
 


});


function adjustLayout()
{
	// Get natural heights
	var lHeight = xHeight("sidebar");
	var rHeight = xHeight("content");
	
	// Find the maximum height
	var maxHeight =	Math.max(lHeight, Math.max(rHeight));
	
	// Assign maximum height to all columns
	xHeight("left", maxHeight);
	xHeight("right", maxHeight);
	
	// Show the footer
	// xShow("footer");
}

function noSidebar() {
		$('#main #left').css('background', 'transparent');
}
