$(document).ready(function(){
		
	 
	 $('#menu').css('visibility','visible');



	$(".success-message").fadeOut(3000);	 
	
		
	
	
if($("#dropline li.selected").html() != null)
{	
	// Toon submenu
			$("#dropline li.selected:eq(0) div").show();
		
	//Breedte Sub menu
			var UlWidth	=	$("#dropline li.selected:eq(0) div ul").width() /2;  
			// Breedte list item
			var LiWidth =	$("#dropline li.selected:eq(0)").width();
			
			// Deel list item door 2
			var LiWidthMiddle =	$("#dropline li.selected:eq(0)").width() / 2;
			
			// Hoofditem positie
			
			var ParentPosition	=	$("#dropline li.selected:eq(0)").position();
			
						
			// Set offset voor submenu
			var OffsetParent	=	UlWidth - LiWidth + LiWidthMiddle;

			// Zet submenu in het midden onder het hoofditem
			

				$("#dropline li.selected:eq(0) div ul").css({
					"marginLeft": (ParentPosition.left - OffsetParent) + "px"
					
				});
			
			
			
			
			// Offset menu left
			var OffsetDropline	=	$("#dropline").offset();
			
			
			// Offset Submenu left
			if($("#dropline li.selected:eq(0) div ul").offset() != null){
				var OffsetSubUl	=	$("#dropline li.selected:eq(0) div ul").offset();
			}
						
			// Wanneer de offset van het submenu kleiner is dan het hoofdmenu, lijn het menu dan links uit.
			if($("#dropline li.selected:eq(0) div ul").offset() != null){
				
				
				if(OffsetSubUl.left < OffsetDropline.left){
						
					$("#dropline li.selected:eq(0) div ul").css({
						"marginLeft":"0px"
					});
				}
				
				var RightWidth	=	OffsetDropline.right - ParentPosition.left - OffsetParent;

					
				//alert(OffsetDropline.right);
				//alert(OffsetSubUl.right);
				
				
				if($.browser.msie){
					
					if(OffsetSubUl.right >= OffsetDropline.right){
						
						$("#dropline li.selected:eq(0) div ul").css({
							"marginLeft" : (RightWidth + LiWidthMiddle) + "px"
						});
					}
					
					
				}else{
					
					if(OffsetSubUl.right > OffsetDropline.right){
					$("#dropline li.selected:eq(0) div ul").css({
						"marginLeft" : (RightWidth + LiWidthMiddle) + "px"
					});
					}
				}
				
				
			}
	
	
	//menu
	
	$("#dropline li.selected:eq(0)").children(":first-child").css({
																"color" : "#fff",
																"font-weight" : "bold"
															});
		$("#dropline li div ul li.selected:eq(0)").children(":first-child").css({
																"color" : "#00437a",
																"font-weight" :"bold"
		});
}

		$("#dropline li").hover(function(){
			
			if(this.className.indexOf("selected") == -1)  
			{
				
				getCurrent = $(this).parent().children("li.selected:eq(0)");
			
			
				if(this.className.indexOf("top") != -1)  
				{
				
					$('#dropline li#' + this.id).children("a:eq(0)").css({
						"color":"#fff"
						
						
						
						} );
			
				}
				else
				{
					$('#dropline li#' + this.id).children("a:eq(0)").css({
						"color":"#40729b"
						} );
				}
			
			
				if(getCurrent = 1)
				{
					//$('#dropline li.selected:eq(0) div').hide();;
					$(this).parent().children("li.selected:eq(0)").children("div").hide();;

				}
				
				// Toon submenu
				$('#dropline li#' + this.id + ":eq(0) div").show();
				
				
				

				//Breedte Sub menu
				var UlWidth	=	$("#dropline li#" + this.id + ":eq(0) div ul").width() / 2;  
				// Breedte list item
				var LiWidth =	$("#dropline li#" + this.id + ":eq(0)").width();
			
				// Deel list item door 2
				var LiWidthMiddle =	$("#dropline li#" + this.id + ":eq(0)").width() / 2;
			
				// Hoofditem positie
				var ParentPosition	=	$("#dropline li#" + this.id + ":eq(0)").position();
				
				// Set offset voor submenu
				var OffsetParent	=	 UlWidth - LiWidth + LiWidthMiddle;
					
				// Zet submenu in het midden onder het hoofditem
				$("#dropline li#" + this.id + ":eq(0) div ul").css({
					"marginLeft": ParentPosition.left - OffsetParent + "px"
				});
			
				// Offset menu 
				var OffsetDropline	=	$("#dropline").offset();
			
				// Offset Submenu 
				if($("#dropline li#" + this.id + ":eq(0) div ul").offset() != null)
				{
					var OffsetSubUl	=	$("#dropline li#" + this.id + ":eq(0) div ul").offset();
				}
			
				// Wanneer de offset van het submenu kleiner is dan het hoofdmenu, lijn het menu dan links uit.
				if($("#dropline li#" + this.id + ":eq(0) div ul").offset() != null)
				{
					
					if(OffsetSubUl.left < OffsetDropline.left)
					{
						$("#dropline li#" + this.id + ":eq(0) div ul").css({
							"marginLeft":"0px"
						});
					}
				
					var RightWidth	=	OffsetDropline.right - ParentPosition.left - OffsetParent;

				
					if($.browser.msie)
					{
					
						if(OffsetSubUl.right >= OffsetDropline.right)
						{
						
							$("#dropline li#" + this.id + ":eq(0) div ul").css({
								"marginLeft" : RightWidth + LiWidthMiddle + "px"
							});
						}
					
					}
					else
					{
					
						if(OffsetSubUl.right > OffsetDropline.right)
						{
							$("#dropline li#" + this.id + ":eq(0) div ul").css({
								"marginLeft" : RightWidth + LiWidthMiddle + "px"
							});
						}
					}
				}
				
			}
			
			
		},function(){
			
				if(this.className.indexOf("selected") == -1)  
				{
					
					getCurrent = $(this).parent().children("li.selected:eq(0)");
					
					if(this.className.indexOf("top") != -1) 
					{

						$('#dropline li#' + this.id).children("a:eq(0)").css({
							"color":"#fff",
							"font-weight" :"normal"

						} );
					
					}else{
						
						$('#dropline li#' + this.id).children("a:eq(0)").css({
							"color":"#666",
							"font-weight" :"normal"} );
					}
				

					if(getCurrent = 1){
						$(this).parent().children("li.selected:eq(0)").children("div").show();;
//						$('#dropline li.selected:eq(0) div').show();;
					}
					$(this).children("div").hide();
						
				}		
						
													
		});
	
	
	$.imageFrame.defaultFrameStyle = 'soft';
	$('#content_frame').imageFrame();

	
});


//--><!]]>
