this.standardbody=(document.compatMode=="CSS2Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
var popwindow=null;
var model=1, copydate="2011"; 
var n=1;
var listdate="<font style='font-family:Verdana; font-size:13.5pt; color:#000080; font-weight:bold'>As at 20 August 2011</font>";
var d=new Array;
d[n++]=new Array("312014","Std","Plastic Card Outer","Dennis Dominator/East Lancs  10m","China Motor Bus","Blue/Cream","-","DD1","BX 2164","84M","Chai Wan","","Feb-04","Y","500");
d[n++]=new Array("AD4585","Std","?","Guy Arab Mk IV/Longwell Green","China Motor Bus","Maroon/Cream","-","-","AD 4585 or AD 4586","9 or 14","?","","Jul-01","?","300");
d[n++]=new Array("B0009","Std","?","MCW Metrobus 11.5m","China Motor Bus","Blue/Cream","-","MB13","BZ 3677","104","Pak Tin","","May-05","Y","500");
d[n++]=new Array("B0010","Std","Plastic White Card Outer","Mitsubishi Rosa","Public Light Bus","Cream/Green Roof","-","-","JS 7393","-","Broadcast Drive","","Jun-05","Y","200");
d[n++]=new Array("B0011","Std","Plastic White Card Outer","Mitsubishi Rosa","Public Light Bus","Cream/Red Roof","-","-","JS 7393","-","Tsuen Wan","","Jun-05","Y","200");
d[n++]=new Array("B0012","Std","Plastic White Card Outer","Guy Arab Mk IV/Longwell Green","China Motor Bus","Maroon/Cream","-","-","AD 4586","8","Chai Wan","","Jun-05","Y","150");
d[n++]=new Array("B0013A","Std","Plastic White Card Outer","Bedford OB","China Motor Bus","Maroon/Cream","-","-","4135","6","Stanley - Vehicular Pier","","Aug-05","Y","200");
d[n++]=new Array("B0013B","Std","Plastic White Card Outer","Bedford OB","China Motor Bus","Maroon/Cream","-","-","4138","1","Happy Valley - Vehicular Pier","","Aug-05","Y","200");
d[n++]=new Array("B0014","Std","Plastic White Card Outer","MCW Metrobus 11.5m","China Motor Bus","Blue/Cream","-","MB33","CA 2258","914","Causeway Bay","","Feb-06","Y","300");
d[n++]=new Array("B0015","Std","Plastic White Card Outer","Ailsa Volvo/Alexander RV 12m","China Motor Bus","Blue/Cream","-","AL2","CT 1003","112","So Uk","","Mar-06","Y","400");
d[n++]=new Array("B0016","Std","?","Dennis Pax/Sparshatts","Kowloon Motor Bus","Red/Cream","-","-","HK 4092","18","Un Long - Sheng Shui","","Apr-06","Y","400");
d[n++]=new Array("B0017","Std","?","MCW Metrobus II 11m","Kowloon Motor Bus","Cream/Red","-","S3M148","EL 7383","27","Shun Tin to Mong Kok (circular)","","May-06","?","400");
d[n++]=new Array("B0018","Std","?","Bedford OB","Kowloon Motor Bus","Red/Cream","-","-","4227","10","Star Ferry - The Monument","","Jun-06","?","400");
d[n++]=new Array("B0019","Std","?","Ailsa Volvo/Alexander RV 12m","China Motor Bus","Blue/Cream","-","AL1","CT 1094","914","Sham Shui Po Ferry","","Jul-06","Y","400");
d[n++]=new Array("B0020A","Std","Plastic White Card Outer","Albion Viking EVK55CL/Duple Dominant","Kowloon Motor Bus","Cream/Gold","-","-","BH 7637","206","Lai Chi Kok","","Sep-06","Y","200");
d[n++]=new Array("B0020B","Std","Plastic White Card Outer","Albion Viking EVK55CL/Duple Dominant","Kowloon Motor Bus","Cream/Gold","-","-","BL 1825","208","Tsim Sha Tsui","","Sep-06","Y","200");
d[n++]=new Array("B0021A","Std","?","Dennis Jubilant/KMB 9.5m","Kowloon Motor Bus","Red/Cream","-","N4","BT 7277","103","Lok Fu","","Nov-06","?","400");
d[n++]=new Array("B0021B","Std","?","Dennis Jubilant/KMB 9.5m","Kowloon Motor Bus","Red/Cream","-","N4","BT 7277","13D","SauMauPing Central","","Nov-06","?","200");
d[n++]=new Array("B0022A","Std","?","Dennis Condor/Alexander RX 12m","China Motor Bus","Blue/Cream","-","DL2","CW 3359","106","Wong Tai Sin","","Aug-07","?","400");
d[n++]=new Array("B0022B","Std","?","Dennis Condor/Alexander RX 12m","China Motor Bus","Blue/Cream","-","DL2","CW 3359","112","North Point","","Aug-07","?","200");
d[n++]=new Array("B0023A","Std","?","Leyland Olympian/Alexander RX 11m","Kowloon Motor Bus","Cream/Red","-","S3BL181","DR 2006","1","Star Ferry","","Jun-07","?","450");
d[n++]=new Array("B0023B","Std","?","Leyland Olympian/Alexander RX 11m","Kowloon Motor Bus","Cream/Red","-","S3BL293","DY 9913"," 60M","Tsen Wan","","Jun-07","?","225");
d[n++]=new Array("B0024A","Std","?","Guy Victory/BUSAF","Kowloon Motor Bus","Red/Cream","-","G2","BJ 9267","112","So Uk","","Nov-07","?","500");
d[n++]=new Array("B0024B","Std","?","Guy Victory/BUSAF","Kowloon Motor Bus","Red/Cream","-","G2","BJ 9267","40","Tsuen Wan Ferry","","Nov-07","?","250");
d[n++]=new Array("B0025A","Std","?","Albion Viking EVK55CL/KMB","Kowloon Motor Bus","Red/Cream","-","L287","BK 8211","64K","Tai Po KCR Station","","Mar-08","?","400");
d[n++]=new Array("B0025B","Std","?","Albion Viking EVK55CL/KMB","Kowloon Motor Bus","Red/Cream","-","L308","BM 248","51","Kam Tin","","Mar-08","?","200");
d[n++]=new Array("B0026A","Std","Plastic White Card Outer","Dennis Dragon/Alexander RX 12m","Kowloon Motor Bus","Cream/Red","-","3N2","CV 2718","112","So Uk","","Jan-08","?","200");
d[n++]=new Array("B0026B","Std","Plastic White Card Outer","Dennis Dragon/Alexander RX 12m","Kowloon Motor Bus","Cream/Red","-","3N3","CW 5424","5","Star Ferry","","Jan-08","?","200");
d[n++]=new Array("B0027A","Std","Plastic White Card Outer","Leyland Olympian/ECW 12m","Kowloon Motor Bus","Cream/Red","-","3BL1","CV 184","112","North Point","","May-08","?","500");
d[n++]=new Array("B0027B","Std","Plastic White Card Outer","Leyland Olympian/ECW 12m","Kowloon Motor Bus","Cream/Red","-","3BL1","CV 184","6","Lai Chi Kok","","May-08","?","250");
d[n++]=new Array("B0028A","Std","?","Dennis Dominator/Duple Metsec 9.5m","Kowloon Motor Bus","Cream/Red","-","DM1","DA 7157","105","Lai Chi Kok","","Nov-08","?","500");
d[n++]=new Array("B0028B","Std","?","Dennis Dominator/Duple Metsec 9.5m","Kowloon Motor Bus","Cream/Red","-","DM18","DB 951","15A","Tsz Wan Shan","","Nov-08","?","250");
d[n++]=new Array("B0029A","Std","?","MCW Metrobus II 12m","Kowloon Motor Bus","Red/Cream","-","M1","CN 870","70M","Wo Che","","Aug-08","?","460");
d[n++]=new Array("B0029B","Std","?","MCW Metrobus II 12m","Kowloon Motor Bus","Red/Cream","-","M1","CN 870","112","North Point","","Aug-08","?","230");
d[n++]=new Array("B0030A","Std","Plastic White Card Outer","Dennis Dart/Duple Metsec 10.2m","Kowloon Motor Bus","White Grey Skirt Red Stripe","-","AA3","FN 1332","284","Sha Tin Central ","","Apr-09","Y","250");
d[n++]=new Array("B0030B","Std","Plastic White Card Outer","Dennis Dart/Duple Metsec 10.2m","Kowloon Motor Bus","White Grey Skirt Red Stripe","-","AA16","FP 1330","34","Kwai Shing Central ","","Apr-09","Y","250");
d[n++]=new Array("B0031A","Std","Plastic White Card Outer","Dennis Dart/Duple Metsec 10.2m","Kowloon Motor Bus","Cream/Red","-","S3N225 ","ES 2621","70","Sheung Shui","","Aug-09","Y","400");
d[n++]=new Array("B0031B","Std","Plastic White Card Outer","Dennis Dart/Duple Metsec 10.2m","Kowloon Motor Bus","Cream/Red","-","S3N242","ES 5859","85K","Heng On","","Aug-09","Y","400");
d[n++]=new Array("B0032A","Std","Plastic White Card Outer","Leyland Olympian/Alexander 11m","Kowloon Motor Bus","White Grey Skirt Red Stripes","-","AL1","DX 2437","6","Star Ferry","","Oct-09","Y","200");
d[n++]=new Array("B0032B","Std","Plastic White Card Outer","Leyland Olympian/Alexander 11m","Kowloon Motor Bus","White Grey Skirt Red Stripes","-","AL1","DX 2437","238","Riveria Garden","","Dec-09","Y","200");
d[n++]=new Array("B0033A","Std","?","Dennis Dragon/Duple Metsec 12m","Kowloon Motor Bus","Cream/Red","-","3N190","DK 8500","38","Kwai Shing (East)","","Feb-10","?","250");
d[n++]=new Array("B0033B","Std","?","Dennis Dragon/Duple Metsec 12m","Kowloon Motor Bus","Cream/Red","-","3N174","DK 5416","88P","Hin Keng","","Feb-10","?","250");
d[n++]=new Array("B0033C","Std","?","Dennis Dragon/Duple Metsec 12m","Kowloon Motor Bus","Cream/Red","-","3N168","DK 4632","27","(Circular)  Shun Tin - Mong Kok","","Feb-10","?","?");
d[n++]=new Array("B0033D","Std","?","Dennis Dragon/Duple Metsec 12m","Kowloon Motor Bus","Cream/Red","-","3N191","DM 3103","42","Cheung Ching","","Jul-10","?","200");
d[n++]=new Array("B0034-260","Std","White Card","Dennis Dart/Carlyle 9.8m","China Motor Bus","Air-conditioned Demonstrator","-","DC1","EU 3821","260","Stanley","","May-10","Y","150");
d[n++]=new Array("B0034-84M","Std","White Card","Dennis Dart/Carlyle 9.8m","China Motor Bus","Cream/Blue","-","DC17","EZ 9823","84M","Siu Sai Wan","","May-10","Y","150");
d[n++]=new Array("B0034A","Std","White Card","Dennis Dart/Carlyle 9.8m","China Motor Bus","Cream/Blue","-","DC2","EZ 1835","A20","Pacific via Central Place","Includes 25 with Destination Airport commissioned by 3cubian.com","Sep-10","Y","300");
d[n++]=new Array("B0034B-15","Std","White Card","Dennis Dart/Carlyle 9.8m","China Motor Bus","Cream/Blue","-","DC13","EZ 4951","15","The Peak","","Aug-10","?","150");
d[n++]=new Array("B0034B-590","Std","White Card","Dennis Dart/Carlyle 9.8m","China Motor Bus","Cream/Blue","-","DC9","EZ 597","590","South Horizons","","Aug-10","?","150");
d[n++]=new Array("B0034K","Std","?","Dennis Dart/Carlyle 9.8m","-","-","-","-","-","-","-","Issued in kit form","May-10","?","?");
d[n++]=new Array("B0035-1A","Std","?","Dennis Dragon/Duple Metsec 12m","Kowloon Motor Bus","Cream/Red","-","3N104","DJ 6533","1A","Star Ferry","","Nov-10","?","500");
d[n++]=new Array("B0035-43X","Std","?","Dennis Dragon/Duple Metsec 12m","Kowloon Motor Bus","Cream/Red","-","3N132","DK 319","43X","Yiu On","","Dec-10","?","500");
d[n++]=new Array("B0035-6C","Std","?","Dennis Dragon/Duple Metsec 12m","Kowloon Motor Bus","Cream/Red","-","3N96","DJ 6962","6C","Kowloon City Ferry","","Nov-10","?","500");
d[n++]=new Array("B0035K","Std","?","Dennis Dragon/Duple Metsec 12m","-","-","-","-","-","-","-","Issued in kit form","May-11","?","?");
d[n++]=new Array("B0036-6","Std","?","Dennis Dragon/Duple Metsec 12m","Kowloon Motor Bus","White Grey Skirt Red Stripes","-","AD1","EL 5113","6","Mei Foo","","Mar-11","?","350");
d[n++]=new Array("B0036-238","Std","?","Dennis Dragon/Duple Metsec 12m","Kowloon Motor Bus","White Grey Skirt Red Stripes","-","AD1","EL 5113","238M","Tseung Wan","","Mar-11","?","");
d[n++]=new Array("B0037A","Std","?","Dennis Dart/Carlyle 9.8m","Kowloon Motor Bus","White","-","AA2","EP 1863","2","Star Ferry","","Jun-11","?","200");
d[n++]=new Array("B0037B","Std","?","Dennis Dart/Carlyle 9.8m","Kowloon Motor Bus","White","-","AA2","EP 1863","2","So Uk","","Jun-11","?","200");
d[n++]=new Array("B0038A","Std","?","MCW Metrobus II 9.7m","Kowloon Motor Bus","Red/Cream","-","M11","CZ 3920","606","Choi Wan","","Jul-11","?","360");
d[n++]=new Array("B0038B","Std","?","MCW Metrobus II 9.7m","Kowloon Motor Bus","Red/Cream","-","M14","CZ 5866","46","Lai Yiu","","Jul-11","?","360");
d[n++]=new Array("BH106B","Std","?","Seddon Pennine IV","China Motor Bus","Blue/Cream","-","SM1","BH 106","-","?","","Feb-02","?","300");
d[n++]=new Array("BH106R","Std","?","Seddon Pennine IV","China Motor Bus","Red/Cream","-","SM1","BH 106","-","?","","Feb-02","?","300");
d[n++]=new Array("BJ352","Std","?","Albion Viking EVK55CY/Duple Dominant","China Motor Bus","Blue/Cream","-","AM1","BJ 352","-","Chung Hom Kok","","Sep-02","?","300");
d[n++]=new Array("BX2164","Std","?","Dennis Dominator/East Lancs  10m","China Motor Bus","Blue/Cream","-","DD1","BX 2164","111","Ping Shek","","Feb-05","Y","300");
d[n++]=new Array("DU4573","Std","?","Mitsubishi Fuso Recovery Truck","Citybus","Yellow","-","-","DU 4573","-","-","","Apr-02","?","?");
d[n++]=new Array("GU9585","Std","White Card","Leyland Victory 2 Tow Truck","Citybus","Yellow/Red/Blue","-","-","GU 9585","-","","","Jun-02","Y","300");
d[n++]=new Array("JN4881","Std","?","Mitsubishi Fuso Recovery Truck","Kowloon Motor Bus","White","-","-","-","-","-","","Nov-01","?","300");

var no_of_models=d.length-1;
// 312 P & T Code - © K. Ellis - Ver 1.0-312_p&t 02-10-10
function catnolist()
// Produce model list table
{
var len=0;
var excep=0;
for (var l=1; l<d.length; l++)
{
// Add non-breakable space to any empty fields to maintain cell borders
for (var f=1; f<15; f++)
{
if ((f==1 || f==2 || f==3||  f==4 || f==7 || f==8 || f==9 || f==12 || f==13) && (d[l][f]=="" || d[l][f]==" ")) d[l][f]="?";
if ((f==5  || f==6 || f==10 || f==11 || f==14) && (d[l][f]=="" || d[l][f]==" ")) d[l][f]="&nbsp;";
}
// Check & deal with any special entries
excep=0;

// Remove any trailing * from dates
d[l][12]=d[l][12].substr(0,6);

// Check cat no. for dual destination models
dual=0;
if (d[l][0].length>5 && d[l][0].charAt(5)=="A") process_dual(l);


if (excep==0 && dual==0) document.write("<tr><td id=x onmouseover = popup("+l+") onmouseout= hide_popup()>"+d[l][0]+"</a></td><td id=x>"+d[l][3]+"</td><td id=x>"+d[l][4]+"</td><td id=x>"+d[l][7]+"</td><td id=x>"+d[l][8]+"</td><td id=x>"+d[l][9]+"</td><td id=x>"+d[l][10]+"</td><td id=x>"+d[l][12]+"</td><td id=x>"+d[l][13]+"</td></tr>");
if (excep==1) model_b(l);
if (dual==1) l++;
}
document.write("<tr><td id=x colspan='15'><p align='center'><font style='color:blue; font-family:arial; font-size:10pt'>&copy; Peter Harrison "+copydate+".<br>This list contains details of  "+ no_of_models+" different 312 P & T models.</font></td></tr>");
window.document.getElementById("date").innerHTML=" - "+listdate;
hide_popup();
}

function process_dual(r)
{
// Do modfied list code for both destinations versions & amend data for popup
dual=1;
var span=2;
d[r][14]+="&nbsp;Across&nbsp;both&nbsp;versions";
var t_qty=d[r][14];
// model a
document.write("<tr><td id=x onmouseover = popup("+r+") onmouseout= hide_popup()>"+d[r][0]+"</a></td><td id=x>"+d[r][3]+"</td><td id=x>"+d[r][4]+"</td><td id=x>"+d[r][7]+"</td><td id=x>"+d[r][8]+"</td><td id=x>"+d[r][9]+"</td><td id=x>"+d[r][10]+"</td><td id=x>"+d[r][12]+"</td><td id=x>"+d[r][13]+"</td></tr>");
r++;
d[r][14]=t_qty;
model_b(r);
}

function model_b(r)
// model b entry (no qty field)
{
document.write("<tr><td id=x onmouseover = popup("+r+") onmouseout= hide_popup()>"+d[r][0]+"</a></td><td id=x>"+d[r][3]+"</td><td id=x>"+d[r][4]+"</td><td id=x>"+d[r][7]+"</td><td id=x>"+d[r][8]+"</td><td id=x>"+d[r][9]+"</td><td id=x>"+d[r][10]+"</td><td id=x>"+d[r][12]+"</td><td id=x>"+d[r][13]+"</td></tr>");
}

function show_popup(divobj){ //Centers a div element on the page
var ie=document.all && !window.opera
var dom=document.getElementById("popup1");
var scroll_top=(ie)? this.standardbody.scrollTop : window.pageYOffset
var scroll_left=(ie)? this.standardbody.scrollLeft : window.pageXOffset
var docwidth=(ie)? this.standardbody.clientWidth : window.innerWidth-this.scrollbarwidth
var docheight=(ie)? this.standardbody.clientHeight: window.innerHeight
var docheightcomplete=(this.standardbody.offsetHeight>this.standardbody.scrollHeight)? this.standardbody.offsetHeight : this.standardbody.scrollHeight //Full scroll height of document
var objwidth=560 //width of div element
var objheight=340//height of div element
var topposition=(docheight>objheight)? scroll_top+docheight/2-objheight/2+"px" : scroll_top+10+"px" //Vertical position of div element: Either centered, or if element height larger than viewpoint height, 10px from top of viewpoint
//dom.style.left=100
dom.style.top=Math.floor(parseInt(topposition))+"px"
dom.style.visibility="visible";
dom.style.width="560"
dom.style.height="auto"
}

function hide_popup()
// Hide pop up division
{
var obj=window.document.getElementById("popup1");
obj.style.visibility="hidden";
}

function popup(l)
// process raw model data, pre-format fields for pop-up window
{
var fno=d[l][7];
var reg=d[l][8];
var release=d[l][1];
var details=d[l][11];
var cert=d[l][13];
var qty=d[l][14];
var month=d[l][12].substr(0,3);
var yt= d[l][12].substr(4,2);
if (yt=="") yt="88";
if (d[l][4]=="") d[l][4]="&nbsp;";
switch(month)
{
case "Jan" : month="January"; break;
case "Feb" : month="February"; break;
case "Mar" : month="March"; break;
case "Apr" : month="April"; break;
case "Jun" : month="June"; break;
case "Jul" : month="July"; break;
case "Aug" : month="August"; break;
case "Sep" : month="September"; break;
case "Oct" : month="October"; break;
case "Nov" : month="November"; break;
case "Dec" : month="December"; break;
case "?" : month="Unknown"; break;
}
var year=parseInt(yt,10);
if (fno=="-") fno="None";
if (reg=="-") reg="None";
if (details.length==0) details="-";
if (cert=="Y") cert="Yes"; else cert="No";
if (release=="Std") release="Standard";
if (release=="Com") release="Commissioned";
if (qty.length==0) qty="Not disclosed by Corgi";
if (year>88) year+=1900; else year+=2000;
if (year==2088) year="";

// HTML Code strings for pop up window
// <img width=568 height=48 border=0 src='pop_header1.gif'>
var info1="<center><table width=98% border=1 cellpadding=2 cellspacing=1 bordercolor=#687BF8><tr><td id=ph colspan=2>"+d[l][0]+" - "+d[l][3]+"<br>"+d[l][4]+"</td></tr><tr><td colspan=2 align=left id=px><b>Operator:</b> "+d[l][6]+"</td></tr><tr><td colspan=2 align=left id=px><b>Livery:</b> "+d[l][5]+"</td></tr><tr><td width=50% id=px><b>Fleet No.:</b> "+fno+"</td><td width=50% id=px><b>Registration:</b> "+reg+"</td></tr>";
var info2="<tr><td colspan=2 align=left id=px><b>Route &amp; Destination:</b> "+d[l][9]+" "+d[l][10]+"</td></tr><tr><td id=px><b>Issue Type:</b> "+release+"</td><td id=px><b>Release Date:</b> "+month+" "+year+"</td></tr><tr><td colspan=2 id=px><b>Box Type:</b> "+d[l][2]+"</td></tr><tr><td id=px><b>Models&nbsp;Produced: </b> "+qty+"</td><td id=px><b>Certificated:</b> "+cert+"</td></tr><tr><td colspan=2 id=px><b>Notes:</b> "+details+"</td></tr></table><font style='color:blue; font-family:arial; font-size:10pt'>&copy; Peter Harrison "+copydate+"</font></center>";
//</body></html>";

// Insert model data into hidden pop up window division & make visible
hide_popup();
document.getElementById("popup1").innerHTML=info1+info2;
show_popup("popup1");
}

catnolist();

