
function show_data(anzahl,prefixown){

	for(var i=1; i<=anzahl; i++){
	var obj_ON = document.getElementById(prefixown+i);
		obj_ON.style.display='none';
		obj_ON.disabled='true';
	}
	var dropdownbox = prefixown+'dropdown';
	var aktiv_el = document.getElementById(dropdownbox).value;
	if(aktiv_el == 0){
		document.getElementById(prefixown+'off').style.display='';
	}else{
		document.getElementById(prefixown+'off').style.display='none';
		var obj = document.getElementById(prefixown+aktiv_el);
		obj.style.display='';
		obj.disabled='';
	}
}

function selecthandys(option)
{
	var optionen;
	var newcookie = "";
	var control = 1;
if (option != "")
{
	if (option.checked == true)
	{
		document.cookie = option.name + '=1;';
	}
	else
	{
		document.cookie = option.name + '=0';
	}
}

	optionen=document.cookie.split(";");
	for (i=0;i<document.forms.length;++i)
	{
		document.getElementById("handy_"+document.forms[i].artnr.value).className="";

		for (iii=0;iii<optionen.length;++iii)
		{
		if (optionen[iii] != "")
		{
			if (optionen[iii].search(/PHPSESSID.+/) == -1)
			{
				if (optionen[iii].search(/webfx.+/) == -1)
				{
					bedingung=optionen[iii].split("=");
					if (bedingung[1] == "1")
					{
						bedingung[0] = bedingung[0].replace(/ /,"");
						if (document.getElementById("feature_"+document.forms[i].artnr.value+"_"+bedingung[0]).value != "ja")
						{
							document.getElementById("handy_"+document.forms[i].artnr.value).className="not-have";
							break;
						}
					}
				}
			}
		}
		}
	}
}

function selectoptions()
{
	if(document.cookie)
 	{
		optionen=document.cookie.split(";");
		for (iii=0;iii<optionen.length;++iii)
		{
			if (optionen[iii].search(/PHPSESSID.+/) == -1)
			{
				if (optionen[iii].search(/webfx.+/) == -1)
				{
					if (optionen[iii] != "")
					{
						bedingung=optionen[iii].split("=");
						if (bedingung[1] == "1")
						{
							bedingung[0] = bedingung[0].replace(/ /,"");
							document.getElementById("option_"+bedingung[0]).checked = true;
						}
					}
				}
			}
		}
	}
	selecthandys("");
}

function getPreise(tarifid)
{
		liste = document.getElementsByName("preisliste");
		for (i=0;i<document.forms.length;++i)
		{
			for(ii=0;ii<liste[0].options.length;++ii)
			{
				document.getElementById("preis_"+liste[0].options[ii].value+"_"+document.forms[i].artnr.value).style.display="none";
			}
			document.getElementById("preis_"+tarifid+"_"+document.forms[i].artnr.value).style.display="";
		}
}

function getHersteller(url,warengruppeid)
{

	
	if(warengruppeid != 0)
	{

		document.location = url+'?hersteller='+warengruppeid;
	}
	else
	{
		document.location = url;
	}
}

function geheVergleich(url)
{
	ii = 0;
	handys = new Array();

	for (i=0;i<document.forms.length;++i)
	{
		if (document.forms[i].clicked_handy.checked == true)
		{
			handys[ii] = document.forms[i].artnr.value;
			++ii;
		}
	}
	if (handys.length > 4)
	{
		alert("Bitte wählen Sie nur 4 Handys für den Handy-Vergleich aus!");
		return false;
	}
	if (handys.length == 0)
	{
		alert("Bitte wählen Sie mindestens ein Handy für den Handy-Vergleich aus!");
		return false;
	}

	for(i=0;i < handys.length;++i)
	{
		pluseins = i + 1;
		url = url + handys[i]+",";
	}

	
	url = url.substr(0,url.length-1)+"/";
	
	document.location = url;
}
