$(document).ready(function(){
		/* Toggle Lightbox and Expose script */
		if (/msie|MSIE 6/.test(navigator.userAgent) || /msie|MSIE 7/.test(navigator.userAgent))  {
			$(".tt-mail").click(function () { 
				$('#overlay').show();
				$('.overlay-shadow').show();
				$('.content-block fieldset :input').addClass('ignore'); // for validating - so the form in the lightbox submits
			});
			
			$(".close").click(function () { 
				$('.overlay-shadow').css('background','none');
				$('#overlay').fadeOut('5500');					
				$('.content-block fieldset :input').removeClass('ignore'); // for validating - so the form in the lightbox submits
			});										
		}
		
		else if (/msie|MSIE 8/.test(navigator.userAgent))  {
			$(".tt-mail").click(function () { 
				$('#overlay').expose({api: true}).load();
				$('#overlay').show();
				$('.overlay-shadow').show();
				$('.content-block fieldset :input').addClass('ignore'); // for validating - so the form in the lightbox submits
			});
			
			$(".close").click(function () { 
				$('.overlay-shadow').css('background','none');
				$('#overlay').fadeOut('2500');
				$('#overlay').expose().close();
				$('.content-block fieldset :input').removeClass('ignore'); // for validating - so the form in the lightbox submits
			});				
		}				
		
		else {
			$(".tt-mail").click(function () { 
				$('#overlay').expose({api: true}).load();
				$('#overlay').fadeIn('3500');
				$('.overlay-shadow').show();
				$('.content-block fieldset :input').addClass('ignore'); // for validating - so the form in the lightbox submits
			});
			$(".close").click(function () { 
				$('#overlay').fadeOut('3500');
				$('#overlay').expose().close();
				$('.content-block fieldset :input').removeClass('ignore'); // for validating - so the form in the lightbox submits
			});				
		}
		
		/* validate commentform - edit messages in the script file */
		$("#aspnetForm").validate({
			submitHandler: function(form) {
				form.submit();
			},
			ignore : ':hidden, .ignore' // only validate visible input fields
		});

		jQuery('select[name=fieldset-choice]').change(function(){
			var fieldsetName = $(this).val();
			$('fieldset').hide().filter('#' + fieldsetName).show();
		});
		
		// We need to hide all fieldsets except the first:
		$('fieldset').hide().filter('#f1').show();
})



