var revert = new Array();
var arrAreaNames = new Array('default', 'ea', 'se', 'sc', 'sw', 'ldn', 'mid', 'tyne', 'nw', 'ne');

// Preload images
if (document.images) {
  var flipped = new Array();
  for(i=0; i < arrAreaNames.length; i++) {
    flipped[i] = new Image();
    flipped[i].src = '/site/upload/image/map_' + arrAreaNames[i] + '.gif';
  }
}

// browser detection
var DH = 0;
var an = 0;
var al = 0;
var ai = 0;
if (document.getElementById) {
	ai = 1;
	DH = 1;
	}
else {
	if (document.all) {
		al = 1;
		DH = 1;
		}
	else {
		browserVersion = parseInt(navigator.appVersion);
		if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) {
			an = 1;
			DH = 1;
		}
	}
}

function fd(oi,ws) {
	if (ws == 1) {
		if (ai) {return (document.getElementById(oi).style);}
		else {
			if (al){return (document.all[oi].style);}
			else {
				if (an) {return (document.layers[oi]);}
			};
		}
	} 
	else {
		if (ai) {return (document.getElementById(oi));} 
		else {
			if (al) {return (document.all[oi]);}
			else {
				if (an) {return (document.layers[oi]);}
			};
		}
	}
}

function HandleMouseOut(evt, item, PicToHideID, PicToShowID) {
	ImageOut(PicToHideID, PicToShowID);
	//HideText(evt,item);
}

function HandleMouseOver(evt, item, PicToHideID, PicToShowID) {
	ImageOver(PicToHideID, PicToShowID);
	ShowText(evt,item);
}

function ShowText(evt,oi) {
  for(i=0; i < arrAreaNames.length; i++) {
	if (arrAreaNames[i] != 'default') {
		HideText(evt,arrAreaNames[i])
	}
  }

	ds = fd(oi,1);
	ds.visibility = 'visible';
}

function HideText(evt,oi) {
	ds = fd(oi,1);
	ds.visibility = 'hidden';
}

function ImageOver(PicToHideID, PicToShowID) {
  if(document.images) {
    revert[PicToHideID] = document.images[arrAreaNames[PicToHideID]].src;
    document.images[arrAreaNames[PicToHideID]].src = flipped[PicToShowID].src;
  }
}

function ImageOut(PicToHideID, PicToShowID) {
  // the folowing is commented out so that the image area is still shown on mouse out
  //if(document.images) document.images[arrAreaNames[PicToHideID]].src = revert[PicToShowID];
}
