// ----------------------------------------------------------------------
// browser detection
// ----------------------------------------------------------------------
var V1 = (document.getElementById) ? 1 : 0;
var V2 = (document.all) ? 1 : 0;
var V3 = (document.layers) ? 1 : 0;


// ----------------------------------------------------------------------
// go back one history step
// ----------------------------------------------------------------------
function back() {
	window.history.back();
}

function backback() {
	window.history.back();
	window.history.back();
}


// ----------------------------------------------------------------------
// Launch a window
// ----------------------------------------------------------------------
function imShow(image,w,h,x,y) {
	window.open("http://www.tessin.ch/files/imshow.phtml?image="+image+"&x="+x+"&y="+y, "_blank", "height="+h+",innerHeight="+h+",width="+w+",innerWidth="+w);
}


// ----------------------------------------------------------------------
// Show tessin map
// ----------------------------------------------------------------------
function mapShow(image,w,h,x,y) {
	hh = h + 25;
	scb = "no";
	if (hh > screen.availHeight) {
		hh = screen.availHeight;
		scb = "yes";
	}
	if (w > screen.availWidth) {
		w = screen.availWidth;
		scb = "yes";
	}
	window.open("http://www.tessin.ch/files/mapshow.phtml?image="+image+"&x="+x+"&y="+y, "_blank", "height="+hh+",innerHeight="+hh+",width="+w+",innerWidth="+w+",scrollbars="+scb+",location=no,resizable=yes");
}


// ----------------------------------------------------------------------
// Mouse click on tessin map
// ----------------------------------------------------------------------
function onMapClick(menu,ort) {
	window.opener.location = "http://www.tessin.ch/files/tessin.phtml?menu="+menu+"&action=suchen&typ=&von=0&suchbegriffe=ort::&feld[0]="+ort;
}


// ----------------------------------------------------------------------
// Mouse over an active item on tessin map
// ----------------------------------------------------------------------
function onMapOver(event,ort) {
	if (V1 == 1) {
		document.body.style.cursor='pointer';

		document.getElementById(ort).style.visibility="visible";
		document.getElementById(ort).style.position="absolute";
		document.getElementById(ort).style.left=event.clientX+15;
		document.getElementById(ort).style.top=event.clientY;
	}
	else if (V2 == 1) {
		document.all.style.cursor='hand';

		document.all[ort].style.visibility="visible";
		document.all[ort].style.position="absolute";
		document.all[ort].style.left=event.clientX+15;
		document.all[ort].style.top=event.clientY;
	}
	else if (V3 == 1) {
		document.style.cursor='hand';

		document[ort].style.visibility="visible";
		document[ort].style.position="absolute";
		document[ort].style.left=event.clientX+15;
		document[ort].style.top=event.clientY;
	}
}


// ----------------------------------------------------------------------
// Mouse out of an active item on tessin map
// ----------------------------------------------------------------------
function onMapOut(event,ort) {
	if (V1 == 1) {
		document.body.style.cursor='default';

		document.getElementById(ort).style.visibility="hidden";
	}
	else if (V2 == 1) {
		document.all.style.cursor='default';

		document.all[ort].style.visibility="hidden";
	}
	else if (V3 == 1) {
		document.style.cursor='default';

		document[ort].style.visibility="hidden";
	}
}


// ----------------------------------------------------------------------
// Region window roll over
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
// mouse over event
// ----------------------------------------------------------------------
function regMouseOver(n,reg) {
	var file = "http://www.tessin.ch/bilder/"+reg;

	if (V1 == 1) {
		document.getElementById(n).src = file;
	}
	else if (V2 == 1) {
		document.all[n].src = file;
	}
	else if (V3 == 1) {
		document[n].src = file;
	}
	
}

// ----------------------------------------------------------------------
// mouse out event
// ----------------------------------------------------------------------
function regMouseOut(n,reg) {
	var file = "http://www.tessin.ch/bilder/reg-andere.png";

	if (V1 == 1) {
		document.getElementById(n).src = file;
	}
	else if (V2 == 1) {
		document.all[n].src = file;
	}
	else if (V3 == 1) {
		document[n].src = file;
	}
}

