//remove blank or null values form array
function removeEmptyElem(ary) {
    for (var i=ary.length;i>=0;i--) {
        if (ary[i] == undefined)  {
            ary.splice(i, 1);
        }
        if (ary[i] == "") {
            ary.splice(i, 1);
        }   
    }
    return ary;
}

//remove a sinle or arry of items from an array
/*Array.prototype.removeItems = */function removeArrayElem(itemsToRemove,ary) {

    if (!/Array/.test(itemsToRemove.constructor)) {
        itemsToRemove = [ itemsToRemove ];
    }

    var j;
    for (var i = 0; i < itemsToRemove.length; i++) {
        j = 0;
        while (j < ary.length) {
            if (ary[j] == itemsToRemove[i]) {
                ary.splice(j, 1);
            } else {
                j++;
            }
        }
    }
	return ary;
}

function arrHasDupes(A) {                          // finds any duplicate array elements using the fewest possible comparison
	var i, j, n;
	n=A.length;
                                                     // to ensure the fewest possible comparisons
	for (i=0; i<n; i++) {                        // outer loop uses each item i at 0 through n
		for (j=i+1; j<n; j++) {              // inner loop only compares items j at i+1 to n
			if (A[i]==A[j]) return true;
	}	}
	return false;
}

/*Array.prototype.chkforDuplicates = */function checkElem(value,ary)
// Returns true if the passed value is found in the
// array. Returns false if it is not.

{
var i;
var ctr = 0;
for (i=0; i < ary.length; i++) {
// use === to check for Matches. ie., identical (===), ;
if (ary[i] == value) {
return true;
}
}
return false;
};

function joinArray()
{
  var a, b,c;
 c=ary.split(",");
  a=new Array(c);
  b = a.join("+");
  return(b);
}

