var BlockShownArrayName="BlockShownArray"+getTocDefaultUrlExtension();
var allBlocksArrayName="allBlocksArray"+getTocDefaultUrlExtension();
var allBlocks=new Array();
var allBlocksCount=0;
function GetCookie(d){var b=document.cookie.split("; ");
for(var c=0;
c<b.length;
c++){var a=b[c].split("=");
if(d==a[0]){return a[1]
}}return null
}function SetCookie(c,e,d){var b=new Date();
var a=1000*3600*24*365;
document.cookie=c+"="+e+((a)?";expires="+new Date(b.getTime()+a).toGMTString():"")+";path= /"+((d)?";domain="+d:"")
}function DeleteCookie(a,c,b){if(GetCookie(a)){SetCookie(a,"",-30,c,b)
}}var blocksShown=new Array();
var leftContentArray=new Array();
var rightContentArray=new Array();
var currentPortal;
var save_layout="";
var blocksIdSting="";
save_layout=function(){currentPortal=Ext.select(".x-portal").first();
var b=currentPortal.select(".x-portal-column").first();
var a=currentPortal.select(".x-portal-column").last();
blocksIdSting="";
b.select("div.x-portlet").each(function(c){blocksIdSting=blocksIdSting+c.dom.id+","
},mainPortal);
a.select("div.x-portlet").each(function(c){blocksIdSting=blocksIdSting+c.dom.id+","
},mainPortal);
DeleteCookie(BlockShownArrayName);
SetCookie(BlockShownArrayName,blocksIdSting)
};
function getAllBlocks(){var c=GetCookie(allBlocksArrayName,null);
if(c==null){allBlocks=listOfAllBlocks()
}else{allBlocksCount=0;
var a=c.split("/");
a=removeGivenValueFromArray(a,"");
for(var b=0;
b<a.length;
b++){allBlocks[allBlocksCount]=a[b].split(",");
allBlocks[allBlocksCount]=removeGivenValueFromArray(allBlocks[allBlocksCount],"");
allBlocksCount++
}}}function reArrangeAllBlocks(g,b){var h=GetCookie(BlockShownArrayName);
if(h!=null){var l=h.substring(0,h.indexOf(g)-1);
var i=l.substring(l.lastIndexOf(",")+1,l.length);
var n=new Array();
var m=new Array();
var k=new Array();
if(i==""){for(var e=0;
e<allBlocks.length;
e++){if(allBlocks[e][0]==g){m=allBlocks.splice(e,1);
m[0][1]=b
}}allBlocks=m.concat(allBlocks)
}else{for(var j=0;
j<allBlocks.length;
j++){if(allBlocks[j][0]==i){n=allBlocks.slice(0,j+1);
k=allBlocks.slice(j+1,allBlocks.length)
}}for(var a=0;
a<n.length;
a++){if(n[a][0]==g){n.splice(a,1)
}}for(var f=0;
f<k.length;
f++){if(k[f][0]==g){k.splice(f,1)
}}for(var d=0;
d<allBlocks.length;
d++){if(allBlocks[d][0]==g){m=allBlocks.splice(d,1);
m[0][1]=b
}}allBlocks=n.concat(m).concat(k)
}for(var c=0;
c<allBlocks.length;
c++){allBlocks[c][2]="/"
}DeleteCookie(allBlocksArrayName);
SetCookie(allBlocksArrayName,allBlocks)
}}function listOfAllBlocks(){allBlocksCount=0;
allBlocks=new Array();
for(var a=0;
a<incidentsOrdering.length;
a++){if(incidentsOrdering[a].trim()=="FROM_STATION_UPDATES"){allBlocks[allBlocksCount]=new Array(3);
allBlocks[allBlocksCount][0]="generalUpdatesFromStationUpdates";
allBlocks[allBlocksCount][1]="left";
allBlocks[allBlocksCount][2]="/";
allBlocksCount++
}if(incidentsOrdering[a].trim()=="FROM_THIS_STATION_UG"){allBlocks[allBlocksCount]=new Array(3);
allBlocks[allBlocksCount][0]="generalUpdatesFromStationUndergroundUpdate";
allBlocks[allBlocksCount][1]="left";
allBlocks[allBlocksCount][2]="/";
allBlocksCount++
}if(incidentsOrdering[a].trim()=="ENGINEERING_WORKS"){allBlocks[allBlocksCount]=new Array(3);
allBlocks[allBlocksCount][0]="generalUpdatesEngineeringWorkUpdate";
allBlocks[allBlocksCount][1]="left";
allBlocks[allBlocksCount][2]="/";
allBlocksCount++
}if(incidentsOrdering[a].trim()=="LINE_PROBLEM"){allBlocks[allBlocksCount]=new Array(3);
allBlocks[allBlocksCount][0]="generalUpdatesLineUpdate";
allBlocks[allBlocksCount][1]="left";
allBlocks[allBlocksCount][2]="/";
allBlocksCount++
}if(incidentsOrdering[a].trim()=="CATERING_ALTERATIONS"){allBlocks[allBlocksCount]=new Array(3);
allBlocks[allBlocksCount][0]="generalUpdatesCateringAlteration";
allBlocks[allBlocksCount][1]="left";
allBlocks[allBlocksCount][2]="/";
allBlocksCount++
}if(incidentsOrdering[a].trim()=="TRAIN_CANCELLATIONS"){allBlocks[allBlocksCount]=new Array(3);
allBlocks[allBlocksCount][0]="generalUpdatesTrainCancellation";
allBlocks[allBlocksCount][1]="left";
allBlocks[allBlocksCount][2]="/";
allBlocksCount++
}if(incidentsOrdering[a].trim()=="OTHER_TRAIN_ALTERATIONS"){allBlocks[allBlocksCount]=new Array(3);
allBlocks[allBlocksCount][0]="generalUpdatesOtherTrainAlteration";
allBlocks[allBlocksCount][1]="left";
allBlocks[allBlocksCount][2]="/";
allBlocksCount++
}if(incidentsOrdering[a].trim()=="ALTERED_FORMATIONS"){allBlocks[allBlocksCount]=new Array(3);
allBlocks[allBlocksCount][0]="generalUpdatesAlteredFormations";
allBlocks[allBlocksCount][1]="left";
allBlocks[allBlocksCount][2]="/";
allBlocksCount++
}if(incidentsOrdering[a].trim()=="SERVICE_PROBLEM"){allBlocks[allBlocksCount]=new Array(3);
allBlocks[allBlocksCount][0]="generalUpdatesServiceUpdate";
allBlocks[allBlocksCount][1]="left";
allBlocks[allBlocksCount][2]="/";
allBlocksCount++
}if(incidentsOrdering[a].trim()=="UNDERGROUND_PROBLEM"){allBlocks[allBlocksCount]=new Array(3);
allBlocks[allBlocksCount][0]="generalUpdatesUndergroundUpdate";
allBlocks[allBlocksCount][1]="left";
allBlocks[allBlocksCount][2]="/";
allBlocksCount++
}if(incidentsOrdering[a].trim()=="OTHER_INCIDENT"){allBlocks[allBlocksCount]=new Array(3);
allBlocks[allBlocksCount][0]="generalUpdatesGeneralUpdate";
allBlocks[allBlocksCount][1]="left";
allBlocks[allBlocksCount][2]="/";
allBlocksCount++
}if(incidentsOrdering[a].trim()=="TO_THIS_STATION_UG"){allBlocks[allBlocksCount]=new Array(3);
allBlocks[allBlocksCount][0]="generalUpdatesToStationUndergroundUpdate";
allBlocks[allBlocksCount][1]="left";
allBlocks[allBlocksCount][2]="/";
allBlocksCount++
}if(incidentsOrdering[a].trim()=="STATION_UPDATES"){allBlocks[allBlocksCount]=new Array(3);
allBlocks[allBlocksCount][0]="generalUpdatesStationUpdates";
allBlocks[allBlocksCount][1]="left";
allBlocks[allBlocksCount][2]="/";
allBlocksCount++
}if(incidentsOrdering[a].trim()=="TO_STATION_UPDATES"){allBlocks[allBlocksCount]=new Array(3);
allBlocks[allBlocksCount][0]="generalUpdatesToStationUpdates";
allBlocks[allBlocksCount][1]="left";
allBlocks[allBlocksCount][2]="/";
allBlocksCount++
}}allBlocks[allBlocksCount]=new Array(3);
allBlocks[allBlocksCount][0]="liveDepartures";
allBlocks[allBlocksCount][1]="right";
allBlocks[allBlocksCount][2]="/";
allBlocksCount++;
allBlocks[allBlocksCount]=new Array(3);
allBlocks[allBlocksCount][0]="liveArrivals";
allBlocks[allBlocksCount][1]="right";
allBlocks[allBlocksCount][2]="/";
allBlocksCount++;
allBlocks[allBlocksCount]=new Array(3);
allBlocks[allBlocksCount][0]="currentRouteCO2Emission";
allBlocks[allBlocksCount][1]="right";
allBlocks[allBlocksCount][2]="/";
allBlocksCount++;
DeleteCookie(allBlocksArrayName);
SetCookie(allBlocksArrayName,allBlocks);
return allBlocks
}function removeGivenValueFromArray(e,d){var a=new Array();
var b=0;
for(var c=0;
c<e.length;
c++){if(e[c]!=d){a[b++]=e[c]
}}return a
}function generateHeader(c,b){var a=new Ext.BoxComponent({applyTo:"portletDivHeading"+c,baseCls:b});
return a
}function generateText(c,a){var b=new Ext.BoxComponent({applyTo:"portletDivBody"+c,style:"cursor:default",baseCls:a});
return b
}function generatePortlet(c,a){var b=new Ext.ux.Portlet({applyTo:c,id:c,autoHeight:true,title:"",footer:false,forceLayout:true,frame:false,baseCls:"mainSection",collapsible:false});
return b
}function jcheckSlideIn(a,d,c,b){Ext.get(a).slideIn(d,b);
if(mainPortal!=null){mainPortal.fireEvent("expandCollapse",mainPortal,c)
}}function jcheckSlideOut(a,d,c,b){Ext.get(a).slideOut(d,b);
if(mainPortal!=null){mainPortal.fireEvent("expandCollapse",mainPortal,c)
}}var minMainPortalHeight=0;
function setMainPortalHeight(){if(Ext.isIE6||Ext.isOpera){var a=Ext.select("div.x-column-inner").first().dom.clientHeight;
if(Ext.isIE6){if(a<(minHeightForPotal)){Ext.select("div.x-column-inner").first().setHeight(minHeightForPotal,{})
}Ext.get("jc_mainContent").dom.style.height=(a<(minHeightForPotal)?minHeightForPotal:a)
}else{if(Ext.isOpera){Ext.get("jc_mainContent").dom.style.height=(a<(minHeightForPotal)?minHeightForPotal:a)+80
}}}}function addBlock(d,a){if(d=="leftSidePortal"){var c=generatePortlet(a,"left");
leftSidePortal.add(c)
}else{var b=generatePortlet(a,"right");
rightSidePortal.add(b)
}}function drawPortalLayout(){leftSidePortal=new Ext.ux.PortalColumn({cls:"x-portal-column leftColumn",stateful:true,scope:this,applyTo:"leftSection",collapsible:true,columnWidth:0.5,style:Ext.isIE6?"height:"+minHeightForPotal+"px;":"min-height:"+minHeightForPotal+"px;height:auto",forceLayout:true,autoHeight:true});
rightSidePortal=new Ext.ux.PortalColumn({cls:"x-portal-column rightColumn",stateful:true,scope:this,applyTo:"rightSection",style:Ext.isIE6?"height:"+minHeightForPotal+"px;":"min-height:"+minHeightForPotal+"px;height:auto",collapsible:true,columnWidth:0.5,forceLayout:true,autoHeight:true});
for(var b=0;
b<leftContentArray.length;
b++){if(document.getElementById(leftContentArray[b])!=null){addBlock("leftSidePortal",leftContentArray[b])
}}for(var a=0;
a<rightContentArray.length;
a++){if(document.getElementById(rightContentArray[a])!=null){addBlock("rightSidePortal",rightContentArray[a])
}}mainPortal=new Ext.ux.Portal({border:false,applyTo:"mainDataDiv",autoScroll:false,items:[leftSidePortal,rightSidePortal],style:Ext.isIE6?"width:"+mainPortalWidth+"px;height:"+minHeightForPotal+"px;":"width:"+mainPortalWidth+"px;min-height:"+minHeightForPotal+"px;height:auto",header:false,monitorResize:false,width:mainPortalWidth,baseCls:"mainDataSection",listeners:{expandCollapse:function(c,d){window.setTimeout("setMainPortalHeight();",d+100)
},render:function(){Ext.get("mainDataDivBody").setHeight=function(c,d){c=this.adjustHeight(c);
if(!d||!A){return this
}else{this.anim({height:{to:c}},this.preanim(arguments,1))
}return this
}
}}});
removeGivenValueFromArray(blocksShown,"");
jcheckContainerPanel=new Ext.Panel({border:false,applyTo:"jcheckContainerDiv",autoScroll:false,header:false,autoHeight:true,items:[mainPortal]});
setMainPortalHeight();
save_layout.call(mainPortal);
if(Ext.isIE){Ext.select("div.mainSection-header").each(function(d){var c=d.dom.parentNode.clientWidth;
d.dom.style.width=c
})
}}Ext.ux.Portlet=Ext.extend(Ext.Panel,{anchor:"100%",frame:true,collapsible:true,draggable:true,cls:"x-portlet"});
Ext.reg("portlet",Ext.ux.Portlet);
Ext.ux.PortalColumn=Ext.extend(Ext.Container,{layout:"anchor",autoEl:"div",defaultType:"portlet",cls:"x-portal-column"});
Ext.reg("portalcolumn",Ext.ux.PortalColumn);
Ext.ux.Portal=Ext.extend(Ext.Panel,{layout:"column",autoScroll:true,cls:"x-portal",defaultType:"portalcolumn",initComponent:function(){Ext.ux.Portal.superclass.initComponent.call(this);
this.addEvents({validatedrop:true,beforedragover:true,dragover:true,beforedrop:true,drop:true})
},initEvents:function(){Ext.ux.Portal.superclass.initEvents.call(this);
this.dd=new Ext.ux.Portal.DropZone(this,this.dropConfig)
},beforeDestroy:function(){if(this.dd){this.dd.unreg()
}Ext.ux.Portal.superclass.beforeDestroy.call(this)
}});
Ext.reg("portal",Ext.ux.Portal);
Ext.ux.Portal.DropZone=function(a,b){this.portal=a;
Ext.dd.ScrollManager.register(a.body);
Ext.ux.Portal.DropZone.superclass.constructor.call(this,a.bwrap.dom,b);
a.body.ddScrollConfig=this.ddScrollConfig
};
Ext.extend(Ext.ux.Portal.DropZone,Ext.dd.DropTarget,{ddScrollConfig:{vthresh:50,hthresh:-1,animate:true,increment:200},createEvent:function(a,f,d,b,h,g){return{portal:this.portal,panel:d.panel,columnIndex:b,column:h,position:g,data:d,source:a,rawEvent:f,status:this.dropAllowed}
},notifyOver:function(u,s,v){var f=s.getXY(),a=this.portal,m=u.proxy;
if(!this.grid){this.grid=this.getGrid()
}var b=a.body.dom.clientWidth;
if(!this.lastCW){this.lastCW=b
}else{if(this.lastCW!=b){this.lastCW=b;
a.doLayout();
this.grid=this.getGrid()
}}var d=0,k=this.grid.columnX,l=false;
for(var q=k.length;
d<q;
d++){if(f[0]<(k[d].x+k[d].w)){l=true;
break
}}if(!l){d--
}var o,j=false,i=0,t=a.items.itemAt(d),n=t.items.items;
for(var q=n.length;
i<q;
i++){o=n[i];
var r=o.el.getHeight();
if(r!==0&&(o.el.getY()+(r/2))>f[1]){j=true;
break
}}var g=this.createEvent(u,s,v,d,t,j&&o?i:t.items.getCount());
if(a.fireEvent("validatedrop",g)!==false&&a.fireEvent("beforedragover",g)!==false){m.getProxy().setWidth("auto");
if(o){m.moveProxy(o.el.dom.parentNode,j?o.el.dom:null)
}else{m.moveProxy(t.el.dom,null)
}this.lastPos={c:t,col:d,p:j&&o?i:false};
this.scrollPos=a.body.getScroll();
a.fireEvent("dragover",g);
return g.status
}else{return g.status
}},notifyOut:function(){delete this.grid
},notifyDrop:function(k,g,f){delete this.grid;
if(!this.lastPos){return
}var i=this.lastPos.c,b=this.lastPos.col,j=this.lastPos.p;
var a=this.createEvent(k,g,f,b,i,j!==false?j:i.items.getCount());
if(this.portal.fireEvent("validatedrop",a)!==false&&this.portal.fireEvent("beforedrop",a)!==false){k.proxy.getProxy().remove();
k.panel.el.dom.parentNode.removeChild(k.panel.el.dom);
if(j!==false){i.insert(j,k.panel)
}else{i.add(k.panel)
}i.doLayout();
this.portal.fireEvent("drop",a);
var l=this.scrollPos.top;
if(l){var h=this.portal.body.dom;
setTimeout(function(){h.scrollTop=l
},10)
}}delete this.lastPos
},getGrid:function(){var a=this.portal.bwrap.getBox();
a.columnX=[];
this.portal.items.each(function(b){a.columnX.push({x:b.el.getX(),w:b.el.getWidth()})
});
return a
},unreg:function(){Ext.ux.Portal.DropZone.superclass.unreg.call(this)
}});
