var pwDiagnosticMode=false;
var pwCustomFunctionManager=null;
var PW_UNSUPPORTED=-1;
var PW_IE=0;
var PW_MOZILLA=1;
var PW_IE5=2;
var PW_IE5MAC=3;
var PW_OPERA=4;
var PW_KONQUEROR=5;
var PW_GALEON=6;
var PW_NETSCAPE6=7;
var PW_NOERROR=0;
var PW_UNABLETOACQUIREREQUEST=1;
var PW_DISABLEAUTOBEHAVIOR=0;
var PW_SHOWALERT=1;
var pwTimerArray=new Array();
var pwTimerCount=0;
function pwAddPageTimer(pwTimer){
if(pwGetPageTimer(pwTimer.id)==null)
pwTimerArray[pwTimerCount++]=pwTimer;
}
function pwGetPageTimer(pwId){
for(var i=0;i<pwTimerCount;i++){
if(pwTimerArray[i].id==pwId)
return pwTimerArray[i];
}
return null;
}
function pwTimerIsTicking(pwId){
var pwTempTimer=pwGetPageTimer(pwId);
return(pwTempTimer==null?false:pwTempTimer.started);
}
function pwDisablePageTimer(pwId){
var pwTempTimer=pwGetPageTimer(pwId);
if(pwTempTimer){
if(typeof(pwTempTimer.timeoutId)!="undefined"){
clearTimeout(pwTempTimer.timeoutId);
pwTempTimer.started=false;
}
}
}
function pwMacTick(){
var pwTheTimer=pwTimerArray[0];
if(!pwTheTimer)return'';
if(pwTheTimer.started)
pwBeginCallback(pwTheTimer.id,'Tick','','pwInternalCallback',null,pwTheTimer.block,pwTheTimer.waitLabel,pwTheTimer.waitMessage,pwTheTimer.errorBehavior,pwTheTimer.errorMessage,pwTheTimer.updateAll);
if(pwTheTimer.started)pwTheTimer.timeoutId=setTimeout("pwMacTick()",pwTheTimer.interval);
}
function pwTimer(id,interval,started,block,waitLabel,waitMessage,errorBehavior,errorMessage,updateAll,eventName){
this.id=id;
this.interval=interval;
this.started=started;
this.block=block;
this.waitLabel=waitLabel;
this.waitMessage=waitMessage;
this.errorBehavior=errorBehavior;
this.errorMessage=errorMessage;
this.updateAll=updateAll;
this.tick=new Function(this.getFunctionText(id));
this.timeoutId="";
if(!eventName)
this.eventName="Tick";
else
this.eventName=eventName;
if(started)this.start();
}
pwTimer.prototype.start=function(){
this.started=true;
if(pwManager.detectedBrowser==PW_IE5MAC)
this.timeoutId=setTimeout("pwMacTick()",this.interval);
else
this.timeoutId=setTimeout(this.tick,this.interval);
}
pwTimer.prototype.stop=function(){
clearTimeout(this.timeoutId);
this.started=false;
}
pwTimer.prototype.getFunctionText=function(pwId){
var text="var pwTimerId = '"+pwId+"';";
text+="pwTheTimer = pwGetPageTimer(pwTimerId);";
text+="if(!pwTheTimer) return '';";
text+="if(pwTheTimer.started){";
text+="pwBeginCallback(pwTheTimer.id, pwTheTimer.eventName, '', 'pwInternalCallback', null, pwTheTimer.block, pwTheTimer.waitLabel, pwTheTimer.waitMessage, pwTheTimer.errorBehavior, pwTheTimer.errorMessage, pwTheTimer.updateAll);";
text+="}";
text+="if(pwTheTimer.started)pwTheTimer.timeoutId = setTimeout(pwTheTimer.tick, pwTheTimer.interval);";
return text;
}
function pwRsRequestManager(pwDetectedBrowser){
this.requestCount=0;
this.requests=new Array();
this.detectedBrowser=PW_UNSUPPORTED;
this.initialRequestPoolSize=1;
this.callbackNumber=0;
if(pwDetectedBrowser!=null)this.detectedBrowser=pwDetectedBrowser;
this.createInitialRequests();
}
pwRsRequestManager.prototype.createInitialRequests=function(){
for(var i=0;i<this.initialRequestPoolSize;i++)
this.createRequest();
}
pwRsRequestManager.prototype.acquireRequest=function(){
for(var i=0;i<this.requestCount;i++){
if(this.requests[i].busy==false){
this.requests[i].busy=true;
return this.requests[i];
}
}
this.createRequest();
this.requests[this.requestCount-1].busy=true;
return this.requests[this.requestCount-1];
}
pwRsRequestManager.prototype.getRequestIndex=function(pwRequestId){
for(var i=0;i<this.requestCount;i++){
if(this.requests[i].id==pwRequestId)
return i;
}
return-1;
}
pwRsRequestManager.prototype.removeRequest=function(pwRequestId){
var pwIndex=this.getRequestIndex(pwRequestId);
if(pwIndex>-1){
this.requests.splice(pwIndex,0);
this.requestCount--;
}
}
pwRsRequestManager.prototype.createRequest=function(){
this.requests[this.requestCount]=new pwRsRequest(pwBaseUrl,"request"+this.requestCount);
this.requestCount++;
}
pwRsRequestManager.prototype.retrieveRequest=function(pwRequestId){
for(var i=0;i<this.requestCount;i++){
if(this.requests[i].id==pwRequestId)
return this.requests[i];
}
return null;
}
pwRsRequestManager.prototype.isBlocking=function(){
for(var i=0;i<this.requestCount;i++){
if(this.requests[i].busy==true&&this.requests[i].block==true){
return true;
}
}
return false;
}
pwRsRequestManager.prototype.isPendingCallback=function(){
for(var i=0;i<this.requestCount;i++){
if(this.requests[i].busy==true){
return true;
}
}
return false;
}
pwRsRequestManager.prototype.isPendingTick=function(pwId){
for(var i=0;i<this.requestCount;i++){
if(this.requests[i].serverEvent=="Tick"&&this.requests[i].caller.id==pwId){
return true;
}
}
return false;
}
var handlerText="";
handlerText+="var pendingRequest = pwManager.retrieveRequest(requestId);";
handlerText+="if(!pendingRequest) return;";
handlerText+="if(!pendingRequest.xmlHttp) return;";
handlerText+="if(pendingRequest.xmlHttp.readyState != 4) return;";
handlerText+="if(pendingRequest.xmlHttp.status != 200) return;";
handlerText+="pendingRequest.callbackObject.rawData = pendingRequest.xmlHttp.responseText;";
handlerText+="pendingRequest.callbackObject.data = pwTrim(pendingRequest.callbackObject.rawData);";
handlerText+="if(pendingRequest.block) pwFakeUnblock(pendingRequest.caller);";
handlerText+="pendingRequest.clearWaitLabel();";
handlerText+="pendingRequest.busy=false;";
handlerText+="eval(pendingRequest.callbackFunction + '(pendingRequest.callbackObject)');";
handlerText+="pendingRequest.serverEvent = '';";
handlerText+="if(typeof(pwAfterCallback) == 'function')";
handlerText+="pwAfterCallback();";
function pwHandleCustom(pwCallbackObject,pwText,pwHandler){
pwCallbackObject.data=pwText;
eval(pwHandler+"(pwCallbackObject);");
}
function pwRsRequest(pwServerUrl,pwId){
this.serverUrl=pwServerUrl;
this.id=pwId;
this.xmlHttp=null;
this.flash=null;
this.iframe=null;
this.busy=false;
this.block=true;
this.updateAll=true;
this.callbackFunction=null;
this.callbackObject=null;
this.caller=null;
this.serverEvent="";
this.waitLabel=null;
this.waitMessage="";
this.errorBehavior=null;
this.errorMessage="";
this.oldWaitMessage="";
this.createCallbackMechanism();
}
var pwTempObj=null;
var pwTempRequest=null;
pwRsRequest.prototype.createXmlHttp=function(){
var pwSuccess=false;
try{
this.xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
pwSuccess=true;
}
catch(err){
try{
this.xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
pwSuccess=true;
}
catch(err){
try{
this.xmlHttp=new XMLHttpRequest();
pwSuccess=true;
}
catch(err){
}
}
}
if(pwSuccess==true&&pwCallbackType=="AutoDetect")
pwCallbackType="XmlHttp";
return pwSuccess;
}
pwRsRequest.prototype.createFlash=function(){
var pwSuccess=false;
try{
var pwFrm=document.forms[0];
if(!pwFrm)return;
var pwSpanObj=document.getElementById("pwBin");
if(pwSpanObj)return;
pwSpanObj=document.createElement("span");
pwSpanObj.setAttribute("id","pwBin");
pwSpanObj.setAttribute("style","height:0px;width:0px;position:absolute;top:0px;left:0px;");
pwFrm.appendChild(pwSpanObj);
pwSpanObj.innerHTML="<embed src='"+pwBaseResourcePath+"PWCallback.swf' loop='false' swLiveConnect='true' height='1' width='1' id='pwFlashCallback' name='pwFlashCallback' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' />";
this.flash=pwSpanObj.firstChild;
}
catch(err){
}
if(pwSuccess==true&&pwCallbackType=="AutoDetect")
pwCallbackType="Flash";
return pwSuccess;
}
pwRsRequest.prototype.createIFrame=function(pwFromCallback){
if(pwFromCallback){
pwCreateAllIFrames();
}
else{
if(pwIsInitialized==false){
document.body.onload=pwCreateAllIFrames;
pwIsInitialized=true;
return;
}
}
}
pwRsRequest.prototype.createCallbackMechanism=function(){
if(pwCallbackType=="AutoDetect"){
var isCreated=this.createXmlHttp();
if(!isCreated)isCreated=this.createFlash();
if(!isCreated)isCreated=this.createIFrame();
if(pwCallbackType=="AutoDetect")pwCallbackType="None";
}
else if(pwCallbackType=="XmlHttp")
this.createXmlHttp();
else if(pwCallbackType=="Flash")
this.createFlash();
else if(pwCallbackType=="IFrame")
this.createIFrame();
}
pwRsRequest.prototype.callback=function(pwEventSrc,pwEventTarget,pwEventArgs){
this.setWaitLabel();
if(typeof(pwBeforeCallback)=="function"){
pwBeforeCallback();
}
var requestUrl="";
if(pwIsCookieless==true)
requestUrl=(pwCookielessUrl.indexOf("?")>-1)?pwCookielessUrl+"&":pwCookielessUrl+"?";
else
requestUrl=(pwBaseUrl.indexOf("?")>-1)?pwBaseUrl+"&":pwBaseUrl+"?";
var requestData="";
if(pwUsingServerViewState==false)requestData+=pwGetHiddenFields(pwEventSrc);
requestData+=pwEventSrcKey+"="+pwEscape(pwEventSrc);
if(this.updateAll){
var pwTempFields=pwGetFormFields(pwEventSrc);
if(pwTempFields=="!!!ERROR!!!"){
this.busy=false;
return;
}
requestData+="&"+pwTempFields;
}
else
{
var pwPageKeyEl=pwObj("pwPageKey");
if(pwPageKeyEl!=null)
requestData+="&"+pwEscape(pwPageKeyEl.name)+"="+pwEscape(pwPageKeyEl.value);
}
requestData+="&"+"requestId="+this.id;
var pwHandlingControl="";
if(this.caller.type=="radio")pwHandlingControl=pwFixGroupName(this.caller.name);
if(this.caller.name==""||this.caller.name==null||pwHandlingControl=="")pwHandlingControl=this.caller.id;
if(!pwSkipField(requestData,pwEventSrc)){
var tempVal=pwObj(pwEventSrc).value;
if(typeof(tempVal)!="undefined")tempVal=pwEscape(tempVal);
requestData+="&"+pwGetHandlingControl(pwHandlingControl)+"="+tempVal;
}
requestData+="&__EVENTTARGET="+pwEventSrc;
requestData+="&__EVENTARGUMENT=";
requestData+="&"+pwEventTargetKey+"="+pwEscape(pwEventTarget);
requestData+="&"+pwEventArgsKey+"="+pwEscape(pwEventArgs);
requestData+="&"+pwCallbackKey+"=true";
requestData+="&"+pwCallbackNumberKey+"="+pwManager.callbackNumber++;
requestData+="&"+pwCallbackTypeKey+"="+pwCallbackType;
var pwValidatorIndex=pwInArray(pwHandlingControl,pwArrValidators);
var pwValidator=pwArrValidators[pwValidatorIndex];
var pwValidationGroup=pwArrValidationGroups[pwValidatorIndex];
try{
if(pwValidator){
if(typeof(Page_ClientValidate)=="function"){
if(!Page_ClientValidate(pwValidationGroup)){
this.busy=false;
return;
}
}
}
}
catch(err){}
if(this.block){
if(this.caller.className!="pwNonVisual")
pwFakeBlock(this.caller);
}
if(pwDiagnosticMode)pwAddDebug(requestData,"request");
if(pwCallbackType=="XmlHttp"){
this.xmlHttp.open("POST",requestUrl,true);
this.xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=UTF-8");
this.internalHandler=new Function("var requestId = '"+this.id+"';"+handlerText);
this.xmlHttp.onreadystatechange=this.internalHandler;
this.xmlHttp.send(requestData);
}
else if(pwCallbackType=="Flash"){
requestData=pwReplaceString(requestData,"&&","&");
pwSendFlashCallback(this,pwServer+requestUrl+requestData);
}
else if(pwCallbackType=="IFrame"){
if(pwIsIE()){
this.iframe.open();
this.iframe.write('<html><body>');
this.iframe.write('<form name="pwForm" action="'+requestUrl+'" method="post">');
this.iframe.write('<input type="hidden" name="macplaceholder" value="filler" />\r\n');
var pwMacArgs=requestData.split('&');
for(var i=0;i<pwMacArgs.length;i++){
var pwMacParts=pwMacArgs[i].split('=');
if(pwMacParts.length>=2){
var pw2ndField=pwMacParts[1];
for(var j=2;j<pwMacParts.length;j++)
pw2ndField+="=";
var blah='<input type="hidden" name="'+pwMacParts[0]+'" value="'+pw2ndField+'" />\r\n';
this.iframe.write(blah);
}
}
this.iframe.write('</form></body></html>');
this.iframe.close();
this.iframe.forms['pwForm'].submit();
}
else{
requestData=pwReplaceString(requestData,"&&","&");
this.iframe.location.replace(requestUrl+requestData);
}
}
else{
if(typeof(document.forms[0].__EVENTTARGET)=="undefined"){
var pwTarget=document.createElement("input type=hidden");
pwTarget.name="__EVENTTARGET";
pwTarget.value=pwEventSrc;
document.forms[0].appendChild(pwTarget);
if(document.all)document.forms[0].normalize();
}
else
document.forms[0].__EVENTTARGET.value=pwEventSrc;
document.forms[0].submit();
}
if(typeof(pwAfterSend)=="function"){
pwAfterSend();
}
}
pwRsRequest.prototype.setWaitLabel=function(){
if(this.waitLabel){
if(typeof(this.waitLabel.value)!="undefined")
this.waitLabelProp="value";
else if(typeof(this.waitLabel.text)!="undefined")
this.waitLabelProp="text";
else
this.waitLabelProp="innerHTML";
this.oldWaitMessage=eval("this.waitLabel."+this.waitLabelProp);
eval("this.waitLabel."+this.waitLabelProp+"='"+this.waitMessage+"'");
}
}
pwRsRequest.prototype.clearWaitLabel=function(){
if(this.waitLabel){
eval("this.waitLabel."+this.waitLabelProp+"='"+this.oldWaitMessage+"'");
}
}
var pwIFramesCompleted=false;
function pwCreateAllIFrames(){
pwIFramesCompleted=false;
for(var i=0;i<pwManager.requestCount;i++){
pwCreateIFrame(pwManager.requests[i]);
}
}
function pwCreateIFrame(pwRequest){
var pwSuccess=false;
try{
if(pwIsIE()){
var newIFrame=document.createElement('iframe');
newIFrame.setAttribute('id','pwIFrame');
newIFrame.setAttribute('name','pwIFrame');
newIFrame.style.border='0px';
newIFrame.style.width='0px';
newIFrame.style.height='0px';
newObj=document.body.appendChild(newIFrame);
newObj=document.frames['pwIFrame'];
pwRequest.iframe=newObj.document;
pwSuccess=true;
}
else{
var newFrame=document.createElement('iframe');
newFrame.setAttribute('id','pwIFrame'+this.id);
newFrame.setAttribute('name','pwIFrame'+this.id);
newFrame.style.border='0px';
newFrame.style.width='0px';
newFrame.style.height='0px';
pwRequest.pwTempObj=document.body.appendChild(newFrame);
setTimeout(pwCompleteIFrames,50);
pwSuccess=true;
}
}
catch(err){
}
if(pwSuccess==true)
pwCallbackType="IFrame";
}
function pwCompleteIFrames(){
if(pwIFramesCompleted==false){
pwIFramesCompleted=true;
for(var i=0;i<pwManager.requestCount;i++){
pwManager.requests[i].iframe=pwManager.requests[i].pwTempObj.contentDocument;
}
}
}
function pwInternalFrameCallback(pwRequestId,pwCode){
var pendingRequest=pwManager.retrieveRequest(pwRequestId);
pendingRequest.callbackObject.rawData=pwCode;
pendingRequest.callbackObject.data=pwTrim(pendingRequest.callbackObject.rawData);
pendingRequest.callbackObject.data=pwReplaceString(pendingRequest.callbackObject.data,"\r\n","");
pendingRequest.callbackObject.data=pwReplaceString(pendingRequest.callbackObject.data,"\t","");
if(!pwManager.isBlocking())pwFakeUnblock(pendingRequest.caller);
pendingRequest.clearWaitLabel();
if(typeof(pwAfterCallback)=='function')
pwAfterCallback();
pendingRequest.busy=false;
eval(pendingRequest.callbackFunction+'(pendingRequest.callbackObject)');
pendingRequest.caller=null;
pendingRequest.serverEvent="";
}
function pwUpdateViewState(pwViewState){
pwUpdateHiddenField("__VIEWSTATE",pwViewState);
}
function pwUpdateHiddenField(pwFieldName,pwFieldValue){
if(!pwFieldValue)return;
if(pwFieldValue=="")return;
if(pwIsIE())
document.getElementById(pwFieldName).value=pwFieldValue;
else{
try{
for(var i=0;i<document.forms[0].elements.length;i++){
var pwFormEl=document.forms[0].elements[i];
if(pwFormEl.name==pwFieldName)
pwFormEl.value=pwFieldValue;
}
}
catch(err){
}
}
}
function pwInternalCallback(pwCallbackObject){
if(pwCallbackObject.request.serverEvent=="Tick"){
if(!pwTimerIsTicking(pwCallbackObject.request.caller.id)){
return;
}
}
if(pwDiagnosticMode)pwAddDebug(pwCallbackObject.data,"response");
try{
eval(pwCallbackObject.data);
}
catch(err){
if(pwCallbackObject.data.indexOf("<!DOCTYPE HTML")>-1||
pwCallbackObject.data.indexOf("<HTML")>-1||
pwCallbackObject.data.indexOf("<html")>-1)
document.write(pwCallbackObject.data);
else{
if(err.message){
alert(err.message);
}else{
alert(err);
}
}
}
}
function pwRsCallbackResponse(pwContext){
this.error=PW_NOERROR;
this.errorMessage="";
this.data="";
this.rawData="";
this.context=pwContext;
this.request=null;
}
function pwFakeBlock(pwElement){
if(pwElement)pwElement.disabled=true;
}
function pwFixFields(pwData){
pwData=pwReplaceString(pwData,"==&","@#$#@&");
var pwFixedFields="";
var pwFields=pwData.split('&');
for(var i=0;i<pwFields.length;i++){
var pwParts=pwFields[i].split('=');
if(pwParts.length==2){
if(pwParts[0]!=""&&pwParts[1]!="")
pwFixedFields+=pwParts[0]+"="+pwParts[1]+"&"
}
}
pwFixedFields=pwFixedFields(pwData,"@#$#@&","==&");
return pwFixedFields;
}
function pwFakeUnblock(pwElement){
if(pwElement)pwElement.disabled=false;
}
function pwSkipField(pwRequestString,pwEventSrc){
var pwCaller=pwObj(pwEventSrc);
if(pwInRequest(pwRequestString,pwCaller))
return true;
if(pwCaller.type=="checkbox"||pwCaller.type=="radio")
if(!pwCaller.checked)return true;
if(typeof(pwCaller.value)=="undefined")
return true;
if(pwCaller.className=="pwNonVisual")
return true;
return false;
}
function pwInRequest(pwRequestString,pwElement){
var fields=pwRequestString.split("&");
for(var i=0;i<fields.length;i++){
var parts=fields[i].split("=");
if(parts[0]==pwElement.name)return true;
}
}
function pwDoUpdateUI(pwCursorType,pwDisabled){
for(var i=0;i<document.forms.length;i++){
for(var j=0;j<document.forms[i].elements.length;j++){
if(pwManager.detectedBrowser==PW_IE||pwManager.detectedBrowser==PW_MOZILLA){
if(pwCursorType=="wait"){
document.forms[i].elements[j].origDisabled=document.forms[i].elements[j].disabled;
document.forms[i].elements[j].disabled=pwDisabled;
}
else
document.forms[i].elements[j].disabled=document.forms[i].elements[j].origDisabled;
}
document.forms[i].elements[j].onClick=(pwDisabled==true)?pwOnClick:"";
}
}
}
function pwGetHiddenFields(pwElemId){
pwElem=pwObj(pwElemId);
if(typeof(pwElem)=="undefined")return"";
var pwHiddenFields="";
if(pwManager.detectedBrowser==PW_IE){
pwHiddenFields="__VIEWSTATE="+pwEscape(pwObj("__VIEWSTATE").value)+"&";
}
else{
try{
for(var i=0;i<pwElem.form.elements.length;i++){
var pwFormEl=pwElem.form.elements[i];
if(pwFormEl.name=="__VIEWSTATE")
pwHiddenFields+="__VIEWSTATE="+pwEscape(pwFormEl.value)+"&";
}
}
catch(err){
}
}
return pwHiddenFields;
}
function pwGetFormFields(pwElemId){
pwElem=pwObj(pwElemId);
if(!pwElem)return;
var pwFields="";
try{
if(!pwElem.form)pwElem.form=pwGetForm(pwElem);
if(!pwElem.form)pwElem.form=document.forms[0];
}
catch(err){
pwDisablePageTimer(pwElemId);
return"!!!ERROR!!!";
}
for(var i=0;i<pwElem.form.elements.length;i++){
var pwFormEl=pwElem.form.elements[i];
if(pwFormEl.type=="radio"){
if(!pwInRequest(pwFields,pwFormEl)){
if(pwFormEl.checked)
pwFields+=pwEscape(pwFormEl.name)+"="+pwEscape(pwFormEl.value)+"&";
}
}
else{
if(pwFormEl.type=="button")continue;
if(pwFormEl.type=="submit")continue;
if(pwFormEl.name=="")continue;
if(pwFormEl.value==null)continue;
if(pwFormEl.name=="__EVENTTARGET")continue;
if(pwFormEl.name=="__EVENTARGUMENT")continue;
if(pwFormEl.className=="pwNonVisual")continue;
if(pwFormEl.name=="__VIEWSTATE")continue;
if(pwFormEl.type=="select-one"||pwFormEl.type=="select-multiple"){
var selectedValues="";
for(var j=0;j<pwFormEl.options.length;j++){
if(pwFormEl.options[j].selected)
selectedValues+=(pwFormEl.options[j].value+",");
}
selectedValues=selectedValues.substring(0,selectedValues.length-1);
if(selectedValues!="")pwFields+=pwEscape(pwFormEl.name)+"="+pwEscape(selectedValues)+"&";
}
else if(pwFormEl.type=="checkbox"){
if(pwFormEl.checked)
pwFields+=pwEscape(pwFormEl.name)+"=on&";
}
else
pwFields+=pwEscape(pwFormEl.name)+"="+pwEscape(pwFormEl.value)+"&";
}
}
if(pwFields!="")pwFields=pwFields.substring(0,pwFields.length-1);
return pwFields;
}
function pwGetForm(pwElem){
return pwGetInstance("form",pwElem);
}
function pwGetInstance(pwElementType,pwSelectedElement){
if(pwElementType.toLowerCase()==pwSelectedElement.tagName.toLowerCase())
return pwSelectedElement;
else if(pwSelectedElement.tagName.toLowerCase()=="body")
return null;
else{
var pNode=null;
pNode=(pwIsIE()?pwSelectedElement.parentElement:pwSelectedElement.parentNode);
return pwGetInstance(pwElementType,pNode);
}
}
function pwIsIE(){
if(pwManager.detectedBrowser==PW_IE
||pwManager.detectedBrowser==PW_IE5
||pwManager.detectedBrowser==PW_IE5MAC)
return true;
return false;
}
function pwEscape(pwString){
pwString=pwReplaceString(pwString,"<","%3C");
pwString=pwReplaceString(pwString,">","%3E");
if(!(pwIsIE()&&pwCallbackType=="IFrame")){
pwString=pwReplaceString(pwString,"+","%2B");
pwString=pwReplaceString(pwString,"&","%26");
}
return pwString;
}
function pwReplaceString(pwStr,pwStrFind,pwStrReplace){
while(pwStr.indexOf(pwStrFind)!=-1){
pwStr=pwStr.replace(pwStrFind,pwStrReplace);
}
return pwStr;
}
function pwTrim(pwStr){
if(typeof pwStr!="string"){return pwStr;}
var retValue=pwStr;
var ch=retValue.substring(0,1);
while(ch==" "){
retValue=retValue.substring(1,retValue.length);
ch=retValue.substring(0,1);
}
ch=retValue.substring(retValue.length-1,retValue.length);
while(ch==" "){
retValue=retValue.substring(0,retValue.length-1);
ch=retValue.substring(retValue.length-1,retValue.length);
}
return retValue;
}
var pwLoopCount=0;
var pwSavedRequest=null;
function pwBeginCallback(pwEventSrc,pwEventTarget,pwEventArgs,pwCallbackFunction,pwContext,pwBlock,pwWaitLabel,pwWaitMessage,pwErrorBehavior,pwErrorMessage,pwUpdateAll){
if(pwManager.isBlocking()){
return;
}
if(pwEventTarget=="Tick"){
if(pwManager.isPendingTick(pwEventSrc)){
return;
}
}
if(pwCallbackType=="Flash"&&pwManager.isPendingCallback())
return;
if(typeof(pwInitCallback)=="function")
pwInitCallback();
var internalRequest=pwManager.acquireRequest();
if(internalRequest==null){
var nullCallback=new pwRsCallbackResponse(null);
nullCallback.error=PW_UNABLETOACQUIREREQUEST;
nullCallback.errorMessage="Unable to acquire a request.";
pwCallbackFunction;
return null;
}
else{
if(pwCallbackType=="IFrame")
internalRequest.createIFrame(true);
else if(pwManager.detectedBrowser==PW_MOZILLA&&pwCallbackType!="Flash"){
if(pwEventTarget=="ConfirmResponse"||pwEventTarget=="PromptResponse"||pwEventTarget=="PromptNullResponse")
internalRequest.createCallbackMechanism();
}
var pwCaller=pwObj(pwEventSrc);
if(!pwCaller)
{
pwManager.removeRequest(internalRequest.id);
return;
}
internalRequest.callbackFunction=pwCallbackFunction;
internalRequest.block=pwBlock;
internalRequest.updateAll=pwUpdateAll;
internalRequest.waitLabel=document.getElementById(pwWaitLabel);
internalRequest.waitMessage=pwWaitMessage;
internalRequest.errorBehavior=pwErrorBehavior;
internalRequest.errorMessage=pwErrorMessage;
internalRequest.callbackObject=new pwRsCallbackResponse(pwContext);
internalRequest.callbackObject.request=internalRequest;
internalRequest.callerId=pwEventSrc;
internalRequest.caller=pwCaller;
internalRequest.serverEvent=pwEventTarget;
internalRequest.serverArgs=pwEventArgs;
pwSavedRequest=internalRequest;
if(pwCallbackType=="IFrame"&&(!pwIsIE()))
setTimeout(pwDoCallback,50);
else{
internalRequest.callback(pwEventSrc,pwEventTarget,pwEventArgs);
}
}
}
function pwDoCallback(){
pwSavedRequest.callback(pwSavedRequest.callerId,pwSavedRequest.serverEvent,pwSavedRequest.serverArgs);
}
function pwBeginCallServerFunction(pwFunctionName,pwCallbackFunction,pwContext,pwBlock,pwP1,pwP2,pwP3,pwP4,pwP5,pwP6,pwP7,pwP8,pwP9){
var pwArgs="";
if(pwP1&&pwP1!="")pwArgs+=pwP1+pwViewStateDelimiter;
if(pwP2&&pwP2!="")pwArgs+=pwP2+pwViewStateDelimiter;
if(pwP3&&pwP3!="")pwArgs+=pwP3+pwViewStateDelimiter;
if(pwP4&&pwP4!="")pwArgs+=pwP4+pwViewStateDelimiter;
if(pwP5&&pwP5!="")pwArgs+=pwP5+pwViewStateDelimiter;
if(pwP6&&pwP6!="")pwArgs+=pwP6+pwViewStateDelimiter;
if(pwP7&&pwP7!="")pwArgs+=pwP7+pwViewStateDelimiter;
if(pwP8&&pwP8!="")pwArgs+=pwP8+pwViewStateDelimiter;
if(pwP9&&pwP9!="")pwArgs+=pwP9+pwViewStateDelimiter;
pwArgs+=pwCallbackFunction;
var pwUpdateAll=true;
try{
if(typeof(pwCustomFunctionManagerUpdateAll)!="undefined")
pwUpdateAll=pwCustomFunctionManagerUpdateAll;
}catch(err){}
pwBeginCallback(pwCustomFunctionManager,pwFunctionName,pwArgs,"pwInternalCallback",pwContext,pwBlock,'','',null,null,pwUpdateAll);
}
function pwObj(pwObjId){
var pwObjRef=pwGetElement(pwObjId);
if(pwObjRef)return pwObjRef;
return pwGetElement(pwGetHandlingControl(pwObjId));
}
function pwGetElement(pwObjId){
var pwObjRef=document.getElementById(pwObjId);
if(pwObjRef)return pwObjRef;
var pwTempObjId=pwReplaceString(pwObjId,"$","_");
pwObjRef=document.getElementById(pwTempObjId);
if(pwObjRef)return pwObjRef;
pwObjId=pwReplaceString(pwObjId,":","_");
pwObjRef=document.getElementById(pwObjId);
if(pwObjRef)return pwObjRef;
var pwParts=pwObjId.split('_');
pwObjRef=document.getElementById(pwParts[pwParts.length-1]);
if(pwObjRef)return pwObjRef;
pwObjRef=pwFindChangedControl(pwObjId);
return pwObjRef;
}
function pwFindChangedControl(pwId){
var pwParts=pwId.split("_");
var pwI=0;
for(pwI=0;pwI<pwParts.length;pwI++){
if(pwParts[pwI].indexOf("ctl")==0)break;
}
if(pwI==pwParts.length)return null;
var pwPart=pwParts[pwI];
var pwSnum=pwReplaceString(pwPart,"ctl","");
if(pwSnum=="")return null;
var pwNum=parseInt(pwSnum);
for(var i=pwNum;i<5000;i++){
var pwNewId=pwId.replace("_"+pwPart+"_","_ctl"+i+"_");
var pwObj=document.getElementById(pwNewId);
if(pwObj)return pwObj;
}
return null;
}
function pwGetHandlingControl(pwId){
var gridIndex=pwInArray(pwId,pwArrGrids);
if(gridIndex!=-1&&pwArrGrids[gridIndex]!="")return pwArrGrids[gridIndex];
if(pwId.indexOf("__")>-1)
return pwId.split('__')[0];
if(pwId.indexOf(":")>-1)
return pwReplaceString(pwId,":","%3A");
return pwId;
}
function pwInArray(pwId,pwArr){
for(var i=0;i<pwArr.length;i++){
if(pwId.indexOf(pwArr[i])==0)return i;
var pwParts=pwArr[i].split(':');
var pwCounter=0;
if(pwParts.length==1)pwCounter=0;
for(var j=pwCounter;j<pwParts.length;j++){
if(pwParts[j].indexOf("_")!=0){
if(pwId.indexOf(pwParts[j])>-1)
return i;
}
}
}
return-1;
}
function pwFixGroupName(pwId){
return pwId.split(":")[pwId.split(":").length-1];
}
function pwRecursiveSetDisplay(pwObj,pwVisibility){
for(var i=0;i<pwObj.childNodes.length;i++){
try{
pwObj.childNodes[i].style.display=pwVisibility;
}
catch(err){}
pwRecursiveSetDisplay(pwObj.childNodes[i],pwVisibility);
}
}
function pwSetMozillaOuterHTML(pwId,pwData){
var pwEl=pwObj(pwId);
if(!pwEl)return;
var pwRange=document.createRange();
pwRange.selectNode(pwEl);
var pwFrag=pwRange.createContextualFragment(pwData);
pwEl.parentNode.replaceChild(pwFrag,pwEl);
}
var pwDebugWindow=null;
function pwKillWindowIfOpen(){
if(pwDebugWindow!=null){
if(!pwDebugWindow.closed)
pwDebugWindow.close();
pwDebugWindow=null;
}
}
function pwAddDebug(pwStr,pwTitle){
try{
window.onunload=pwKillWindowIfOpen;
if(pwDebugWindow==null||pwDebugWindow.closed){
pwDebugWindow=window.open("about:blank","name","resizable=yes,scrollbars=yes,height="+(window.screen.height/2)+",width="+(window.screen.width/2));
if(!pwDebugWindow.opener)pwDebugWindow.opener=self;
pwDebugWindow.document.write("<html><head><title>PowerWEB Diagnostic Window</title></head><body><div style='font-family:verdana;font-size:12px'>");
}
pwStr=pwReplaceString(pwStr,"<","&lt;");
pwStr=pwReplaceString(pwStr,">","&gt;");
if(pwTitle=="response")
pwStr="<span style='color:blue'>"+pwStr+"</span>";
pwDebugWindow.document.write("<br><b>"+pwTitle+"</b>:<br>"+pwStr+"<br>");
if(pwTitle=="response")
pwDebugWindow.document.write("<hr width='100%'>");
pwDebugWindow.scrollTo(0,pwDebugWindow.document.all?pwDebugWindow.document.body.scrollHeight:pwDebugWindow.document.height);
}
catch(err){}
}
function pwGetScriptSources(){
var pwScriptSources=document.getElementsByTagName("script");
var pwScriptString="";
for(var i=0;i<pwScriptSources.length;i++){
if(typeof(pwScriptSources[i].src)!="undefined"
&&pwScriptSources[i].src.indexOf("Dart.PowerWEB.LiveControls")==-1){
pwScriptString=pwScriptString+pwScriptSources[i].src+"&";
}
}
if(pwScriptString.length>0)pwStringString=pwScriptString.substr(0,pwScriptString.length-1);
return pwScriptString.split('&');
}
function pwResetScriptSources(){
for(var i=0;i<pwArrSources.length;i++){
if(pwArrSources[i]!=""){
var newScript=document.createElement("script");
newScript.src=pwArrSources[i];
document.body.appendChild(newScript);
}
}
}
function pwUpdateCaption(tableId,captionText,captionAlign){
var table=pwObj(tableId);
if(table.caption==null)
table.createCaption();
table.caption.innerHTML=captionText;
if(document.all)
table.caption.align=captionAlign;
else
table.caption.style.captionSide=captionAlign;
}
var pwFlashObj=null;
var pwFlashScript="";
var pwFlashViewState="";
var pwFlashHandled=false;
function pwSendFlashCallback(pwRequest,pwUrl){
pwFlashObj=pwRequest.flash;
if(typeof(pwFlashObj.length)!="undefined")pwFlashObj=pwFlashObj[0];
pwFlashObj.SetVariable("_root.url",pwUrl);
pwFlashObj.SetVariable("_root.requestID",pwRequest.id);
pwFlashHandled=false;
pwFlashObj.Play();
setTimeout(pwCheckFlashData,5);
}
function pwCheckFlashData(){
pwFlashViewState=pwFlashObj.GetVariable("_root.viewState");
pwFlashScript=pwFlashObj.GetVariable("_root.script");
var requestId=pwFlashObj.GetVariable("_root.requestID");
if(typeof(pwFlashViewState)!="undefined"&&pwFlashViewState!="undefined"&&pwFlashViewState!=""&&pwFlashViewState!=null&&pwFlashHandled==false){
pwFlashObj.StopPlay();
pwFlashObj.GotoFrame(0);
pwFlashObj.SetVariable("_root.url","");
pwFlashObj.SetVariable("_root.script","");
pwFlashObj.SetVariable("_root.viewState","");
pwFlashHandled=true;
pwFlashViewState=pwReplaceString(pwFlashViewState,"%2B","+");
pwFlashScript=pwReplaceString(pwFlashScript,"%2B","+");
pwFlashScript=pwReplaceString(pwFlashScript,"#pwpercentatt#","%\"");
pwFlashScript=pwReplaceString(pwFlashScript,"#pwpercentsty#","%;");
var entities=["&quot;","&ldquo;","&lsaquo;","&lsquo;","&rdquo;","&rsaquo;","&rsquo;","&nbsp;","&lt;","&gt;"];
for(var i=0;i<entities.length;i++){
var tempEntity="#pwent"+i+"#";
pwFlashScript=pwReplaceString(pwFlashScript,tempEntity,entities[i]);
}
pwFlashScript=pwReplaceString(pwFlashScript,"\r\n","");
pwFlashScript=pwReplaceString(pwFlashScript,"\t","");
var handlerText="";
var pendingRequest=pwManager.retrieveRequest(requestId);
pendingRequest.callbackObject.rawData=pwFlashScript;
pendingRequest.callbackObject.data=pwTrim(pendingRequest.callbackObject.rawData);
if(pendingRequest.block)pwFakeUnblock(pendingRequest.caller);
pendingRequest.clearWaitLabel();
if(typeof(pwAfterCallback)=='function')pwAfterCallback();
pendingRequest.busy=false;
eval(pendingRequest.callbackFunction+'(pendingRequest.callbackObject)');
pendingRequest.serverEvent='';
pendingRequest.caller=null;
}
else
setTimeout(pwCheckFlashData,5);
}
function pwClearElementStyle(pwElem){
pwElem.style.backgroundColor="";
pwElem.style.borderWidth="";
pwElem.style.borderColor="";
pwElem.style.borderStyle="";
pwElem.style.color="";
pwElem.style.fontFamily="";
pwElem.style.fontSize="";
pwElem.style.fontStyle="";
pwElem.style.fontWeight="";
pwElem.style.textDecoration="";
}
function pwSetStyleString(pwControlId,pwPropString){
if(!pwControlId)return;
var pwControl=null;
if(typeof(pwControlId)=="string")
pwControl=pwObj(pwControlId);
else if(typeof(pwControlId)=="object")
pwControl=pwControlId;
if(!pwControl)return;
var pwPropItems=pwPropString.split(';');
for(var i=0;i<pwPropItems.length;i++){
try{
eval("pwControl."+pwPropItems[i]);
}
catch(err){
}
}
}
function pwReplaceDotnetTrace(script){
var aspTrace=pwObj("__asptrace");
if(!aspTrace)return;
aspTrace.childNodes[1].innerHTML=script;
}
function pwCheckMozillaHelpRequested(e){
if(e.keyCode==112){
pwBeginCallback(e.target.id,'HelpRequested','0@0','pwInternalCallback','',false,'','Processing...');
}
}
function pwUpdateValidators(validatorIDs){
if(typeof(Page_Validators)=="undefined"){
Page_Validators=new Array();
}
var arrValidators=validatorIDs.split(',');
for(var i=0;i<arrValidators.length;i++)
Page_Validators.push(pwObj(arrValidators[i]));
}
if(typeof(Sys)!="undefined"&&typeof(Sys.Application)!="undefined"){
Sys.Application.load.add(pwAtlasCallbackOnLoad);
function pwAtlasCallbackOnLoad(){
var page=$object("_PageRequestManager");
if(page!=null&&typeof(pwAtlasComplete)=="function")
page.propertyChanged.add(pwAtlasComplete);
}
function pwAtlasComplete(obj,args){;
if(args.get_propertyName()&&obj.get_inPostBack()==false){
var scriptDiv=pwObj("pwAtlasScript");
if(scriptDiv!=null)
eval(scriptDiv.innerHTML);
}
}
}
