function link_popup(url,breite,hoehe)
{
    window.open(url,'','width=' + breite + ',height=' + hoehe + ',scrollbars=yes');
}
function popup(url,breite,hoehe)
{
    window.open(url,'','width=' + breite + ',height=' + hoehe + ',scrollbars=no');
}

function openChiffre(lID,lAD)
{
	
	window.open("chiffre.html?ID="+escape(lID),"chiffrefl","width=270,height=250");
}

function openmerkzettel()
{
	window.name="flroot";
	window.open("/merkzettel.html","merkzetteldhz","width=466,height=250,scrollbars=yes");
}

function openbilder(url,height)
{
    height = height + 50;
    if (height > 600) 
	{height = 600;}
	window.open(url,'','resizable=0,location=0,directories=0,status=0,menubar=0,scrollbars=auto,toolbar=0,width=520,height=' + height);
}

function getmerkzettel()
{
	var alleCookies = document.cookie;
	var pos = alleCookies.indexOf("merkzetteldhz=");
	if (pos != -1)
	{
		var start = pos + 14;
		var ende = alleCookies.indexOf(";",start);
		if (ende == -1) 
		{
			ende = alleCookies.length;
		}
		return alleCookies.substring (start,ende);
	}
	return "";
}

function ChangeClip(lID)
{
	sClip = getmerkzettel();
	var exDate = new Date(2030,1,1);

	if (document.all("MZ"+lID).checked)
	{
		if (sClip == '')
		{
			document.cookie = "merkzetteldhz=" + lID + ";Expires=" + exDate.toUTCString() + ";path=/";
		}
		else
		{
			aClip = sClip.split(',')
			bFound = false
			for (i=0;i<aClip.length;i++)
			{
				if (aClip[i] == lID)
				{
					bFound = true
				}
			}
			if (!bFound)
			{
				sClip = sClip + ',' + lID
				document.cookie = "merkzetteldhz=" + sClip + ";Expires=" + exDate.toUTCString() +";path=/";
			}
		}
	}
	else
	{
		sResult = '';
		if (sClip != '')
		{
			aClip = sClip.split(",");
			for (i=0;i < aClip.length;i++)
			{
				if (aClip[i] != lID)
				{
					sResult = sResult + aClip[i] + ',';
				}
			}	
			if (sResult.length > 0)
			{
				sResult = sResult.substr(0,sResult.length-1);
			}
		}
		document.cookie = "merkzetteldhz=" + sResult + ";path=/";
	}
}

function Add2Clip(lID)
{
	sClip = getmerkzettel();
	var exDate = new Date(2030,0,1)

		if (sClip == '')
		{
			document.cookie = "merkzetteldhz=" + lID + ";Expires=" + exDate.toUTCString() +";path=/";
		}
		else
		{
			aClip = sClip.split(',')
			bFound = false
			for (i=0;i<aClip.length;i++)
			{
				if (aClip[i] == lID)
				{
					bFound = true
				}
			}
			if (!bFound)
			{
				sClip = sClip + ',' + lID
				document.cookie = "merkzetteldhz=" + sClip + ";Expires=" + exDate.toUTCString() +";path=/";
			}
		}

}
function DelClip(lID)
{
	sClip = getmerkzettel();
	
		sResult = '';
		if (sClip != '')
		{
			aClip = sClip.split(",");
			for (i=0;i < aClip.length;i++)
			{
				if (aClip[i] != lID)
				{
					sResult = sResult + aClip[i] + ',';
				}
			}	
			if (sResult.length > 0)
			{
				sResult = sResult.substr(0,sResult.length-1);
			}
		}
		document.cookie = "merkzetteldhz=" + sResult + ";path=/";
	
}

function vote(elem)
{
	var form = elem.form;
	var option = '-1';
	for (i = 0; i < form.elements['option'].length; i++)
	{
		if (form.elements['option'][i].checked == true)
		{
			option += ',' + i;
		}
	}
	if (option != '-1')
	{
		var url = '/ratingergebnis.html?rbid='+form.elements['rbid'].value+'&sprache=2&save=1&show=1&option='+option;
		var newwin = window.open(url, 'umfrage', 'width=500,height=150,scrollbars=no');
	}
	else
	{
		alert('Bitte treffen Sie Ihre Wahl');
	}
	return false;
}

function closeLayer() {
	var images = document.getElementsByTagName('img');
	var divTag;

	for (i=0; i < images.length; i++) {
		if (images[i].getAttribute('src') == 'http://banman.holzmannverlag.de//images/DHTMLE/close.gif'){
			divTag = images[i].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
		}
	}
	var attrId = divTag.getAttribute('id');
	var attrIdSpl = attrId.split('_');
	var functionName = 'bsads_simplepop_'+attrIdSpl[1];
	window[functionName]('close');
	
	
}
