function testFunction()	{

	alert("test here");
	
}

function processLocatorForm(thisForm)	{
   
   _CF_error_exists = false;
   _CF_error_messages = new Array();
   _CF_error_fields = new Object();
   _CF_FirstErrorField = null;
	if( _CF_hasValue(thisForm['LocatorZipCode'], "TEXT", false ) )

	{

		if (!_CF_checkinteger(thisForm['LocatorZipCode'].value, true))
			
			{
			
				_CF_onError(thisForm, "LocatorZipCode", thisForm['LocatorZipCode'].value, "Please enter a Valid Zip Code.");
				_CF_error_exists = true;
	
			}

	} else {

		_CF_onError(thisForm, "LocatorZipCode", thisForm['LocatorZipCode'].value, "Please enter your Zip Code.");
		_CF_error_exists = true;

	}

	if( _CF_error_exists )	{

		if( _CF_error_messages.length > 0 )
			  {
				 // show alert() message
				 _CF_onErrorAlert(_CF_error_messages);
				 // set focus to first form error, if the field supports js focus().
				 if( thisForm[_CF_FirstErrorField].type == "text")
				 { thisForm[_CF_FirstErrorField].focus(); }
			  }

	}	else		{
		
		mZipCode = thisForm['LocatorZipCode'].value;
		
		DWREngine._execute(_ajaxConfig._cfscriptLocation, null, 'ProcessLocatorZipCode', mZipCode, getAjaxLocatorZipCodeResult);
		
	}

	return false;

}

function processLocatorForm2(z,d)	{

	mZipCode = z;
	mDistance = d;
			
	DWREngine._execute(_ajaxConfig._cfscriptLocation, null, 'ProcessLocatorZipCode', mZipCode, mDistance, getAjaxLocatorZipCodeResult);

}

function getAjaxLocatorZipCodeResult(s)	{
		
	$('LocatorFormDiv').innerHTML = s;

}

function hideLocatorZipCode ()	{

	$('LocatorFormDiv').innerHTML = "";

}

function processEmailPage(thisForm)	{

	// alert("test here");
   
   // reset on submit
   
   _CF_error_exists = false;
   _CF_error_messages = new Array();
   _CF_error_fields = new Object();
   _CF_FirstErrorField = null;

	if( !_CF_hasValue(thisForm['FriendName'], "TEXT", false ) )

	{

		_CF_onError(thisForm, "FriendName", thisForm['FriendName'].value, "Please enter your friend's Name.");
		_CF_error_exists = true;

	}

	if( _CF_hasValue(thisForm['RecipientEmail'], "TEXT", false ) )

	{

		//form element field1 'EMAIL' validation checks

		if (!_CF_checkEmail(thisForm['RecipientEmail'].value, true))
			
			{
			
				_CF_onError(thisForm, "RecipientEmail", thisForm['RecipientEmail'].value, "Please enter a Valid email address for your friend.");
				_CF_error_exists = true;
	
			}

	} else {

		_CF_onError(thisForm, "RecipientEmail", thisForm['RecipientEmail'].value, "Please enter your friend's email address.");
		_CF_error_exists = true;

	}

	if( !_CF_hasValue(thisForm['SenderName'], "TEXT", false ) )

	{

		_CF_onError(thisForm, "SenderName", thisForm['SenderName'].value, "Please enter your Name.");
		_CF_error_exists = true;


	}

	if( _CF_hasValue(thisForm['SenderEmail'], "TEXT", false ) )

	{

		if (!_CF_checkEmail(thisForm['SenderEmail'].value, true))
			
			{
	
				_CF_onError(thisForm, "SenderEmail", thisForm['SenderEmail'].value, "Please enter a Valid email address for yourself.");
				_CF_error_exists = true;
			}

	} else {

		_CF_onError(thisForm, "SenderEmail", thisForm['SenderEmail'].value, "Please enter your email address.");
		_CF_error_exists = true;

	}

	if( thisForm['AdditionalMessage'].value.length > 100 )
	{
		_CF_onError(thisForm, "AdditionalMessage", thisForm['AdditionalMessage'].value, "Message too long...");
		_CF_error_exists = true;
	}
   
   
	if( _CF_error_exists )	{

		if( _CF_error_messages.length > 0 )
			  {
				 // show alert() message
				 _CF_onErrorAlert(_CF_error_messages);
				 // set focus to first form error, if the field supports js focus().
				 if( thisForm[_CF_FirstErrorField].type == "text")
				 { thisForm[_CF_FirstErrorField].focus(); }
				 if( thisForm[_CF_FirstErrorField].type == "textarea")
				 { thisForm[_CF_FirstErrorField].focus(); }
			  }

	}	else		{
		
		mSender = thisForm['SenderEmail'].value;
		mSenderName = thisForm['SenderName'].value;
		mRecipient = thisForm['RecipientEmail'].value;
		mRecipientName = thisForm['FriendName'].value;
		mMessage = thisForm['AdditionalMessage'].value;
		mVisitorIP = thisForm['currVisitorIP'].value;
		mSubject = 'Web Page at Cotton Tale Designs';
		
		if (typeof currProductURL != 'undefined')	{
		
		mProductURL = currProductURL;
		mProductDescription = currProductDescription;
		
		}
		else	if( typeof currLineURL != 'undefined' )	{
					
					mProductURL = currLineURL;
					mProductDescription = currLineDescription;
		
				
		}
		else	if( typeof currCategoryURL != 'undefined' )	{
			
			mProductURL = currCategoryURL;
			mProductDescription = currCategoryDescription;

		
		}
		
		DWREngine._execute(_ajaxConfig._cfscriptLocation, null, 'ProcessSendToFriend', mVisitorIP, mSender, mRecipient, mSubject, mMessage, mProductURL, mProductDescription, mSenderName, mRecipientName, getAjaxEmailAFriendResult);

	}

	return false;
}

