var myArgs = [
		'<div align="center"><img src="../../../img/loader1.gif" alt="" width="32" height="32"/></div>',
		'<img src="../../../img/mail-icon-small.jpg" alt="" width="75" height="45" style="float:left;"/><h4>  A text message has been sent to your phone.</h4>'
			+ '<p>Please be patient, as it may take a few minutes for the message to arrive. Once you receive the message, you can follow the link by selecting \'Menu\' or \'Options\', and then \'Go\' or \'Go To\' on most phones.</p>'
			+ '<p align="center" style="clear: both; margin-bottom: 2px;"><a href="#na" onClick="closediv(\'landdiv2\'); opendiv(\'landdiv1\');">Close</a>',
		'<h4 >There was a problem processing your request.</h4>'
			+ '<p>Close this message and verify what you\'ve entered.</p>  '
			+ '<p align="center" style="clear: both;"><a href="#na" onClick="closediv(\'landdiv2\'); opendiv(\'landdiv1\');">Back</a>',
		'<h4 >There was a problem processing your request.</h4>'
			+ '<p>Please use your browser\'s back button to go back to the form and verify or correct what you\'ve entered.</p>  '
		];

var responseSuccess = function(o)
{
	var aRoot = o.responseXML;
	var aD = aRoot.getElementsByTagName('ans')[0].firstChild.nodeValue; 
	var anE = document.getElementById("landdiv2");
	if (anE)
	{
		if ("true" == aD)
		{
			anE.style.color = '#000000';
			anE.style.borderColor = '#CCCCCC';
			anE.innerHTML = myArgs[1];
		} else
		{
			anE.style.color = 'red';
			anE.style.borderColor = 'red';
			anE.innerHTML = myArgs[2];
		}
	}
}

var responseFailure = function(o)
{
 	document.getElementById("landdiv2").innerHTML = myArgs[3];
}

var callback =
{
	success:responseSuccess,
	failure:responseFailure,
	argument:myArgs
}

function closediv(thediv)
{
	var anE = document.getElementById(thediv);
	if (anE)
	{
		anE.style.display = 'none';
	}
}

function opendiv(thediv)
{
	var anE = document.getElementById(thediv);
	if (anE)
	{
		anE.style.display = 'block';
	}
}


function sendForm(theEl)
{
	var anInputs = theEl.getElementsByTagName('input');
	var aQuery = new Array();
	for(var i = 0; i < anInputs.length; i++)
	{
		if(anInputs[i].name)
		{
			aQuery.push(anInputs[i].name + '=' + anInputs[i].value);
		}
	}
	aQuery = '?' + aQuery.join('&');
	send(theEl.action + aQuery);
}

function send(theURL)
{
	//document.getElementById("landdiv1").style.display = 'none';
	document.getElementById("landdiv2").style.display = 'block';
	document.getElementById("landdiv2").innerHTML = myArgs[0];
	var aJax = YAHOO.util.Connect.asyncRequest('GET', theURL, callback, null);
}