
// check w3c standards compliance
var w3c = document.getElementById ? true : false;

// set global variables for elements of the URL
var pagePath = new String(location.pathname);
var pageDirs = new String(pagePath.substring(1, pagePath.lastIndexOf('/', 200)));
var pageName = new String(pagePath.substring(pagePath.lastIndexOf('/', 200)+1, pagePath.lastIndexOf('.', 200)));

// set local variables for use in the 'toggleInfo' function
if (window.infoHold == undefined) {
	infoHold = 'info000';
}
if (window.infoMaxm == undefined) {
	infoMaxm = 000;
}
if (window.infoMinm == undefined) {
	infoMinm = 000;
}
infoPrev = 'empty';

// write styles classes for use in the 'toggleInfo' function
document.write('<style type="text/css">');
if (w3c == true) {
	document.write('.infostyle1 { display: none; }');
}
else {
	document.write('.infostyle1 { display: block; }');
}
document.write('.infostyle2 { display: block; }');
document.write('</style>');

// FUNCTION: toggleInfo - for alternating which page elements are visible or invisible
function toggleInfo(infoName) {
	if (infoName == 'info000' && infoHold == 'info000') {
		infoName = infoPrev;
	}
	if (infoName == 'next') {
		if ((parseFloat(infoHold.substring(4))+1) > infoMaxm ) {
			infoSufx = '000'+infoMinm;
		} else {
			infoSufx = '000'+(parseFloat(infoHold.substring(4))+1);
		}
		infoName = 'info'+infoSufx.substring(infoSufx.length-3,infoSufx.length);
	}
	if (infoName == 'prev') {
		if ((parseFloat(infoHold.substring(4))-1) < infoMinm ) {
			infoSufx = '000'+infoMaxm;
		} else {
			infoSufx = '000'+(parseFloat(infoHold.substring(4))-1);
		}
		infoName = 'info'+infoSufx.substring(infoSufx.length-3,infoSufx.length);
	}
	if (w3c == true) {
		document.getElementById(infoHold).className = 'infostyle1';
		document.getElementById(infoName).className = 'infostyle2';
		// extra action for map pages within the 'places' section
		if (pageDirs == 'places' && pageName.substring(pageName.lastIndexOf('_',50)+1, pageName.length) == 'map') {
			document.getElementById('infomaptx').className = 'infostyle2';
		}
	}
	if (infoName != 'info000') {
		infoPrev = infoName;
	}
	infoHold = infoName;
}

// FILE IMPORT: for map pages within the 'places' section - import 'imagewindow' function
if (pageDirs == 'places' && pageName.substring(pageName.lastIndexOf('_',50)+1, pageName.length) == 'map') {
	document.write('<script type="text/javascript" src="/javascript/imagewindow.js"></script>');
}

