//	All JS common used functions
// getObject() is © by Macromedia
// Other functions are © by Harm van Tilborg - 2003-3007

function getObject(name, place) {
	var p,i,x;
	if (!place) place = document;
	if ((p = name.indexOf("?")) > 0 && parent.frames.length) {
		place = parent.frames[name.substring(p+1)].document;
		name = name.substring(0,p);
	}
	if (!(x = place[name]) && place.all) x = place.all[name];
	if (!(x = place[name]) && place.getElementById) x = place.getElementById(name);
	for (i = 0;!x && i < place.forms.length;i++) x = place.forms[i][name];
	for (i = 0;!x && place.layers && i < place.layers.length;i++) x = getObject(name,place.layers[i].document);
	if (x == '') x = 0;
	return x;
}

function addopened(menuname) {
	if (opened != '') {
		opened = opened + '|' + menuname;
	} else {
		opened = menuname;
	}
}

function removeopened(menuname) {
	var opened_array = opened.split("|");
	var loop, inopened = 0;

	opened = '';
	for (loop = 0; loop < opened_array.length; loop++) {

		if (opened_array[loop] != menuname) {
			if (inopened != 0) {
				opened = opened + '|';
			}
			opened = opened + opened_array[loop];
			inopened++;
		}
	}

}

function showstart(name) {
	obj = getObject(name);
	obj.style.position = '';
	obj.style.visibility = 'visible';
}

function showhide(name) {
	if (name == 'home') {
		document.location.href = 'index.php?opened='+opened;
	} else {
		obj = getObject(name);
		if (obj.style.visibility == 'hidden') {
			addopened(name);
			obj.style.position = '';
			obj.style.visibility = 'visible';
		} else {
			removeopened(name);
			obj.style.position = 'absolute';
			obj.style.visibility = 'hidden';
		}
	}
}

function flop(layer) {
	if (layer == 'home') {
		document.location.href = 'index.php';
	} else {
		obj = document.getElementById(layer);
		if (obj) {
			if (obj.style.display == 'none') {
				obj.style.display = 'block';
			} else {
				obj.style.display = 'none';
			}
		}
	}
}

function openwindow(url, width, height) {
	if (!width) {
		width = 980;
	}
	if (!height) {
		height = 800;
	}
	if (url != '') {
		window.open(url, 'dsv', 'resizable=yes, scrollbars=yes, width='+width+', height='+height);
	}
}
