var isIE4=(!document.getElementById&&document.all);
var isIE5=(document.getElementById&&document.all);
var isNN4=(document.layers);
var isN6=(document.getElementById&&!document.all);
//if (document.getElementById&&(navigator.userAgent.indexOf('Opera') != -1)) {
//var opera = 1; } else { var opera = 0; }
if(is_opera) isIE5 = false;

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]; }
    if (is_opera) { return document.getElementById(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 ImL(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 || isN6) {
		x = 0;
		while (obj.offsetParent != null) {
			x += obj.offsetLeft;
			obj = obj.offsetParent;
		}
		x += obj.offsetLeft;
		return x;
	}
    if(is_opera) { 
        var curleft = 0;
        if (obj.offsetParent) 	{
            while (obj.offsetParent) {
                curleft += obj.offsetLeft;
                obj = obj.offsetParent;
            }
        }
        else if (obj.x)
            curleft += obj.x;
         return curleft; 
    }
	return 0;
}

function ImT(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 || isN6) {
		y = 0;
		while (obj.offsetParent != null) {
			y += obj.offsetTop;
			obj = obj.offsetParent;
		}
		y += obj.offsetTop;
		return y;
	}
    if(is_opera) {
    var curtop = 0;
	var printstring = '';
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			printstring += ' element ' + obj.tagName + ' has ' + obj.offsetTop;
			curtop += obj.offsetTop;
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	window.status = printstring;
	return curtop;}
	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; }
    if (is_opera) { 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;
}
