//sistemul de rularea a bannerelor pe prima pagina

	var currentPromo = 0;
	//var noBanners = 10;
	
	var delay = 5000;
	var delayOnClick = 15000;
	var canBeSwitched = true;
	var openedTab = 'banner_0';
	var timeoutId = 0;	 

	
	
	function redirect2Promo(){
		document.location ="redirect-to-promotion-"+currentPromo;
	}
	
	function activateBanner(elm){		
		/*alert(document.getElementById('banner_map_'+elm).href);
		document.getElementById('current_banner_href').href = document.getElementById('banner_map_'+elm).href;
		alert(document.getElementById('current_banner_href').href);*/
		
		document.getElementById('banner_img_'+currentPromo).className="inactivePromo";
		document.getElementById('banner_img_'+elm).className="activePromo";
		
		
		document.getElementById('div_btn_menu_'+currentPromo).className="buttonPromoOff";
		document.getElementById('div_btn_menu_'+elm).className="buttonPromoOn";
		
		
		currentPromo = elm;
	}

	function moveToNext(){		
		var next = currentPromo+1;
		if(next==noBanners){
			next = 0;
		}		
		activateBanner(next);		
		
		clearTimeout(timeoutId);		
		timeoutId = setTimeout('moveToNext()', delay);	
	}
	
	function bannerClick(id){
		if(id!=currentPromo){
			clearTimeout(timeoutId);
			activateBanner(id);
			currentPromo = id;
			timeoutId = setTimeout('moveToNext()', delayOnClick);
		}else{
			clearTimeout(timeoutId);
			timeoutId = setTimeout('moveToNext()', delayOnClick);
		}
	}
	
	function reinitializeBoxes(){
	
	try{
		for(i=1;i<=ids;i++){
			
			var elm = document.getElementById('ob_contentRow_'+i);
			var x =elm.offsetHeight;
			elm.style.height=x+"px";
			
			//document.getElementById('contentRow_'+ids[i]).style.height=x+"px";
			document.getElementById('ob_middleLeft_'+i).style.height=x+"px";
			document.getElementById('ob_middleRight_'+i).style.height=x+"px";	
		}
	}catch(e){
	}
    }
	
	