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

	
	$("#logo").click(function(){ window.location.href  = 'http://www.acsense.nl/software'; });
	
	

	/* Eerste afbeelding met effect binnen laten komen.		 */
	
	$(".carousel").carousel({loop: true, effect: "zoom"});
	
	$(".carousel ul li#0 .carousel-image img").css("width","900px");
	$(".carousel ul li#0 .carousel-text-container").hide();
	

	$(".carousel img").fadeIn(2000);
	$(".carousel ul li#0 .carousel-image img").animate( { width:"770px"}, 4000 );
	$(".carousel ul li#0 .carousel-text-container").css('opacity', 0.8);
	$(".carousel ul li#0 .carousel-text-container").animate({right:"10px"},3000).fadeIn(100);




	$(".success-message").fadeOut(3000);	 
	
		
	$("#search-input").focus(function(){
				$("#search-input").attr("value","");
				$("#search-input").css("color", "#333");
	 });
	
	$("#search-input").blur(function(){
			if($("#search-input").val() == '')
			{
				$("#search-input").val("Zoeken...");
				$("#search-input").css("color", "#999");
			}
				
	 });
	
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",
																"background-color" : "#00437a"
															});
		$("#dropline li div ul li.selected:eq(0)").children(":first-child").css({
																"color" : "#00437a",
																"background-color" :"#fff"
		});
}

		$("#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",
						"backgroundColor" :"#40729b",
						"backgroundImage" : "url(http://www.acsense.nl/voorbeeld/software/resources/images/menu-line.png)",
						"backgroundRepeat": "repeat-y",
						"backgroundPosition": "right"
						
						} );
			
				}
				else
				{
					$('#dropline li#' + this.id).children("a:eq(0)").css({
						"color":"#40729b",
						"backgroundColor" :"#fff"} );
				}
			
			
				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",
							"backgroundColor" :"#757577",
							"backgroundImage" : "url(http://www.acsense.nl/voorbeeld/software/resources/images/menu-line.png)",
							"backgroundRepeat": "repeat-y",
							"backgroundPosition": "right"
						} );
					
					}else{
						
						$('#dropline li#' + this.id).children("a:eq(0)").css({
							"color":"#666",
							"backgroundColor" :"#fff"} );
					}
				

					if(getCurrent = 1){
						$(this).parent().children("li.selected:eq(0)").children("div").show();;
//						$('#dropline li.selected:eq(0) div').show();;
					}
					$(this).children("div").hide();
						
				}		
						
													
		});
	
	$("#company-brand").click(function(){
		window.location.href='http://www.acsense.nl';
	});
	
});


//--><!]]>