/* common functions
==============================================================================*/
$(document).ready(function() {
	
	// add target to external links
	$('a[@rel=blank]').each(function(e) {
		if (this.href) { $(this).attr('target', '_blank'); }											 
	});

	// table striping
	$(".zebra tr").mouseover(function() {
		$(this).addClass("over");
	}).mouseout(function() {
		$(this).removeClass("over");
	});
	$(".zebra tr:even").addClass("alt");
});

//All/None buttons for checkboxes
//all checkboxes must have the same name - use onclick="check(name)"
var checkflag = "false";
function check(field) {
  if (checkflag == "false") {
    for (i = 0; i < field.length; i++) {
      field[i].checked = true;
    }
    checkflag = "true";
  } else {
    for (i = 0; i < field.length; i++) {
      field[i].checked = false;
    }
    checkflag = "false";
  }
}


// autotab

	function autotab(original,destination){
		destination = document.getElementById("msForm:"+destination);		
		if (original.getAttribute&&original.value.length==original.getAttribute("maxlength"))
		destination.focus()
	}
// to use, format the input fields with this -- <input required="true" size="3" onkeyup="autotab(this, 'ss2')" maxlength="3" id="ss1" >