var acr_action = false;

function sleep(S){
      S = S * 1000;
      var sleeping = true;
      var now = new Date();
      var alarm;
      var startingMSeconds = now.getTime();
      while(sleeping){
         alarm = new Date();
         alarmMSeconds = alarm.getTime();
         if(alarmMSeconds - startingMSeconds > S){ sleeping = false; }
      }
}
 
function goAction(convTrack, formId, actionUrl)
{
	if (acr_action)
	{
		return true;
	} else {
		document.getElementById('rc1').innerHTML = '<iframe scrolling="no" src="convTrack/' + convTrack + '.html" onLoad="goAction2(\'' + formId + '\', \'' + actionUrl + '\');" width="1" height="1" marginheight="0" marginwidth="0" frameborder="0"></iframe>';
		return false;
	}
	
}

function goAction2(formId, actionUrl)
{
	acr_action = true;
	sleep(1);
	document.getElementById(formId).action = actionUrl;
	document.getElementById(formId).submit();
}

function showPop()
{
	if (acr_action == false)
	{
		var reqFields = new Array('first_name', 'last_name', 'company', 'website', 'email');
		
		var okay = true;
		
		for (i in reqFields)
		{
			if (document.getElementById('id_' + reqFields[i]).value == '')
			{
				okay = false;
			}
		}
		
		var email = document.getElementById('id_email').value;
	
		if ((email.indexOf(".") > 2) && (email.indexOf("@") > 0))
		{
			//
		} else {
			alert ('Please enter a valid email address before submitting.');
			return false;
		}
		
		if (okay)
		{
			//window.open("yahoo-analytics/yahoo-analytics.html","Window1","menubar=no,width=750,height=510,toolbar=no");
			//goAction('YWA_Feb_2009_Demo', 'demoForm', 'demo.php');
			//return false;
      return true;
		} else {
			alert('Please fill out the form completely before submitting.');
			return false;
		}
	} else {
		return true;
	}
}