 function initMenu() {
    $('.menu ul').hide();
    $('#menu ul:first').show();
 	$('.menu li a').click(
 			function() {
 				var checkElement = $(this).next();
 				if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
 					checkElement.slideUp('normal');
					$(this).children(".arrow").removeClass('arrow-bottom');
 					$(this).children(".arrow").addClass('arrow-left');
 					return false;
 				}
 				if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
 					$('.menu ul:visible').slideUp('normal');
 					checkElement.slideDown('normal');
 					$(this).children(".arrow").addClass('arrow-bottom');
 					$(this).children(".arrow").removeClass('arrow-left');
 					return false;
 				}
                
 			}
 	);

    $('.menu li ul li.current').parent().show();
 }

$(document).ready( function(){

	    $(".menu > li:last-child").addClass('rounded-bottom');
        $(".menu > li:last-child li:last-child").addClass('rounded-bottom');

        // Rounded corners
        $('.rounded-bottom').corner("10px bottom");
		$('.rounded-bottomleft').corner("10px bottom-left");  
		$('.rounded-topleft').corner("10px top-left");
		$('.rounded-top').corner("10px top");
		$('.rounded-topright').corner("10px top-right");
		$('.rounded').corner("10px");

		
		$('.chip').click(function(){
			var radio = $(this).children().children("input") 
			radio.attr("checked",true);
			$('#userChipAccount_balance').val(radio.val());
		});
		
		
		// Toggle
		jQuery(".toggle-set").click(function(a){
			a.preventDefault();
			var item = $(this).parent(); 			
			item.next(".toggle").slideToggle('fast');
			item.find(".toggle").toggle();

		});

                jQuery(".help div.toggle").css("display","none");

                // Accordion Menu
		initMenu();

		
		/*
		 * IE 6 does not support the ":hover" pseudoclass on elements other than anchor tags. To get the hover to work in IE6, create a class that duplicates the :hover styles
		 * source: http://www.filamentgroup.com/lab/update_styling_the_button_element_with_css_sliding_doors_now_with_image_spr/
		 */
		$('.submitBtn').hover(
				// mouseover
				function(){$(this).addClass('submitBtnHover');},
				
				// mouseout
				function(){$(this).removeClass('submitBtnHover');}
                );
				
});


/* Hide JS errors */
window.onerror = function() {
    return true
};
