var mydate=new Date()
var year=mydate.getYear()
if (year<200) year=1900+year
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")

function todayText() {
    document.writeln("<Center><font class=todayText>"+dayarray[day]+", "+daym+" "+montharray[month]+" "+year+"</font></center>")
}


function dateText() {
    var today=new Date();
    var month=today.getMonth()
    var months=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")   
    var thisDate=today.getDate()+months[month]
    //alert(thisDate);

    switch (thisDate) {
    case "1Jan":  text="Happy New Year!"; break;
    case "1Mar":  text="During March 1966 the Austin Countryman & Morris Traveller were launched at Geneva Motor Show"; break;
    case "19Jun": text="On this day in 1974 the last Vanden Plas Princess 1300 rolled off the production line"; break;
    case "15Aug": text="On this day in 1962 the Morris 1100 was launched"; break;
    case "6Sep":  text="On this day in 1963 the Austin 1100 was launched"; break;
    case "1Oct":  text="On this day in 1969 the Austin/Morris 1300 GT was launched."; break;
    case "2Oct":  text="Alec Issigonis passed away on this day in 1988."; break;
    case "14Oct": text="On this day in 1971 the Austin 1300 Mk 3 was launched."; break;
    case "18Nov": text="Alec Issigonis was born this day in Izmir in 1906."; break;
    case "22Nov": text="On this day in 1975 BL announced it would be selling remaining ADO16 body shells"; break;
    case "21Dec": text="On this day in 1967 the Morris 1300 was launched."; break;
    case "24Dec": text="It's Christmas Eve!"; break;
    case "25Dec": text="Merry Christmas."; break;
    default: text="ADO16: Without a doubt Britain’s best selling car between 1963 - 1974"; break;
}
document.writeln("<Center><font class=dateText>" + text + "</font></Center>")
}

function contactMe(who, where) {
    prefix = '<A class=tbar HR' + 'EF="ma' + 'ilto:'
    midfix = who + '&#64' + where
    suffix = '">Email</A>'
    document.write(prefix+midfix+suffix)
}

function comments() {
    window.location = "mailto:webmaster@ado16.info"+"?subject=Comments on www.ado16.info" + "&body=I have something I'd like to comment on: "+window.location;
}

function reportError() {
    window.location = "mailto:webmaster@ado16.info"+"?subject=Error on www.ado16.info" + "&body=I have found an error on: "+window.location;
}

function coverStar() {
    window.location = "mailto:register@ado16.info"+"?subject=Web site cover star" + "&body=Please find below my web site cover star submission: "+document.title+" "+window.location;
}

///// Cookie code (borrowed & adapted from Duncan Crombie) /////

var cookee = document.cookie;

function getCookie(name) { // use: getCookie("name");
    var index = cookee.indexOf(name + "=");
    if (index == -1) return null;
    index = cookee.indexOf("=", index) + 1;
    var endstr = cookee.indexOf(";", index);
    if (endstr == -1) endstr = cookee.length;
    return unescape(cookee.substring(index, endstr));
  }


function setCookie(name, value) { 
    var cToday = new Date();
    var cExpiry = new Date(cToday.getTime() + 1 * 24 * 60 * 60 * 1000);
    if (value != null && value != "") {
    document.cookie=name + "=" + escape(value) + "; expires=" + cExpiry.toGMTString();
    cookee = document.cookie;}
  }


function deleteCookie(cookieName) {
    var cToday = new Date();
    var cExpired = new Date(cToday.getTime() - 48 * 60 * 60 * 1000);
    document.cookie=cookieName + "=null; expires=" + cExpired.toGMTString();
    cookee = document.cookie;
  }

function welcome() {
    if (getCookie("beenb4") == null) {
    document.write("Welcome")
    setCookie ("beenb4","true") }
    else {document.write("Welcome back") }
  }

function lastModd()

{

      //lastmod = self.parent.main.document.lastModified     // get string of last modified date
      lastmod = document.lastModified     // get string of last modified date
      lastmoddate = Date.parse(lastmod)   // convert modified string to date
      if(lastmoddate == 0){               // unknown date (or January 1, 1970 GMT)
         lmText = ""
      } else {
        d = new Date(lastmoddate);
        lmday=dayarray[d.getDay()];
        lmmon=montharray[d.getMonth()];
        lmdte=d.getDate(); lmyr=d.getFullYear();
        lmh=d.getHours(); if (lmh < 10) {lmh = "0"+lmh}
	lmm=d.getMinutes(); if (lmm < 10) {lmm = "0"+lmm}
        lmText = "<P CLASS=comments>This page was last modified on " + lmday + ", " + lmdte + " " + lmmon + " " + lmyr + " at " + lmh + ":" + lmm + "</P>";
      }

	document.write(lmText)
}

