function getElementsByClassName( strClassName, obj ) {
    var ar = arguments[2] || new Array();
    var re = new RegExp("\\b" + strClassName + "\\b", "g");

    if ( re.test(obj.className) ) {
        ar.push( obj );
    }
    for ( var i = 0; i < obj.childNodes.length; i++ )
        getElementsByClassName( strClassName, obj.childNodes[i], ar );
    
    return ar;
}
function hide_button()
{
	if ($("#software_input_submit_primary"))
	{
		var aryClassElements = getElementsByClassName('software_input_submit_primary', document.body);
		aryClassElements[0].style.display= "none";
	}
}
function check_code()
{
	$.get("/livesite/FormValidator/check_code.php",{'code': $("#Turing").attr("value")},function(result)
	{
		if(result == true)
		{
			document.getElementById("livesite-submit-button").innerHTML = "<input type='submit' value='Send Information' class='livesite_input_submit_primary'/>";
			//$("#livesite-submit-button").attr("innerHTML") = "<input type='submit' value='Send Information' class='livesite_input_submit_primary'/>";
			if (document.getElementsByName("submit"))
			{
				document.getElementsByName('submit')[0].click();
			}
		}
		else
		{
			
			//$("#livesite-submit-button").attr("innerHTML") = "<b><font color='red' face='Verdana' size='2'>"
			document.getElementById("livesite-submit-button").innerHTML = "<b><font color='red' face='Verdana' size='2'>"
			+"Please Re-enter the Code.</font>"
			+"<br />"
			+"<font color='black' face='Verdana' size='2'>"
			+"The Letters and Numbers you entered do not match the image shown on your screen.</font></b><br />";
		}
	}); 
}
function restoreBtn()
{
	document.getElementById("livesite-submit-button").innerHTML = '<input type="button" value="Send Information" class="livesite_input_submit_primary" onclick="check_code();"/>';
}
function small_restoreBtn()
{
	document.getElementById("livesite-submit-button").innerHTML = '<input type="button" value="Send Information" class="submit_mailing_list" onclick="check_code();"/>';
}
//function restoreBtn()
//{
//	document.getElementById("livesite-submit-button").innerHTML = '<input type="button" value="Send Information" class="livesite_input_submit_primary" onclick="xajax_checkCode(document.getElementById(\'Turing\').value);"/>';
//}
//function small_restoreBtn()
//{
//	document.getElementById("livesite-submit-button").innerHTML = '<input type="button" value="Send Information" class="submit_mailing_list" onclick="xajax_checkCode(document.getElementById(\'Turing\').value);"/>';
//}
function handleKeyPress(e,form)
{
	var key=e.keyCode || e.which;
	if (key==13)
	{
		xajax_checkCode(document.getElementById('Turing').value);
	}
}