var compatibility = new Array();

function xxx(products_id) {

	index=document.cart_quantity.comp_hersteller.selectedIndex;
	comp_hersteller=document.cart_quantity.comp_hersteller[index].value;
	if(area=document.getElementById("comp_area")) {
		if(index==0) {
			area.innerHTML="Bitte wählen Sie Hersteller und Modell Ihres Telefons, um zu prüfen, ob dieses Headset dazu kompatibel ist.";
		}
		else {
			area.innerHTML="Bitte wählen Sie das Modell Ihres Telefons, um zu prüfen, ob dieses Headset dazu kompatibel ist.";
		}
	}

	try{
		req = new XMLHttpRequest();
	}
	catch(e){
		try{
			req = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e){
			try{
				req = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (failed){
				req = null;
			}
		}
	}
	
	if(req != null) {
		

		req.open("GET", "headset_ajax.php?comp_hersteller="+comp_hersteller+"&products_id="+products_id, true);
		//req.open("GET", "http://bob/headset/headset_ajax.php", true);
		req.send(null);
		req.onreadystatechange = function(){ 
			if(req.readyState == 4) {
				if(req.status==200) {

					compatibility = new Array();

					xml = req.responseXML;
					telefone=xml.getElementsByTagName("TELEFON");
					eintraege=document.cart_quantity.comp_modell.options.length;


					for(i=0;i<(eintraege-1);i++) {
						document.cart_quantity.comp_modell.options[document.cart_quantity.comp_modell.length - 1] = null;
					}
					for(i=0;i<telefone.length;i++) {
						option_name	= telefone[i].firstChild.firstChild.nodeValue;
						option_value= telefone[i].firstChild.nextSibling.firstChild.nodeValue;
						option_compatibility= telefone[i].firstChild.nextSibling.nextSibling.firstChild.nodeValue;
						option_link= telefone[i].firstChild.nextSibling.nextSibling.nextSibling.firstChild.nodeValue;

						ne=new Option(option_name, option_value, false, true);
						document.cart_quantity.comp_modell.options[document.cart_quantity.comp_modell.options.length] = ne;

						//compatibility[i]=option_name;
						compatibility[i]= new Array();
						compatibility[i][0]	= option_name;
						compatibility[i][1]	= option_value;
						compatibility[i][2]	= option_compatibility;
						compatibility[i][3]	= option_link;
				

					}
				}



				document.cart_quantity.comp_modell.selectedIndex=0;
				if(comp_hersteller != "") {	
					document.cart_quantity.comp_modell.disabled=false;
				}
				else {
					document.cart_quantity.comp_modell.disabled=true;
				}

			}

		}
	}
}


function modell_select() {
	index=document.cart_quantity.comp_modell.selectedIndex;
	var html="";
	if(index>0) {
		c=compatibility[(index-1)];
		html+="<table cellspacing='0' cellpadding='0' width='100%' border='0'><tr>";
		if(c[2]==0) {
			html+="<td width='15' valign='top'><img src='images/lbrot.gif' alt='nicht kompatibel' title='nicht kompatibel'></td>";
			html+="<td valign='top' class='main'>Das Headset ist nicht für Ihr Telefon geeignet<br/><a href='telefon_headset.asp?artikelid="+document.cart_quantity.comp_modell[index].value+"'>Hier finden Sie passende Headsets für Ihr "+document.cart_quantity.comp_modell[index].text+"</a></td>";
			html+="<td valign='top' width='133' class='main'>&#160;</td>";
		}
		else {
			var link=c[3];

			html+="<td width='15' valign='top'><img src='images/lbgruen.gif' alt='kompatibel' title='kompatibel'></td>";
			html+="<td valign='top' class='main'>Das Headset ist für Ihr Telefon geeignet<br/>Klicken Sie auf den &quot;Anschließen&quot;-Button, um zu sehen, welches Zubehör wie z.B. Kabel Sie zudem noch benötigen.</td>";
			html+="<td style='padding-right:2px' valign='top' width='133' class='main'><a href='"+link+"'><img width='133' height='31' border='0' alt='anschlie&szlig;en' title='anschlie&szlig;en' src='includes/languages/german/images/buttons/button_connect.gif'/></a></td>";
		}
		html+="</tr></table>";

		if (area=document.getElementById("comp_area")) {
			area.innerHTML=html;
		}
	}
	else {
		if (area=document.getElementById("comp_area")) {
			area.innerHTML="Bitte wählen Sie das Modell Ihres Telefons, um zu prüfen, ob dieses Headset dazu kompatibel ist.";
		}
	}
}

