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 listdate="<font style='font-family:Verdana; font-size:13.5pt; color:#000080; font-weight:bold'>As at 20 August 2011</font>";
var n=1
var d=new Array;
d[0]=new Array("Ref No..","Iss","Box","Vehicle","Fleetname","Livery","Operator Name","Fleet No.","Reg No.","Route","Destination","Other Notes","Date","Cert","Qty");
d[n++]=new Array("MB-101a","Com","Paint Can","Dennis Dragon/Duple Metsec 12m","Citybus","All-Over Ad China Paint Flower Brand","-","855","GR 2793","182","City One Shatin","China Paint","Feb-01","Y","1000");
d[n++]=new Array("MB-101b","Com","Paint Can","Dennis Dragon/Duple Metsec 12m","Citybus","All-Over Ad China Paint Flower Brand","-","833","GM 6324","170","Wah Fu","China Paint","May-01","Y","1000");
d[n++]=new Array("MB-101c","Com","Plastic","Dennis Dragon/Duple Metsec 12m","Citybus","All-Over Ad China Paint Flower Brand","-","838","GN 485","182","Sorry I'm Not In Service","China Paint","Aug-01","Y","500");
d[n++]=new Array("MB-101d","Com","Tin","Dennis Dragon/Duple Metsec 12m","Citybus","All-Over Ad China Paint Flower Brand","-","838","GN 485","182","Sorry I'm Not In Service","China Paint  Comes with model of Airbus A300","Aug-01","N","500");
d[n++]=new Array("MB-102","Com","Plastic Card Outer","Dennis Dragon/Duple Metsec 12m","Citybus","Route 118","-","808","GG 5800","118","Siu Sai Wan","Citybus     Also issued by EFE with Reference Number 99501","Nov-00","Y","5280");
d[n++]=new Array("MB-103","Std","Plastic Card Outer","Dennis Dragon/Duple Metsec 12m","Citybus","All-Over Ad Nin Jiom Pei Pa Koa","-","856","GS 4109","182","Central (Macau Ferry)","","Jul-01","Y","2880");
d[n++]=new Array("MB-104","Std","Special Card","Dennis Dragon/Duple Metsec 12m","Citybus","All-Over Ad United Airlines","-","803","GH 290","1","Central","","Nov-01","Y","1088");
d[n++]=new Array("MB-105","Std","Plastic Card Outer","Dennis Dragon/Duple Metsec 12m","Citybus","All-Over Ad Japan Home Centre","-","812","GH 469","10","Kennedy Town","","Dec-01","Y","1088");
d[n++]=new Array("MB-106","Std","Plastic Card Outer","Dennis Dragon/Duple Metsec 12m","Citybus","All-Over Ad Nin Jiom Pei Pa Koa","-","856","GS 4109","182","Shatin (Yu Tsui Court) ","","Nov-02","Y","1088");
d[n++]=new Array("MB-107","Std","Special Card","Dennis Dragon/Duple Metsec 12m","Citybus","Hong Kong  Asia's world city","-","855","GR 2793","1","Central","","Dec-02","Y","2888");
d[n++]=new Array("MB-108","Std","Plastic Card Outer","Dennis Dragon/Duple Metsec 12m","Citybus","Year of the Ram","-","815","GG 9967","8X","Siu Sai Wan","","Apr-03","Y","1066");
d[n++]=new Array("MB-109C","Std","Plastic Card Outer","Dennis Dragon/Duple Metsec 12m","Citybus","The Year of the Dog's Wealthy Bus","-","838","GN 485","102","Aldrich Bay","Citybus Reference Number CM061","Mar-06","Y","688");
d[n++]=new Array("MB-109N","Std","Plastic Card Outer","Dennis Dragon/Duple Metsec 12m","New World First Bus","The Year of the Dog's Wealthy Bus","-","DA93","GR 9720","18","North Point","NWFB Reference Number 20018","Mar-06","Y","688");
d[n++]=new Array("MB-110C","Std","Plastic Card Outer","Dennis Dragon/Duple Metsec 12m","Citybus","Year of the Pig's Prosperous Bus","-","832","GM 5723","789","Admiralty","Citybus Reference Number CM063","Feb-07","Y","888");
d[n++]=new Array("MB-110N","Std","Plastic Card Outer","Dennis Dragon/Duple Metsec 12m","New World First Bus","The Year of the Pig's Prosperous Bus","-","DA95","GR 9217","905","Lai Chi Kok ","NWFB Reference Number 20019 ","Feb-07","Y","888");
d[n++]=new Array("MB-111C","Std","Plastic Card Outer","Dennis Dragon/Duple Metsec 12m","Citybus","The Year of the Rat's Rich Fortune Bus","-","830","GL 3812","780","Chai Wan","Citybus Reference Number CM066","Feb-08","Y","1000");
d[n++]=new Array("MB-111N","Com","Plastic Card Outer","Dennis Dragon/Duple Metsec 12m","New World First Bus","The Year of the Rat's Rich Fortune Bus","-","DA96","GR 9217","113","Choi Hung","NWFB Reference Number 20022","Feb-08","Y","1000");
d[n++]=new Array("MB-112","Std","Plastic Card Outer","Dennis Dragon/Duple Metsec 12m","New World First Bus","","New World First Bus Services Limited","DA93","GR 9720","M590","Central   Express","","Nov-08","Y","1680");
// MBE Code - © K. Ellis - Ver 2.4-mbe 01-10-09
var no_of_models=d.length-1;
function catnolist()
// Produce HTML code for main model list table
{
for (var l=1; l<d.length; l++)
{
//Add non_breakable space to any empty fields to preserve table 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;";
}
// Deal with any problem model entries
// None

// All fields Code - document.write("<tr><td id=x onmouseover = popup("+l+") onmouseout= hide_popup()>"+d[l][0]+"</a></td><td id=x>"+d[l][1]+"</td><td id=x>"+d[l][2]+"</td><td id=x>"+d[l][3]+"</td><td id=x>"+d[l][4]+"</td><td id=x>"+d[l][5]+"</td><td id=x>"+d[l][6]+"</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][11]+"</td><td id=x>"+d[l][12]+"</td><td id=x>"+d[l][13]+"</td><td id=x>"+d[l][14]+"</td></tr>");

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>");

}
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 MBE models.</font></td></tr>");
window.document.getElementById("date").innerHTML=" - "+listdate;
hide_popup();
}


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 ABC";
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'>

// 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>Quantity:</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();

