$(document).ready(function (){	$('.ContactLink').click(function(event) {	  event.preventDefault();	  if ($('#Contact').is(":visible"))		{		    $('.ContactLink').removeClass('down');			$('#Contact').slideToggle('slow');		}		else		{		  $('.ContactLink').addClass('down');		  $('#Contact').slideToggle('slow');		}	});		$('#MapLink').click(function() {		$("#LocationMap").modal({ minWidth: 780, minHeight: 640, onOpen: function (dialog)		{			dialog.overlay.fadeIn('slow', function ()			{				dialog.data.hide();				dialog.container.fadeIn('slow', function ()				{					dialog.data.slideDown('slow');				});			});		},		onClose: function (dialog)		{			dialog.data.fadeOut('slow', function ()			{				dialog.container.hide('slow', function ()				{					dialog.overlay.slideUp('slow', function ()					{						$.modal.close();					});				});			});		} 		});	});		$('#NewsletterSignupLink').click(function() {		$("#NewsletterSignup").modal({ minWidth: 480, minHeight: 200, onOpen: function (dialog)		{			dialog.overlay.fadeIn('slow', function ()			{				dialog.data.hide();				dialog.container.fadeIn('slow', function ()				{					dialog.data.slideDown('slow');				});			});		},		onClose: function (dialog)		{			dialog.data.fadeOut('slow', function ()			{				dialog.container.hide('slow', function ()				{					dialog.overlay.slideUp('slow', function ()					{						$.modal.close();					});				});			});		} 		});	});		$('#headernext').click(function () 	{		gallery('LogoTextSlideshow');	});				  $('#btnSubmit').click(function() { SendContact(); });		$('#btnNewsletterSignup').click(function() { SendSignup(); });		if (window.location.href.indexOf("newsletter-signup")!=-1)	{	  $("#NewsletterSignupLink").click();	}});function SendContact(){  if ($('#frmContact').validationEngine('validate'))  {		$.ajax({			type: "POST",			url: "/classes/Page.php?action=SendContact",			data: $('#frmContact').find("input,textarea,select,hidden").serialize(),			success: function (msg)			{				if (msg == "true")				{					$('#MailSuccess').show();				}				else				{					$('#MailFail').show();				}			},			failure: function (msg)			{				$('#MailFail').show();			},			complete: function(jqXHR, textStatus)			{			  $('#Contact').slideToggle('slow');			}		});		$("#ContactConfirmation").modal({ onOpen: function (dialog)		{			dialog.overlay.fadeIn('slow', function ()			{				dialog.data.hide();				dialog.container.fadeIn('slow', function ()				{					dialog.data.slideDown('slow');				});			});		},		onClose: function (dialog)		{			dialog.data.fadeOut('slow', function ()			{				dialog.container.hide('slow', function ()				{					dialog.overlay.slideUp('slow', function ()					{						$.modal.close();					});				});			});		} 		});	}	else	{    setTimeout(function () { jQuery('#frmContact').validationEngine('hide'); }, 2500);	}}function SendSignup(){  if ($('#frmNewsletterSignup').validationEngine('validate'))  {		$.ajax({			type: "POST",			url: "/classes/page.php?action=SendSignup",			data: $('#frmNewsletterSignup').find("input,textarea,select,hidden").serialize(),			success: function (msg)			{				if (msg == "true")				{          $('#frmNewsletterSignup').fadeOut('slow', function ()          {            $('#NewsletterSuccess').fadeIn('slow');          });				}				else				{          $('#frmNewsletterSignup').fadeOut('slow', function ()          {            $('#NewsletterFail').fadeIn('slow');          });				}			},			failure: function (msg)			{        $('#frmNewsletterSignup').fadeOut('slow', function ()        {          $('#NewsletterFail').fadeIn('slow');        });			}		});	}	else	{	  $(".formError").css("z-index", "1000000");    setTimeout(function () { jQuery('#frmNewsletterSignup').validationEngine('hide'); }, 2500);	}}function slideShow(el, speed){  //append a LI item to the UL list for displaying caption  $('ul#' + el).append('<li id="' + el + '-caption" class="caption"><div class="slideshow-caption-container"><h3></h3><p></p></div></li>');  //Set the opacity of all images to 0  $('ul#' + el + ' li').css({ opacity: 0.0 });  //Get the first image and display it (set it to full opacity)  $('ul#' + el + ' li:first').css({ opacity: 1.0 });  //Get the caption of the first image from REL attribute and display it  $('#' + el + '-caption h3').html($('ul#' + el + ' a:first').find('img').attr('title'));	  $('#' + el + '-caption p').html($('ul#' + el + ' a:first').find('img').attr('alt'));  //Display the caption  $('#' + el + '-caption').css({ opacity: 1, bottom: 0 });  //Call the gallery function to run the slideshow	  var timer = setInterval("gallery('" + el + "')", speed);  //pause the slideshow on mouse over  $('ul#' + el).hover(		function ()		{		  clearInterval(timer);		},		function ()		{		  timer = setInterval("gallery('" + el + "')", speed);		}	);}function gallery(el){  //if no IMGs have the show class, grab the first image  var current = ($('ul#' + el + ' li.show') ? $('ul#' + el + ' li.show') : $('ul#' + el + ' li:first'));    //Get next image, if it reached the end of the slideshow, rotate it back to the first image  var next = ((current.next().length) ? ((current.next().attr('id') ==  el + '-caption') ? $('ul#' + el + ' li:first') : current.next()) : $('ul#' + el + ' li:first'));  //Get next image caption  var title = next.find('img').attr('title');	  var desc = next.find('img').attr('alt');  //Set the fade in effect for the next image, show class has higher z-index  next.css({ opacity: 0.0 }).addClass('show').animate({ opacity: 1.0 }, 1500);  //Hide the caption first, and then set and display the caption  //$('#' + el + '-caption').slideToggle(500, function ()  //{	    $('#' + el + '-caption h3').html(title);		    $('#' + el + '-caption p').html(desc);		    //$('#' + el + '-caption').slideToggle(500);  //});  //Hide the current image  current.animate({ opacity: 0.0 }, 3000).removeClass('show');}
