// #
// Javascript functions
// Travis P. Walter
// #

var maxatt = 4;
var minatt = 1;
var attcount = minatt;

// Increment attCount and return the element id to be enabled
function attadd() {
   if (attcount >= maxatt){
      attcount = maxatt;
      return null;
   } else {
      attcount++;
      return "colcontainer" + attcount;
   }
}

// Decrement attCount and return the element id to be disabled
function attsub() {
   if (attcount <= minatt){
      attcount = minatt;
      return null;
   } else {
      attcount--;
      return "colcontainer" + (attcount + 1);
   }
}

function setminatt(min) {
	minatt = min;
}

function setmaxatt(max) {
	maxatt = max;
}

// Check to see if the form was properly filled out, if not show an alert and return false.
function validateform(form) {
   if (form.listNameBox.value == '') {
      alert("Please enter a List name");
      return false;
   } else if (form.attbox0.value == '') {
       alert("Please enter at least one attribute name");
       return false;
     } else if (form.valbox0.value == '') {
         alert("Please enter at least one attribute value");
         return false;
       }
   return true;
}

// C
function confirmListDelete(delUrl) {
	if (confirm("Are you sure you want to delete this list?")) {
		document.location = delUrl;
	}
}

