$(document).ready(function(){
	$('#maileremail').focus(function(){
		if($(this).val() == "Enter email address"){
			$(this).val('');
		}
	});
	$('#maileremail').blur(function(){
		if($(this).val() == ""){
			$(this).val('Enter email address');
		}
	});
	
	
	$('#categorynav > ul > li').hover(
		function(){
			$(this).children('ul').stop(true,true).slideDown();
		},

		function(){
			$(this).children('ul').slideUp();
		}
	);

		position = $('.brandsliderImages table').offset();
		var sliderWidth = $('.brandsliderImages table').width();
		var sliderLeftHome = 0;
		var movement = 500;
		var sliderRightHome = sliderLeftHome - sliderWidth + 594;
		currentPos = sliderLeftHome;
//		currentPos = position.left;

		$('.pageSizer').change(function(){
			$(this).parent('form').submit();
		});
		
		$('.sliderRight').click(function(){
			currentPos = (currentPos - movement < sliderRightHome) ? sliderRightHome : currentPos = currentPos - movement;
			$('.brandsliderImages table').animate({
				marginLeft: currentPos
			},500, 'swing');
		});
		$('.sliderLeft').click(function(){
			currentPos = (currentPos + movement > sliderLeftHome) ? currentPos = sliderLeftHome : currentPos = currentPos + movement;
			$('.brandsliderImages table').animate({
				marginLeft: currentPos
			},500, 'swing');
		});
		
		$('#tab-description').click(function(){			
			if($(this).is(".tab-description-off")) {
				$('#tab-description').removeClass("tab-description-off");
				$('#tab-description').addClass("tab-description-on");
				$('#tab-specification').removeClass("tab-specification-on");
				$('#tab-specification').addClass("tab-specification-off");
				$('#tab-bundles').removeClass("tab-bundles-on");
				$('#tab-bundles').addClass("tab-bundles-off");
				$('#tab-deliveryinfo').removeClass("tab-deliveryinfo-on");
				$('#tab-deliveryinfo').addClass("tab-deliveryinfo-off");
				$('.tab-panels').each(function(){
					if($(this).is(':visible')){
						$(this).slideUp(function(){
							$('#productdescription').slideDown();		
						});
					}
				});
			}
		});
		$('#tab-specification').click(function(){			
			if($(this).is(".tab-specification-off")) {
				$('#tab-description').removeClass("tab-description-on");
				$('#tab-description').addClass("tab-description-off");
				$('#tab-specification').removeClass("tab-specification-off");
				$('#tab-specification').addClass("tab-specification-on");
				$('#tab-bundles').removeClass("tab-bundles-on");
				$('#tab-bundles').addClass("tab-bundles-off");
				$('#tab-deliveryinfo').removeClass("tab-deliveryinfo-on");
				$('#tab-deliveryinfo').addClass("tab-deliveryinfo-off");
				$('.tab-panels').each(function(){
					if($(this).is(':visible')){
						$(this).slideUp(function(){
							$('#productspecification').slideDown();		
						});
					}
				});
			}
		});
		$('#tab-bundles').click(function(){			
			if($(this).is(".tab-bundles-off")) {
				$('#tab-description').removeClass("tab-description-on");
				$('#tab-description').addClass("tab-description-off");
				$('#tab-specification').removeClass("tab-specification-on");
				$('#tab-specification').addClass("tab-specification-off");
				$('#tab-bundles').removeClass("tab-bundles-off");
				$('#tab-bundles').addClass("tab-bundles-on");
				$('#tab-deliveryinfo').removeClass("tab-deliveryinfo-on");
				$('#tab-deliveryinfo').addClass("tab-deliveryinfo-off");
				$('.tab-panels').each(function(){
					if($(this).is(':visible')){
						$(this).slideUp(function(){
							$('#productbundles').slideDown();		
						});
					}
				});
			}
		});
		$('#tab-deliveryinfo').click(function(){			
			if($(this).is(".tab-deliveryinfo-off")) {
				$('#tab-description').removeClass("tab-description-on");
				$('#tab-description').addClass("tab-description-off");
				$('#tab-specification').removeClass("tab-specification-on");
				$('#tab-specification').addClass("tab-specification-off");
				$('#tab-bundles').removeClass("tab-bundles-on");
				$('#tab-bundles').addClass("tab-bundles-off");
				$('#tab-deliveryinfo').removeClass("tab-deliveryinfo-off");
				$('#tab-deliveryinfo').addClass("tab-deliveryinfo-on");
				$('.tab-panels').each(function(){
					if($(this).is(':visible')){
						$(this).slideUp(function(){
							$('#productdeliveryinfo').slideDown();		
						});
					}
				});
			}
		});
	
	
});
