//		Purpose:	DIV/LAYER Functions
//		Language:	Javascript (Netscape>4, IE>4)
//		Author:		Marc Schneider
//		Copyright:	2002 Trüffelschwein GbR

// Frame Reload
if(self==top)
  top.location.href="index.jsp";

// moep cache
moep=new Image;
moep.src = "moep.gif";
  
// Detect Browser
NS4=(navigator.appName.indexOf('Netscape')!=-1&&parseInt(navigator.appVersion)<5);
NS6=(navigator.appName.indexOf('Netscape')!=-1&&parseInt(navigator.appVersion)>=5);
IE=(navigator.appName.indexOf('Microsoft')!=-1);

//
// Debug NS4 resize bug
function reDo(){ window.location.reload() }
if (NS4) window.onresize = reDo;



Vis=new Array();
Vis[0]=(IE||NS6) ? "hidden" : "hide";
Vis[1]=(IE||NS6) ? "visible" : "show";

function MakeDiv(divId,divX,divY,divW,divH,bCol,visb,zInd){
	bgcol= (bCol=="")? "" : ((NS4)?" bgColor="+bCol:";background:"+bCol);

	if(IE||NS6){
		layr ="<DIV ID="+divId;
		layr+=" style='position:absolute;top:"+divY+";left:"+divX+";width:"+divW+";height:"+divH+" "+bgcol;
		layr+=";visibility:"+Vis[visb]+";z-index:"+zInd;
		layr+="'>";
	}

	if(NS4){
		layr ="<LAYER ID="+divId;
		layr+=" top="+divY+" left="+divX+" width="+divW+" height="+divH+" "+bgcol;
		layr+=" visibility="+Vis[visb]+" z-index="+zInd;
		layr+=">";
	}
	document.writeln(layr);
}

function EndDiv(){
	(IE||NS6)? document.writeln("</DIV>"): document.writeln("</LAYER>");
}

function PutIt(ID,dX,dY){
	if(NS4){
		document.layers[ID].left=dX;
		document.layers[ID].top=dY;
	}
	if(IE){
		document.all[ID].style.left=dX;
		document.all[ID].style.top=dY;
	}
	if(NS6){
		document.getElementById(ID).style.left=dX;
		document.getElementById(ID).style.top=dY;
	}
}

function ShowHide(ID,vs){
	if(NS4){
		document.layers[ID].visibility=Vis[vs];
	}
	if(IE){
		document.all[ID].style.visibility=Vis[vs];
	}
	if(NS6){
		document.getElementById(ID).style.visibility=Vis[vs];
	}
}

function Xof(ID){
	if(NS4){
		return document.layers[ID].left;
	}
	if(IE){
		return parseInt(document.all[ID].style.left);
	}
	if(NS6){
		return document.getElementById(ID).style.left;
	}
}

function Yof(ID){
	if(NS4){
		return document.layers[ID].top;
	}
	if(IE){
		return parseInt(document.all[ID].style.top);
	}
	if(NS6){
		return document.getElementById(ID).style.top;
	}
}



function Zind(ID,zz){
	if(NS4){
		document.layers[ID].zIndex=zz;
	}
	if(IE){
		document.all[ID].style.zIndex=zz;
	}
	if(NS6){
		document.getElementById(ID).style.zIndex=zz;
	}
}

function ChangeCol(ID,colrx){
	if(IE)	document.all[ID].style.background=colrx;
	if(NS4)	document.layers[ID].bgColor=colrx;
	if(NS6)	document.getElementById(ID).style.background=colrx;
}

function DivWrite(IdName,Str) {
	if (NS4){
		document.layers[IdName].document.write(Str);
		document.layers[IdName].document.close();
	}
	if(IE) document.all[IdName].innerHTML=Str;
	if(NS6) document.getElementById(IdName).innerHTML=Str;
}

function ChangeImg(IdName,ImgName,NewSrc) {
	if (NS4)	{
		if (IdName!='')	document.layers[IdName].document.images[ImgName].src = NewSrc;
		else			document.images[ImgName].src = NewSrc;
	}
	if (IE)		document.images[ImgName].src = NewSrc;
	if (NS6)	document.getElementById(ImgName).src=NewSrc;
}

function addtext() {
	opt=document.form1.selection.selectedIndex;
 	sel=document.form1.selection.options[opt].value;
	document.form1.keys.value = document.form1.keys.value.replace(/^\s*/, '').replace(/\s*$/, '');
	if (document.form1.selection.value!="") {	
		document.form1.keys.value = document.form1.keys.value.replace(/^\s*/, '').replace(/\s*$/, '');

		if (document.form1.keys.value=="") {
			document.form1.keys.value += sel;
		} else {
			document.form1.keys.value += " "+sel;
		}
	}

}

function nothing(no) {
	return;
}

function fr(fr, hr) {
	changeframe=eval("parent."+fr);
	changeframe.location.replace(hr);
	return;
}
