function delete_this(form, delField)
{
	if(confirm("Möchten Sie wirklich löschen?"))
	{
		eval("document."+ form +".delete_"+ delField +".value='true'");
		eval("document."+ form +".submit()");
	}
}


var at_timeout = 50;
function at_show_aux(parent, child)
{
	var p = document.getElementById(parent);
	var c = document.getElementById(child);
	p.className = "active";
	var top  = (c["at_position"] == "y") ? p.offsetHeight+2 : 0;
	var left = (c["at_position"] == "x") ? p.offsetWidth +2 : 0;
	c.style.position   = "absolute";
	c.style.top        = '11px';
	if(navigator.appVersion.toLowerCase().indexOf("msie 6.0")!=-1)
	{
		c.style.left       = p.offsetLeft-55+'px';
	}else
	{
		c.style.left       = p.offsetLeft-23+'px';
	}
	c.style.visibility = "visible";
}

function at_hide_aux(parent, child)
{
	document.getElementById(parent).className        = "parent";
	document.getElementById(child ).style.visibility = "hidden";
}

function at_show()
{
	var p = document.getElementById(this["at_parent"]);
	var c = document.getElementById(this["at_child" ]);
	at_show_aux(p.id, c.id);
	clearTimeout(c["at_timeout"]);
}

function at_hide()
{
	var c = document.getElementById(this["at_child"]);
	c["at_timeout"] = setTimeout("at_hide_aux('"+this["at_parent"]+"', '"+this["at_child" ]+"')", at_timeout);
}

function at_attach(parent, child, position)
{
	p = document.getElementById(parent);
	c = document.getElementById(child );
	p["at_child"]    = c.id;
	c["at_child"]    = c.id;
	p["at_parent"]   = p.id;
	c["at_parent"]   = p.id;
	c["at_position"] = position;
	p.onmouseover = at_show;
	p.onmouseout  = at_hide;
	c.onmouseover = at_show;
	c.onmouseout  = at_hide;
}

function dhtmlmenu_build_aux(parent, child, position, fam)
{
	document.getElementById(parent).className = "parent";
	document.write('<div class="vert_menu" id="'+parent+'_child">');
	if(navigator.appVersion.toLowerCase().indexOf("msie")!=-1)
	{
		document.write('<div style=\"height:11px\"><img src=\"images/spacer.gif\" height=\"11\" width=\"170\"></div>');
	}else
	{
		document.write('<div style=\"height:11px\"></div>');
	}
	var n = 0;
	for (var i in child)
	{
		if (i == '-')
		{
			continue;
		}
		if (typeof child[i] == "object")
		{
			document.write('<a class="parent" id="'+parent+'_'+n+'">'+i+'</a>');
			dhtmlmenu_build_aux(parent+'_'+n, child[i], "x");
		}else document.write('<a id="'+parent+'_'+n+'" href="'+child[i]+'">'+i+'</a>');
		n++;
	}
	
	if(fam)
	{
		document.write('<img src="images/boxende_fam.gif\" width=\"189\"></div>');	
	}else
	{
		document.write('<img src="images/boxende.gif\" width=\"189\"></div>');
	}
	at_attach(parent, parent+"_child", position);
}

function dhtmlmenu_build(menu, fam)
{
  for (var i in menu) dhtmlmenu_build_aux(i, menu[i], "y", fam);
}


function func_changeGallery()
{
	if(document.galleryn.picture)
	{
		document.galleryn.picture.value='0';
	}
	document.galleryn.submit();
}

function func_addLink(form, content_id)
{
	site = prompt("Internetadresse", "http://www.");
	text = prompt("Anzeigetext (beim klick auf diesen Text wird auf die gewünschte Seite weitergeleitet)");
	new_window = confirm("Soll der Link in einem neuen Fenster geöffnet werden?\n(Abbrechen = Link wird im aktuellen Fenster geöffnet)");
	if(new_window)
	{
		eval("field_text = document."+form+".content_text.value");
		field_text = field_text + "<a href=\"index.php?content_id="+content_id+"\" onclick=\"javascript: window.open(\'"+site+"\');\">"+text+"</a>";
	}else
	{
		eval("field_text = document."+form+".content_text.value");
		field_text = field_text + "<a href=\""+site+"\");\">"+text+"</a>";
	}
	eval("document."+form+".content_text.value = field_text;");
	eval("document."+form+".html.checked = true;");
}

function func_delete_element(url)
{
	if(confirm("Möchten Sie das Element wirklich löschen?"))
	{
		window.location.href = url;
	}
}

function func_delete_title(url)
{
	if(confirm("Möchten Sie das Element wirklich löschen?"))
	{
		document.sellinglists.submit();
	}
}

function func_check_highlights()
{
	counter=0;
	for(i=0;i<document.highlights.elements["active_highlights[]"].length;i++)
	{
		if(document.highlights.elements["active_highlights[]"][i].checked==true)
		{
			counter++;
		}
	}
	if(counter!=6)
	{
		alert("Sie müssen 6 Highlights aktivieren!\nAktuell sind "+counter+" aktiviert.");
	}else
	{
		document.highlights.activate_highlights.value="true";
		document.highlights.submit();
	}
}