function showHidden(theid, callFun) //显示或隐藏theid
{ 
	if(theid.style.display == "")
	{
		theid.style.display = "none";
	}
	else
	{
		theid.style.display = "";
	}
	if(arguments[1] != null)
	{
		callFun();
	}
}
function displayOrHiddenAtoB(objA, objB, flag)
{
	var obj = objA;
	var theValue = flag ? "" : "none";
	while(obj != objB)
	{
		obj.style.display = theValue;
		obj = obj.nextSibling;
	}
}
function setHidden(theid, thename, thevalue)
{
	var formid = (arguments[3] == null) ? document.forms[0] : arguments[3];
	if(formid.all.item(theid) != null)
	{
		var inputHidden = formid.all.item(theid);
		inputHidden.name = thename;
		inputHidden.value = thevalue;
	}
	else
	{
		var inputHidden = document.createElement("INPUT");
		inputHidden.type = "HIDDEN";
		inputHidden.name = thename;
		inputHidden.id = theid;
		inputHidden.value = thevalue;
		formid.insertAdjacentElement("beforeEnd", inputHidden);
	}
}
function addHidden(theid, thename, thevalue)
{
	var formid = (arguments[3] == null) ? document.forms[0] : arguments[3];
	var inputHidden = document.createElement("INPUT");
	inputHidden.type = "HIDDEN";
	inputHidden.name = thename;
	inputHidden.id = theid;
	inputHidden.value = thevalue;
	formid.insertAdjacentElement("beforeEnd", inputHidden);
}
//设置老值oldValue
function setControlsOldValue(isClear)
{
	var collection = (arguments[1] == null) ? document.forms[0] : arguments[1];
	collection.isChange = true;
	var len = collection.length;
	for(var i= 0; i < len; i++)
	{
		var currObj = collection(i);
		if(isDefined(currObj.dbtype) && isDefined(currObj.format))
		{
			if(isClear)
				currObj.oldValue = "";
			else
				currObj.oldValue = currObj.value;
		}
	}
}
//设置值value
function resetControlsValue(isClear)
{
	var collection = (arguments[1] == null) ? document.forms[0] : arguments[1];
	var len = collection.length;
	for(var i= 0; i < len; i++)
	{
		var currObj = collection(i);
		if(isDefined(currObj.dbtype) && isDefined(currObj.format))
		{
			if(isClear)
			{
				if(isDefined(currObj.oldValue))
					currObj.oldValue = "";
				currObj.value = "";
			}
			else
			{
				if(isDefined(currObj.oldValue))
					currObj.value = currObj.oldValue;
			}		
		}
	}
}
function clearControlsValue_AtoB(objA, objB)
{
	var collection = (arguments[2] == null) ? document.forms[0] : arguments[2];
	var len = collection.length;
	var isContinue = true;
	var isBegin = false;
	for(var i= 0; i < len && isContinue == true; i++)
	{
		var currObj = collection(i);
		if(currObj == objA)
			isBegin = true;
		if(currObj == objB)
		{
			isBegin = false;
			isContinue = false;
		}
		if(isBegin == true)
		{
			currObj.value = "";	
		}
	}
}
function resetControlsValue_AtoB(isClear, objA, objB)
{
	var collection = (arguments[3] == null) ? document.forms[0] : arguments[3];
	var len = collection.length;
	var isContinue = true;
	var isBegin = false;
	for(var i= 0; i < len && isContinue == true; i++)
	{
		var currObj = collection(i);
		if(currObj == objA)
			isBegin = true;
		if(currObj == objB)
		{
			isBegin = false;
			isContinue = false;
		}
		if(isDefined(currObj.dbtype) && isDefined(currObj.format) && isBegin == true)
		{
			if(isClear)
			{
				currObj.value = "";
			}
			else
			{
				if(isDefined(currObj.oldValue))
					currObj.value = currObj.oldValue;
			}		
		}
	}
}
//设置控件的可用性
function setControlsDisabled(bFlag)
{
	var collection = (arguments[1] == null) ? document.forms[0] : arguments[1];
	var len = collection.length;
	for(var i= 0; i < len; i++)
	{
		var currObj = collection(i);
		if(isDefined(currObj.dbtype) && isDefined(currObj.format))
		{
			if (currObj.tagName == "TEXTAREA")
				currObj.readOnly = bFlag;
			else
				currObj.disabled = bFlag;
			
			if(currObj.format == "date")	
			{
				var itemObj = currObj.nextSibling;
				
				if (itemObj.nextSibling != null)
					itemObj.nextSibling.disabled = bFlag;
				else
					itemObj.disabled = bFlag;
			}	
		}	
	}
}