function getAjaxEmailAFriendResult(r)	{

	if ( r == 'ERROR')	{

		$('emailThisPageDiv').innerHTML = '<b>System error encountered... Please try again in a few minutes.</b>.';
		
	}	else	{
	
		
		$('emailThisPageDiv').innerHTML = '<b>This page successfully emailed to ' + r + '</b>.';
	
	}
	return;

}

function emailThisPage()	{

	// alert("test here");	
	// SenderEmail, RecipientEmail, Additional Message
	
	eContent = "<form onsubmit=\"return processEmailPage(this)\" id=\"emailThisPageForm\" method=\"post\" action=\"ThisPage\" class=\"emailThisPage\" style=\"border: 1px solid #758447; padding: 10px; \"><table><tr><td class=\"emailThisPage\" align=\"left\"><b>Friend's Name: *</b><br/><input type=\"text\" name=\"FriendName\" id=\"FriendName\" size=\"22\" class=\"emailThisPage\"/><br/><br/></td><td class=\"emailThisPage\"/><b>Friend's Email Address: *</b><br/><input type=\"text\" name=\"RecipientEmail\" id=\"RecipientEmail\" size=\"22\" class=\"emailThisPage\"/><br/><br/></td></tr><tr><td class=\"emailThisPage\" align=\"left\"><b>Your Name: *</b><br/><input type=\"text\" name=\"SenderName\" size=\"22\" class=\"emailThisPage\"/><br/><br/></td><td class=\"emailThisPage\"/><b>Your E-mail Address: *</b><br/><input type=\"text\" name=\"SenderEmail\" size=\"22\" class=\"emailThisPage\"/><br/><br/></td></tr><tr><td colspan=\"2\" class=\"emailThisPage\">Personal Message:<br/><textarea id=\"AdditionalMessage\" cols=\"40\" rows=\"4\" class=\"emailThisPage\"></textarea><br/><input type=\"hidden\" id=\"currVisitorIP\" value=\"" + currVisitorIP + "\"><input type=\"submit\" id=\"submitemailThisPage\" value=\"  SEND  \" class=\"emailThisPage\" style=\"font-weight: bold; margin-top: 5px; \"/></td></tr><tr><td class=\"emailThisPage\" align=\"left\">Your IP: " + currVisitorIP + "</td><td class=\"emailThisPage\" align=\"right\"><b>* Required</b></td></tr><tr><td colspan=\"2\" class=\"emailThisPage\" align=\"right\"><a href=\"javascript:hideSendemail()\" class=\"Outlink2\">close...</a></td></tr></table></form>";
	
	// FriendName, RecipientEmail, SenderName, SenderEmail, AdditionalMessage
	
	$('emailThisPageDiv').innerHTML = eContent;

	
}
function hideSendemail ()	{

	$('emailThisPageDiv').innerHTML = "";

}


