// JavaScript Document

	//function validate(form)
//	{
//		alert ("FCK Editor value is "  + form.description.value);
//	}


	function isBlank(data)
	{
		// Remove all cases of "<br>" and "&nbsp;"
		data = data.replace(/\r|\n|\<br>|\&nbsp;/g, "");
		// Remove all spaces
		data = data.replace(/\s/g, "");	

		if (data == '')
			return true;
		else
			return false;	
	}

	function confirmYesNo()
	{
		return confirm("Are you sure?");
	}

	function validateContactForm(form)
	{
		if (form.name.value == '')
		{
			alert("You must enter a name!");
			return false;
		}

		if (form.email.value == '')
		{
			alert("You must enter an email address!");
			return false;
		}

		if (form.phone.value == '')
		{
			alert("You must enter a phone address!");
			return false;
		}

		if (form.content.value == '')
		{
			alert("You must enter comments!");
			return false;
		}

		return true;
	}

	function validateArticleForm()
	{			
		if (title.value == '')
		{
			alert("You must enter a title");
			return false;
		}

		if (author.value == '')
		{
			alert("You must enter an author!");
			return false;
		}

		if (source.value == '')
		{
			alert("You must enter a source");
			return false;
		}
		
		if (hyperlink.value == '')
		{
			alert("You must enter a link!");
			return false;
		}

		if (checkFCKEditorContent("fckEditorContent") == false)
		{
			alert("You must enter the article content!");
			return false;
		}

		return true;
	}


	function validateGuideLinkForm()
	{			
		if (categoryID.value == '')
		{
			alert("You must enter a category!");
			return false;
		}

		if (title.value == '')
		{
			alert("You must enter a title!");
			return false;
		}


		if (hyperlink.value == '')
		{
			alert("You must enter a link!");
			return false;
		}


		if (checkFCKEditorContent("description") == false)
		{
			alert("You must enter the guide link description!");
			return false;
		}

		return true;
	}

	function validateTestimonialForm(form)
	{			
		
		if (form.name.value == '')
		{
			alert("You must enter a name!");
			return false;
		}

		if (form.location.value == '')
		{
			alert("You must enter a location!");
			return false;
		}

		if (checkFCKEditorContent("testimonial") == false)
		{
			alert("You must enter the guide link description!");
			return false;
		}

		return true;
	}

	function validateGuideCategoryForm(form)
	{					
		if (form.name.value == '')
		{
			alert("You must enter a name!");
			return false;
		}

		return true;
	}


	function validateTeamInfoForm(form)
	{					 
		/*if (form.name.value == '')
		{
			alert("You must enter a name!");
			return false;
		}

		if (form.slogan.value == '')
		{
			alert("You must enter a slogan!");
			return false;
		}

		if (checkFCKEditorContent("description") == false)
		{
			alert("You must enter a description!");
			return false;
		}
		*/
		return true;
	}



	function validateTeamMemberForm(form)
	{					 
		if (form.name.value == '')
		{
			alert("You must enter a name!");
			return false;
		}

		if (checkFCKEditorContent("description") == false)
		{
			alert("You must enter a description!");
			return false;
		}

		return true;
	}

	function validateRelocationGuide(form)
	{	
		if (isBlank(form.name.value))
		{
			alert("You must enter your name!");
			return false;
		}		
		
		if (isBlank(form.email.value))
		{
			alert("You must enter your email address!");
			return false;
		}		
		if (isBlank(form.address_1.value))
		{
			alert("You must enter your address!");
			return false;
		}		
		if (isBlank(form.city.value))
		{
			alert("You must enter your City!");
			return false;
		}		
		if (isBlank(form.state.value))
		{
			alert("You must enter your State!");
			return false;
		}		
		if (isBlank(form.zip.value))
		{
			alert("You must enter your zip code!");
			return false;
		}		
		if (isBlank(form.phone.value))
		{
			alert("You must enter your Main Telephone number!");
			return false;
		}		

		return true;
	}


	function validateAppReq(form)
	{
		if (isBlank(form.phone.value) || (form.phone.value == 'phone'))
		{
			alert("You must enter a phone number!");
			return false;
		}	
	}


	function checkFCKEditorContent(fckEditorInstanceName)
	{
		var oEditor = FCKeditorAPI.GetInstance(fckEditorInstanceName);		
		var content = oEditor.GetHTML(true);

		// Remove all cases of "<br>" and "&nbsp;"
		content	= content.replace(/\r|\n|\<br>|\&nbsp;/g, "");
		// Remove all spaces
		content = content.replace(/\s/g, "");	

		// Check if content is empty
		if (content == '')
		{
			return false;
		}
		else
		{
			return true;
		}
	}

	function removeCharacters( strValue, strMatchPattern ) 
	{
	/************************************************
	DESCRIPTION: Removes characters from a source string
	  based upon matches of the supplied pattern.

	PARAMETERS:
	  strValue - source string containing number.

	RETURNS: String modified with characters
	  matching search pattern removed

	USAGE:  strNoSpaces = removeCharacters( ' sfdf  dfd',
									'\s*')
	*************************************************/
	 var objRegExp =  new RegExp( strMatchPattern, 'gi' );

	 //replace passed pattern matches with blanks
	  return strValue.replace(objRegExp,'');
	}