// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults


function validateUSZip( strValue ) {
/************************************************
DESCRIPTION: Validates that a string a United
  States zip code in 5 digit format or zip+4
    format. 99999 or 99999-9999

	PARAMETERS:
	   strValue - String to be tested for validity

	   RETURNS:
	      True if valid, otherwise false.

		  *************************************************/
		  var objRegExp  = /(^\d{5}$)|(^\d{5}-\d{4}$)/;

		    //check for valid US Zipcode
			  return objRegExp.test(strValue);
			  }


function myjs(i)
{
	alert( i );
}

function showComm()
{

if (comm.style.display == "none")
{
comm.style.display=""; 
}
else
{
comm.style.display="none"; 
}
}

function toggleCheckAll(checkboxgroup, flag){
    for (i = 0; i < checkboxgroup.length; i++) {
        checkboxgroup[i].checked = flag;
    }
}

function updateIds(idshiddenfield, checkboxgroup){
	var ids = '';
    for (i = 0; i < checkboxgroup.length; i++) {
        if(checkboxgroup[i].checked){
			ids += checkboxgroup[i].value + ','; 
		} 
    }
	if (ids == '') {
		alert("You need select one contact at least.");
		return false;
	}
	else {
		idshiddenfield.value = ids;
		return true;
	}
}
