// myapi is a javascript library  based on the 'dynapi', originally written by dan steinman,
// now adapted for Netscape 6 functionality by budi scheidegger, http://www.budis-teststrecke.ch
// Copyright (C) 1999 Dan Steinman, http://www.dansteinman.com/dynapi/
// Distributed under the terms of the GNU Library General Public License

function BrowserCheck() {
	var b = navigator.appName
	if (b=="Netscape") this.b = "ns"
	else if (b=="Microsoft Internet Explorer") this.b = "ie"
	else this.b = b
	this.v = parseInt(navigator.appVersion)
	this.ns = (this.b=="ns" && this.v>=4)
	this.ns4 = (this.b=="ns" && this.v==4)
	this.ns5 = (this.b=="ns" && this.v==5)
	this.ie = (this.b=="ie" && this.v>=4)
	this.ie4 = (navigator.userAgent.indexOf('MSIE 4')>0)
	this.ie5 = (navigator.userAgent.indexOf('MSIE 5')>0)
	if (this.ie5) this.v = 5
	this.min = (this.ns||this.ie)
	this.obie = (document.all)? true:false
	this.obns = (document.layers)? true:false
	this.obn6 = (document.getElementById) ? true:false
}
is = new BrowserCheck();

function css(id,left,top,width,height,color,vis,z,other) {
	if (id=="START") return '<STYLE TYPE="text/css">\n'
	else if (id=="END") return '</STYLE>'
	var str = (left!=null && top!=null)? '#'+id+' {position:absolute; left:'+left+'px; top:'+top+'px;' : '#'+id+' {position:relative;'
	if (arguments.length>=4 && width!=null) str += ' width:'+width+'px;'
	if (arguments.length>=5 && height!=null) {
		str += ' height:'+height+'px;'
		if (arguments.length<9 || other.indexOf('clip')==-1) str += ' clip:rect(0px '+width+'px '+height+'px 0px);'
	}
	if (arguments.length>=6 && color!=null) str += (document.layers)? ' layer-background-color:'+color+';' : ' background-color:'+color+';'
	if (arguments.length>=7 && vis!=null) str += ' visibility:'+vis+';'
	if (arguments.length>=8 && z!=null) str += ' z-index:'+z+';'
	if (arguments.length==9 && other!=null) str += ' '+other
	str += '}\n'
	return str
}
function writeCSS(str,showAlert) {
	str = css('START')+str+css('END')
	document.write(str)
	if (showAlert) alert(str)
}
function findWH() {
	var f = parent.frames.length;
	if (f>0){
	winW = (is.ns)? window.innerWidth+4 : document.body.offsetWidth;
	winH = (is.ns)? window.innerHeight+4 : document.body.offsetHeight;
	}
	else {
	winW = (is.ns)? window.innerWidth : document.body.offsetWidth-20;
	winH = (is.ns)? window.innerHeight : document.body.offsetHeight-4;
	}
}
function makeLiquid() {
	if (is.ns5)
	location.reload(false);	//false & without parameter => reload from cache; true => reload from Server
	else if ((is.ns && (winW!=window.innerWidth || winH!=window.innerHeight)) || is.ie)
	history.go(0)
}
function hide(id,nestref) {
	if (is.obie) document.all[id].style.visibility = "hidden";
	else if (is.obns) {
		var lyr = (nestref)? eval('document.'+nestref+'.document.'+id):document.layers[id];
		lyr.visibility = "hide";
		}
	else if (is.obn6) document.getElementById(id).style.visibility = "hidden";
}
function show(id,nestref) {
	if (is.obie) document.all[id].style.visibility = "visible";
	else if (is.obns) {
		var lyr = (nestref)? eval('document.'+nestref+'.document.'+id):document.layers[id];
		lyr.visibility = "show";
		}
	else if (is.obn6) document.getElementById(id).style.visibility = "visible";
}
function setBGColor(id,nestref,color) {
	if (is.obie) {
		if (color==null)color='';
                document.all[id].style.backgroundColor = color;
                }
	else if (is.obns) {
		var lyr = (nestref)? eval('document.'+nestref+'.document.'+id):document.layers[id];
		lyr.document.bgColor = color;
		}
	else if (is.obn6) document.getElementById(id).style.backgroundColor = color;
}
function layerWrite(id,nestref,text) {
        if (is.obie) document.all[id].innerHTML = text;
        if (is.obn6) document.getElementById(id).innerHTML = text;
        else if (is.obns) {
                var lyr = (nestref)? eval('document.'+nestref+'.document.'+id+'.document') : document.layers[id].document
		lyr.open()
                lyr.write(text)
                lyr.close()
                }
}