function toggle(strElement)
{
  if(document.getElementById(strElement).style.display=='none')
  {
    document.getElementById(strElement).style.display='inline';
    return true;
  }

  if(document.getElementById(strElement).style.display=='inline')
  {
    document.getElementById(strElement).style.display='none';
    return true;
  }
}

function setTopicImage(strImageWithPath,strImage)
{
	document.strMessageIcon.src = strImageWithPath;
	document.formular.strMessageIcon.value = strImage;	
}

function cursor(strText)
{
	if((navigator.userAgent.indexOf("Opera") != -1) || (navigator.userAgent.indexOf("Netscape") != -1))
	{
		strBefore = document.formular.strMessageContent.value;
		strAfter  = "";
	}
	else
	{
		formular.strMessageContent.focus();
		var iSel = document.selection.createRange();
		iSel.collapse();
		var iSelBefore = iSel.duplicate();
		var iSelAfter = iSel.duplicate();
		iSel.moveToElementText(document.formular.strMessageContent);
		iSelBefore.setEndPoint("StartToStart",iSel);
		iSelAfter.setEndPoint("EndToEnd",iSel);
		strBefore = iSelBefore.text;
		strAfter = iSelAfter.text;
	}

	document.formular.strMessageContent.value = strBefore + strText + strAfter;
}

function setAnswer(strFormular,iAnswerId)
{
	strFormular.iAntwortId.value = iAnswerId;
}

function setVote(strFormular)
{
	var iUmfrageId = strFormular.iUmfrageId.value;
	var iAntwortId = strFormular.iAntwortId.value;
	var strUrl     = 'votes/utilpage_result.php?&umfrageid='+iUmfrageId+'&antwortid='+iAntwortId;
	
	if(strFormular.iAntwortId.value == 0)
	{
		alert('Bitte wählen Sie.');
	}
	else
	{
		window.open(strUrl,'Umfrage','width=520,height=450,scrollbars=no');
	}
}

function mailen(strEMail)
{
	window.open('mailto: '+strEMail,'Betreff','toolbar=no,statusbar=no,menubar=no,location=no,directories=no,scrollbars=no,width=510,height=300');
}

function setImage(iImageId)
{
	strImagePath = "";

	if(document.alignment.checkResize.checked) strImagePath ="<a href=\"http://www.sentimes.de/_common/picture.php?tablename=b_sonst&imageid=" + iImageId + "\" target=\"_blank\">";	

	strImagePath += "<img style=\"float:";

	if(document.alignment.radioFloat[0].checked) strImagePath += "none;\"";
	if(document.alignment.radioFloat[1].checked) strImagePath += "left; margin:0px 8px 6px 0px;\"";		
	if(document.alignment.radioFloat[2].checked) strImagePath += "right; margin:0px 0px 6px 8px;\"";
	if(document.alignment.checkResize.checked) strImagePath += " width=\"" + document.alignment.textWidth.value +"\"";

	strImagePath += " align=\"absmiddle\" src=\"http://www.sentimes.de/_common/picture.php?tablename=b_sonst&imageid=" + iImageId;

	if(document.alignment.checkResize.checked) strImagePath += "&breiteNeu=" + document.alignment.textWidth.value ;

	strImagePath += "\" border=\"0\">";

	if(document.alignment.checkResize.checked) strImagePath += "</a>";

	if((navigator.userAgent.indexOf("Opera") != -1) || (navigator.userAgent.indexOf("Netscape") != -1))
	{
		strBefore = document.formular.strLangText.value;
		strAfter  = "";
	}
	else
	{
		formular.strLangText.focus();
		var iSel = document.selection.createRange();
		iSel.collapse();
		var iSelBefore = iSel.duplicate();
		var iSelAfter = iSel.duplicate();
		iSel.moveToElementText(document.formular.strLangText);
		iSelBefore.setEndPoint("StartToStart",iSel);
		iSelAfter.setEndPoint("EndToEnd",iSel);
		strBefore = iSelBefore.text;
		strAfter = iSelAfter.text;
	}

	document.formular.strLangText.value = strBefore + strImagePath + strAfter;
}