//crunchinatorvariable_compressed
var sgSessionID=null;function fStartup(){if((!sgSessionID)||(sgSessionID=='')||(sgSessionID==null))fLogin();fDisableByID('ALL');for(var i=0;i<document.all.tags('BUTTON').length;i++)document.all.tags('BUTTON')[i].unselectable='on';fSetupIE5();oPriviliges.startDownload('http://gtwebpublisher.co.uk/cgi-bin/webpublisher4/getdata.cgi?sessionid='+sgSessionID+'&datatype=editorsetupdata',fSetupEditor);}function fShutdown(){fDebugPoint('fShutdown','logging out '+sgSessionID);if((!sgSessionID)||(sgSessionID==''))return;if((oForm.objectname.value!='')&&(oForm.pagecontent.changed==true)&&(fConfirm('Document will close','do you want to save changes ?','yes no','default')))fSave();for(var i=aPallets.length-1;i>=0;i--)aPallets[i].fXClose();var oWin=window.open('engines/logout.htm?sessionid='+top.sgSessionID,'_logout','scrollbars=no,status=no,width=409,height=119,top=50,left=50,borderStyle=none');oWin.focus();}function fDisableByID(sIDs){fDebugPoint('fDisableByID','disabling for ids '+sIDs);var aIDs=new Array();aIDs=sIDs.split(',');for(var i=0;i<document.all.length;i++){for(j=0;j<aIDs.length;j++){if(document.all[i].disableon){with(document.all[i]){var aDisableOn=new Array();var aDisableOn=disableon.split(',');if((sIDs=='ALL')||(aDisableOn.indexOf(aIDs[j])>=0)){document.all[i].disabled=true;style.filter='alpha(opacity=50)';}else{document.all[i].disabled=false;style.filter='';}}}}}}function fActionFormatBar(oRow,sToolbar){fDebugPoint('fActionFormatBar','show/hiding toolbar '+sToolbar);if((oRow.disabled)&&(oRow.disabled==true))return;fToggleLabel('Show','Hide',oRow);fShowHideToolbar(sToolbar);fDebugPoint('fActionFormatBar','Complete');}function fDocChange(){fDebugPoint('fDocChange','current document changed');document.title=oForm.objectname.value+'* - GT webPublisher4';oForm.pagecontent.changed=true;}function fReportLoaded(){fDebugPoint('fReportLoaded','setting div content editable');if(oEditor.bContentEditable)oEditor.body.contentEditable=true;}function fLogin(){fDebugPoint('fLogin','starting login');fWait('Logging In');window.status='Logging in ...';var aDocumentParameters=new Array();aDocumentParameters=fURLParameters(document);var sSessionID=aDocumentParameters.indexOf('sessionid')<0?showModalDialog('engines/login.htm','','dialogHeight:313px;dialogWidth:416px;help:no;resizable:no;scroll:no;status:no'):aDocumentParameters[1][aDocumentParameters.indexOf('sessionid')];if(sSessionID){switch(sSessionID){case 'cancelled':fWait('Login Cancelled.  Quitting ...');if((!sgSessionID)||(sgSessionID==''))window.close();fDebugPoint('fLogin','Login Cancelled');break;default:fDebugPoint('fLogin','Logged in as '+sSessionID);sgSessionID=sSessionID;}}else window.close();}function fReLogin(){fDebugPoint('fReLogin','starting login');fWait('Logging In');var oParameters=new Object();oParameters.sessionid=sgSessionID;oParameters.page='relogin.htm';window.focus();var sLoginResult=showModalDialog('engines/login.htm',oParameters,'dialogHeight:313px;dialogWidth:416px;help:no;resizable:no;scroll:no;status:no');if(!sLoginResult){fDebugPoint('fReLogin','relogin failed');return false;}if(document.all.oEditor)fDisableByID('oEditor');if(document.all.oIntray)fDisableByID('oIntray');fUnWait();if(sLoginResult=='cancelled')return false;return true;}function fSetFormFields(){fDebugPoint('fSetFormFields','setting form fields');with(oForm){sessionid.value=sgSessionID;fDebugPoint('fSetFormFields','Setting VALUE');pagecontent.value=document.all.oEditor.tagName=='DIV'?document.all.oEditor.innerHTML:document.all.oEditor.value;}return true;}function fPresaveComplete(sData){fDebugPoint('fPresave','created file '+sData);if(sData.match(/gtwebpublishervariable/i)){var sMessage=sData.split('_')[1];if(sMessage=='authenticationrequired')fAuthenticateAndRetry('fPresave()');else{fConfirm('Error creating file','The server quit with the error '+sMessage,'ok','warning');fDisableByID('oEditor');}return;}oForm.objectname.value=sData;fSave();}function fAuthenticateAndRetry(sFunction){fDebugPoint('fAuthenticateAndRetry','Retrying '+sFunction);if(fReLogin())window.execScript(sFunction,'javascript');else fConfirm('Authentication Cancelled','Your must log back in to continue working','ok','warning');}function fSetEditorEdit(sData){fDebugPoint('fSetEditor','Setting editor editable');with(document.all.oEditor){className='editorClass';if(tagName=='TEXTAREA'){value=sData;}else{innerHTML=sData;contentEditable=true;}}}function fRestartObj(){fDebugPoint('fRestartObj','Restarting object');if(oForm.objectname.value=='')return;fWait('Restarting '+oForm.objectname.value.replace(/_/,' '));with(oForm)oDownload2.startDownload('http://gtwebpublisher.co.uk/cgi-bin/webpublisher4/workflow.cgi?platform=IE&workflowaction=restart&sessionid='+sgSessionID+'&objectname='+escape(objectname.value)+'&groupname='+escape(groupname.value),fRestartObjComplete);}function fDeleteObj(){fDebugPoint('fDeleteObj','Deleting object');with(oForm){if(document.all.oIntray){if(all.objectSelect){var sDeleteType='object';var oSelect=all.objectSelect;}else{if(all.templateSelect){var sDeleteType='template';var oSelect=all.templateSelect;}else{alert('Cannot recognise delete type');return;}}if(getAttribute('deleteString')==null){var sObjectList='';if(!oSelect.length){if(oSelect.checked)sObjectList=oSelect.value.split(',')[0];}else for(var i=0;i<oSelect.length;i++)if(oSelect[i].checked)sObjectList+=escape(oSelect[i].value.split(',')[0]+',');if(sObjectList==''){fConfirm('Nothing to Delete','Please select some items and try again','ok','warning');return;}setAttribute('deleteString',sObjectList);}fWait('Deleting selected objects');}else{var sDeleteType='object';if(objectname.value=='')return;setAttribute('deleteString',escape(objectname.value));fWait('Deleting '+oForm.objectname.value.replace(/_/,' '));}oDownload2.startDownload('http://gtwebpublisher.co.uk/cgi-bin/webpublisher4/delete.cgi?platform=IE&deleteaction=presubmit&deletetype='+sDeleteType+'&sessionid='+sgSessionID+'&objectname='+getAttribute('deleteString'),fConfirmDeleteObj);setAttribute('deleteType',sDeleteType);}}function fSubmitObj(){fDebugPoint('fSubmitObj','Submitting object');with(oForm){if(document.all.oIntray){if(!all.objectSelect)return;if((getAttribute('submitObjectString')==null)&&(getAttribute('submitGroupString')==null)){var sObjectList='';var sGroupList='';if(!all.objectSelect.length){if(objectSelect.checked){sObjectList=objectSelect.value.split(',')[0];sGroupList=objectSelect.value.split(',')[1];}}else for(var i=0;i<objectSelect.length;i++)if(objectSelect[i].checked){sObjectList+=escape(objectSelect[i].value.split(',')[0]+',');sGroupList+=escape(objectSelect[i].value.split(',')[1]+',');}if(sObjectList==''){fConfirm('Nothing to Submit','Please select some items and try again','ok','warning');return;}if(sObjectList.split(',').length!=sGroupList.split(',').length){fConfirm('An error has occurred','Please logout and try again','ok','warning');return;}setAttribute('submitObjectString',sObjectList);setAttribute('submitGroupString',sGroupList);}fWait('Submitting Selected Objects');}else{if(objectname.value=='')return;setAttribute('submitObjectString',escape(objectname.value));setAttribute('submitGroupString',escape(groupname.value));fWait('Submitting '+oForm.objectname.value.replace(/_/,' '));}oForm.dosubmit.disabled=true;fAnimateButton(oForm.dosubmit,'down');var sTempStr='http://gtwebpublisher.co.uk/cgi-bin/webpublisher4/submit_object.cgi?platform=IE&workflowaction=presubmit&sessionid=&objectname=&groupname=';sTempStr=getAttribute('submitObjectString');sTempStr+=getAttribute('submitGroupString');if(sTempStr.length>1800){fConfirm('Too many items selected','You cannot submit this many items in one go.  Please unselect some and try again. ['+sTempStr.length+']','ok','warning');removeAttribute('submitObjectString');removeAttribute('submitGroupString');if(document.all.oIntray)fDisableByID('oIntray');else fDisableByID('oEditor');fUnWait();}else oDownload2.startDownload('http://gtwebpublisher.co.uk/cgi-bin/webpublisher4/submit_object.cgi?platform=IE&workflowaction=presubmit&sessionid='+sgSessionID+'&objectname='+getAttribute('submitObjectString')+'&groupname='+getAttribute('submitGroupString'),fConfirmSubmitObj);}}function fRevert(){fDebugPoint('fRevert','reverting to previously saved verion');if(fNotInEditMode())return;if(oEditor.innerHTML=='')return;if(!fConfirm('Revert to previously saved version ?','All changes will be lost','ok cancel','default'))return false;with(oForm)fDirectOpen(objectname.value,groupname.value);}function fOpen(sDialogPath){fDebugPoint('fOpen','open a file');var oParams=new Object();if(sDialogPath==null)sDialogPath='dialogs/open.htm';oParams.sessionID=sgSessionID;if(oForm.objectname.value!=null)oParams.objectname=oForm.objectname.value;var sString=showModalDialog(sDialogPath,oParams,'dialogHeight:510px;dialogWidth:216px;help:no;resizable:no;scroll:no;status:no');if(sString==null)return false;if((oForm.pagecontent.changed==true)&&(fConfirm('Document will close','do you want to save changes ?','yes no','default')))fSave();with(oForm){if(oParams.groupname)groupname.value=oParams.groupname;if(oParams.objectname)objectname.value=oParams.objectname;}fShowFile(sString);return true;}function fOpenVersion(){fDebugPoint('fOpenVerion','opening a version from history');if(!fConfirm('Changes will be lost','Are you sure you want to continue ?','yes no','default'))return false;fOpen('dialogs/versions.htm');}function fNew(){fDebugPoint('fNew','starting a new file');var sGroup=showModalDialog('dialogs/createNew.htm',sgSessionID,'dialogHeight:510px;dialogWidth:216px;help:no;resizable:no;scroll:no;status:no');if(sGroup==null)return;fDebugPoint('fNew','checking open document for changes');if((oForm.pagecontent.changed==true)&&(fConfirm('Document will close','do you want to save changes ?','yes no','default')))fSave();with(document.oForm){pagecontent.value='';objectname.value='';groupname.value=sGroup;}fShowFile('');}function fAddImage(oDoc){fDebugPoint('fAddImage','Inserting an image');if(oDoc.selection.type=='Control')return;var oDialogData=new Object();oDialogData.sSessionID=sgSessionID;var sNewImage=showModalDialog('dialogs/selectImage.htm',oDialogData,'dialogHeight:560px;dialogWidth:216px;help:no;resizable:no;scroll:no;status:no');if(sNewImage==null)return;var oRange=oDoc.selection.createRange();if(!fRangeInEditor(oRange,oDoc))return false;oRange.collapse(true);oRange.execCommand('InsertImage','',sNewImage);var aImages=oDoc.all.oEditor.all.tags('IMG');for(var i=0;i<aImages.length;i++)aImages[i].style.float='left';}function fAddDoc(oDoc){fDebugPoint('fAddDoc','Inserting a document');if(oDoc.selection.type=='Control')return;var oDialogData=new Object();oDialogData.sSessionID=sgSessionID;var sDocument=showModalDialog('dialogs/selectDocument.htm',oDialogData,'dialogHeight:560px;dialogWidth:216px;help:no;resizable:no;scroll:no;status:no');if(sDocument==null)return;var oRange=oDoc.selection.createRange();if(!fRangeInEditor(oRange,oDoc))return false;oRange.collapse(true);oRange.pasteHTML(sDocument);}function fAddTable(oDoc){fDebugPoint('fAddTable','Inserting a table');if(oDoc.selection.type=='Control')return;var oRange=oDoc.selection.createRange();if(!fRangeInEditor(oRange,oDoc))return false;oRange.collapse(true);oRange.pasteHTML('<TABLE border="1" cellspacing="0" cellpadding="0"><TR><TD>NEW TABLE</TD></TR></TABLE>');}function fPrint(){if(document.all.oEditor)document.all.oEditor.setAttribute('grabFocus','false');window.print();}function fRangeInEditor(oRange,oDoc){fDebugPoint('fRangeInEditor','checking range in editor');if(oDoc==null)oDoc=document;var oRangeParent=fObjectFromRange(oRange);if(!oDoc.all.oEditor)return false;if(oRangeParent==oDoc.oEditor)return true;if(oDoc.all.oEditor.contains(oRangeParent))return true;fDebugPoint('fRangeInEditor','range not contained in editor');return false;}function fCacheEditorRange(){fDebugPoint('fCacheEditorRange','caching current selection in editor');if(document.selection.type!='Text')return;fDebugPoint('fCacheEditorRange','creating range');var oRange=document.selection.createRange();if(!fRangeInEditor(oRange,document))return;if(!oRange)return;fDebugPoint('fCacheEditorRange','caching range in editor');document.all.oEditor.rangeCache=oRange.duplicate();}function fEditorUnFocus(oObject){fDebugPoint('fEditorUnfocus','Editor has been unfocused');with(document.all){if(oEditor.getAttribute('grabFocus')!='true')return;fDebugPoint('fEditorUnfocus','Focusing editor');oEditor.focus();if(oEditor.rangeCache){fDebugPoint('fEditorUnfocus','Setting editor range');var oRange=oEditor.rangeCache.duplicate();oRange.select();}oEditor.rangeCache=null;}}function fReplaceNode(oNode,sTag){fDebugPoint('fReplaceNode','transforming '+oNode.id+' to '+sTag);with(oNode){if(tagName==sTag)return oNode;var iWidthCache=oNode.offsetWidth;var iHeightCache=oNode.offsetHeight;var sIDCache=id;var oNew=document.createElement(sTag);replaceNode(oNew);}with(oNew){with(style){width=575;height='100%';}id=sIDCache;}return oNew;}function fShowHideHTML(sDefault){fDebugPoint('fShowHideHTML','toggling HTML display to mode '+sDefault);var sContent;var sToolbarsHidden;with(document.all.oEditor){var sType=tagName;if(sType==sDefault)return false;sContent=sType=='DIV'?innerHTML:value;if(sType=='DIV')sToolbarsHidden=fHideToolbarGroup('1');else if(getAttribute('barshidden')!=null)sToolbarsHidden=barshidden;}sType=sType=='DIV'?'TEXTAREA':'DIV';var oNew=fReplaceNode(document.all.oEditor,sType);with(oNew){className='editorClass';if(sType=='TEXTAREA'){value=sContent;fDisableByID('HTMLMODE');document.all.oEditor.barshidden=sToolbarsHidden;}else{insertAdjacentHTML('beforeEnd',sContent);if(sToolbarsHidden!=null)fShowToolbars(sToolbarsHidden);contentEditable='true';fDisableByID('WYSIWYGMODE');}}return true;}function fSetupIE5(){fDebugPoint('fSetupIE5','detecting browser ...');if(fNavVersion()>=5.5)return false;fDebugPoint('fSetupIE5','setting up for IE5');document.all.oIntray.editorMode='TEXTAREA';fToggleLabel('WYSIWYG','HTML',editormode);return true;}function fSetupPlugins(aPluginList){fDebugPoint('fSetupPlugins','setting up plugnis '+aPluginList);var oPluginsTable=document.all.tasksPlugins.all.menuTable;if((aPluginList=='')||(!aPluginList.length)||(aPluginList.length==0)){fRemoveExpander(fParentElement(oPluginsTable,'DIV'));return;}for(var i=0;i<aPluginList.length;i++){var aPluginPath=new Array();aPluginPath=aPluginList[i].split('/');var iPluginPathLen=aPluginPath.length;var sInterfaceName=aPluginPath[iPluginPathLen-1];var sPluginName=aPluginPath[iPluginPathLen-3];with(oPluginsTable){if((rows.length==0)||(rows[rows.length-1].getAttribute('pluginName')!=sPluginName)){if(rows.length>0){with(insertRow(-1)){id='divider';with(insertCell(-1))setAttribute('colSpan','2');}}with(insertRow(-1)){id='caption';setAttribute('pluginName',sPluginName);with(insertCell(-1)){className='inertTableLeft';style.height=25;innerHTML='&nbsp;';}with(insertCell(-1)){className='inertTableRight';style.height=25;innerHTML='<b style="color:#999999; text-transform:uppercase">'+sPluginName+'</b>';}}}with(insertRow(-1)){with(insertCell(-1)){className='inertTableLeft';style.height=25;innerHTML='&nbsp;';}with(insertCell(-1)){className='inertTableRight';style.height=25;sInterfaceName=sInterfaceName.replace(/_/ig,' ');innerHTML=sInterfaceName.replace(/\.(htm|php)$/,'');}setAttribute('pluginName',sPluginName);setAttribute('action','fRunPlugin(\''+aPluginList[i]+'\')');}}}}function fSetupSections(){fDebugPoint('fSetupSections','prompting to set up sections');if(!fConfirm('This site currently has no sections','Would you like to set up sections now ?','yes no','questo'))return;do{fShowWizard('createObjectGroup.htm');}while(fConfirm('Would you like to setup another section ?','','yes no','questo'));}function fSetupEditor(sData){fDebugPoint('fSetupEditor','user options comprise '+sData);var aData=new Array();aData=fParseData(sData);document.igCompanyName=aData[0];fDeactivateElements(aData[1]);fSetupColors(aData[2]);if(aData[1].indexOf('use_plugins')>-1)fSetupPlugins(aData[3]);else fSetupPlugins('');fHideToolbarGroup('1');document.all.oContainerTable.style.visibility='visible';document.aPrivileges=new Array();document.aPrivileges.addStuff(aData[1]);fUnWait();if(aData[1].indexOf('show_intray')>-1)fLoadIntray();else fLoadWelcome();if(aData[4]=='true')fSetupSections();}function fWait(sMessage,sParameters,iTimeout){fDebugPoint('fWait','setting wait info');with(document.all){oWaitLayerMessage.innerText=sMessage==null?'':sMessage;if(sParameters!=null){var aParameters=new Array();aParameters=sParameters.split(',');for(var i=0;i<aParameters.length;i++)eval('oWaitLayer.style.'+aParameters[i].split('=')[0])=aParameters[i].split('=')[1];}window.status='Working ...';oWaitLayer.style.visibility='visible';fDisableByID('ALL');}}function fUnWait(){fDebugPoint('fUnWait','hiding wait window');window.status=document.igCompanyName?'You are logged into the '+document.igCompanyName+' website':'Done';oWaitLayer.style.visibility='hidden';}function fSquareDblClick(){var oEvent=window.event;if(oEvent.ctrlKey){var sSessionIDCache=sgSessionID;sgSessionID='';top.location='reportWriter.htm?sessionid='+sSessionIDCache;}if(oEvent.shiftKey)fShowDebugLog();}fRegister('reportWriter.js v.3110031158');
