// co_map.js

// WRITE FORM OPTIONS PLACE FUNCTION

var cIndex = new createArray(cityN)
var cSelIndex = new createArray(cityN)

function cityOptions(){
  document.writeln ("<option selected>"+city[0]+"</option>")
  var ii=0
  for (var i = 1; i<cityN; i++){
    if (cn[i]==countyNumber){
      document.writeln ("<option>"+city[i]+"</option>")
      ii++
      cIndex[ii]=i
      cSelIndex[i]=ii
    }
  }
}

function showCity(){
  var i=document.cityForm.citySel.selectedIndex, cIx=cIndex[i]
  if ( i == 0 ) {
    imagename = new Image()
    imagename.src = "frame.jpg" 
    if (ns4) {
      document.pixDiv.document.images["pixImg"].src = imagename.src
    } else {
      document.images["pixImg"].src = imagename.src
    }
    hide("dotDiv")
    hide("pixxDiv")
    hide("infDiv")

  } else {
   overDisplay(city[cIx])
  }
}


// DIV HIDE/UNHIDE FUNCTIONS

ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false

// Show/Hide functions for non-pointer layer/objects
function show(id) {

	if (ns4) document.layers[id].visibility = "show"
	else if (ie4) document.all[id].style.visibility = "visible"
}

function hide(id) {
	if (ns4) document.layers[id].visibility = "hide"
	else if (ie4) document.all[id].style.visibility = "hidden"
}

function display(){
  var locName=city[comNum]
  if ( locName=="" | locName==undefined | cInf[comNum] < 1) {
    if ( locName=="" | locName==undefined ) {
      alert ( "No location selected." )
    } else {
      locName=comName
      alert("No additional information is available about "+locName+".")
    }
  } else {
    open (cName+".htm")
  }
}
var comName="", comNum=0
function overDisplay(location){
//  endDisplay()
  comName=location
  comNum=0
  hide("dotDiv")
  for (var i=0; i < cityN; i++) {
    if (city[i]==comName) {
      comNum=i
      i=cityN
      document.cityForm.citySel.selectedIndex = cSelIndex[comNum]
    }
  }
  if (comNum>0) {
    displayName(comName)
    if  (cPix[comNum] > 0) {
      show("pixxDiv")
    } else {
      hide("pixxDiv")
    }
    if (cInf[comNum]){
      show("infDiv")
    } else {
      hide("infDiv")
    }
    imagename = new Image()
    if (cPix[comNum]==1) {
      imagename.src = "DA_"+cName+".jpg" 
    }
    else {
      imagename.src = "DA_no_picture.gif"
    }
    if (ns4) {
      document.pixDiv.document.images["pixImg"].src = imagename.src
    } else {
      document.images["pixImg"].src = imagename.src
    }
  }
  // SHOW & MOVE MAP DOT
  if (i>0) {
    if ( cX[comNum]!=null && cY[comNum]!=null) {
      show("dotDiv")
      var x = (ratioX*cX[comNum])+parseInt(adjX)
      var y = (ratioY*cY[comNum])+parseInt(adjY)
      dotD.xpos = x
      dotD.ypos = y
      dotD.left = dotD.xpos 
      dotD.top = dotD.ypos
    }
  }
 
}

// INITIALIZE for SHOW & MOVE MAP DOT

function initMapDot(){
  if (ns4) {
    dotD = document.dotDiv
  }
  if (ie4) {
    dotD = dotDiv.style
  }
}

function openCoInst() {
  window.open("co_instructions.htm", "", "scrollbars=yes,resizable=yes,width=450,height=480,toolbar=no,menubar=no,location=no,directories=no,status=no")
}
