// <!--
// BEGIN Script

function disableSubmit() { noSubmit(true) }

function enableSubmit() {
	//noSubmit(false);
}

function noSubmit(action) {
	var color,cursor,i, f, j, g, gType, gName;
	if (action) {
		color = "#cccccc";
		cursor = "default";
	} else {
		color="black";
		cursor = "pointer";
	}
	i = 0;
	// traverse the forms collection
	while (i < document.forms.length) {
		j = 0;
		f = document.forms[i];
		// traverse the elements in each form
		while (j < f.elements.length) {
			g = f.elements[j];
			gType = g.type.toLowerCase();
			gName =  g.nodeName.toLowerCase();
			//disable the following elements
			if (gType == "submit" || gType == "button" || gType == "image" || gName == "select" || gType == "radio")
				g.disabled = action;
			j++;
		}
		i++;
	}
	i = 0;
	//traverse the links collection
	f = document.links;
	while (i < f.length)	{
		f[i].onclick = (! action );
		f[i].disabled = action;
		f[i].style.color = color;
		f[i].style.cursor = cursor;
		i++;
	}
}

//generic form confirmation
function confirmSubmit(text, elem) {
	var agree= confirm(text);
	if (agree) {
		if(! (elem.type.toLowerCase()=="submit" || elem.type.toLowerCase()=="image") ) {
			elem.parentNode.submit();
		}
		if(elem.nodeName.toLowerCase()=="form") {
			elem.submit();
		}
		disableSubmit();
		return true;
	} else {
		return false;
	}
}

// END Script
// -->
