/*

	Custom validation functions for i:Communicate Pages
	
*/
function ValidateMembershipSearch(obj, args)
{

	
	if ( 
		jQuery('.txtCompany').val().trim() == "" 
		&& jQuery('.txtCity').val().trim() == "" 
		&& jQuery('.txtFName').val().trim() == "" 
		&& jQuery('.txtLName').val().trim() == ""
		&& jQuery('.ddlClassification').val().trim() == "%"
		)
	{
		args.IsValid = false;
	}
	
	else
		args.IsValid = true;

}

/*
	Helper function to trim strings
*/
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };

/**
 * This public function enables the target control when the destination
 * control has a higher index than 0.
 */
function enableOnIndex(targetId, destId) {
  var target = document.getElementById(targetId);
  var dest = document.getElementById(destId);
  target.disabled = !(dest.selectedIndex > 0);
}
/**
 * This public function performs the auto jump between fields.
 */
function autoTab(fromField, toFieldId) {
  var toField = document.getElementById(toFieldId);
  if (fromField.value.length == fromField.getAttribute("maxlength"))
    toField.focus();
}
/**
 * This public function adds the item to a list control.
 */
function addOptionToList(listId, text, value) {
  var list = document.getElementById(listId);
  var newOp = new Option(text, value);
  list.options[list.options.length] = newOp;
  list.selectedIndex = list.options.length - 1;
}
function removeOptionFromList(listId) {
  var list = document.getElementById(listId);
  if (list.selectedIndex >= 0) {
    list.options[list.selectedIndex] = null;
  }
}