// JavaScript Document

		function produktid_cb(a) {
			p = document.getElementById('produktid');
			p.innerHTML="";
			document.getElementById("sHcount").innerHTML = a["hcount"];
			var tmp = document.createElement("option");
			tmp.value="0";
			tmp.appendChild(document.createTextNode("----------- Modell ----------"));
			p.appendChild(tmp);
			for(key in a) {
				if(Number(key)>0) {
					var tmp = document.createElement("option");
					tmp.value=key;
					tmp.appendChild(document.createTextNode(a[key]));
					p.appendChild(tmp);
				}
			}
		}
		function produktid_refresh() {
			id = this.value;
			x_getProductsH(id, pg, produktid_cb);
		}
		function hersteller_cb(a) {
			h = document.getElementById('hersteller');
			h.innerHTML="";
			document.getElementById("sHcount").innerHTML = a["hcount"];
			var tmp = document.createElement("option");
			tmp.value="0";
			tmp.appendChild(document.createTextNode("--------- Hersteller --------"));
			h.appendChild(tmp);
			for(key in a) {
				if(Number(key)>0) {
					var tmp = document.createElement("option");
					tmp.value=key;
					tmp.appendChild(document.createTextNode(a[key]));
					h.appendChild(tmp);
				}
			}
			x_getProductsH(0, pg, produktid_cb);
		}
		function hersteller_refresh() {
			pg = this.value;
			x_getHerstellerH(pg, hersteller_cb);
			if(neu = document.getElementById("anfragen_"+pg)) {
				for(pgi in pglist) {
					if(alt=document.getElementById("anfragen_"+pglist[pgi])) {
						alt.style.display = "none";
					}
				}
				neu.style.display = "block";
			}
		}
		function tab(i) {
			document.cookie = "tabid="+i+"; path=/;"
			if(!tabs.length) {
				// init
				tabs[0] = document.getElementById("dSchnellsuche");
				tabs[1] = document.getElementById("dDetailsuche");
				currentTab= tabs[firsttab];
			}
			currentTab.style.display="none";
			tabs[i].style.display="block";
			currentTab = tabs[i];
			document.getElementById("iTabimage").src = tabImages[i].src;
		}
		function req(at) {
			id = document.getElementById("produktid");
			if(id.value>0) {
				at=at?"&at="+at:"";
				location.href="req.php?p_id="+id.value+at;
			} else {
				alert("Bitte erst Produkt auswählen");
			}
		}
		tabs = new Array();
		
		function produkt_details() {
			id = document.getElementById("produktid");
			if(id.value>0) {
				location.href="suche.php?p_id="+id.value;
			} else {
//				alert("Bitte erst Drucker auswählen");
			}
			
		}
		function ds_pg_changed() {
			pg = this.value;
			if(neu = document.getElementById("detailsuche_"+pg)) {
				for(pgi in pglist) {
					if(alt=document.getElementById("detailsuche_"+pglist[pgi])) {
						alt.style.display = "none";
					}
				}
				neu.style.display = "block";
			}
		}
