/**
 * @author Jeroen Dijkstra
 *
 * Remove the text on the homepage in the searchbar
 
$(document).ready(
	function()
	{
		$('#HomeSearch input.input[name=search]').css({"color" : "gray", "font-style" : "italic"}).val("bijv. - Jordaan, Amsterdam");
		$('#HomeSearch input.input[name=search]').focus(function () {$(this).css({"color" : "black", "font-style" : "normal"}).val("");});
	}
);
*/
/**
 * @author Jeroen Dijkstra
 *
 * Messes around with the position of the ad container (#Zoekresultaten2)
 * and pushes the Google Maps container down (.ColumnRestaurantMap)
 */
$(document).ready(
	function()
	{
		$('#Zoekresultaten2').css({'margin-top' : $('#Zoekresultaten1').height() + 'px'});
		$('.ColumnRestaurantMap').css({'margin-top' : $('#Zoekresultaten2').height() + 40 + 'px'}); // 40 is standard margin-top
	}
);

/**
 * @author Jeroen Dijkstra, Pim Elshoff
 *
 * Capture the click on the search for and redirects
 * Update: also capture the page click
 */
$(document).ready(
	function()
	{
		$('form.Search').submit(
			function()
			{
				var searchVal 	= $('form.Search input[name=search]').val();
				if (searchVal != 'bijv. - Rotterdam, Dolfinarium of Jordaan')
				{
					searchVal		= escape(searchVal);
					var types		= "";
					if ($('input#hidden1').val() != "")
					{
						types			+= "restaurants";
					}
					if ($('input#hidden2').val() != "")
					{
						if (types.length > 0)
						{
							types			+= "-";
						}
						types			+= "cafetarias";
					}
					if ($('input#hidden3').val() != "")
					{
						if (types.length > 0)
						{
							types			+= "-";
						}
						types			+= "cafes";
					}
					if ($('input#hidden4').val() != "")
					{
						if (types.length > 0)
						{
							types			+= "-";
						}
						types			+= "discotheken";
					}
					var url			= '/zoeken/' + types + "/" + searchVal;
					this.action		= url;
				}
				else
				{
					this.action		= '/zoeken/';
				}
				return true;
			}
		);
		$('#ColumnResults #ColumnResultPink a').click(
			function()
			{
				var link = this.href;
				$('#FilterContainer form').each(
					function()
					{
						this.action	= link;
						this.submit();
					}
				);
				return false;
			}

		);
	}
);

/**
 * @author Jeroen Dijkstra
 *
 * Makes sure that the top hover image is active
 * even if the hover is on the child items
 */
 if(!$.browser.msie && !$.browser.version=="6.0") // jQuery IE6 detection
 {
 	var navigation = $(function()
		{
			$('ul.SubMenuHorecaondermer').mouseover(function()
				{
					$('ul.SubMenuHorecaondermer').parent().children('a#Customer').css(
						{ background: 'transparent url(./Includes/Images/Lay-out/navigation/horecaondernemer2.jpg) no-repeat scroll 0 0' }
					);
				}
			),
			$('ul.SubMenuHorecaondermer').mouseout(function()
				{
					$('ul.SubMenuHorecaondermer').parent().children('a#Customer').css(
						{ background: 'transparent url(./Includes/Images/Lay-out/navigation/horecaondernemer1.jpg) no-repeat scroll 0 0' }
					);
				}
			),
			$('ul.SubMenuHelp').mouseover(function()
				{
					$('ul.SubMenuHelp').parent().children('a#Help').css(
						{ background: 'transparent url(./Includes/Images/Lay-out/navigation/helponderwerpen2.jpg) no-repeat scroll 0 0' }
					);
				}
			),
			$('ul.SubMenuHelp').mouseout(function()
				{
					$('ul.SubMenuHelp').parent().children('a#Help').css(
						{ background: 'transparent url(./Includes/Images/Lay-out/navigation/helponderwerpen1.jpg) no-repeat scroll 0 0' }
					);
				}
			),
			$('ul.SubMenuSpoen').mouseover(function()
				{
					$('ul.SubMenuSpoen').parent().children('a#Spoen').css(
						{ background: 'transparent url(./Includes/Images/Lay-out/navigation/spoen2.jpg) no-repeat scroll 0 0' }
					);
				}
			);
			$('ul.SubMenuSpoen').mouseout(function()
				{
					$('ul.SubMenuSpoen').parent().children('a#Spoen').css(
						{ background: 'transparent url(./Includes/Images/Lay-out/navigation/spoen1.jpg) no-repeat scroll 0 0' }
					);
				}
			);

		}
	);
}
