<!--

//--
// Global Variables
//
var	DetailWindow;
var iOpen = 0;

/*********************************************************************************
Name:	FlipImg

Purpose: 

Parameters:
	strDocImage		IMG to change
	strNewImg		the URL of the new src for the IMG

Return Values:
	void

Author: Li-Wen Hu

Date:	2002-08-03

Revision History:
	Date:		2002-08-03
	UserName:	Li-Wen Hu

**********************************************************************************/
function FlipImg(oImage, strNewImg) {
	oImage.src = strNewImg;
}

/*********************************************************************************
// Open up a Generic Search Window
//
// 2001-10-02
// Bart Bartera
// Add target document parameter and change the static 
// list of elements to an array?
**********************************************************************************/
function OpenDetailWindow(URL, Width, Height) {

	var	Param;
		
	CloseDetailWindow();	// Close if already open

	Param			= BuildWindowParameters(Width, Height, 'auto');
	DetailWindow	= window.open(URL, 'detail', Param);
	
} // end of function OpenSearchWindow


/*********************************************************************************
// Open up a Generic Search Window with Scrollbar turned on
//
// 2003-02-05
// Li-Wen Hu
**********************************************************************************/
function OpenDetailWindowScroll(URL, Width, Height, GetFocus) {

	var	Param;
		
	CloseDetailWindow();	// Close if already open

	Param			= BuildWindowParameters(Width, Height, 'yes');
	DetailWindow	= window.open(URL, 'detail', Param);
	if (GetFocus) {
	
		DetailWindow.focus();

	}
	
} // end of function OpenDetailWindowScroll


/*********************************************************************************
// Open up a Window with no param
//
// 2003-09-29
// Li-Wen Hu
**********************************************************************************/
function OpenGenericDetailWindow(URL, Width, Height, GetFocus) {

	var	Param;
		
	CloseDetailWindow();	// Close if already open

	DetailWindow	= window.open(URL, 'detail');
	if (GetFocus) {
	
		DetailWindow.focus();

	}
	
} // end of function OpenDetailWindowScroll


/*********************************************************************************
// Open up a Window with no param
//
// 2003-09-29
// Li-Wen Hu
**********************************************************************************/
function OpenResizeWindow(URL, Width, Height, Top, Left, GetFocus) {

	var	Param;
		
	CloseDetailWindow();	// Close if already open

	Param		= 'toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,copyhistory=no';
	Param		+= ',top=' + Top + ',left=' + Left;
//	Param		+= ',scrollbars=yes'
	Param		+= ',width=' + Width + ',height=' + Height;
	DetailWindow	= window.open(URL, 'detail', Param);
	if (GetFocus) {
	
		DetailWindow.focus();

	}
	
} // end of function OpenDetailWindowScroll

/*********************************************************************************
// Open up a Window with no param
//
// 2003-09-29
// Li-Wen Hu
**********************************************************************************/
function OpenResizeAndScrollWindow(URL, Width, Height, Top, Left, GetFocus) {

	var	Param;
		
	CloseDetailWindow();	// Close if already open

	Param		= 'toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,copyhistory=no';
	Param		+= ',top=' + Top + ',left=' + Left;
	Param		+= ',scrollbars=yes';
	Param		+= ',width=' + Width + ',height=' + Height;
	DetailWindow	= window.open(URL, 'detail', Param);
	if (GetFocus) {
	
		DetailWindow.focus();

	}
	
} // end of function OpenDetailWindowScroll

/*********************************************************************************
Author: Li-Wen Hu
Date:	2003-10-03

Revision History:
	Date:		2009-08-27
	UserName:	Li-Wen Hu
	Notes:      Add setTimeout
**********************************************************************************/
function openNewWin(URL, winName, params, GetFocus) {

	CloseDetailWindow();	// Close if already open

//	DetailWindow = window.open(URL, winName, params);
//	DetailWindow.opener = self;
//	DetailWindow.focus();
//	setTimeout("DetailWindow.focus()", 60);
    setTimeout(function() {openWin(URL, winName, params, GetFocus); }, 20);
}
function openWin(URL, winName, params, GetFocus) {

	DetailWindow = window.open(URL, winName, params);
	DetailWindow.focus();
}

