/***********************************************************************Author:     Sander TiekstraCompany:    TiekstramediaURL:        http://www.tiekstramedia.nl***********************************************************************/$(document).ready(function() {		/* Initiate	------------------------------------------------------------------*/	// Replace hr	replaceHr();			// Check and initiate specials navigation	if ($('#specials-navigation').length > 0) initSpecialsNav();		// Check and initiate date picker	if ($('.calendar').length > 0) initDatePicker();	// Check and initiate post its	if ($('.postit').length > 0) initPostIt();		// Check and initiate another attachment	if ($('#anotherattachment').length > 0) initAnotherattachment();			// .home-sub functions	if ($('body.home-sub').length > 0) homeSubFunc();	// .home functions	if ($('body.home').length > 0) homeFunc();		// Add .radio and .checkbox to hide custom borders	$("input:radio").addClass("radio");	$("input:checkbox").addClass("checkbox");		// Expanding textarea	if ($('textarea.expanding').length > 0) {    $.getScript("/static/menzis/menzis2009/js/lib/jquery.autogrow.js", function(){			$('textarea.expanding').autogrow();		});	}				/* Functions	------------------------------------------------------------------*/	// Input help text (by Joe Lencioni, http://webservices.blog.gustavus.edu/2008/06/23/text-input-example-text-with-jquery/)	function switchText()	{		if ($(this).val() == $(this).attr('title'))			$(this).val('').removeClass('hint');		else if ($.trim($(this).val()) == '')			$(this).addClass('hint').val($(this).attr('title'));	}	$('#site-search input[type=text][title!=""]').each(function() {		if ($.trim($(this).val()) == '') $(this).val($(this).attr('title'));		if ($(this).val() == $(this).attr('title')) $(this).addClass('hint');	}).focus(switchText).blur(switchText);	$('#site-search form').submit(function() {		$(this).find('input[type=text][title!=""]').each(function() {			if ($(this).val() == $(this).attr('title')) $(this).val('');		});	});			// Behaviour for specials navigation	function initSpecialsNav() {		$('#specials-navigation ul li').each(function() {			$(this).mouseover(function() {				$('#specials-navigation ul li.breadcrumb').removeClass('breadcrumb');				$('#specials-navigation ul li.last-child-breadcrumb').removeClass('last-child-breadcrumb');								if ($(this).hasClass('last-child')) {					$(this).addClass('last-child-breadcrumb');					}				$(this).addClass('breadcrumb');			});		});	}		// Replace hr	function replaceHr() {		$('hr').wrap('<div class="hr"></div>');	}		// .home functions	function homeFunc() {		var doormatH = $('.doormat').outerHeight();		var specialsH = $('.specials').outerHeight();		if (doormatH > specialsH) {			$('.specials>div').height(doormatH - 1);		};		var corporateH = $('.corporate').outerHeight();		var newsH = $('.news').outerHeight();		if (corporateH > newsH) {			$('.news').height(corporateH);		};	}			// .home-sub functions	function homeSubFunc() {		if ( $('body').hasClass("customer-offers") ) {			$('#page .content>.hr').remove();			$('#page .content>div').addClass('tabulated');			$('#page .content').find('>div:nth-child(1), >div:nth-child(2), >div:nth-child(3)').equalHeights();			$('#page .content').find('>div:nth-child(4), >div:nth-child(5), >div:nth-child(6)').equalHeights();			$('#page .content').find('>div:nth-child(7), >div:nth-child(8), >div:nth-child(9)').equalHeights();			$('#page .content').find('>div:nth-child(10), >div:nth-child(11), >div:nth-child(12)').equalHeights();			$('#page .content').find('>div:nth-child(13), >div:nth-child(14), >div:nth-child(15)').equalHeights();					} else {			$('#page .content>div').hover(function() {				$(this).toggleClass("hover");			}, function() {				$(this).toggleClass("hover");			}).click(function() {				window.location = $(this).find('a:last').attr("href");			});		}	}		// Date Picker	function initDatePicker() {    $.getScript("/static/menzis/menzis2009/js/lib/date.js", function(){      $.getScript("/static/menzis/menzis2009/js/lib/jquery.datepicker.js", function(){				// IE6-div-ontop-of-select-fix				if ($.browser.msie && $.browser.version == 6.0 && $('select').length > 0) {          $.getScript("/static/menzis/menzis2009/js/lib/jquery.bgiframe.js");				}								var today = new Date();				var currentYear = today.getFullYear();												$('.calendar')					.datePicker({						verticalOffset: '-5',						startDate: '01/01/' + (currentYear - 10),						endDate: '31/12/' + (currentYear + 10)					})					.bind(						'click',						function() {							$(this).dpDisplay();							this.blur();							return false;						}					)					.bind(						'dateSelected',						function(e, selectedDate, $td)						{							var day		= selectedDate.getDate();							var month	= selectedDate.getMonth() + 1;							var year	= selectedDate.getFullYear();														$(this).parent().find('.day').val(day);							$(this).parent().find('.month').val(month);							$(this).parent().find('.year').val(year);						}					);									$('.dp-choose-date').html("<img src='/static/menzis/menzis2009/assets/layout/icn.agenda.gif' />");												$('.day, .month, .year').change(function() {					var day			= $(this).parent().find('.day').val();					var month		= $(this).parent().find('.month').val();					var year		= $(this).parent().find('.year').val();					var calendar	= $(this).parent().find('.calendar');										// update input.calendar					calendar.val(day + '/' + month + '/' + year);										// update the selected date					var d = new Date(						year,						month-1,						day					);					calendar.dpSetSelected(d.asString());				});							});						});	};			// Postit notes	function initPostIt() {		$(".postit").after("<img src='/static/menzis/menzis2009/assets/layout/icn.postit.gif' class='postit_icon' />");		$(".postit_icon").click(function () {			$(".postit:visible").hide();			$(this).parent("div").css("overflow","visible");			$(this).prevAll("input:text").css("background","#fff299");			$(this).prev().show();		});		$(".postit").click(function () {			$(this).parent("div").css("overflow","hidden");			$(this).prevAll("input:text").css("background","#fff");			$(this).hide();		});		$(".postit").append("<span class='postit_close'>Close</span>");	}	    // Adding upload inputs	function initAnotherattachment(args) {	    $('#anotherattachment').bind('click', function() {	        var max_attachments = 5; // Maximaal aantal file input velden in bijbehorende ul	        // Maak li met input en verwijder link en voeg deze toe aan ul	        var ul = $(this).parent().children('ul');	        var count = ul.children().length;	        var name = 'bijlage_'+(count+1);	        var li = $(document.createElement('li'));	        var file = $(document.createElement('input'));	        file.attr('type', 'file');	        file.attr('name', name);	        li.append(file);	        var a = $(document.createElement('a'));	        a.attr('href', 'javascript:;');	        a.html('Verwijder');	        li.append(a);	        ul.append(li);	        // Actie voor verwijder link	        a.bind('click', function() {	            if (li.parent().children().length == max_attachments) {	                li.parent().parent().children('.maxattachments').remove();	                $('#anotherattachment').show();	            }	            li.remove();	        });	        // Verberg toevoegen link en laat bericht zien dat maximum bereikt is 	        if (count+1 == max_attachments) {	            var span = $(document.createElement('span'));	            span.attr('class', 'maxattachments');	            span.html('U heeft het maximaal aantal bijlages bereikt.');	            $(this).parent().append(span);	            $(this).hide();	        }	    });			}	});// Replace NotesSoft width CufónCufon.replace('#header div#mijn-menzis h3, .home #container h3, #main-navigation li a, #page h1, #page h2, #page h3, #page .content .bar span .score, body.home-wb #container h3, body.landing-page h2, body.landing-page h3');Cufon.replace('#shortcuts h2, #shortcuts .doormat h3 a, #shortcuts .corporate h3, p.call-to-action-mini a em', {	hover: true});Cufon.replace('p.call-to-action a em', {	hover: true,	hoverables: { em: true }});Cufon.replace('#site-search form button, body.page-not-found button', {	hover: true,	hoverables: { button: true }});/** * Equal Heights Plugin * Equalize the heights of elements. Great for columns or any elements * that need to be the same size (floats, etc). *  * Version 1.0 * Updated 12/109/2008 * * Copyright (c) 2008 Rob Glazebrook (cssnewbie.com)  * * Usage: $(object).equalHeights([minHeight], [maxHeight]); *  * Example 1: $(".cols").equalHeights(); Sets all columns to the same height. * Example 2: $(".cols").equalHeights(400); Sets all cols to at least 400px tall. * Example 3: $(".cols").equalHeights(100,300); Cols are at least 100 but no more * than 300 pixels tall. Elements with too much content will gain a scrollbar. *  */(function($) {	$.fn.equalHeights = function(minHeight, maxHeight) {		tallest = (minHeight) ? minHeight : 0;		this.each(function() {			if($(this).height() > tallest) {				tallest = $(this).height();			}		});		if((maxHeight) && tallest > maxHeight) tallest = maxHeight;		return this.each(function() {			$(this).height(tallest).css("overflow","auto");		});	}})(jQuery);