var step;
step = 1;
var timer = null;
function allowcontinue()
{
	clearInterval(timer);
}
function takeaction(btn)
{
	if (!validate(document.forms[0]))
	{
		return false;
	}
	document.getElementById("divPleaz1").style.visibility = "visible";
	//timer = window.setInterval("allowcontinue()",3000);								
	var displayobj;
	var hideobj;
	var objcontinue;
	if (step == 1)
	{
		document.forms[0].txtName.focus();
		displayobj = document.getElementById("step2");
		hideobj = document.getElementById("step1");
		//objcontinue = document.getElementById("divContinue");
		displayobj.style.display = "block";
		hideobj.style.display = "none";
		//objcontinue.style.display = "block";
		document.getElementById("btnBack").style.display = "block"
		step = 2;
		document.getElementById("divPleaz1").style.visibility = "hidden";
		document.forms[0].txtFavoriteBars.focus();
		return;
	}
	if (step == 2 && btn == 1)
	{
		document.forms[0].txtFavoriteBars.focus();
		displayobj = document.getElementById("step2");
		hideobj = document.getElementById("step1");
		displayobj.style.display = "none";
		hideobj.style.display = "block";
		document.getElementById("btnBack").style.display = "none"
		step =1;
		document.forms[0].txtName.focus();
		document.getElementById("divPleaz1").style.visibility = "hidden";
	}
	else
	{
		document.getElementById("divPleaz1").style.visibility = "hidden";
		
		if (validate(document.forms[0]))
		{
			document.forms[0].action = "application_submit.php";
			document.forms[0].submit();
		}
	}
}
function showhide(objname)
{
	var obj = document.getElementById(objname);
	if (obj.style.display == 'none')
		obj.style.display = 'block';
	else
		obj.style.display = 'none'
}

function validate(frm)
{
	if (step == 1)
	{
		if (frm.txtName.value == "")
		{
			alert("Please enter name.");
			frm.txtName.focus();
			return false;
		}
		if (frm.txtPhone.value == "")
		{
			alert("Please enter phone number.");
			frm.txtPhone.focus();
			return false;
		}
	}

	if (step == 2)
	{
		if (!frm.chkagree.checked)
		{
			alert("Please select declaration checkbox.");
			frm.chkagree.focus();
			return false;
		}
	}
	return true;
}