/*********************************************************************************
**********************************************************************************/
function OpenProductDetail(strDocImage, strNewImg) {
	document[strDocImage].src = strNewImg;
}


/*********************************************************************************
// Build the configuration of the new window
**********************************************************************************/
function BuildWindowParameters(Width, Height, Scroll) {

	var	Param;
	
	Param		= 'toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,copyhistory=no,top=10,left=10';
	Param		+= ',scrollbars=' + Scroll
	Param		+= ',width=' + Width + ',height=' + Height;

	return		Param;
}

/*********************************************************************************
// Close the Detail Window (if it's open)
//
// The "DetailWindow" variable is a window handle set in OpenDetailWindow()
// to the result of a window.open call
**********************************************************************************/
function CloseDetailWindow() {

	if (DetailWindow) {
	
		if (!DetailWindow.closed) {
	
			CloseWindowObj(DetailWindow);
			DetailWindow = null;
	
		}
	
	}

}

/*********************************************************************************
// Close a Child Window
**********************************************************************************/
function CloseWindowObj(WindowObj) {

	if (WindowObj != null) {
		WindowObj.close();
	}

}

/*********************************************************************************
Author: Li-Wen Hu
Date:	2006-07-27

Revision History:
	Date:		2006-07-27
	UserName:	Li-Wen Hu
**********************************************************************************/
function CloseWindow() {

	var oWindow = window;
	if (parent.window != null) {
		oWindow = parent.window;
	}
	oWindow.close();
}

/*********************************************************************************
Author: Li-Wen Hu
Date:	2006-07-27

Revision History:
	Date:		2006-07-27
	UserName:	Li-Wen Hu
**********************************************************************************/
function Redirect(URL) {

	var oWindow = window;
	if (parent.window != null) {
		oWindow = parent.window;
	}
	oWindow.location.replace(URL);
}

/*********************************************************************************
Author: Li-Wen Hu
Date:	2006-07-27

Revision History:
	Date:		2006-07-27
	UserName:	Li-Wen Hu
**********************************************************************************/
function ReloadOpenerAndClose() {

	var oWindow = window;
	if (parent.window != null) {
		oWindow = parent.window;
	}
	
	if (oWindow.opener != null) {
	//	oWindow.opener.location.reload();
		oWindow.opener.document.forms[0].submit(); 
	}
	oWindow.close();
}

/*********************************************************************************
**********************************************************************************/
function OpenAddPopup(URL, Width, Height) {

	var	Param;
		
	CloseDetailWindow();	// Close if already open

	Param			= BuildWindowParameters(Width, Height, 'no');
	DetailWindow	= window.open(URL, 'detail', Param);
	
} // end of function OpenSearchWindow

/*********************************************************************************
**********************************************************************************/
function CloseAddPopup(url) {

	opener.document.location = url;
	
}

/*********************************************************************************
**********************************************************************************/
function redirectopener(url) {

	var oWindow = window;
	if (parent.window != null) {
		oWindow = parent.window;
	}
	
	if (oWindow.opener != null) {
		opener.location = url;
	}
	oWindow.close();
	
	
}

/*********************************************************************************
Name:		confirmCtlAction
Parameters:	Form or submit control name
			Optional: customized message, control to reset the value, the reset value

Author: Li-Wen Hu
Date:	2005-10-14

Revision History:
	Date:		2005-10-14
	UserName:	Li-Wen Hu
**********************************************************************************/
//function confirmCtlAction() {

//	var sMsg
//	var iArgs = arguments.length;
//	var sCtl, oCtl;

