var t=true;
var showArray = { senderIcon:t,sender:t,subject:t,message:t,date:t,url:t,summary:t,image:t,recipient:t}

if(typeof localOrder!="undefined" && localOrder!=""){ // if localOrder found overwrite showArray with it
showArray = new Array(); //reset
var setShowArray=localOrder.split('_')
for(var i=0;i<setShowArray.length;i++){showArray[setShowArray[i]]=true;}
}

/******
element ids may be blahblah_'+padid
variables may be named padid+'_render'
This stops any accidental browser confusion
****/
function w(txt){document.write(txt)}

var padid = pad.replace(/[:.\/-]/g,'_');
top[padid] = new Array(); // storage for bits

var cont_mod_pad = pad; // turns the public path into a module path

if(cont_mod_pad.indexOf('Resources')==-1){
if(typeof cont_mod_pad_sub =="undefined") // author can add ext path e.g. pub/set and sys will use it
var cont_mod_pad_sub="public/";
else {
cont_mod_pad_sub=cont_mod_pad_sub.replace(/^\//g,'').replace(/\/$/g,'');
cont_mod_pad_sub+='/';
}
cont_mod_pad=cont_mod_pad.replace('portal/','')
var s=cont_mod_pad.split('/')
s[s.length-1]= 'Resources/' + cont_mod_pad_sub + s[s.length-1];
cont_mod_pad=s.join('/')
}

var sfxpath= '/sico/gc21/lcom/ibt/flexipad_frame/board/Pad.ibt?load=detailsLayout.xhtml&pad=' ;

var path_cont_ano="/ibt/GC21/area=gc21/main/en" + sfxpath + pad ;
var path_cont_reg="/ibt/login/GC21/area=gc21/main/en"   + sfxpath + pad ;
var path_cont_mod="/ibt/login/GC21/area=gc21/main/en"   + sfxpath + cont_mod_pad ;
var text_cont_ano = "edit ano";
var text_cont_reg = "edit reg";
var text_cont_mod = "edit mod";


function editLinks(contType){

var section,dv,lnk,text;
dv = document.getElementById(contType);
if(dv!=null) {dv.id = 'ele_'+contType+'_'+padid ;} // alter id if found

if(typeof parent[contType]!="undefined" && parent[contType]!= null) {
top[padid][contType] = parent[contType];
parent[contType] = null; //prevents bug with body.innerHTML
dv = document.getElementById('ele_'+contType);
if(dv!=null) {dv.id = 'ele_'+contType+'_'+padid ;} // alter id if found
else
{w('<span class="'+contType+'" id="ele_'+contType+'_'+padid+'" style="visibility : hidden;" >'+ parent["text_" + contType]  +'</span>')} //or create

section = document.getElementById( 'ele_'+contType+'_'+padid); //pickup ele again
if(section.childNodes[0].nodeName!="A"){
section.style.visibility="visible"
text=section.innerHTML ;
lnk = document.createElement('A');
lnk.className = contType ;
lnk.href = parent['path_'+contType] ;
lnk.target = '_blank';
section.innerHTML ="";
section.appendChild(lnk);
lnk.appendChild(document.createTextNode(text));
}
}
}

editLinks('cont_reg')
editLinks('cont_ano')
editLinks('cont_mod')




/********** FlexiFeed.js (081022)******
* Manages the dynamic loading of javascript files
* with the intention of expanding the Flexipad system
* This will work with any JS at any location (limited by some server security)
*
* By Jeremy Crowe j-crowe(a)crowna.com
***************************************/

function aniload(){
if(typeof anidots=="undefined") anidots=0;
var dots ='';
for(var i=0;i<anidots; i++){dots+='.';}
var item=document.getElementById('wait')
item.innerHTML = 'loading.'+ dots ;
anidots++;
if(anidots>=13)anidots=0;
}
var aniID;


function loading(on){
if(typeof anidots=="undefined") aniID = setInterval('aniload()',180);
if(document.getElementById('wait')==null) newEle('DIV','wait','loading.')
var item=document.getElementById('wait');
(on)? item.style.display='inline' : item.style.display='none' ;
}

function newEle(eletype,id,cont){
var skrp = document.createElement(eletype)
skrp.id = id;
skrp.innerHTML = cont ;
document.body.appendChild(skrp);
}

var JSloaded,call_top,skid_top,baseurl ='';

function JSI(call,skid){
call_top = call;
skid_top = skid;
if (typeof call!='undefined' && call!='' && call.indexOf('#')!=-1){
var callscr = call.substr(0,call.indexOf('#')) ;
var callftn = call.substr(call.indexOf('#')+1) ;
var callftnname = callftn.substr(0,callftn.indexOf('(')) ;
if(typeof parent[callftnname]=='function'){
eval(callftn);
call_top="";
}else {
if(JSloaded.indexOf(callscr)==-1){
JSloaded += callscr;
newSkrp('importScr',baseurl+callscr,1)
}else{
alert(callscr+' - '+callftn+': find or loading error.\nparent[callftnname] is '+typeof parent[callftnname]);
}
}
}else alert('JSI call empty! call:'+call+' skid:'+skid );
}

function newSkrp(id,scpt_url,newLoad){

var d = (scpt_url.indexOf('?')!=-1)? '&' : '?' ; d+='d='+new Date().valueOf(); //date stamp causes load every time
var item =  document.getElementById(id)  ;
if(item!=null)    document.body.removeChild(item)
var skrp = document.createElement('SCRIPT')
skrp.src = scpt_url+'.js' ;
skrp.src += (typeof newLoad!="undefined" && newLoad)? d :'' ;
skrp.id = id;
document.body.appendChild(skrp);
}


function loadCheck2(){
/***************
* This loads/reloads JS files SEQUENCIALLY, not out of cache
*
* It is passed an object containing a list of identifyer(unique script tab id + boolian for fresh loading) containing the file path e.g.
*  - var jsSet={  'boxy': {0:'/ibt/sfdaf/jim',1:1}  ,  'moxy': {0:'/esae/gfdtg/',1:1} }
*  - loadCheck(jsSet)
*
* Dependant on: the local function newSkp() that it calls to load scripts
* Dependant on: The end of each file being imported must be "if(typeof loadCheck=="function") loadCheck()"
*  - this repeats the loadCheck function causing it to load the next file
*
****************/

if(typeof lci=="undefined") lci=0; //load check index
if(typeof lcarr=="undefined") lcarr=new Array(); //load check index
if(typeof lcset=="undefined") lcset=''; //load check set

if(arguments.length!=0){ //set loadCheck up
if(typeof loadingAnimation=="undefined") var loadingAnimation=false;
loading(loadingAnimation)
lci=0;
lcarr=new Array();
lcset='';
lcset = arguments[0] ; //first argument is an object
for(ob in lcset){ lcarr[lcarr.length] = ob;}
lci=0; //reset indexer
arguments=new Array()
}
if(lci>=lcarr.length) {
alert('crash point in loadCheck()')
return;
}else{
lci++
newSkrp( lcarr[(lci-1)] , lcset[lcarr[(lci-1)]][0], lcset[lcarr[(lci-1)]][1] )
}
}

var dn = document.location.pathname.toString()
var filename=dn.substr(dn.lastIndexOf('\\')+1)
if (dn==filename)
filename=dn.substr(dn.lastIndexOf('\/')+1)


/****
*see monitor.js
*
*  function monitorget()
* if load=="flxInc002.sxhtml"
*  test if padid is in the pad plus eid of script
*  -subject
*  -pad
* can be left out -action get
*  -script
*  -load
*  -eid
*/

function monitorget(){
if(typeof load!="undefined" && (load=="flxInc002.sxhtml" || load=="detailsLayout_SSI.sxhtml")){
var ver = load=="flxInc002.sxhtml"? 2 : 1 ;
var server = document.location.toString().indexOf('author.gc21.de')==-1? '(P)':'(A)' ;
var tid = new Date().valueOf();
var padname = pad.indexOf(':')==-1 ? this[padid].pad : pad;

var skrp = document.createElement('SCRIPT');
skrp.src = 'http://crowna.co.nz/monitor.php?sub='+padname+'&msg='+document.location.toString()+'&server='+server+'&ver='+ver+'&d='+new Date().valueOf();
skrp.id = 'monget'+ tid;
document.body.appendChild(skrp);
}
}

