function mainmenu(){
$(" #nav ul ").css({display: "none"}); // Opera Fix
$(" #nav li").hover(function(){
		$(this).find('ul:first').css({visibility: "visible",display: "none"}).show(10);
			$('#dio-lens').hide();
			$('#dio-sensor').hide();
		},function(){
		$(this).find('ul:first').css({visibility: "hidden"});
			$('#dio-lens').show();
			$('#dio-sensor').show();
		});
	
}

 function hoverize(id, all_browsers){
	 
	 if($(id).size()){
		 	jQuery.each($(id), function(i, val){
		 		if(all_browsers == 1){
			 		$(val).hover(
						    function () {
					    	  $(this).css('background-position', 'center bottom');
					        }, 
					        function () {
					        	$(this).css('background-position', 'center top');
					        }
					    );
			 	}else{
			 		if(jQuery.browser.msie && (jQuery.browser.version == 6 || jQuery.browser.version == 7)){
			 			$(val).hover(
							    function () {
						    	  $(this).css('background-position', 'center bottom');
						        }, 
						        function () {
						        	$(this).css('background-position', 'center top');
						        }
						    );

					}
			 	}
		 	});
		 	
			
		 }
 }
 
 $(document).ready(function(){					
	//mainmenu();
	//$('.zhelp').bbgiframe();
	//$(".second_level").css("z-index","9999");
	//$('#subcategories').hide();
	 //hoverize('#login_submit', 1);
	 //hoverize('#register_submit', 1);
	 hoverize('.hover', 1);
	 hoverize('#add_to_basket', 0);
	 
	 $('#browse_by_type').change(function(){
		 window.location.href = $(this).val();
	 });
	 
});

function handleRegisterAddress(){
	if($("#billing_address").val() == 0){
		$('#billing_address').parent().parent().nextAll(':lt(6)').hide();
	}
	$("#billing_address").change(function(event){
		event.preventDefault();
		if($("#billing_address").val() == 1){
			$('#billing_address').parent().parent().nextAll(':lt(6)').show();
		}
		if($("#billing_address").val() == 0){
			$('#billing_address').parent().parent().nextAll(':lt(6)').hide();
		}
	});
	//alert($("#billing_address").val());
}
function is_valid_email (email)
{
	return /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(email);
}
