  $(document).ready(function(){
  
  	
	$("#dialog").hide();
	
	/* setup the tabs */
	if($.swapImage)
		$.swapImage(".swapImage");
	
	
	/* setup the form */
	if(jQuery('form').formValidate)
		jQuery('form').formValidate();
	
	
  });
  
  
  function privacy(){
  		$("#dialog").show();
		$("#dialog").dialog({ 
			height: 300,
			width: 300,
			modal: true, 
			overlay: { 
				opacity: 0.5, 
				background: "black" 
			},
			buttons: { 
				"Close": function() { 
					$(this).dialog("close"); 
				} 
			} 
		});
	//$("#privacyContents").css("display","block");
  }
  
  
  
	function validateForm(theform) {
	with (theform) {
		var alertMsg = "The following REQUIRED fields\nhave been left empty:\n";
		if (theform.username.value == "") alertMsg += "\nUsername";
		if (theform.password.value == "") alertMsg += "\nPassword";
		if (alertMsg != "The following REQUIRED fields\nhave been left empty:\n") {
			alert(alertMsg);
			return false;
		} else {
		if( theform.system[0].checked) {
		//	theform.action = "http://www.mydirectconnections.com/Authenticate.php";
		} else {
		//	theform.action = "http://mdctwo.com/authenticate.php";
		}	 
		return true;
	} } }




function submitForm(form){

	if ( document.getElementById('name') || document.getElementById('email') || document.getElementById('message') || document.getElementById('contactForm'))
	{
		if ( document.getElementById('name').value != "" || document.getElementById('email').value != "" || document.getElementById('message').value != "" )
		{
		
			// Insert code here to post it somewhere
			document.getElementById('contactForm').submit();
		}else
		{
			alert( "Check required form fields" );
		}
	}else
	{
		alert ("Form elements not found");
	}
	


}
