//Pop-Up windows
function openWin(windowURL, windowName, windowFeatures) {
	window.open(windowURL, windowName, windowFeatures);
}

//this script only works in IE
var IE = (document.all) ? true : false;
function expandIt(whichEl,show){
   whichEl.style.display = (show == 'none' ) ? "none" : "";
}

//Show/Hide Area
function toggleAnyArea(areaid) {
	for(var i=0; i<arguments.length; i++)
	{
		areaid = arguments[i];	
		var area = document.getElementById(areaid);
		if(area.style.display=='none') {
			area.style.display='';
		} else {
			area.style.display = 'none';
		}
	}
}

function DOMElement(el){
	this.label = "";
	if(arguments.length > 0){
		this.label=arguments[1];
	}
	for(i in el){
		eval("this['" + i + "']=" + "function(){ return el['" + i + "']}");
	}
	
}

DOMElement.prototype.setLabel = function(s){
	this.label = s;
}

DOMElement.prototype.getLabel = function(){
	return this.label;
}

function DuplicationListener(){
	this.order = new Array();
}

DuplicationListener.prototype.add = function(obj){
	this.order[this.order.length] = obj;
}

DuplicationListener.prototype.hasDuplicate = function(){
	for(var i=0; i<this.order.length; i++){
		iObj = this.order[i];
		iVal = iObj.value();
		for(var n=0; n<this.order.length; n++){
			nObj = this.order[n];
			nVal = nObj.value();
			if(( iObj != nObj) && iVal == nVal){
				alert("DUPLICATION ERROR\nThe following elements have duplicate values\n\n* " 
				+ iObj.getLabel() + "\n* " + nObj.getLabel()); 
				return false;
			}
		}
	}
	return true;
}
