var ycs_isIe, ycs_isNS, ycs_isIEMac, ycs_gEvt;

function handleFormEvents() {
	if ((formName != null) && (enableButtonArray != null)) {	
		ycs_detectBrowsers();
			
		var elType;
		for (idx = 0; idx <  _proxy_jslib_handle(document, (formName), 0, 0).elements.length; idx++) {
			elType =  _proxy_jslib_handle( _proxy_jslib_handle(document, (formName), 0, 0).elements, (idx), 0, 0).type;
			
			if ((elType == "checkbox") || (elType == "password") || (elType == "radio") || (elType == "select-one") || (elType == "select-multiple") || (elType == "text") || (elType == "textarea")) {
				if ((elType == "password") || (elType == "select-one") || (elType == "select-multiple") || (elType == "text") || (elType == "textarea")) {
					if (ycs_isNS) { //ns
						 _proxy_jslib_handle( _proxy_jslib_handle(document, (formName), 0, 0).elements, (idx), 0, 0).addEventListener('change', activateButton, false);
					} else if (ycs_isIe) { //ie pc
						 _proxy_jslib_handle( _proxy_jslib_handle(document, (formName), 0, 0).elements, (idx), 0, 0).attachEvent("onchange", activateButton);
					} else if (ycs_isIEMac) { //ie mac
						ycs_gEvt.attachEvent('onchange', activateButton,  _proxy_jslib_handle( _proxy_jslib_handle(document, (formName), 0, 0).elements, (idx), 0, 0));
					} else {}
				} else if ((elType == "checkbox") || (elType == "radio")) {
					if (ycs_isNS) { //ns
						 _proxy_jslib_handle( _proxy_jslib_handle(document, (formName), 0, 0).elements, (idx), 0, 0).addEventListener('click', activateButton, false);
					} else if (ycs_isIe) { //ie pc
						 _proxy_jslib_handle( _proxy_jslib_handle(document, (formName), 0, 0).elements, (idx), 0, 0).attachEvent('onclick', activateButton);
					} else if (ycs_isIEMac) { //ie mac
						ycs_gEvt.attachEvent('onclick', activateButton,  _proxy_jslib_handle( _proxy_jslib_handle(document, (formName), 0, 0).elements, (idx), 0, 0));
					} else {}
				}
			}
		}
	}
}

function activateButton() {
	for (idx = 0; idx < enableButtonArray.length; idx++) {
		var btnObj = eval(_proxy_jslib_proxify_js(("document." + formName + "['" +  _proxy_jslib_handle(enableButtonArray, (idx), 0, 0) + "']"), 0, 0) );
		if (btnObj.disabled == true) {
			btnObj.disabled = false;
			btnObj.className = "ygbtem";
		}
		if (btnObj.className != "ygbtem") {
			btnObj.className = "ygbtem";
		}
	}
}


function deactivateButton(whichForm, whichButton) {
	for (idx = 0; idx <  _proxy_jslib_handle(document, (whichForm), 0, 0).elements.length; idx++) {
		if ( _proxy_jslib_handle( _proxy_jslib_handle(document, (whichForm), 0, 0).elements, (idx), 0, 0).name == whichButton) {
			 _proxy_jslib_handle( _proxy_jslib_handle(document, (whichForm), 0, 0).elements, (idx), 0, 0).disabled = true;
			 _proxy_jslib_handle( _proxy_jslib_handle(document, (whichForm), 0, 0).elements, (idx), 0, 0).className = "ygbtdssm";
		}
	}
}

function confirmAction(thisStr) {
	return confirm(thisStr);
}

function openWin(thisURL, thisName, thisW, thisH, thisScroll) {
	if (thisScroll == null) {
		thisScroll = "yes";
	}
	newWin =  _proxy_jslib_handle(window, 'open', '', 1, 0)(thisURL, thisName, "toolbar=no, scrollbars=" + thisScroll + ", resizable=yes, width=" + thisW + ", height=" + thisH);
	newWin.focus();
}

function setCatSetting(thisCat, thisValue) {
     _proxy_jslib_handle(document, 'getElementById', '', 1, 0)(thisCat + 'Ictr').style.visibility = 'visible';
	
	if (thisValue == 0) {
	     _proxy_jslib_handle(document, 'getElementById', '', 1, 0)(thisCat).width = "";
	} else {
	     _proxy_jslib_handle(document, 'getElementById', '', 1, 0)(thisCat).width = (Math.round(thisValue/10) * 10) + "%";
	}
}

function swapText(whichDiv, whichText) {
	txtObj =  _proxy_jslib_handle(document, 'getElementById', '', 1, 0)(whichDiv);
	 _proxy_jslib_assign('', txtObj, 'innerHTML', '=', ( whichText));
}

function toggleCheck(onState, checkFld) {
	for (idx = 0; idx < checkFld.length; idx++) {
		 _proxy_jslib_handle(checkFld, (idx), 0, 0).checked = onState ? true : false;
	}
}

