var routes = new Array()
var route_codes = new Array("EW", "LC", "SC", "SP", "CM", "V1")
routes["EW"] = new Array("East West"      , 144	, 32	, 255)
routes["LC"] = new Array("Logan Central"  , 0	, 192	, 192)
routes["SW"] = new Array("Springwood"     , 255	, 32	, 144)
routes["SC"] = new Array("Slacks Creek"   , 0	, 160	, 80 )
routes["SP"] = new Array("Shailer Park"   , 144	, 0	, 72 )
routes["CM"] = new Array("Crestmead"      , 224	, 112	, 0  )
routes["V1"] = new Array("V1 Bikeway"     , 0	, 48	, 144)
	
var BIKE_MAPS = [
  "Key Map",
  "Map Guide",
  "1 - Underwood Precinct",
  "2 - Rochedale South Precinct",
  "3 - Hillcrest Precinct",
  "4 - Browns Plains Precinct",
  "5 - Logan Central Precinct",
  "6 - Daisy Hill Precinct",
  "7 - Cornubia North Precinct",
  "8 - Boronia Heights Precinct",
  "9 - Regents Park Precinct",
  "10 - Kingston Precinct",
  "11 - Meadowbrook Precinct",
  "12 - Cornubia South Precinct",
  "13 - Park Ridge Precinct",
  "14 - Waterford West Precinct",
  "15 - Loganholme Precinct"
]

var details = new Array() // used during upload of page

function display_route_title(route_code) {
  RC = route_code.toUpperCase()
  col = hex_triplet(routes[RC][1], routes[RC][2], routes[RC][3])
  suffix = (RC != "V1") ? " Route" : ""
  document.write("<table width='100%' border='0' cellpadding='2' cellspacing='0' bgcolor='" + col + "'><tr><td style='FONT-WEIGHT: bold; FONT-SIZE: small; COLOR: white; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif'>")
  document.write(routes[RC][0] + suffix + " (" + RC + ")")
  document.write("</td></tr></table>")
}

function display_route_title_and_top(route_code) {
  RC = route_code.toUpperCase()
  col = hex_triplet(routes[RC][1], routes[RC][2], routes[RC][3])
  suffix = (RC != "V1") ? " Route" : ""
  document.write("<table width='100%' border='0' cellpadding='2' cellspacing='0' bgcolor='" + col + "'><tr><td style='FONT-WEIGHT: bold; FONT-SIZE: small; COLOR: white; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif'>")
  document.write(routes[RC][0] + suffix + " (" + RC + ")</td><td>")
  document.write("<A href='#_top'><IMG height=18 alt='Go to top' hspace=0 src='support/top.gif' width=49 align=right border=0></A>")
  document.write("</td></tr></table>")
}

function display_route_desc_paras(route_code) {
  RC = route_code.toUpperCase()
  for (i = 0; i < route_paras[RC].length; i++) {
    document.writeln("<p>" + route_paras[RC][i] + "</p>")
  }
}

function display_route_link(route_code) {
  RC = route_code.toUpperCase()
  col = hex_triplet(routes[RC][1], routes[RC][2], routes[RC][3])
  suffix = (RC != "V1") ? " Route" : ""
  document.write("<P align=left>View the <A href=\"javascript:window.name='launch_pad'; document.location='route_info_" + RC.toLowerCase() + ".htm'\">route information for the&nbsp;<STRONG>" + routes[RC][0] + suffix + "</STRONG> (" + RC + ")</A></P>")
}

function dec2hex(decimal) {
  // max value is 255
  hex = decimal.toString(16)
  if (hex.length == 1) {
    return "0" + hex
  } else {
    return hex
  }
}

function hex_triplet(r, g, b) {
  return "#" + dec2hex(r) + dec2hex(g) + dec2hex(b)
}

function display_back_link(route) {

  document.writeln("<td align='left' valign='top'>")
  document.writeln("<a href='javascript:bike_home()'>Bike Home</a><br>")
  if (!window.name) {
    document.writeln("<a href='javascript:back_maps()'>Previous</a>")
  } else {
    //document.writeln("<a href='javascript:open_maps()'>Open Maps</a>")
  }
  //document.writeln("<br><a href='feedbackform.htm' target='_blank'><nobr>Feedback Form</nobr></a>")
  document.writeln("</td>")
}

function display_route() {
  route_selected = document.route_form.route_selector[document.route_form.route_selector.selectedIndex].value
  if (route_selected != "0") {
    window.location.href = "route_info_" + route_selected.toLowerCase() + ".htm"
  }
}

function open_maps() {
  window.name='mapper'
  window.location.href = "../pdfs/bike_key_map.pdf"
}

function bike_home() {
  window.location.href = "launch.htm"
}

function display_pdf_map() {
  window.name='mapper'
  pdf_map_selected = document.route_form.pdf_map_selector[document.route_form.pdf_map_selector.selectedIndex].value
  if (pdf_map_selected != "0") {
    window.location.href = "../pdfs/bike_" + pdf_map_selected + ".pdf"
  }
}

function back_maps() {
  history.back()
}

function toggle_detail(sect) {
  de = document.getElementById(sect).style.display
  if (de != "") {
    document.getElementById(sect).style.display = "none"
  } else {
    document.getElementById(sect_detail).style.display = ""
  }
}

function hide_detail_all() {
  for (i = 0; i < details.length; i++) {
    document.getElementById("detail_" + details[i]).style.display = "none"
    document.all("show_hide_" + details[i]).style.backgroundImage = "url(support/button_show.gif)"
    window.scroll(0, 0)
  }
}

function show_detail_all(goto_link) {
  for (i = 0; i < details.length; i++) {
    document.getElementById("detail_" + details[i]).style.display = ""
    document.all("show_hide_" + details[i]).style.backgroundImage = "url(support/button_hide.gif)"
  }
  document.location.href = "#" + goto_link
}

function toggle_detail_all(goto_link) {
  if (document.getElementById("toggle_mode").firstChild.nodeValue.search("Show") != -1) {
    show_detail_all(goto_link)
    document.all("show_hide_master").style.backgroundImage = "url(support/button_hide.gif)"
    document.getElementById("toggle_mode").firstChild.nodeValue = "Hide Details"
  } else {
    hide_detail_all()
    document.all("show_hide_master").style.backgroundImage = "url(support/button_show.gif)"
    document.getElementById("toggle_mode").firstChild.nodeValue = "Show Details"
  }
}

var view_image = ""
var bike_images = new Array()

function bike_image_viewer_1(im) {
  view_image = im
  attributes = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0,width=630,height=530"';
  bike_image_window = window.open("bike_image_viewer.htm", "bike_image_viewer", attributes)
}

function bike_image_viewer_2(im) {
  attributes = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0,width=630,height=530"';
  bike_image_window = window.open("", "", attributes)
  bike_image_window.document.open("text/html", "replace")
  bike_image_window.document.write("<table cellspacing='0' cellpadding='0' border='0' bordercolor='#000000' width='100%'><tr><td bgcolor='yellow'><nobr><strong>&nbsp;" + im.split("/").pop() + " : " + bike_images[im.split("/").pop()] + "</strong></nobr><br>")
  bike_image_window.document.write("<img src='" + im + "'>")
  bike_image_window.document.write("</td></tr></table>")
  bike_image_window.document.close()
}

