/*
 * requires jQuery!
 *
 */

$(document).ready(function()
{
		
	//SLIDER CONTROLL BUTTONS
	$('#slider-controll a').click(function()
	{
	
		//PROOF IF SLIDER IS ANIMATED
		var animating = $('.offers:animated');
		
		if (animating.length == 0)
		{
		
			var marginLeftBefore = $('.offers').css('marginLeft');
			var width = $('.offers li:eq(0)').attr('offsetWidth');
			
			marginLeftBefore = parseInt(marginLeftBefore.substr(0,marginLeftBefore.length-2));
			
			switch (this.className)
			{
				case 'pre-link':
					if (marginLeftBefore < 0)
						$('.offers').animate({marginLeft:(marginLeftBefore+width)+"px"},500,"swing");
						
						if(marginLeftBefore < width*-1){
							$('.pre').css("display", "inline");
						}
						else{
							$('.pre').css("display", "none");
						}
						$('.fwd').css("display", "inline");
				break;
				
				case 'fwd-link':
					if (marginLeftBefore > width*-2){
						$('.offers').animate({marginLeft:(marginLeftBefore-width)+"px"},500,"swing");	
						
						if(marginLeftBefore > width*-1){
							$('.fwd').css("display", "inline");
						}
						else{
							$('.fwd').css("display", "none");
						}
						$('.pre').css("display", "inline");
						}
				default:
				
				break;
			}
		
		}
		return false;
	});
	
	$('#slider-controll a').focus(function()
	{this.blur();});
	
});