

		$(document).ready(function(){	
			$("#slider").easySlider({
				controlsBefore:	'<p id="controls">',
				controlsAfter:	'</p>',
				auto: true, 
				continuous: true
			});
			$("#slider2").easySlider({
				controlsBefore:	'<p id="controls2">',
				controlsAfter:	'</p>',		
				prevId: 'prevBtn2',
				nextId: 'nextBtn2'	
			});			
		});	
jQuery(document).ready(function() {
  jQuery('#southport, #tennis, #sailing', '#healthcare', '#volunteer', '#southport2', '#carolinaNational', '#founders', '#membersClub', '#playersClub', '#windingRiver', '#stJames', '#reserve', '#magnolia','#capeFear','#oceanRidge','#beaches','#brunswickForest','#waterford', '#walkingTrails', '#oakIsland', '#oceanIsle','#holdenBeach').show();
  if(window.location.hash) {
    fakeAccordion(window.location.hash.substring(1));
	setTimeout(function(){window.scrollTo(0,0)},200);
  }
});
function fakeAccordion(el) {
  var elements = ['southport', 'tennis', 'sailing', 'healthcare', 'volunteer', 'southport2', 'carolinaNational', 'founders', 'membersClub', 'playersClub', 'windingRiver', 'stJames', 'reserve', 'magnolia','capeFear','oceanRidge','beaches','brunswickForest','waterford','walkingTrails','oceanIsle','oakIsland', 'holdenBeach'];
  jQuery.each(elements, function() {
    if(el == this) {
      if(jQuery('#' + this).is(':visible')) {
      }
      else {
        jQuery('#' + this).show();
      }
    }
    else {
      jQuery('#' + this).hide();
    }
  });
}
		jQuery(document).ready(function($){
				$(".nav2")
				.superfish({
						animation : { opacity:"show",height:"show"}
				})
				.find(">li:has(ul)") 
						.mouseover(function(){
								$("ul");
						})
						.find("a")
								.focus(function(){
										$("ul", $(".nav>li:has(ul)"));
		
								});
		
		
				$(".dropDown")
				.superfish({
						animation : { opacity:"show",height:"show"}
				})
				.find(">li:has(ul)") 
						.mouseover(function(){
								$("ul");
						})
						.find("a")
								.focus(function(){
										$("ul", $(".nav>li:has(ul)"));
		
								});
		
						$("#lavaLamp").superfish({
								fx: "backout", 
								speed: 700,
								click: function(event, menuItem) {
										return true;
								}
						});
				});
jQuery(document).ready(function(){

  //Hide (Collapse) the toggle containers on load
  jQuery(".toggleContent").hide(); 

  //Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state)
  jQuery(".toggleLabel").click(function(){
    jQuery(this).toggleClass("active").next().slideToggle("slow");
    return false;
  });
});
$(document).ready(function(){
	$("#contactLink").click(function(){
	if ($("#contactForm").is(":hidden")){
		$("#contactForm").slideDown("slow");
	}
	else{
	$("#contactForm").slideUp("slow");
		}
	});
	});
	function closeForm(){
		$("#messageSent").show("slow");
		setTimeout('$("#messageSent").hide();$("#contactForm").slideUp("slow")', 2000);
	}	
