function raspSearch(xml){
	var tip = xml.getElementsByTagName("rasp_tip")[0].firstChild.data;
	if (tip == "false") {
		document.getElementById("id_raspuns").style.display = "none";
		var rasp = "Ne pare rau, seria introdusa nu a fost gasita in baza de date. Va rugam contactati SKIN";
		alert(rasp);
		document.getElementById("id11").innerHTML = "";
		document.getElementById("id22").innerHTML = "";
		document.getElementById("id33").style.display = "none";
		document.cumpara_garantie.action = "";
	}
	else if (tip == "true"){
		document.getElementById("id_raspuns").style.display = "";
		var produs = xml.getElementsByTagName("produs")[0].firstChild.data;
		var rasp = "Produsul a fost identificat in baza de date ca fiind " + produs + ". Daca a fost identificat corect, va rugam sa apasati butonul MERGI MAI DEPARTE pentru a putea cumpara garantia suplimentara.";
		var cod_gecad = xml.getElementsByTagName("gecad")[0].firstChild.data;
		var serie = xml.getElementsByTagName("serie")[0].firstChild.data;
		alert(rasp);
		document.getElementById("id11").innerHTML = "Poti achizitiona extensia de 1 an garantie pentru Nikon " + produs;
		document.getElementById("id22").innerHTML = "Pretul este de " + xml.getElementsByTagName("pret")[0].firstChild.data + " RON (TVA inclus)";
		document.cumpara_garantie.action = "https://secure.epayment.ro/order/checkout.php?PRODS=" + cod_gecad + "&QTY=1&REF=" + serie;
		document.getElementById("id33").style.display = "";
	}
	return false;
}

function cautaSerie(){
	var s = document.getElementById("id_serie").value;
	if (s == "") {
		alert("Nu ati completa nicio serie");
		return false;
	}
	
	ajaxRead("garantie/cauta.php?", "POST", false, "serie=" + s, raspSearch);
			
	return false;
}
