function enter_submit(myform) {
  if (window.event && window.event.keyCode == 13)
    myform.submit();
  else
    return true;
}

function changeColor(obj, oi, menu, arrow) {
	
	//var arrowOn= new Image();
	//arrowOn.src="../images/arrow4b.gif";
	//var arrowOff= new Image();
	//arrowOff.src="../images/arrow4.gif";	

	if(oi == 'i') {
		
		//document.images[arrow].src = arrowOn.src;
		//obj.style.backgroundColor='#E7E7E7';
		//obj.style.color='#000066';
		obj.style.fontWeight='bold';
		

	} else {
		//document.images[arrow].src = arrowOff.src;
		//obj.style.backgroundColor='#000066';
		//obj.style.color='white';
		obj.style.fontWeight='normal';
	}
	
}

function showFamilies() {
	
	myRef = window.open('../admin/listFams.php','mywin',
		'left='+(screen.width/2 - 120)+',top='+(screen.height/2 - 57)+',width=400,height=300,toolbar=0,resizable=0,scrollbars=yes');

}

function showMembers(famid) {
	
	myRef = window.open('../admin/listMems.php?famid='+famid,'mywin',
		'left='+(screen.width/2 - 120)+',top='+(screen.height/2 - 57)+',width=400,height=300,toolbar=0,resizable=0,scrollbars=yes');

}

function showAllMembers() {
	
	myRef = window.open('../admin/listMemsAll.php','mywin',
		'left='+(screen.width/2 - 120)+',top='+(screen.height/2 - 57)+',width=400,height=300,toolbar=0,resizable=0,scrollbars=yes');

}

function validDate( strValue ) {

  var objRegExp = /^\d{2}(\-)\d{2}\1\d{4}$/

  //check to see if in correct format
  if(!objRegExp.test(strValue))
    return false; //doesn't match pattern, bad date
  else{
    return true;
  }
}


function notifyInvalidInput(msg, fld) {
	alert(msg);
	fld.style.background = 'yellow';
	fld.focus();
}

function setLoadFocus(fld) {
	fld.focus();
}

function getHTTPObject() {

  var xmlhttp;

  /*@cc_on

  @if (@_jscript_version >= 5)

    try {

      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");

    } catch (e) {

      try {

        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

      } catch (E) {

        xmlhttp = false;

      }

    }

  @else

  xmlhttp = false;

  @end @*/

  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {

    try {

      xmlhttp = new XMLHttpRequest();

    } catch (e) {

      xmlhttp = false;

    }

  }

  return xmlhttp;

}


function moveItems(source, destination){
     //alert('called');
     var listLen	 = source.length;
     var selItems = new Array();
     var j = 0;
     var match = false;
     for(i = 0; i < source.length; i++) {
         if (source.options[i].selected && source.options[i].value != "Error") {
             source.options[i].selected = false;
             //Variable "match" is used to make sure source item is not already in destination
             //We do NOT do this if the destination is null since the destination
             if (destination != null) {
                 for (k = 0; k < destination.options.length; k++) {
                     if (destination.options[k].value == source.options[i].value) {
                         match = true;
                         break;
                     }
                 }
             }
             if (!match) selItems[j++] = i;
                 match = false;
         }
     }
     //Copy the items over to the target control
     if (destination != null) {
         for (i = 0; i < selItems.length; i++) {
             var o = new Option("","");
             o.text = source.options[selItems[i]].text;
             o.value = source.options[selItems[i]].value;
             destination.options[destination.length] = o;
         }
     }
     //And finally, remove them from the source control
     //in reverse order, which will make sure that the
     //indexes remain correct even as items are removed
     //from the control
     for (i = selItems.length-1; i >= 0; i--) {
         source.options[selItems[i]] = null;
     }
     if (destination == null) return;
     //If the event handler is installed, automatically call it
     if (destination.onchange) destination.onchange();
}

function setSelected(list){
	var options = list.options;
	for (var i = 0; i < options.length; i++){
    		options[i].selected = true;
	}
}