//	sMsg = "Are you sure"
//	if (iArgs >= 2) {
//		sMsg += " " + arguments[1];
//	}
//	sMsg += "?"
//	
//	if(confirm(sMsg)) {
//		if (iArgs >= 3) {
//			sCtl = arguments[2];
//			oCtl = document.getElementById(sCtl);
//			oCtl.value = arguments[3];
//		}
//		
//		sCtl = arguments[0];
//		if (document.forms[sCtl] != null) {
//			document.forms[sCtl].submit();
//		}
//		else {
//			oCtl = document.getElementById(sCtl);
//		//	alert((oCtl.type));
//			oCtl.click();
//		}
//	}
//}

/*********************************************************************************
Name:		confirmAction
Parameters:	Form or submit control name
			Optional: customized message, control to reset the value, the reset value

Author: Li-Wen Hu
Date:	2005-10-14

Revision History:
	Date:		2005-10-14
	UserName:	Li-Wen Hu
**********************************************************************************/
function confirmAction() {

	var sMsg
	var iArgs = arguments.length;

	sMsg = "Are you sure"
	if (iArgs >= 1) {
		sMsg += " " + arguments[0];
	}
	sMsg += "?"
	
	if(confirm(sMsg)) {
		window.event.returnValue = true;
	}
	else {
		window.event.returnValue = false;
	}
}
// Constants: Begin.var net_repeater_ctlid_base = "__ctl";	//.NET Repeater Item Name Rootvar net_client_id_separator = "_";		//.NET ClientID separatorvar id_page_content ="_ctl0_Main_content"   // "PC";var id_form = "aspnetForm";     // "form1";// Constants: End.var gs_packout_alert_begin = "You can only order in ";
var gs_packout_alert_end = " item increments."

/*********************************************************************************
Name:		Init
Parameters:	none

Author: Li-Wen Hu
Date:	2007-05-03

Revision History:
	Date:		2007-05-03
	UserName:	Li-Wen Hu
**********************************************************************************/
function Init() {    if (typeof(initPage) == "function") {
        initPage(); 
    }
}/*********************************************************************************
Name:		OnSub
Parameters:	none

Author: Li-Wen Hu
Date:	2007-06-15

Revision History:
	Date:		2007-06-15
	UserName:	Li-Wen Hu
**********************************************************************************/
function OnSub() {    if (typeof(onSubPage) == "function") {
        return onSubPage();
    }
    return true;
}/*********************************************************************************
Author: Li-Wen Hu
Date:	2007-04-25

Revision History:
	Date:		2007-04-25
	UserName:	Li-Wen Hu
**********************************************************************************/
function getParentId(sChildCId, sChildId) {
	
	var aId = sChildCId.split(net_client_id_separator + sChildId);
	return aId[0];
}/*********************************************************************************
Author: Li-Wen Hu
Date:	2007-05-02

Revision History:
	Date:		2007-05-02
	UserName:	Li-Wen Hu
**********************************************************************************/
function getChildCId(sParentId, sChildId) {
	
	if (sParentId == '') {		return sChildId;	}	else if (sChildId == '') {		return sParentId;	}	else {		return sParentId + net_client_id_separator + sChildId;	}}/*********************************************************************************
Name:		getRepeaterItemId
Parameters:	First: Repeater Item ID
			Optional: Pairs of parent ID, parent Index

Author: Li-Wen Hu
Date:	2007-05-02

Revision History:
	Date:		2007-05-02
	UserName:	Li-Wen Hu
**********************************************************************************/
function getRepeaterCtlId(sRptId, iIdx) {	return sRptId + net_repeater_ctlid_base + iIdx;}/*********************************************************************************
Name:		getRepeaterElementDetails
Parameters:	Repeater ID, Item ID
			Item Name, Item Index

Author: Li-Wen Hu
Date:	2007-05-02

Revision History:
	Date:		2007-05-02
	UserName:	Li-Wen Hu
**********************************************************************************/
function getRepeaterElementDetails(sRptId, sCtlCId) {	var sIdx;
	var aId;
	
	if (sCtlCId.indexOf(sRptId) == -1) {
		return null;
	};
	
	aId = sCtlCId.split(sRptId + net_repeater_ctlid_base);
	sIdx = aId[1];
	
	aId = sIdx.split(net_client_id_separator);
	
	return aId;
}/*********************************************************************************
Name:		getRepeaterElementId
Parameters:	Repeater ID, Item ID

Author: Li-Wen Hu
Date:	2007-05-02

Revision History:
	Date:		2007-05-02
	UserName:	Li-Wen Hu
**********************************************************************************/
function getRepeaterElementId(sRptId, sCtlCId) {	var sIdx;
	var aId;
	
	if (sCtlCId.indexOf(sRptId) == -1) {
		return "";
	};
	
	aId = sCtlCId.split(sRptId + net_repeater_ctlid_base);
	sIdx = aId[1];
	
	aId = sIdx.split(net_client_id_separator);
	return aId[1];
}/*********************************************************************************
Name:		getRepeaterCtlIdx
Parameters:	Repeater ID, Item ID

Author: Li-Wen Hu
Date:	2007-05-02

Revision History:
	Date:		2007-05-02
	UserName:	Li-Wen Hu
**********************************************************************************/
function getRepeaterCtlIdx(sRptId, sCtlCId) {	var sIdx;
	var aId;
	
	if (sCtlCId.indexOf(sRptId) == -1) {
		return -1;
	};
	
	aId = sCtlCId.split(sRptId + net_repeater_ctlid_base);
	sIdx = aId[1];
	
	aId = sIdx.split(net_client_id_separator);
	return aId[0];
}
/*********************************************************************************
Name:		getElementClientId
Parameters:	List of containers id and element id

Author: Li-Wen Hu
Date:	2007-05-02

Revision History:
	Date:		2007-05-02
	UserName:	Li-Wen Hu
**********************************************************************************/
function getElementClientId() {	var sCtlCId = id_page_content;
	var i;
	for (i=0; i<arguments.length; i++) {			sCtlCId = getChildCId(sCtlCId, arguments[i]);	}		return sCtlCId;}
