function setOpacity(obj,value){
	testObj= new getObj(obj);
	testObj.style.opacity = value/10;
	testObj.style.filter = 'alpha(opacity=' + value*10 + ')';
}


function initCaroussel(){
	setOpacity("caroussel_menu_item_container2",2);
	setOpacity("caroussel_menu_item_container3",2);
	currNewsId=-1;
	fadeIncrement=0;
	showNews(1);
	rotateId=1;
	startRotate();
}

function autoRotate(){
	if(doRotate){
		if(rotateId>3){
			rotateId=1;
		}
		showNews(rotateId);
		rotateId++;
		rotateTimer=setTimeout("autoRotate()",10000);
	}
	else{
		clearTimeout(rotateTimer);
	}
}

function startRotate(){
	doRotate=true;
	rotateTimer=setTimeout("autoRotate()",1000);

}

function stopRotate(){
	doRotate=false;
	if(typeof rotateTimer != 'undefined'){
		clearTimeout(rotateTimer);
	}
}

function fadeTab(id){
	if(fadeIncrement!=11){
		setOpacity("caroussel_menu_item_container"+id,fadeIncrement);
		setOpacity("caroussel_item"+id,fadeIncrement);
		fadeIncrement++;
		fadeTimer=setTimeout("fadeTab("+id+")",40);
	}
	else{
		clearTimeout(fadeTimer);
	}
}

function showNews(id){
	if(typeof currNewsId == 'undefined' || id!=currNewsId){
		if(typeof currNewsId != 'undefined' && currNewsId != -1){
			//DEACTIVATE
			setOpacity("caroussel_menu_item_container"+currNewsId,2);

			var iTab="caroussel_menu_item"+currNewsId;
			var inActiveTab = new getObj(iTab);
			inActiveTab.obj.className="caroussel_menu_item_inact"+currNewsId;

			var iContent="caroussel_item"+currNewsId;
			var inActiveContent = new getObj(iContent);
			inActiveContent.style.display="none";
			inActiveContent.style.visibility="hidden";
		}

		//ACTIVATE
		var aTab="caroussel_menu_item"+id;
		var activeTab = new getObj(aTab);
		activeTab.obj.className="caroussel_menu_item_act";

		var aContent="caroussel_item"+id;
		var activeContent = new getObj(aContent);
		activeContent.style.display="block";
		activeContent.style.visibility="visible";

		fadeIncrement=0;
		fadeTab(id)
		currNewsId=id;
		rotateId=id;
	}
}
