var axel = Math.random() + "";
var ord = axel * 1000000000000000000;

function submit_once(theform)
{
	if(document.all || document.getElementById)
	{
		// hunt down "submit" and "reset"
		for(i=0;i<theform.length;i++)
		{
			var tempobj=theform.elements[i];
			if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
			{
				if(tempobj.name!="preview")
				{
					tempobj.disabled=true;
				}
			}
		}
	}
}

function confirm_click(prompt)
{
	input_box=confirm(prompt);
	return input_box;
}


function popUp(URL, window_width, window_height)
{
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=" + window_width + ",height=" + window_height + "');");
}

function check_all(theform)
{
	for (var i=0; i < theform.elements.length; i++)
	{
		var e = theform.elements[i];
		if ((e.name != 'allbox') && (e.type=='checkbox'))
		{
			e.checked = theform.allbox.checked;
		}
	}
}

function TrackCount(fieldObj,countFieldName,maxChars)
{
	var countField = eval("fieldObj.form."+countFieldName);
	var diff = maxChars - fieldObj.value.length;

	// Need to check & enforce limit here also in case user pastes data
	if (diff < 0)
	{
		fieldObj.value = fieldObj.value.substring(0,maxChars);
		diff = maxChars - fieldObj.value.length;
	}
	countField.value = diff;
}

function LimitText(fieldObj,maxChars)
{
	var result = true;
	if (fieldObj.value.length >= maxChars)
		result = false;
  
	if (window.event)
		window.event.returnValue = result;
	return result;
}

function switchit(field)
{
	var elementStyle=document.getElementById(field).style;
	if (elementStyle.display=="none") {
		elementStyle.display="block";
	} else {
		elementStyle.display="none";
	}
}