var colLast = 1;
var subLast = 0;
var num = 0;
var act = 1;
var t = 0;

function slideTo(id,heightPx) {

	if (subLast != 0 && subLast != id) {
		$("div#submenu"+subLast).animate({height:0},"fast");
	}
	
	if (subLast != id) {
		$("div#submenu"+id).animate({height:heightPx},"slow");
		subLast = id;
	}

}

function sliding(col,action) {
	if(action=="1") {
		stopSlideshow();
	}
	document.getElementById("l"+colLast).style.backgroundPosition = "0px -15px";
	document.getElementById("l"+col).style.backgroundPosition = "0px 0px";
	colLast = parseInt(col);
	var x = ((col-1)*-560)
	if (col =="1") var slider = new Fx.Tween('slides', {duration:600});
		else var slider = new Fx.Tween('slides', {duration:600});
	slider.start('left',x);

}

function slide() {
	if(act<num) {
		act++;
	} else {
		act = 1;
	}
	sliding(act,'0');
}
function startSlideshow(nm) {
	num = parseInt(nm);
	t = setInterval("slide()",10000);
}
function stopSlideshow() {
	clearInterval(t);
}

function closeDivAnimate(id) {
	$("div#"+id).animate({height:0},"slow");
}

function openDivAnimate(id) {
	$("div#"+id).animate({height:58},"fast");
	t=setTimeout("closeDivAnimate('"+id+"')",3500);
}
