function fnGetObject(sId) { if (typeof(sId) == 'object') { return sId; } else { if (window.document.all) return window.document.all(sId); else if (window.document.getElementById) return window.document.getElementById(sId); else if (window.document.layers) return window.document.layers[sId]; else return null; } } function fnGetObjectFromWindow(sId, oWindow) { if (typeof(sId) == 'object') { return sId; } else if (typeof(oWindow) == 'object' && oWindow != null) { if (oWindow.document.all) return oWindow.document.all(sId); else if (oWindow.document.getElementById) return oWindow.document.getElementById(sId); else if (oWindow.document.layers) return oWindow.document.layers[sId]; else return null; } else { return fnGetObjectFromWindow(sId); } } function fnGetObjectAttribute(sObject, sAttribute) { var oObject = fnGetObject(sObject); if (typeof(oObject) == 'object' && oObject != null) return oObject.getAttribute(sAttribute); } function fnSetObjectAttribute(sObject, sAttribute, vValue) { var oObject = fnGetObject(sObject); if (typeof(oObject) == 'object' && oObject != null) oObject.setAttribute(sAttribute, vValue); } function fnGetInputValue(sInput) { return (fnGetObjectAttribute(sInput, 'value')); } function fnSetInputValue(sInput, vValue) { fnSetObjectAttribute(sInput, 'value', vValue); } function fnRedirect(sLink) { window.location.href = sLink; } function fnOpenWindow(sLink, sTarget, sParameter) { if (typeof(sParameter) == 'string' && sParameter.length > 0) window.open(sLink, sTarget, sParameter); else window.open(sLink, sTarget); } function fnPrompt(sMessage, sDefaultValue) { return (window.prompt(sMessage, sDefaultValue)); } function fnConfirm(sQuestion) { return (window.confirm(sQuestion)); } function fnConfirmAction(sQuestion, sAction) { if (fnConfirm(sQuestion)) eval(sAction); } function fnConfirmSubmit(sQuestion, sForm) { if (fnConfirm(sQuestion)) { var oForm = fnGetObject(sForm); if (typeof(oForm) && oForm != null) oForm.submit(); } } function fnConfirmRedirect(sQuestion, sUrl) { if (fnConfirm(sQuestion)) fnRedirect(sUrl); } function fnSetClass(sClass, sId) { var oObject = fnGetObject(sId); if (typeof(oObject) == 'object' && oObject != null) oObject.className = sClass; } function fnChangeDisplay() { for (var i=0; i < fnChangeDisplay.arguments.length; i++) { var oId = fnChangeDisplay.arguments[i]; var oRef = fnGetObject(oId); if (typeof(oRef) == 'object' && oRef != null) oRef.style.display = (oRef.style.display != 'inline' ? 'inline' :'none'); } } function fnSetDisplayOn() { for (var i=0; i < fnSetDisplayOn.arguments.length; i++) { var oId = fnSetDisplayOn.arguments[i]; var oRef = fnGetObject(oId); if (typeof(oRef) == 'object' && oRef != null) oRef.style.display = 'inline'; } } function fnSetDisplayOff() { for (var i=0; i < fnSetDisplayOff.arguments.length; i++) { var oId = fnSetDisplayOff.arguments[i]; var oRef = fnGetObject(oId); if (typeof(oRef) == 'object' && oRef != null) oRef.style.display = 'none'; } } function fnSetDisplay() { for (var i=1; i < fnSetDisplay.arguments.length; i++) { var oId = fnSetDisplay.arguments[i]; var oRef = fnGetObject(oId); if (typeof(oRef) == 'object' && oRef != null) oRef.style.display = (fnSetDisplay.arguments[0] ? 'inline' : 'none'); } } function fnSubmitForm(sForm) { var oForm = fnGetObject(sForm); if (typeof(oForm) == 'object' && oForm != null) oForm.submit(); } function fnResetForm(sForm) { var oForm = fnGetObject(sForm); if (typeof(oForm) == 'object' && oForm != null) oForm.reset(); } function fnUrlAddVar(sUrl, sVar, sValue) { if (sVar=='') return sUrl; var sResult = sUrl; var iStart1 = sResult.indexOf('&'+sVar+'='); var iStart2 = sResult.indexOf('?'+sVar+'='); var iEnd = sResult.indexOf('&', (iStart1>-1 ? iStart1+sVar.length+2 : (iStart2>-1 ? iStart2+sVar.length+2 : 0))); if (sValue=='') { if (iStart1>-1) sResult = sResult.substr(0, iStart1)+(iEnd>-1 ? sResult.substr(iEnd) : ''); else if (iStart2>-1) sResult = sResult.substr(0, iStart2+1)+(iEnd>-1 ? sResult.substr(iEnd+1) : ''); } else { var iStart = (iStart2>-1 ? iStart2 : iStart1); if (iStart>-1) sResult = sResult.substr(0, iStart+1)+sVar+'='+sValue+(iEnd>-1 ? sResult.substr(iEnd) : ''); else { sResult += (sResult.indexOf('?')>-1 ? '' : '?'); sResult += (sResult.charAt(sResult.length-1)=='?' ? '' : '&')+sVar+'='+sValue; } } return sResult; } // Backward compatibility ------------------------------------------------------------------------- function getObject(sId) { return fnGetObject(sId); }