function hidetestFunction ()	{

	$('testdiv').innerHTML = "";

}


function showFAQ (l,m) {
	
	DWRUtil.useLoadingMessage('Loading data...');
	DWREngine._execute(_ajaxConfig._cfscriptLocation, null, 'FAQFunction', l, m, getAjaxFAQResult);
	
}


function getAjaxFAQResult (m)	{
	
	fContent = m.r + "<br/><a href=\"javascript:hideFAQDiv('" + m.l + "')\" class=\"Outlink1\" style=\"margin: 0px 0px 0px 100px; \"><i>close...</i></a>";
	
	$('faqDIV' + m.l).innerHTML  = fContent;
	
}

function hideFAQDiv (l)	{

	$('faqDIV' + l).innerHTML = "";

}


////////////////

function getAjaxPreferred (l) {
	
	DWRUtil.useLoadingMessage('Loading data...');
	DWREngine._execute(_ajaxConfig._cfscriptLocation, null, 'PreferredFunction', l, getAjaxPreferredResult);
	
}


function getAjaxPreferredResult (m)	{
	
	

	sContent = m.r + "<br/><a href=\"javascript:hidePreferredDiv('" + m.l + "')\" class=\"Outlink1\" style=\"margin: 0px 0px 0px 100px; \"><i>close...</i></a>";
	
	$('morePreferredDiv').innerHTML = sContent;
	
}

function hidePreferredDiv (l)	{

	$('morePreferredDiv').innerHTML = "<a href=\"javascript:getAjaxPreferred(\'" + l + "\')\" class=\"Outlink1\" style=\"margin: 0px 0px 0px 100px; \"><i>more...</i></a>";

}


//////////////////////////////////


function getTestFunction (p) {
	
	DWRUtil.useLoadingMessage('Loading data...');
	DWREngine._execute(_ajaxConfig._cfscriptLocation, null, 'TestFunction', p, getTestFunctionResult);
	
}

function getTestFunctionResult (r)	{
	// alert ("tests here");
	// DWRUtil.removeAllRows("ttablehead");
	
	// DWRUtil.removeAllRows("TenantTableResult");
	sDumper(r);
	
	sContent = r + "<a href=\"javascript:hidetestFunction()\" class=\"Outlink1\"><u>hide</u></a>";


	$('testdiv').innerHTML = sContent;
	
	// doGetTenantResult(r.tenantcount,r.tenant);

	// sDumper(r);

}

function getTestFunction2 (p) {
	
	DWRUtil.useLoadingMessage('Loading data...');
	DWREngine._execute(_ajaxConfig._cfscriptLocation, null, 'TestFunction2', p, getTestFunctionResult2);
	
}

function getTestFunctionResult2 (r)	{
	// alert ("tests here");
	// DWRUtil.removeAllRows("ttablehead");
	
	// DWRUtil.removeAllRows("TenantTableResult");
	
	sDumper(r);
	sContent = r
	// sContent = r + "<a href=\"javascript:hidetestFunction()\"><u>hide</u></a>";


	$('testdiv').innerHTML = sContent;
	
	// doGetTenantResult(r.tenantcount,r.tenant);

	// sDumper(r);

}


/////////////////////////////////////////
