
var ActualPromo = 1;
var SwitchID = 0;

function promoSetUp() { // activates the promo slider
	
	if (document.getElementById("HomepagePromo") != null) {
			showPromo();
	}
	
}


// start positions for promo thumbnails - now are setted to be ousite of its container in the right side

function setPositions(PromoNr) { 

	xMiddle = parseInt(document.body.clientWidth/2);
	xRight = xMiddle+89;
	wypos = parseInt(document.getElementById("Header").offsetTop);
	document.getElementById('LargeThumbnail'+PromoNr).style.left = xRight+'px';
	document.getElementById('LargeThumbnail'+PromoNr).style.top = 30+'px';		
	

}

function switchPromo(PromoNr) {

	if (PromoNr != ActualPromo) {

	// if somebody clicks very fast on promo buttons the queue is cleared first
	$('#PromoInfo'+ActualPromo).clearQueue();
	$('#LargeThumbnail'+ActualPromo).clearQueue();
	clearTimeout(SwitchID);
	
	// here starts the transition between slides
	hidePromo(ActualPromo);
	$('#PButton'+ActualPromo).removeClass('PromoButton_on').addClass('PromoButton');
	ActualPromo = PromoNr;
	$('#PButton'+ActualPromo).removeClass('PromoButton').addClass('PromoButton_on');
	showPromo(PromoNr);
	
	}
	
}

function showPromo(PromoNr) {
	

	if (!PromoNr) {
		PromoNr = ActualPromo;
	}
	
	setPositions(PromoNr);
	
	//$('#LargeThumbnail'+PromoNr).delay(timeEffects*0.25);
	$('#LargeThumbnail'+PromoNr).fadeIn(timeEffects*0.5);	
		
	//$('#PromoInfo'+ActualPromo).delay(timeEffects*0.375);
	$('#PromoInfo'+ActualPromo).fadeIn(timeEffects*0.5); // change this to animate the showing of promo text in another style

  //$('#LTC'+ActualPromo).show(0);   
  $('#LTC'+ActualPromo).fadeIn(timeEffects*0.5);   
  
   
	//$('#LargeThumbnail'+PromoNr).animate( { left: '-=450' }, 1000); // change this to animate the hiding of smaller thumbnail in another style

    
	PromoNr = ActualPromo+1;

	if (document.getElementById('PButton'+PromoNr) == null) {
		PromoNr = 1;
	}
	
	if (autoSlides == 'yes') {
	SwitchID = setTimeout("switchPromo("+PromoNr+")", timeBetweenSlides);    
	}

}

function hidePromo(PromoNr) {
	
	if (!PromoNr) {
		PromoNr = ActualPromo;
	}
	
	xMiddle = parseInt(document.body.clientWidth/2);
	
	//$('#PromoInfo'+ActualPromo).delay(timeEffects*0.25);
	$('#PromoInfo'+ActualPromo).fadeOut(timeEffects*0.5); // change this to animate the hiding of promo text in another style
 
	//$('#LargeThumbnail'+PromoNr).animate({ left: '+=450'}, 300); // change this to animate the hiding of smaller thumbnail in another style

	//$('#LTC'+ActualPromo).delay(timeEffects*0.25);
  //$('#LTC'+ActualPromo).fadeOut(0)

	$('#LargeThumbnail'+PromoNr).fadeOut(timeEffects*0.5);
   
}
