
var ds=new Ext.data.JsonStore({url:'placemark-data.php',root:'root',fields:['WB','PWR','POD','Licences','LUA','EA','EPA'],loadMask:{msg:'Loading. . .'}});Ext.XTemplate.override({exists:function(o){return typeof o!=='undefined'&&o!==null&&o!=='';}});var tpl=new Ext.XTemplate('<tpl for=".">','<div id="pm">','<h1>{WB} ({PWR} MW) <a href="http://a100.gov.bc.ca/pub/wtrwhse/water_licences.output?p_Source_Name=&p_Licence_No=&p_Priority_Issue_Date=&p_POD_Purpose=&chk_Appurtenant_Land=x&p_POD_Qty_Equality=%3D&p_POD_Qty=&chk_Licence_Comments=x&chk_POD_Qty_Flag_Desc=&chk_Date_Updated=&p_Licensee=&p_Dist_Prec_Name=&chk_Client_No=x&p_Client_No=&chk_Points_Code=x&p_Points_Code={POD}&chk_File_No=&p_File_No=&p_WR_Map=&chk_PCL_No=&p_PCL_No=&chk_Watershed=&p_Watershed=&p_Export=Screen" target="_blank">PD79056</a></h1>','<tpl if="Licences.length != 0">','<table  width="100%">','<tr><th>Licence</td><th>Purpose</td><th>Status</th><th>Priority Date</th><th>Quantity</th></tr>','<tpl for="Licences">','<tr><td><a href="http://a100.gov.bc.ca/pub/wtrwhse/water_licences.output?p_Source_Name=&p_Licence_No={licno}&p_Priority_Issue_Date=&p_POD_Purpose=&chk_Appurtenant_Land=x&p_POD_Qty_Equality=%3D&p_POD_Qty=&chk_Licence_Comments=x&chk_POD_Qty_Flag_Desc=&chk_Date_Updated=&p_Licensee=&p_Dist_Prec_Name=&chk_Client_No=x&p_Client_No=&chk_Points_Code=x&p_Points_Code=&chk_File_No=&p_File_No=&p_WR_Map=&chk_PCL_No=&p_PCL_No=&chk_Watershed=&p_Watershed=&p_Export=Screen" target="_blank">{licno}</a></td>','<td>{purpose}</td>','<td>{status}</td>','<td>{pdate}</td>','<td>{q} {units}</td></tr>','</tpl></table>','</tpl>','<tpl if="LUA.length != 0">','<h1>Land Tenure Application(s)</h1>','<table width="100%" >','<tr><th>Purpose</th><th>Status</th><th>Area</th></tr>','<tpl for="LUA">','<tr>','<td><a href="http://www.arfd.gov.bc.ca/ApplicationPosting/viewpost.jsp?PostID={id}" target="_blank">{purpose}</a></td>','<td width="75px">{status}</td>','<td width="75px">{area}</td>','</tr>','</tpl>','</table>','</tpl>','<tpl if="this.exists(EA)==true">','<h1>Environmental Assesment</h1>','<table width="100%" >','<tpl for="EA">','<tr><td><a href="http://a100.gov.bc.ca/appsdata/epic/html/deploy/epic_project_home_{id}.html"  target="_blank">{name}</a></td><td>{status}</td><td> {start}</td></tr>','</tpl>','</table>','</tpl>','<tpl if="EPA.length !==0">','<h1>Energy Purchase Agreement</h1>','<table width="100%">','<tpl for="EPA">','<tpl if="this.exists(url)==true">','<tr><th>Name:</th><td><a href="{url}" target="_blank">{name}</a></td></tr>','</tpl>','<tpl if="this.exists(url)==false">','<tr><th>Name</th><td>{name}</td><tr>','</tpl>','<tr><th>BC Hydro</th><td>{rfp}</td><tr>','<tr><th>Capacity</th><td>{capacity} MW</td><tr>','<tr><th>Annual energy</th><td>{energy} GWh</td><tr>','<tr><th>Contract Length</th><td>{years} Years</td><tr>','</tpl>','</table>','</tpl>','</div>','</tpl>');var licDialog=function(){var win,showBtn;return{showDialog:function(licNo){if(!win){win=new Ext.Window({layout:'fit',modal:true,width:500,height:'auto',closeAction:'hide',plain:true,autoScroll:true,title:"Licence",items:new Ext.DataView({id:'lic-details',store:ds,loadMask:true,tpl:tpl,deferredRender:false,border:true,height:'auto',prepareData:function(data){return data;},itemSelector:"div:first"}),buttons:[{text:'Close',handler:function(){win.height=20;win.hide();}}]});}
var el=Ext.getCmp("lic-details");el.store.load({params:{id:licNo}});win.show(this);}};}();