/*
 * (c) 2010, Philipp Anger
 *  
 */


function hoverListener(){
	var divWidth;
	var textWidth;
	var margin;

	$('.navi-item'+lang).hover(
			function () {
				if(!isActiveButton($(this).attr('href'))){
					$(this).css('background-image','url(source/images/navi_active'+lang+'.jpg)');
				}
			}, 
			function () {
				if(!isActiveButton($(this).attr('href'))){
					$(this).css('background-image','url(source/images/navi_inactive'+lang+'.jpg)');
				}
			}
		);
	
	$('.sort-item'+lang).hover(
			function () {
				if(!isActiveButton($(this).attr('href'))){
					$(this).css('background-image','url(source/images/sort_active'+lang+'.jpg)');
				}
			}, 
			function () {
				if(!isActiveButton($(this).attr('href'))){
					$(this).css('background-image','url(source/images/sort_inactive'+lang+'.jpg)');
				}
			}
		);
	
	$('#gardentools').hover(
		function () {
			$(this).css('background-image','url(source/images/icons/secateurs_active.jpg)');
			$('<span></span>').attr('class','head-sortiment-info').text(gardentoolsTitle).appendTo('#head-links');
		}, 
		function () {
			$(this).css('background-image','url(source/images/icons/secateurs_inactive.jpg)');
			$('.head-sortiment-info').remove();
		}
	);

	$('#animalhusbandry').hover(
		function () {
			$(this).css('background-image','url(source/images/icons/cow_active.jpg)');
			$('<span></span>').attr('class','head-sortiment-info').text(animalhusbandryTitle).appendTo('#head-links');			
		}, 
		function () {
			$(this).css('background-image','url(source/images/icons/cow_inactive.jpg)');
			$('.head-sortiment-info').remove();
		}
	);
	
	$('#equitation').hover(
		function () {
			$(this).css('background-image','url(source/images/icons/horseshoe_active.jpg)');
			$('<span></span>').attr('class','head-sortiment-info').text(equitationTitle).appendTo('#head-links');
		}, 
		function () {
			$(this).css('background-image','url(source/images/icons/horseshoe_inactive.jpg)');
			$('.head-sortiment-info').remove();
		}
	);
	
	$('#agriculturaltechnology').hover(
			function () {
				$(this).css('background-image','url(source/images/icons/traktor_active.jpg)');
				$('<span></span>').attr('class','head-sortiment-info').text(agriculturaltechnologyTitle).appendTo('#head-links');
			}, 
			function () {
				$(this).css('background-image','url(source/images/icons/traktor_inactive.jpg)');
				$('.head-sortiment-info').remove();
			}
	);

	$('#langEN').hover(
			function () {
				$(this).css('background-image','url(source/images/icons/langEN_active.jpg)');
			}, 
			function () {
				$(this).css('background-image','url(source/images/icons/langEN_inactive.jpg)');
			}
		);	
	
	$('#langDE').hover(
			function () {
				$(this).css('background-image','url(source/images/icons/langDE_active.jpg)');
			}, 
			function () {
				$(this).css('background-image','url(source/images/icons/langDE_inactive.jpg)');
			}
		);
	
	$('.stdlink').hover(
			function () {
				$(this).css({'color': '#4c4c54', 'border-bottom': '2px solid #336699'});
			}, 
			function () {
				$(this).css({'color': '#336699', 'border-bottom': '1px dotted #336699'});
			}
		);
	
	$('#sendbutton').hover(
			function () {
				$(this).css('background-color','#339933');
			}, 
			function () {
				$(this).css('background-color','#336699');
			}
		);
	
	$('#sortgardentools').hover(
			function () {
				$(this).css('background','url(source/images/sortiment_active'+lang+'.jpg) 0 0 no-repeat');
			}, 
			function () {
				$(this).css('background','url(source/images/sortiment_inactive.jpg) 0 0 no-repeat');
			}
		);
	
	$('#sortanimal').hover(
			function () {
				$(this).css('background','url(source/images/sortiment_active'+lang+'.jpg) -250px 0 no-repeat');
			}, 
			function () {
				$(this).css('background','url(source/images/sortiment_inactive.jpg) -250px 0 no-repeat');
			}
		);
	
	$('#sortequitation').hover(
			function () {
				$(this).css('background','url(source/images/sortiment_active'+lang+'.jpg) 0 -250px no-repeat');
			}, 
			function () {
				$(this).css('background','url(source/images/sortiment_inactive.jpg) 0 -250px no-repeat');
			}
		);
	
	$('#sortagricultural').hover(
			function () {
				$(this).css('background','url(source/images/sortiment_active'+lang+'.jpg) -250px -250px no-repeat');
			}, 
			function () {
				$(this).css('background','url(source/images/sortiment_inactive.jpg) -250px -250px no-repeat');
			}
		);

}


function mouseDownListener(){
	$('#gardentools').mousedown(function(){$(this).css('background-image','url(source/images/icons/secateurs_pressed.jpg)');});
	$('#animalhusbandry').mousedown(function(){$(this).css('background-image','url(source/images/icons/cow_pressed.jpg)');});
	$('#equitation').mousedown(function(){$(this).css('background-image','url(source/images/icons/horseshoe_pressed.jpg)');});
	$('#agriculturaltechnology').mousedown(function(){$(this).css('background-image','url(source/images/icons/traktor_pressed.jpg)');});
}


function mouseUpListener(){
	$('#gardentools').mouseup(function(){$(this).css('background-image','url(source/images/icons/secateurs_active.jpg)');});
	$('#animalhusbandry').mouseup(function(){$(this).css('background-image','url(source/images/icons/cow_active.jpg)');});
	$('#equitation').mouseup(function(){$(this).css('background-image','url(source/images/icons/horseshoe_active.jpg)');});
	$('#agriculturaltechnology').mouseup(function(){$(this).css('background-image','url(source/images/icons/traktor_active.jpg)');});
}


function initListener(){
	hoverListener();
	mouseDownListener();
	mouseUpListener();
}