function toggleAccessSet(curCbx, thisCat, onValue, offValue) {
	var tblObj, curWidth;
	tblObj =  _proxy_jslib_handle(document, 'getElementById', '', 1, 0)(thisCat);
	if (tblObj.width == "") {
		curWidth = 0;
	} else {
		if (tblObj.width.indexOf("%") > -1) {
			curWidth = tblObj.width.substring(0, tblObj.width.indexOf("%"));
		}
	}
	
	onValue =  _proxy_jslib_handle(onValue, 'toString', '', 1, 0)(); offValue =  _proxy_jslib_handle(offValue, 'toString', '', 1, 0)();
	
	// check to see if this is incrementing by value
	if (onValue.indexOf("+") > -1) {
		onValue = onValue.substring(1);
		onValue = Math.abs(curWidth) + Math.abs(onValue);
	} else if (onValue.indexOf("-") > -1) {
		onValue = onValue.substring(1);
		onValue = Math.abs(curWidth) - Math.abs(onValue);
	}
	
	if (offValue.indexOf("+") > -1) {
		offValue = offValue.substring(1);
		offValue = Math.abs(curWidth) + Math.abs(offValue);
	} else if (offValue.indexOf("-") > -1) {
		offValue = offValue.substring(1);
		offValue = Math.abs(curWidth) - Math.abs(offValue);
	}
	
	if (curCbx.checked) {
		setCatSetting(thisCat, onValue);
	} else {
		setCatSetting(thisCat, offValue);
	}
}









/* event handlers for Mac IE */
function ycs_detectBrowsers() {
	ycs_isIe = ycs_isNS = ycs_isIEMac = false;
	ycs_gEvt = null;
	
	if ( _proxy_jslib_handle(document, 'getElementById', '', 0, 0) && !document.all) {
		ycs_isNS = true;
	} else if (document.all) {
		if (document.attachEvent) {
			ycs_isIe = true;
		} else {
			ycs_isIEMac = true;
			ycs_gEvt = new (ycs_EvtGlobal)();
		}
	}
}

function ycs_EvtGlobal() {
	this.ycs_EvtElements = new (Array)();
	this.attachEvent = ycs_attachEvent;
	this.getObjIdx = ycs_getObjIdx;
	this.handleEvent = ycs_handleEvent;
}

function ycs_EvtElement(onEvt, tElement) {
	this.oElement = tElement;
	this.aFunctions = new (Array)();		
}

function ycs_attachEvent(onEvt, callFunction, tElement) {
	var isEvtAlreadyAssigned = eval(_proxy_jslib_proxify_js(("(typeof(tElement." + onEvt + ") == 'function');"), 0, 0) )
	var globalEvtIndex = this.getObjIdx(onEvt, tElement);
	var isInEvtGlobal = (globalEvtIndex == -1) ? false : true;
  
	if (!isEvtAlreadyAssigned) {
		eval(_proxy_jslib_proxify_js(("tElement." + onEvt + " = " + callFunction + ";"), 0, 0) );
	} else if (isEvtAlreadyAssigned && !isInEvtGlobal) {
		var newIndex = this.ycs_EvtElements.length;
		 _proxy_jslib_assign('', this.ycs_EvtElements, (newIndex), '=', ( new (ycs_EvtElement)(onEvt, tElement)));
		 _proxy_jslib_handle(this.ycs_EvtElements, (newIndex), 0, 0).aFunctions[0] = eval(_proxy_jslib_proxify_js(("tElement." + onEvt), 0, 0) );
		 _proxy_jslib_handle(this.ycs_EvtElements, (newIndex), 0, 0).aFunctions[1] = callFunction;
		eval(_proxy_jslib_proxify_js(("tElement." + onEvt + " = ycs_gEvt.handleEvent;"), 0, 0) );
	}
}

function ycs_getObjIdx(onEvt, tElement) {
	numEvtObj = this.ycs_EvtElements.length;
	for (i=0; i < numEvtObj; i++) {
		tempObj =  _proxy_jslib_handle(this.ycs_EvtElements, (i), 0, 0);
		if (tempObj.oElement == tElement) {
			return i;
		}
	}
	return -1;
}

function ycs_handleEvent(evt) {
	var evt = ycs_getEvent(evt);
	var sEventName = evt.type;
	if (sEventName.substring(0, 2) != "on") {
		sEventName = "on" + sEventName;
	}
	var tElement = ycs_getEventTarget(evt);
	var gObjIdx = ycs_gEvt.getObjIdx(evt, tElement);
	for (var i=0; i <  _proxy_jslib_handle(ycs_gEvt.ycs_EvtElements, (gObjIdx), 0, 0).aFunctions.length; i++) {
		 _proxy_jslib_handle( _proxy_jslib_handle(ycs_gEvt.ycs_EvtElements, (gObjIdx), 0, 0).aFunctions, (i), 1, 0)(evt);
	}
}

function ycs_getEvent(evt) {
	return(evt) ? evt : ((window.event) ? event : null);
}

function ycs_getEventTarget(evt) {
	evt = (evt) ? evt : ((window.event) ? event : null);
	if ( evt ) {
		var elem = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);

		// if element contains a text node then need to pop up one
		while ( elem.nodeType == 3 ) {
			elem = elem.parentNode;
		}
		return elem;
	}
	return null;
}

//window.onload = handleFormEvents;
if (window.addEventListener) {
	window.addEventListener("load", handleFormEvents, false);
} else if (window.attachEvent) {
	window.attachEvent("onload", handleFormEvents);
}


 ;
_proxy_jslib_flush_write_buffers() ;