function validateForm()
{
var x=document.forms["myForm"]["name"].value
var a=document.forms["myForm"]["email"].value
var b=document.forms["myForm"]["address"].value
var c=document.forms["myForm"]["city"].value
var d=document.forms["myForm"]["answer"].value

if (x==null || x=="")
  {
  alert("Name must be filled out");
  return false;
  }
if (a==null || a=="")
  {
  alert("Email must be filled out");
  return false;
  }
if (b==null || b=="")
  {
  alert("Address must be filled out");
  return false;
  }
if (c==null || c=="")
  {
  alert("City, State and Zipcode must be filled out");
  return false;
  }
if (d!="4")
  {
  alert("Your answer is not correct.");
  return false;
  }
}
	jQuery(function() {
		// a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore!
		jQuery( "#dialog:ui-dialog" ).dialog( "destroy" );
		
		var entrant_fname = $( "#entrant_fname" ),
		    entrant_lname = $( "#entrant_lname" ),
			entrant_email = $( "#entrant_email" ),
			entrant_phone = $( "#entrant_phone" ),
			entrant_address = $( "#entrant_address" ),
			entrant_city = $( "#entrant_city" ),
			entrant_state = $( "#entrant_state" ),
			entrant_zip = $( "#entrant_zip" ),
			
			family_fname = $( "#family_fname" ),
			family_lname = $( "#family_lname" ),
			family_email = $( "#family_email" ),
			family_phone = $( "#family_phone" ),
			family_address = $( "#family_address" ),
			family_city = $( "#family_city" ),
			family_state = $( "#family_state" ),
			family_zip = $( "#family_zip" ),
			allFields = $( [] ).add( entrant_fname ) .add( entrant_lname ).add( entrant_email ).add( entrant_phone ).add( entrant_address ).add( entrant_city ).add( entrant_state ).add( entrant_zip ) .add( family_fname ) .add( family_lname ) .add( family_email ) .add( family_phone ) .add( family_address ) .add( family_city ) .add( family_state ) .add( family_zip ),
			tips = $( ".validateTips" );

		function updateTips( t ) {
			tips
				.text( t )
				.addClass( "ui-state-highlight" );
			setTimeout(function() {
				tips.removeClass( "ui-state-highlight", 1500 );
			}, 500 );
		}

		function checkLength( o, n, min, max ) {
			if ( o.val().length > max || o.val().length < min ) {
				o.addClass( "ui-state-error" );
				updateTips( "Length of " + n + " must be between " +
					min + " and " + max + "." );
				return false;
			} else {
				return true;
			}
		}

		function checkRegexp( o, regexp, n ) {
			if ( !( regexp.test( o.val() ) ) ) {
				o.addClass( "ui-state-error" );
				updateTips( n );
				return false;
			} else {
				return true;
			}
		}
		
		jQuery( "#dialog-form" ).dialog({
			autoOpen: false,
			height: 830,
			width: 450,
			modal: true,
			buttons: {
				"Sign Up": function() {
					var bValid = true;
					allFields.removeClass( "ui-state-error" );

					bValid = bValid && checkLength( entrant_fname, "entrant_fname", 2, 16 );
					bValid = bValid && checkLength( entrant_lname, "entrant_lname", 2, 16 );
					bValid = bValid && checkLength( entrant_email, "entrant_email", 6, 80 );
					bValid = bValid && checkLength( entrant_phone, "entrant_phone", 6, 80 );
					bValid = bValid && checkLength( entrant_address, "entrant_address", 6, 250 );
					bValid = bValid && checkLength( entrant_city, "entrant_city", 3, 150 );
					bValid = bValid && checkLength( entrant_state, "entrant_state", 2, 20 );
					bValid = bValid && checkLength( entrant_zip, "entrant_zip", 4, 80 );
					
					bValid = bValid && checkLength( family_fname, "family_fname", 2, 16 );
					bValid = bValid && checkLength( family_lname, "family_lname", 2, 16 );
					bValid = bValid && checkLength( family_email, "family_email", 6, 80 );
					bValid = bValid && checkLength( family_phone, "family_phone", 6, 80 );
					bValid = bValid && checkLength( family_address, "family_address", 6, 250 );
					bValid = bValid && checkLength( family_city, "family_city", 3, 150 );
					bValid = bValid && checkLength( family_state, "family_state", 2, 20 );
					bValid = bValid && checkLength( family_zip, "family_zip", 4, 80 );

					bValid = bValid && checkRegexp( entrant_fname, /^[a-z]([0-9a-z_])+$/i, "Name may consist of a-z, 0-9, underscores, begin with a letter." );
					bValid = bValid && checkRegexp( entrant_lname, /^[a-z]([0-9a-z_])+$/i, "Name may consist of a-z, 0-9, underscores, begin with a letter." );
					bValid = bValid && checkRegexp( family_fname, /^[a-z]([0-9a-z_])+$/i, "Name may consist of a-z, 0-9, underscores, begin with a letter." );
					bValid = bValid && checkRegexp( family_lname, /^[a-z]([0-9a-z_])+$/i, "Name may consist of a-z, 0-9, underscores, begin with a letter." );
					// From jquery.validate.js (by joern), contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/
					bValid = bValid && checkRegexp( entrant_email, /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i, "eg. ui@jquery.com" );
					
					bValid = bValid && checkRegexp( family_email, /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i, "" );
					

					if ( bValid ) {
					$.post('tripForm.php', $("#myform").serialize());
					$( this ).dialog( "close" );					

					//function(data) {
					//$('#results').html(data);
					//});
						//window.location.replace("http://plantationpropertiesnc.com/tripForm.php");

						//$( this ).dialog( "close" );
					}
				},
				Cancel: function() {
					$( this ).dialog( "close" );
				}
			},
			close: function() {
				allFields.val( "" ).removeClass( "ui-state-error" );
			}
		});

		jQuery( "#create-user" )
			.button()
			.click(function() {
				$( "#dialog-form" ).dialog( "open" );
			});
	});

