function doDates(extra)
{
	suffix = "?status="+extra;
	window.open('dates.php'+suffix, '', 'resizable=no,scrollbars=yes,width=500,height=530');
}

function bookmarkUs()
{
	window.external.AddFavorite('http://www.drlcny.com', 'Debt Relief Law Centre of New York - Fast, Effective Bankruptsy Solutions');
}

function printPage()
{
	window.print();
}

function openQuote(qId)
{
	window.open('quotes.php?q='+qId, '', 'resizable=yes,scrollbars=yes,width=365,height=180');
}

function openNewLaws()
{
	window.open('bankruptcy-laws.php', '', 'resizable=no,scrollbars=yes,width=600,height=500');
}

function recommendUs(pre)
{
	window.open(pre + 'recommend.php', '', 'resizable=no,scrollbars=no,width=400,height=330');
}

function validateQuickContact()
{
	fv = new formValidator();
	
	if (fv.isEmpty("your_name"))
		fv.raiseError("Please specify your name.");
		
	if (fv.isEmpty("your_email"))
		fv.raiseError("Please specify your email address.");
	else
	{
		if (!fv.isEmailAddress("your_email"))
			fv.raiseError("Please specify a valid email address.");
	}
		
	if (!fv.isSelected("find_us"))
		fv.raiseError("Please specify how you heard about us.");		
		
	if (fv.isEmpty("comments"))
		fv.raiseError("Please specify any comments or questions you have.");
		
	if (fv.numErrors() > 0)
	{
		fv.displayErrors();
		return false;
	}
	else
	  return true;
}	

//validates user login
function checkClientLogin()
{
	fv = new formValidator();
	
	if (fv.isEmpty("unameC"))
		fv.raiseError("Please specify your username.");
		
	if (fv.isEmpty("pinC"))
		fv.raiseError("Please specify your password.");

	if (fv.numErrors() > 0)
	{
		fv.displayErrors();
		return false;
	}
	else
	  return true;
}

function validateRecommend()
{
	fv = new formValidator();
	
	if (fv.isEmpty("your_name"))
		fv.raiseError("Please specify your name.");
		
	if (fv.isEmpty("your_email"))
		fv.raiseError("Please specify your email address.");
		
	if (!fv.isEmailAddress("your_email"))
	{
		fv.raiseError("Please specify a valid email address.");
	}	
	
	if (fv.isEmpty("friend_name"))
		fv.raiseError("Please specify your friend's name.");
		
	if (fv.isEmpty("friend_email"))
		fv.raiseError("Please specify your friend's email address.");
	
	if (!fv.isEmailAddress("friend_email"))
	{
		fv.raiseError("Please specify a valid email address for your friend.");
	}	
	

	if (fv.numErrors() > 0)
	{
		fv.displayErrors();
		return false;
	}
	else
	  return true;
}

function validateContactForm()
{
	fv = new formValidator();
	
	toValidate = new Array(2);
	toValidate[0] = new Array("first_name", "Please specify your first name.");
	toValidate[1] = new Array("last_name", "Please specify your last name");

	// validate require input fields
	for (i=0;i<toValidate.length;i++)
	{
		if (fv.isEmpty(toValidate[i][0])) 
			fv.raiseError(toValidate[i][1]);
	}
	
	// validate checkboxes / radios / selectboxes / etc
	if (fv.isCheckedRadio("contact_pref"))
	{
		contactPref = fv.findObj("contact_pref");
		if (contactPref[1].checked)
		{
			if (fv.isEmpty("email_address"))
			  fv.raiseError("You have requested to be contact via email. Please specify a valid email address");
		}
		
		if (contactPref[0].checked)
		{
			if (fv.isEmpty("daytime_no") && fv.isEmpty("alt_phone"))
			  fv.raiseError("You have requested to be contact via phone. Please specify a contact number.");
		}
	}	
	else
		fv.raiseError("Please specify a contact preference.");
	
	if (!fv.isEmpty("email_address"))
	{
		// check email address is valid
		if (!fv.isEmailAddress("email_address"))
			fv.raiseError("Please specify a valid email address.");
	}	
	
	if (fv.numErrors() > 0)
	{
		fv.displayErrors();
		return false;
	}
	else
	  return true;
}

function validateRegistration()
{
	fv = new formValidator();
	
	if (fv.isEmpty("first_name"))
		fv.raiseError("Please enter your First Name.");
	
	if (fv.isEmpty("last_name"))
		fv.raiseError("Please enter your Last Name.");
	
	if (fv.isEmpty("home_address"))
		fv.raiseError("Please provide your home address.");
	
	if (fv.isEmpty("city"))
		fv.raiseError("Please enter your city.");
	
	if (fv.isEmpty("cbostate"))
		fv.raiseError("Please select your state.");
	
	if (!fv.isEmpty("email"))
	{
		if (!fv.isEmailAddress("email"))
			fv.raiseError("Please supply a valid email address.");
	}
	else
		fv.raiseError("Please supply a valid email address.");
		
	if (fv.isEmpty("uname"))
		fv.raiseError("Please specify a Username.");
	
	if (!fv.isEmpty("pass"))
	{
		if (!fv.isSame("pass", "cpass"))
			 fv.raiseError("Please confirm your password.");
	}
	else
		fv.raiseError("Pleae enter a password.");
	
	if (fv.isEmpty("scode"))
		fv.raiseError("Please enter your security question.");

	
	if (fv.numErrors() > 0)
	{
		fv.displayErrors();
		return false;
	}
	else
	  return true;
}

function verifyEulaSteps()
{
	fv = new formValidator();
	
	if (fv.isEmpty("eula_initials"))
		fv.raiseError("Please Initital this Disclosure.\n- If you choose not to, Click Decline to De-Register.");
	
	if (fv.numErrors() > 0)
	{
		fv.displayErrors();
		return false;
	}
	else
	  return true;
}