function pageTurner(newPage)

{
    switch (newPage)
    {
    case 0: if (pageno > 1) {pageno = pageno - 1; break;} else {break;}
    case 99: if (pageno < maxpage) {pageno = pageno + 1; break;} else {break;} 
    default: pageno = newPage;
    }
    document.brochure.src = bropage[pageno].src
}

function ad1(){
win10=window.open("videos/ad1.html","","width=420,height=400")
win10.creator=self
}

function ad2(){
win11=window.open("videos/ad2.html","","width=420,height=400")
win11.creator=self
}

function ad3(){
win12=window.open("videos/ad3.html","","width=420,height=400")
win12.creator=self
}

function ad4(){
win13=window.open("videos/ad4.html","","width=420,height=400")
win13.creator=self
}

function ad5(){
win14=window.open("videos/ad5.html","","width=420,height=400")
win14.creator=self
}

function ad6(){
win15=window.open("videos/ad6.html","","width=420,height=400")
win15.creator=self
}

function ad7(){
win16=window.open("videos/ad7.html","","width=420,height=400")
win16.creator=self
}

function Pix(){	//constructor
this.items=new Array;
this.add=addPix;
this.get=getPix;
}

function addPix(pixURL,pixCaption){	//method to add record
var rec=new Object;
rec.url=pixURL;
rec.cap=pixCaption;
var itemCount=this.items.length;
this.items[itemCount]=rec;
}

function getPix(){	 //method to get record
var itemCount=this.items.length;
var idx=Math.round(Math.random()*(itemCount-1));
var rec=this.items[idx];
var buf='<img src="' + rec.url + '" alt="Picture of the Day">';
buf+='<div>' + rec.cap + '</div>';
return buf;
}

var potd=new Pix; //create your list
potd.add("images/wcs/feb11_01.jpg","<p class=cover>Oliver Coordt's 1970 Austin 1100.<br><br>Seen here on a wintery day admiring the view.</p>");
potd.add("images/wcs/feb11_02.jpg","<p class=cover>Oliver Coordt's 1970 Austin 1100.<br><br>Seen here on a wintery day admiring the view.</p>");
potd.add("images/wcs/apr04.jpg","<p class=cover>Neil Castle's Mk1 Wolseley 1100 named Winnie.<br><br>Neil is lucky enough to be a model owner! You can find out more on the community pages</p>");
potd.add("images/wcs/apr06.jpg","<p class=cover>Terry Trueman's Austin 1100 Mk3.<br><br>You're probably questioning my choice of image here. But there's a good reason I chose this shot. I like the clean look of the base models, and this shot shows just how basic you got! No opening back windows here!</p>");
potd.add("images/wcs/apr08.jpg","<p class=cover>Chris Jones' Wolseley heavily modified Wolseley 1300.<br><br>Luxourious from the ground up, this is certainly high society!</p>");
potd.add("images/wcs/apr10.jpg","<p class=cover>The Wolseley shared its dashboard with the MG for many years.<br><br>Here the Mk1 strip speedo is proudly on show.</p>");
potd.add("images/wcs/may11.jpg","<p class=cover>Ady Horner's Austin 1300 kitted out ready for a Wedding.</p>");
potd.add("images/wcs/june11.jpg","<p class=cover>Felix Weilenmann's Austin 1100 MkII.<br><br>Felix is the second owner of the 1100. The car has covered 95,000km from new, and is original throughout.</p>");
potd.add("images/wcs/aug03.jpg","<p class=cover>Todd Miller's second Austin America.<br><br> This particular example is finished in Damask Red, and is polished to perfection! Notice the white car reflecting in the rear quarter panel?</p>");
potd.add("images/wcs/aug04.jpg","<p class=cover>Geoffrey Boston's 1964 Morris 1100 seen here in 1965! Geoffrey comments that Morris 1100 was bought new in December 1964 and was probably the best out of all the 1100's he owned.</p>");
potd.add("images/wcs/aug05.jpg","<p class=cover>Peter Barrowclough's Mk3 Austin 1300GT.<br><br>Peter bought this un-restored 1300GT from a fellow 1100 Club member. What a purchase!</p>");
potd.add("images/wcs/aug06.jpg","<p class=cover>A sorry end for a 1965 Morris 1100.<br><br>This 1100 was spotted decaying in a field. Further pictures are available on the spotted page.</p>");
potd.add("images/wcs/aug10.jpg","<p class=cover>Oliver Coordt's 1970 Austin 1300.<br><br>Oliver's 1300 was originally registered in the UK (SFJ 669J) and is pictured here in June 2010 during sunset in Lüdenscheid, Germany.</p>");
potd.add("images/wcs/aug11.jpg","<p class=cover>Alexander Attard's 1968 Morris 1300. Do not adjust your monitor, it's snow, not a badly tuned picture!</p>");
potd.add("images/wcs/sept11.jpg","<p class=cover>Charlotte Brown's 1970 Riley 1300.</p>");
potd.add("images/wcs/oct11.jpg","<p class=cover>Scott Dalton's 1971 Austin America. This could almost pass as a BMC/BL press photograph.</p>");
potd.add("images/wcs/nov10.jpg","<p class=cover>Stephen McEvoy's 1964 Austin 1100.<br><br>Stephen's Austin is seen taking a break in rather murky circumstances!</p>");
potd.add("images/wcs/dec10_02.jpg","<p class=cover>Martin Brown's 1964 Austin 1100.<br><br>Martin's daughter has named the car Basil. Anybody know why?</p>");



