$(
	function() {
    $('.submenu').hide();
    
    $('.expand').click(
    	function() {
		  	$heading = $(this).parent();
		  	if ($heading.find('ul:visible').size() <= 0) {
		  		$heading.find('ul').animate({height: 'show', opacity: 'show'}, 500);
		  	}
			  else {
			  	$heading.find('ul').animate({height: 'hide', opacity: 'hide'}, 500);
			  }
		  }
		);
		
		
		//zip handling
		//add "neu" to drop down list
		//$("<option>neu</option>").appendTo("#zip");
		
		//zip changing function
		var zipChange = function() {
			//get zip
			$zip = $("#zip option:selected").text();
			
			if ($zip == "neu") {			
				//show zip input
				$('#newZipDiv').show();
				
				//enable place input
				$('.inputPlace').attr("disabled", "");
				
				//resize
				$('.inputPlace').width(107);
				
				//make it empty
				$(".inputPlace").attr("value", "");
			}
			else {
				//hide zip input
				$('#newZipDiv').hide();
				
				//get value which has to be inserted in place
				$newPlace = zipValues[$zip];
				$(".inputPlace").attr("value", $newPlace);

				//disable place input
				$('.inputPlace').attr("disabled", "disabled");
								
				//resize
				$('.inputPlace').width(215);
			}
		}
		
		$("#zip").bind("change keyup keydown",zipChange);
		$("#reset").click(zipChange);
		
		$(".tabs").accessibleTabs({
			tabhead: "h2",
			fx: "fadeIn",
			wrapperClass: "tabcontent",
			currentInfoText: ""
		});
	}
);
