function showSubMenu(eltToShow)
{
	$('#'+eltToShow).show();
}

function hideSubMenu(eltToShow)
{
	$('#'+eltToShow).hide();
}


$(document).ready(function() {

	/***** MENU & SUBMENU ON HOVER **/
	$('#subAboutLi').hover(
     	function(){
     		$('#subAbout').addClass('dBlock');
     	},
     	function(){
     		$('#subAbout').removeClass('dBlock');
     	}
     );

     $('#subShopLi').hover(
     	function(){
     		$('#subShop').addClass('dBlock');
     	},
     	function(){
     		$('#subShop').removeClass('dBlock');
     	}
     );

	/**	
	$(".withSub").hover(
		function(){
			$(this).find(".subMenu").fadeIn();
		},
		function(){
			$(this).find(".subMenu").fadeOut();
		}
	);

	$("li.menu").hover(
		function(){
			$(this).removeClass('menu').addClass('menuHover');
		},
		function(){
			$(this).removeClass('menuHover').addClass('menu');
		}
	);
	**/

	/***** HOMEPAGE : SLIDE NEWS *****/
	$('#newsSlider').bxSlider({
		mode: 'vertical'     
	});
	

	/***** HOMEPAGE : SLIDE BRANDS *****/
	$('#brandsSlider').bxSlider({
		infiniteLoop: true,
		auto: true,
		displaySlideQty: 3,
		moveSlideQty: 1
	});
	
	$("#forgotPwdLink").click(function(e){
		$('#forgotPwdForm').slideDown();
		e.preventDefault();
	});
	

	/***** CHARITY PR : SLIDE *****/
	$('#charityPictures').bxSlider({
		infiniteLoop: true,
		auto: true,
		displaySlideQty: 1,
		moveSlideQty: 1
	});

	/***** NEW STORE : SLIDE PICTURES *****/
	$('#storesPictures').bxSlider({
		infiniteLoop: true,
		auto: true,
		displaySlideQty: 1,
		moveSlideQty: 1
	});
	
	
	/***** CHECK PAYMENT TYPE ==> DELIVERY FEES OR NOT *****/
	$("input#paymentPickUp").click(function(){
		refreshCart('pickUp');
	});
	$("input#paymentCb").click(function(){
		refreshCart('cb');
	});
	
	
	/***** DISPLAY OR NOT DISPLAY BILLING ADDRESS FORM (ON LOAD) *****/
	if(!$("input#sameBilling").attr('checked'))
	{
		$("#billingCell").fadeIn();
	     $("input#sameBilling").removeAttr('checked');
	}
	else
	{
	     $("#billingCell").fadeOut();
	     $("input#sameBilling").attr('checked',true);
	}
	/***** DISPLAY OR NOT DISPLAY BILLING ADDRESS FORM (ON CLICK) *****/
	$("input#sameBilling").click(function(){
		
		if(!$("input#sameBilling").attr('checked'))
		{
			$("#billingCell").fadeIn();
			$("input#sameBilling").removeAttr('checked');
		}
		else
		{
			$("#billingCell").fadeOut();
			$("input#sameBilling").attr('checked',true);
		}
	});
	
	$('#shippingAddress').change(function(){
		var selectedOption = $('#shippingAddress option:selected').val();
		getAddress(selectedOption,'shipping');
	});
	
	$('#billingAddress').change(function(){
		var selectedOption = $('#billingAddress option:selected').val();
		getAddress(selectedOption,'billing');
	});
	
	
	$('#loginForm').submit(function(){
		
		email = $('#loginEmail').val();
	
		if(email == '')
		{
			return false;
		}
		
		if($('#loginPwd').val() == '')
		{
			return false;
		}
	})
	
});	

