// automatic promo switch
//-----------------------
var stat = 0;
function switchHeadline(hnr, nr1){

	if(stat == 1) {
		clearTimeout(PromoTabID);
		stat = 0;
	}
		
	for (i = 1 ; i <= nr1 ; i++) {
		$("#he"+i).hide();
		
	
		if (hnr == i) {
			$("#he"+hnr).show();
			
			
		}
	}	 
	
	if (stat != 1) {	
		PromoTabID = setTimeout("switchHeadlines("+nr1+", "+hnr+")", 5000);
	}
	
}

function switchHeadlines(nr, starth) {
		$("#promoItem").show();
		
		if (starth == nr) {
			nexth = 1;
		}
			else {
				nexth = starth+1;
			}
		
		if (stat != 1) {
			switchHeadline(nexth, nr);
		}
}
function switchHeadlineClick(nextPrev,nr) {

	//console.log($(".submenu:visible").attr('id').replace('he',''));
	if(nextPrev=='next'){
		nextPromo = parseFloat($(".submenu:visible").attr('id').replace('he',''))+1; 
		if(nextPromo > nr){
			nextPromo = 1;
		}
	}
	else{
		nextPromo = parseFloat($(".submenu:visible").attr('id').replace('he',''))-1; 
		if(nextPromo < 1){
			nextPromo = nr;
		}
	}
	switchHeadline(nextPromo, nr);
}