/*********************************************************************************
Name:		getRepeaterRelElementId
Purpose:	get the clientId for the element of the same itemtemplate
Parameters:	

Author: Li-Wen Hu
Date:	2007-12-12

Revision History:
	Date:		2007-12-12
	UserName:	Li-Wen Hu
**********************************************************************************/
function getRepeaterRelElementCId(oCtl, sCtlId, sRelCtlId) {	var sCtlCId;
	sCtlCId = oCtl.id.replace(sCtlId, sRelCtlId);//	alert(sCtlCId);		return sCtlCId;}
/*********************************************************************************
Name:		getRepeaterRelElementId
Purpose:	get the clientId for the element of the same itemtemplate
Parameters:	

Author: Li-Wen Hu
Date:	2007-12-12

Revision History:
	Date:		2007-12-12
	UserName:	Li-Wen Hu
**********************************************************************************/
function getRepeaterRelElementVal(oCtl, sCtlId, sRelCtlId) {	var sCtlCId;
	var oRelCtl;
	var sVal;
	sCtlCId = oCtl.id.replace(sCtlId, sRelCtlId);//	alert(sCtlCId);	oRelCtl = document.getElementById(sCtlCId);
	if (oRelCtl != null) {
		sVal = oRelCtl.value;
	}
		return sVal;}
/*********************************************************************************
Author: Li-Wen Hu
Date:	2007-04-25

Revision History:
	Date:		2007-04-25
	UserName:	Li-Wen Hu
**********************************************************************************/
function toggleDisplay(oCtl, sCtlId, sImage, sBlock, ClosedImage, OpenedImage) {

	var sParentId;
	var oBlock;
	var oImage;

	sParentId= getParentId(oCtl.id, sCtlId);
	oImage = document.getElementById(getChildCId(sParentId, sImage));
	oBlock = document.getElementById(getChildCId(sParentId, sBlock));
	
	if ((oBlock.style.display == "") || (oBlock.style.display == "none")){
		oBlock.style.display = "block";
		oImage.src = OpenedImage;
	}
	else {
		oBlock.style.display = "none";
		oImage.src = ClosedImage;
	}
	
	return false;
}

/*********************************************************************************
Author: Li-Wen Hu
Date:	2008-05-02

Revision History:
	Date:		2008-05-02
	UserName:	Li-Wen Hu
**********************************************************************************/
function ToggleImage(sCtlId, sLgImgSrc, sSmImgSrc, iLgWidth, iLgHeight, iSmWidth, iSmHeight) {

	var oCtl;
	oCtl = document.getElementById(sCtlId);

	if (oCtl != null) {
		if (oCtl.src != null) {
		    if (oCtl.name == 'Lg') {
		        window.resizeTo(iSmWidth,iSmHeight);
		        oCtl.name = 'Sm';
		        oCtl.src = sSmImgSrc;
		        oCtl.alt = "Double click here to get the enlarged image";
		    }
		    else {
		        window.resizeTo(iLgWidth,iLgHeight);
		        oCtl.name = 'Lg';
		        oCtl.src = sLgImgSrc;
		        oCtl.alt = "Double click here to get the small image";
		    }
		}
	}
	return;
}

/*********************************************************************************
Author: Li-Wen Hu
Date:	2007-04-25

Revision History:
	Date:		2007-04-25
	UserName:	Li-Wen Hu
**********************************************************************************/
function checkChildOnOff(sFormName, oMaster, sMaster, sBlock, sChild) {
	
	var sBlockID;
	var oCtl;
	var sCtlCId;
	var i;
	
	sBlockID = getChildCId(getParentId(oMaster.id, sMaster), sBlock);
	for (i=0; i<document.forms[sFormName].length; i++) {
	
		oCtl = document.forms[sFormName][i];
	
		if (oCtl.type == 'checkbox') {
		
			sCtlCId = oCtl.id;
			if ((sCtlCId.indexOf(sBlockID) == 0) && (sCtlCId.indexOf(sChild) != 0)) {
				if (oCtl.disabled == false) {
				oCtl.checked = oMaster.checked;
				}
			}
		}
	}
}
/*********************************************************************************
Name:		NavMOver
Parameters:	oCtl: 
			sColor: 

Author: Li-Wen Hu
Date:	2007-05-08

Revision History:
	Date:		2007-05-08
	UserName:	Li-Wen Hu
**********************************************************************************/
function NavMOver(oCtl, sClass){
	//oCtl.DefaultBgColor = oCtl.style.backgroundColor;
	//oCtl.DefaultTxtColor = oCtl.style.color;
	//oCtl.style.backgroundColor = sColor;
	oCtl.className = sClass;
	
}

/*********************************************************************************
Name:		NavMOver
Parameters:	oCtl: 
			sColor: 

Author: Li-Wen Hu
Date:	2007-05-08

Revision History:
	Date:		2007-05-08
	UserName:	Li-Wen Hu
**********************************************************************************/
function NavMOut(oCtl, sClass){
//	oCtl.style.backgroundColor = oCtl.DefaultBgColor;
	oCtl.className = sClass;

}

/*********************************************************************************
Author: Li-Wen Hu
Date:	2003-09-05

Revision History:
Notes:			Should replace calls to GetCellValue with getNumeric
	Date:		2003-09-05
	UserName:	Li-Wen Hu
**********************************************************************************/
function z_GetCellValue(sFormName, sCtlCId, bDenyNegative, nDecimal) {
	var nValue;

	nValue = 0;

	if (isNaN(document.forms[sFormName][sCtlCId].value)) {
		nValue = 0;
	}
	else {
		nValue = Number(document.forms[sFormName][sCtlCId].value);
		if (bDenyNegative && nValue < 0) {
			nValue = 0;
		}
		nValue = formatMyNumber(nValue, false, nDecimal);
	}
	document.forms[sFormName][sCtlCId].value = nValue;
	return  Number(nValue);
}


/*********************************************************************************
Author: Li-Wen Hu
Date:	2007-03-12

Revision History:
	Date:		2007-03-12
	UserName:	Li-Wen Hu
**********************************************************************************/
function getNumeric(sCtlCId, bDenyNegative, nDecimal) {
	var oCtl = document.getElementById(sCtlCId);
	return getCtlNumeric(oCtl, bDenyNegative, nDecimal);
}


/*********************************************************************************
Author: Li-Wen Hu
Date:	2007-03-12

Revision History:
	Date:		2007-03-12
	UserName:	Li-Wen Hu
**********************************************************************************/
function getCtlNumeric(oCtl, bDenyNegative, nDecimal) {
	
	var nValue = 0;
//	var oCtl = document.getElementById(sCtlCId);
	
	if (oCtl != null) {

		if (isNaN(oCtl.value)) {
		//	nValue = 0;
		}
		else {
			nValue = Number(oCtl.value);
			if (bDenyNegative && nValue < 0) {
				nValue = 0;
			}
			nValue = formatMyNumber(nValue, false, nDecimal);
		}
		
		oCtl.value = nValue;
	}
	
	return  Number(nValue);
}


/*********************************************************************************
Author: Li-Wen Hu
Date:	2004-10-07

Revision History:
	Notes:		Modified to validate the packout for onTRAK
	Date:		2006-07-06
	UserName:	Li-Wen Hu
**********************************************************************************/
function validatePackout(oCtl, nPackout) {

	var bReturn = true;
	var sResult = '';
	var iQty = getNumeric(oCtl.id, true, 0);
	var remainder = Number(iQty) % nPackout;
	
	if (isNaN(remainder)) {
		sResult = "The packout is invalid."
		bReturn = false;
	}
	else if (remainder != 0) {
		sResult = gs_packout_alert_begin + nPackout + gs_packout_alert_end
		bReturn = false;
	}
	
	if (!bReturn) {
		alert(sResult);
		
	//	var oCtl = document.getElementById(sCtlCId);
		oCtl.value = 0;
        try
        {
            oCtl.focus()
        }
        catch (ex)
        {
            //alert(ex.description);
        }
		
	//	oCtl.focus();
	}
	return bReturn;
	
}


/*********************************************************************************
Name:	formatMyNumber

Purpose: format currency

Parameters:
	amount
	bGroup = true, include the grouping; false, don't include the grouping
	nDecimal = number of digits after decimal point
	
Author: Li-Wen Hu
Date:	2003-09-05

Revision History:
	Date:		2003-09-05
	UserName:	Li-Wen Hu
**********************************************************************************/
function formatMyNumber(amount, bGroup, nDecimal) {

	var bIsNeg = false;
	var sResult;

	if (amount < 0) {
		bIsNeg = true;
		amount = Math.abs(amount);
	}
	
	if (nDecimal == 0) {
		amount = amount + Math.round((amount) - Math.floor(amount));
	}
	
	if (bGroup == true) {
		sResult = formatGroupedDigits(Math.floor(amount-0) + '') + formatDigitsAfterDecimal(amount - 0, nDecimal);
	}
	else {
		sResult = Math.floor(amount-0) + formatDigitsAfterDecimal(amount - 0, nDecimal);
	}
	
	if (bIsNeg == true) {
		sResult = "-" + sResult;
	}
	
	return(sResult);
	
}

/*********************************************************************************
Name:	formatGroupedDigits

Purpose: convert the dollar portion to number with group delimiter.
	Check to see if it's a negative number.
	If yes, take out the minus sign, work on the number and add the minus sign back when finished.

Parameters:
	amount

Author: Li-Wen Hu
Date:	2003-09-05

Revision History:
	Date:		2003-09-05
	UserName:	Li-Wen Hu
**********************************************************************************/
function formatGroupedDigits(amount) {

	var bNeg = false;
	
   if (amount.length <= 3)
      return (amount == '' ? '0' : amount);
   else {
		if (amount < 0 ) {
			bNeg = true;
			amount = Math.abs(amount);
			amount = amount.toString();
		}
      var mod = amount.length%3;
      var output = (mod == 0 ? '' : (amount.substring(0,mod)));
      for (i=0 ; i < Math.floor(amount.length/3) ; i++) {
          if ((mod ==0) && (i ==0))
              output+= amount.substring(mod+3*i,mod+3*i+3);
          else
              output+= ',' + amount.substring(mod+3*i,mod+3*i+3);
      }
      if (bNeg == true){output = '-' + output;};
      return (output);
   }
   
}

/*********************************************************************************
Name:	formatDigitsAfterDecimal.

Purpose: convert the cent portion to number of digits specified.

Parameters:
	nDecimal = number of digits after decimal point.

Author: Li-Wen Hu
Date:	2003-09-05

Revision History:
	Date:		2003-09-05
	UserName:	Li-Wen Hu
**********************************************************************************/
function formatDigitsAfterDecimal(amount, nDecimal) {

	var output = '';
	amount = Math.round(((amount) - Math.floor(amount) ) * Math.pow(10,nDecimal));
	for (i=0 ; i < (nDecimal - Math.floor(amount.toString().length)) ; i++) {
	        output+= "0";
	}
	if (nDecimal > 0) {
	output = '.' + output + amount;
	}
	return output;
   //return (amount < 10 ? '.0' + amount : '.' + amount);
}
/*********************************************************************************
Name:		copyArray
Parameters:	oldArray

Author: Li-Wen Hu
Date:	2007-05-04

Revision History:
	Date:		2007-05-04
	UserName:	Li-Wen Hu
**********************************************************************************/
function copyArray(oldArray) {
	iLen = oldArray.length;	newArray = new Array(iLen);		for (i = 0; i < iLen; ++i) {
	
		jLen = oldArray[i].length;
		newArray[i] = new Array(jLen);
		
		for (j = 0; j < jLen; ++j) {
		
			newArray[i][j] = oldArray[i][j];
		}
	}
	return newArray;
	
}/*********************************************************************************
Purpose: Refresh the frame display.

Author: Li-Wen Hu

Date:	2007-07-17

Revision History:
	Notes:		
	Date:		2007-07-17
	UserName:	Li-Wen Hu
**********************************************************************************/
function refreshFrame() {
	
	var oCtl;
	
	var sFrame = arguments[0];
	var sCtlCId = arguments[1];

	oCtl = window.parent.frames[sFrame].document.getElementById(sCtlCId);
	if (oCtl != null) {
		if (oCtl.src == null) {
			oCtl.innerText = arguments[2];
			if (arguments[3] != null) {
				oCtl.style.color = arguments[3];
			}
		}
		else {
			oCtl.src = arguments[2];
			if (arguments[3] != null) {
				oCtl.alt = arguments[3];
			}
		}
	}
}/*********************************************************************************
Purpose: Refresh the window opener's display.
            When the element CId is known

Author: Li-Wen Hu

Date:	2004-10-19

Revision History:
	Notes:		Modified for .NET
	Date:		2008-04-17
	UserName:	Li-Wen Hu
**********************************************************************************/
function refreshOpenerCId() {
	
	var oCtl;
	var sCtlCId = arguments[0];
	var oOpener = parent.window.opener;
	
	if (oOpener == null) {
		return;
	}
	
	oCtl = oOpener.document.getElementById(sCtlCId);
	if (oCtl != null) {
		if (oCtl.src == null) {
			oCtl.innerText = arguments[1];
			if (arguments[2] != null) {
				oCtl.style.background = arguments[2];
			}
			if (arguments[3] != null) {
				oCtl.className = arguments[3];
			}
		}
		else {
			oCtl.src = arguments[1];
			oCtl.alt = arguments[2];
		}
	}
}/*********************************************************************************
Purpose: Auto tab to Next

Author: Li-Wen Hu

Date:	2009-10-06

Revision History:
	Date:		2009-10-06
	UserName:	Li-Wen Hu
	Notes:		
**********************************************************************************/
function autoTab(oCtl, sNextCtlCId) {
    if(oCtl.value.length >= oCtl.maxLength) {
        document.getElementById(sNextCtlCId).focus();
    }
} 
//-->