function changePage(tabID) {
  switch(tabID) {
  //History & Development//
  case "Ado74": pageName="ado74.php"; break;   
  case "BritainsBest": pageName="britains_best_seller.shtml"; break;   
  case "BuildingBritains": pageName="building_britains_best_seller.shtml"; break;   
  case "Commercial": pageName="ado16_van.shtml"; break;   
  case "History": pageName="ado16_history.shtml"; break;   
  case "IfAmerican": pageName="american_market.shtml"; break;   
  case "IfAustralian": pageName="australian_market.shtml"; break;   
  case "IfChilean": pageName="chilean_market.shtml"; break;   
  case "IfItalian": pageName="italian_market.shtml"; break;   
  case "IfSpanish": pageName="spanish_market.shtml"; break; 
  case "IfSouth": pageName="south_african_market.shtml"; break; 
  case "MakesModels": pageName="makes_models.shtml"; break; 
  case "ProductionFigs": pageName="production_figures.shtml"; break; 
  case "PropADO22": pageName="ado22.shtml"; break; 
  case "PropAero": pageName="aerodynamic.php"; break; 
  case "protoTypes": pageName="prototypes.php"; break;   
  case "ProtoGlass": pageName="glass_fibre_morris_1300.php"; break; 
  case "SRV5": pageName="srv5.php"; break; 
  //Cars//
  case "corOlla": pageName="1300_corolla.php"; break;    
  case "cutAway": pageName="austin_1100_countryman_cutaway.php"; break;    
  case "Brochures": pageName="brochures.php"; break;   
  case "CinemaAdverts": pageName="videos_adverts.php"; break; 
  case "ColourCharts": pageName="colour_charts.php"; break;    
  case "Conversions": pageName="conversions.php"; break;  
  case "CoverStars": pageName="coverstars.php"; break;  
  case "DER": pageName="der_vans.shtml"; break;
  case "DuoTone": pageName="duo_tone.php"; break;  
  case "inVashrew": pageName="invashrew.php"; break;    
  case "KitCars": pageName="kit_cars.php"; break;  
  case "LookaLikes": pageName="look_a_likes.shtml"; break;
  case "MeetOur": pageName="our_ado16s.php"; break;
  case "mySterious": pageName="mysterious_mg.php"; break;
  case "PoliceCars": pageName="police_cars.shtml"; break;
  case "RallyCars": pageName="rally_cars.php"; break;
  case "SafetyVideos": pageName="videos_safety.php"; break;
  case "ServiceBulletins": pageName="service_bulletins.php"; break;
  case "Spotted": pageName="spotted.php"; break;  
  case "Trivia": pageName="trivia.shtml"; break;
  case "WebsiteCoverStars": pageName="WCS.php"; break;
  case "WCS2003": pageName="web_site_cover_stars_2003.php"; break;
  case "WCS2004": pageName="web_site_cover_stars_2004.php"; break;
  case "WCS2005": pageName="web_site_cover_stars_2005.php"; break;
  case "WCS2006": pageName="web_site_cover_stars_2006.php"; break;
  case "WCS2007": pageName="web_site_cover_stars_2007.php"; break;
  case "WCS2008": pageName="web_site_cover_stars_2008.php"; break;
  case "WCS2009": pageName="web_site_cover_stars_2009.php"; break;
  case "WCS2010": pageName="WCS2010.php"; break;  
  //Conversions//
  case "CrayCon": pageName="crayford_convertible.shtml"; break;   
  case "CrayEst": pageName="crayford_estate.shtml"; break; 
  case "CrayVent": pageName="crayford_ventilation.shtml"; break;
  case "Jensen": pageName="jensen_convertible.php"; break; 
  case "Marchal": pageName="marchal_headlamp_conversion.shtml"; break; 
  case "Alexander": pageName="alexander.shtml"; break; 
  case "Broadspeed": pageName="broadspeed.shtml"; break; 
  case "Downton": pageName="downton.shtml"; break; 
  case "Mangoletsi": pageName="mangoletsi.shtml"; break; 
  case "Rjv": pageName="rjv_tuning.shtml"; break; 
  case "Speedwell11": pageName="speedwell_1100_gt.shtml"; break; 
  case "Speedwell13": pageName="speedwell_1300_gt.shtml"; break;
  case "Supremo": pageName="austin_1100_supremo.shtml"; break; 
  //Owning an ADO16//
  case "airCon": pageName="Downloads/air-conditioning.pdf"; break;
  case "Buying": pageName="buying.shtml"; break;  
  case "disMantle": pageName="Downloads/HS_dismantle.pdf"; break;  
  case "tuNing": pageName="Downloads/HS_tuning.pdf"; break;
  case "dashBoard": pageName="dashboard_layouts.php"; break;
  case "dimensions": pageName="dimensions.php"; break;  
  case "eventReports": pageName="event_reports.php"; break;  
  case "gettingStarted": pageName="getting_started.shtml"; break;  
  case "identification": pageName="identification.php"; break;  
  case "priceGuide": pageName="price_guide.shtml"; break;  
  case "register": pageName="register.php"; break;  
  case "restoration": pageName="restoration_index.shtml"; break;  
  case "servicing": pageName="service_index.shtml"; break;  
  case "services": pageName="services.php"; break;  
  case "suspension": pageName="suspension_ride_height.php"; break;  
  case "weights": pageName="weights.php"; break;  
  //Community//
  case "faceBook": pageName="http://www.facebook.com/group.php?gid=294419837632"; break;
  case "foRum": pageName="http://www.forums.ado16.info"; break;  
  case "gwNc": pageName="guest_writers_castle.shtml"; break;  
  case "gwKh": pageName="guest_writers_hallock.shtml"; break;  
  case "gwAj": pageName="guest_writers_jones_a.shtml"; break;  
  case "gwCj": pageName="guest_writers_jones.shtml"; break;  
  case "gwEs": pageName="guest_writers_sharpe.shtml"; break;  
  case "gwTt": pageName="writers_trueman.php"; break;  
  case "redTel": pageName="red_telephone_box.shtml"; break;  
  case "cloSure": pageName="list_closure.shtml"; break;  
  case "nEws": pageName="news.shtml"; break;  
  //Menu structure//
  case "Tab1": pageName="index.php"; break;
  case "Tab2": pageName="hist_dev.php"; break;
  case "Tab3": pageName="cars.php"; break;
  case "Tab4": pageName="owning_an_ado16.php"; break;
  case "Tab5": pageName="community.php"; break;
  case "Tab6": pageName="http://www.forums.ado16.info/"; break;
  case "TL62": pageName="timeline_1962.php"; break; 
  case "TL63": pageName="timeline_1963.php"; break;
  case "TL64": pageName="timeline_1964.php"; break;
  case "TL65": pageName="timeline_1965.php"; break;
  case "TL66": pageName="timeline_1966.php"; break;
  case "TL67": pageName="timeline_1967.php"; break;
  case "TL68": pageName="timeline_1968.php"; break;
  case "TL69": pageName="timeline_1969.php"; break;
  case "TL70": pageName="timeline_1970.php"; break;
  case "TL71": pageName="timeline_1971.php"; break;
  case "TL72": pageName="timeline_1972.php"; break;
  case "TL73": pageName="timeline_1973.php"; break;
  case "TL74": pageName="timeline_1974on.php"; break;
  //General pages//
  case "coverStar": pageName="coverstars.php"; break;

  }
  location.href = pageName;
}
