function HPW_ClearValueOnFocus(id,text) // text = Anfangstext
{
	if (document.getElementById(id).value == text)
	{
		document.getElementById(id).value = "";
	}
}

function HPW_ChangeBgColor(id,farbe)
{
	if (id != "")
	{
		if (document.getElementById(id))
		{
			document.getElementById(id).style.backgroundColor = farbe;
		}
	}
}

function HPW_TextToValueOnBlur(id,text) // text = Anfangstext
{
	if (document.getElementById(id).value == "")
	{
		document.getElementById(id).value = text;
	}
}

function HPW_OpenManualPopup(seite,breite,hoehe,name,scrollen)
{
	startpos_y = (screen.height/2)-(hoehe/2);
	startpos_x = (screen.width/2)-(breite/2);
	window.open(seite,name,"top="+startpos_y+",left="+startpos_x+",width="+breite+",height="+hoehe+",menubar=no,status=no,scrollbars="+scrollen);
}

function HPW_OpenPicturePopup(bild,name)
{
	alert("Diese Funktion ist noch nicht vorhanden.");
}

function HPW_Hide(id,pfad,anzahl,browser)
{
	for (i=0; i<anzahl; i++)
	{
		if (window.document.getElementById(id+"Layer"+i))
		{
			window.document.getElementById(id+"Layer"+i).style.display = "none";
		}
	}
	window.document.getElementById(id+"Image").src = pfad+"img/plus.gif";
}

function HPW_Display(id,pfad,anzahl,browser)
{
	if (anzahl < 1) {anzahl = 1;}

	// Browser...
	if (browser == 5) {sichtbar = "inline";}
	else if (browser == 3) {sichtbar = "table-row-group";}	// geht nicht???
	else {sichtbar = "table-row-group";}
	
	if (window.document.getElementById(id+"Layer0").style.display == sichtbar)
	{
		HPW_Hide(id,pfad,anzahl,browser);
	}
	else
	{
		for (i=0; i<anzahl; i++)
		{
			if (window.document.getElementById(id+"Layer"+i))
			{
				window.document.getElementById(id+"Layer"+i).style.display = sichtbar;
			}
		}
		window.document.getElementById(id+"Image").src = pfad+"img/minus.gif";
	}
}

function HPW_DisplayChange(id,id2,pfad)
{
	if (window.document.getElementById(id+"Layer").style.display == "inline")
	{
		window.document.getElementById(id+"Layer").style.display = "none";
		window.document.getElementById(id2+"Layer").style.display = "inline";
		window.document.getElementById(id+"Image").src = pfad+"img/plus.gif";
	}
	else
	{
		window.document.getElementById(id2+"Layer").style.display = "none";
		window.document.getElementById(id+"Layer").style.display = "inline";
		window.document.getElementById(id+"Image").src = pfad+"img/minus.gif";
	}
}

function HPW_ChangeText(id,text)
{
	document.getElementById(id).innerHTML = text;
}

function HPW_ChangeListe(fromID,toID)
{
	var maxelemente = document.getElementById(fromID).length;
	//j=1;
	for(i=0; i<maxelemente; i++)
	{
		j=1;
		if(document.getElementById(fromID).options[i].selected==true)
		{
			toCopyValue = document.createElement("option");
			toCopyValue.text = document.getElementById(fromID).options[i].text;
			toCopyValue.value = document.getElementById(fromID).options[i].value;
			document.getElementById(toID).options.add(toCopyValue,j);
			//tovalue = document.getElementById(fromID).options[i].value;
			//totext = document.getElementById(fromID).options[i].text;
			//document.getElementById(toID).options(maxtoelemente) = new Option(totext,tovalue);
			j++;
		}
	}
	
	for(i=0; i<maxelemente; i++)
	{
		if(document.getElementById(fromID).options[i].selected==true)
		{
			document.getElementById(fromID).options[i].selected = false;
			document.getElementById(fromID).options[i] = null;
			i--;
			maxelemente--;
		}
	}
}
