


var things          = new Array(nofThings);
var thingNo         = 0;

var outlineShown    = false;
var thingSelected   = false; //true disables auto hide
var outlinedElement = "";
var i=0;


//-- o n L o a d
function onLoad() {
//alert("Hej");
}
//-- a f t e r L o a d
function afterLoad() {
   //outline.style.visibility="hidden";
}
//-- s h o w O u t l i n e
function showOutline(thingName,thNo) {
//    alert("Element Name:"+window.event.srcElement.shape);

//  outline.style.visibility="hidden";
  currElement = window.event.srcElement;
  if (!outlineShown || (currElement != outlinedElement)){
    if (window.event.srcElement.shape == "CIRCLE"){
	radie                = currElement.coords.split(",")[2];
        outline.style.left   = currElement.coords.split(",")[0]-radie;
	outline.style.top    = currElement.coords.split(",")[1]-radie;
//alert("Width,Height: "+outlineImg.style.width+", "+outlineImg.style.heigth);
        outlineImg.style.width  = radie*2;
        outlineImg.style.height = radie*2;
//alert("Width,Height: "+outlineImg.style.width+", "+outlineImg.style.heigth);
//alert("thNo: ");
// alert("Coordinates: "+currElement.coords);
	document.all("outlineMap").innerHTML= 
               "<AREA ID=A1 SHAPE  = CIRCLE COORDS= \""+radie+
               ","+radie+
               ","+radie+
               "\" "+
               "HREF=\"javascript:void(0);\""+ 
               "onMouseOver = \"indicateThing("+thNo+", true)\" "+
               "onClick     = \"showItems("+thNo+")\" onMouseOut=\"nd();\"> "
//        alert("innerHTML: "+document.all("outlineMap").innerHTML);
        outlineShown = true;
	outlineImg.style.visibility="visible"; 
        outlineImg.style.zIndex = 1;
//        alert("innerHTML: "+document.all("outlineMap").innerHTML);
        
        outlinedElement = currElement;
    }
    if (window.event.srcElement.shape == "RECT"){
                      left   = currElement.coords.split(",")[0];
        outline.style.left   = currElement.coords.split(",")[0];
                      top1   = currElement.coords.split(",")[1];
	outline.style.top    = currElement.coords.split(",")[1];
                      right  = currElement.coords.split(",")[2];
	outline.style.right  = currElement.coords.split(",")[2];
                      bottom = currElement.coords.split(",")[3];
	outline.style.bottom = currElement.coords.split(",")[3];
//alert("Width,Height: "+outlineImg.style.width+", "+outlineImg.style.right);
        outlineImg.style.width  = currElement.coords.split(",")[2]-currElement.coords.split(",")[0];
        outlineImg.style.height = currElement.coords.split(",")[3]-currElement.coords.split(",")[1];
        outlineImg.style.zindex = 4;
//alert("Width,Height: "+outlineImg.style.width+", "+outlineImg.style.heigth+", "+currElement.coords.split(",")[3]+", "+currElement.coords.split(",")[1]);
//alert("l,t,r,b: "+left+", "+top1+", "+right+", "+bottom+", ");

// alert("Coordinates: "+currElement.coords);
	document.all("outlineMap").innerHTML= 
               "<AREA ID=A1 SHAPE  = RECT COORDS= \""+0+
               ","+0+
               ","+right+
               ","+bottom+
               "\" "+
               "HREF=\"javascript:void(0);\""+ 
               "onMouseOver = \"indicateThing("+thNo+", true)\" "+
               "onClick     = \"showItems("+thNo+")\" onMouseOut=\"nd();\"> "
//        alert("innerHTML: "+document.all("outlineMap").innerHTML);
        outlineShown = true;
	outlineImg.style.visibility="visible"; 
        outlineImg.style.zIndex = 1;
        
        outlinedElement = currElement;
    }
//        alert("innerHTML: "+document.all("outlineMap").innerHTML);
  }
}
//-- n o H i d e
function noHide() {
  //alert("noHide was called");
}
//-- s h o w I t e m s
function showItems(selThingNo) {
//    alert("Map10: ");
//    alert("Scene Map: "+ things[selThingNo]);
//    alert("Map: ");
//    alert("showItems Called: ");
//    alert("showItems ("+ selThingNo+") Called: "+things[selThingNo][0]+" , "+things[selThingNo][1]+" , "+things[selThingNo][2]);  
//    showOutline();
  if (!thingSelected) {  
    top.navList.showItems(things[selThingNo]);
// alert("Map: "+things[selThingNo][0][1]);
    overlib(things[selThingNo][0][2], STICKY, CAPTION, things[selThingNo][0][1],
            BGCOLOR,'steelblue' , CAPCOLOR, 'yellow', CLOSECOLOR, 'white',
            FGCOLOR, 'steelblue', TEXTCOLOR, 'darkblue',
            BORDER,3, WIDTH, 10,HAUTO,VAUTO);
    thingSelected = true;
  }
}
//-- s h o w I t e m 
function showItem(selThingNo,Itemno) {
  if (!thingSelected) {  
    top.navList.showItem(things[selThingNo],Itemno);
// alert("Map: "+things[selThingNo][0][1]);
    overlib(things[selThingNo][0][2], STICKY, CAPTION, things[selThingNo][0][1],
            BGCOLOR,'steelblue' , CAPCOLOR, 'yellow', CLOSECOLOR, 'white',
            FGCOLOR, 'steelblue', TEXTCOLOR, 'darkblue',
            BORDER,3, WIDTH, 10,HAUTO,VAUTO);
    thingSelected = true;
  }
}
//-- i n d i c a t e T h i n g
function indicateThing(outlThinNo, keepOutline) {
//    alert("outlineMap1: "+ document.all("outlineMap").innerHTML+" "+thingName+" "+keepOutline);
//      "<AREA ID=A1 SHAPE  = CIRCLE COORDS=2,2,4 HREF=\"javascript:void(0);\""+ 
//      "onMouseOver = \"indicateThing('Luleå',         CAPTION, \'Luleå\',BORDER,2, WIDTH, 10,HAUTO,VAUTO)\" "+
//      "onClick     = \"showItems(0)\" onMouseOut=\"nd();\"> ");
//    alert("keepOutline1: "+keepOutline);
//alert("call ShowOutline: "+thingName);
if (!thingSelected) {
    if (!keepOutline ) {
//       alert("call ShowOutline: "+thingName);
       showOutline(things[outlThinNo][0][1], outlThinNo);
    }
//    alert("outlineMap2: "+ document.all("outlineMap").innerHTML+" "+thingName+" "+keepOutline);
//    alert("before overlib");
//    alert("Return overlib= "+ overlib(thingName, STICKY, CAPTION, thingName, 
//                   BGCOLOR,'bisque' , CAPCOLOR, '#4B0082', CLOSECOLOR, '#4B0082',
//                   FGCOLOR, '#F0E68C', TEXTCOLOR, '#800000', 
//                   BORDER,2, WIDTH, 10,HAUTO,VAUTO));
    return overlib(things[outlThinNo][0][2], STICKY, CAPTION, things[outlThinNo][0][1], 
                   BGCOLOR,'steelblue' , CAPCOLOR, 'white', CLOSECOLOR, 'white',
                   FGCOLOR, 'steelblue', TEXTCOLOR, 'darkblue', 
                   BORDER,2, WIDTH, 10,HAUTO,VAUTO);
//    alert("after overlib");
} else {
  return true;
}
}
//-- h i d e O u t l i n e
function hideOutline() {
    outlineShown = false;
    outlineImg.style.visibility="hidden";
}
