var isIE4=(!document.getElementById&&document.all);
var isIE5=(document.getElementById&&document.all);
var isNN4=(document.layers);
var isN6=(document.getElementById&&!document.all);
var Loaded=false;

function Go(field) {
	if (field.options[field.selectedIndex].value != "-") { document.location.href= field.options[field.selectedIndex].value; }
}

function ImageObj(name) {
	if (isNN4) { return FindImageObj(name, document); }
	if (isIE4) { return eval('document.all.' + name); }
	if (isIE5) { return document.getElementById(name); }
	if (isN6) { return document.images[name]; }
	return null;
}

function FindImageObj(name, doc) {
	var i, obj;
	for (i = 0; i < doc.images.length; i++)
	if (doc.images[i].name == name) return doc.images[i];
	for (i = 0; i < doc.layers.length; i++) if ((obj = FindImageObj(name, doc.layers[i].document)) != null) { return obj; }
	return null;
}

function ImageLeft(name) {
	var obj=ImageObj(name);
	if (isNN4) { return obj.x; }
	if (isIE4) {
		x = 0;
		while (obj.offsetParent != null) {
			x += obj.offsetLeft;
			obj = obj.offsetParent;
		}
		x += obj.offsetLeft;
		return x;
	}
	if (isIE5) {
		x = 0;
		while (obj.offsetParent != null) {
			x += obj.offsetLeft;
			obj = obj.offsetParent;
		}
		x += obj.offsetLeft;
		return x;
	}
	if (isN6) {
		x = 0;
		while (obj.offsetParent != null) {
			x += obj.offsetLeft;
			obj = obj.offsetParent;
		}
		x += obj.offsetLeft;
		return x;
	}

	return 0;
}

function ImageTop(name) {
	var obj=ImageObj(name);
	if (isNN4) { return obj.y; }
	if (isIE4) {
		y = 0;
		while (obj.offsetParent != null) {
			y += obj.offsetTop;
			obj = obj.offsetParent;
		}
		y += obj.offsetTop;
		return y;
	}
	if (isIE5) {
		y = 0;
		while (obj.offsetParent != null) {
			y += obj.offsetTop;
			obj = obj.offsetParent;
		}
		y += obj.offsetTop;
		return y;
	}
	if (isN6) {
		y = 0;
		while (obj.offsetParent != null) {
			y += obj.offsetTop;
			obj = obj.offsetParent;
		}
		y += obj.offsetTop;
		return y;
    }
	return 0;
}

function LayerObj(name) {
	if (isNN4) return FindLayerObj(name, document);
	if (isIE4) return eval('document.all.' + name).style;
	if (isIE5) { return document.getElementById(name).style; }
	if (isN6) { return document.getElementById(name).style; }
	return null;
}

function FindLayerObj(name, doc) {
	var i, obj;
	for (i=0; i < doc.layers.length; i++) {
		obj=doc.layers[i];
		if (obj.name == name) return obj;
		if (obj.document.layers.length > 0) if ((obj = FindLayerObj(name, obj.document)) != null) return obj;
	}
	return null;
}


function OpenWindow(url,width,height) {
	var rnd = (Math.round((Math.random()*999)+1));
	var top=Math.round((screen.height-height)/2);
	var left=Math.round((screen.width-width)/2);
	var winname = this.open(url, "w"+rnd, "top="+top+",left="+left+",width="+width+",height="+height+",buttons=no,scrollbars=no,location=no,menubar=no,resizable=no,status=no,directories=no,toolbar=no");
	return winname;
}

function OpenWindowResizeable(url,width,height) {
	var rnd = (Math.round((Math.random()*999)+1));
	var top=Math.round((screen.height-height)/2)-50;
	var left=Math.round((screen.width-width)/2);
	var winname = this.open(url, "w"+rnd, "top="+top+",left="+left+",width="+width+",height="+height+",buttons=no,scrollbars=yes,location=no,menubar=no,resizable=yes,status=no,directories=no,toolbar=no");
	return winname;
}
