// wyszukiwanie model w faq
function getModelFaq(id){
					
	//selIdx = document.faqName.hardwareOption.selectedIndex;
	//id = document.faqName.hardwareOption.options[selIdx].value;
	$.ajax({
	  url: "/index.php?ctr=AJAX&mod=Search&action=getProducts&id="+id,
	  dataType: "xml",
	  success: function(xml)
	  {			
	  	$('#modelOptionFaq option').remove();
		$('#selectmodelOptionFaq').html('wybierz model');
		
		$("items > item", xml).each (
			function() {
				var text = $(this).find('text').text();
				var value = $(this).find('value').text();
				$('select#modelOptionFaq').append('<option value="' + value + '">' + text + '</option>');
			}
		);
		
	  }
	}); 
}

// wyszukiwanie pytań w faq
function getFaq(){
	
	selIdx = document.faqName.modelOptionFaq.selectedIndex;
	id = document.faqName.modelOptionFaq.options[selIdx].value;
	
	$.ajax({
		type: "GET",
		url: "/index.php?ctr=AJAX&mod=Search&action=getFaq&id="+id,
		success: function(msg) {
			$('#faqResult').html(msg);
		},
		error: function() {
			$('#faqResult').html("ERROR: Nie można pobrać danych !!!");
		}
	});
}

// wyszukiwanie modeli w download
function getModelSearch(id){
					
//	selIdx = document.searchProdF.hardwareOption.selectedIndex;
//	id = document.searchProdF.hardwareOption.options[selIdx].value;
	$.ajax({
	  url: "/index.php?ctr=AJAX&mod=Search&action=getProductsDownload&id="+id,
	  dataType: "xml",
	  success: function(xml)
	  {			
	  	$('#modelOption option').remove();
		$('#selectmodelOption').html('wybierz model');
		
		$("items > item", xml).each (
			function() {
				var text = $(this).find('text').text();
				var value = $(this).find('value').text();
				$('select#modelOption').append('<option value="' + value + '">' + text + '</option>');
			}
		);
		
	  }
	}); 
}

// wyszukiwanie modeli w wyszukiwarce na górze
function getModelSearchAll(id){
		
	//selIdx = document.searchProdFAll.hardwareOptionAll.selectedIndex;
	//id = document.searchProdFAll.hardwareOptionAll.options[selIdx].value;
	$.ajax({
	  url: "/index.php?ctr=AJAX&mod=Search&action=getProducts&id="+id,
	  dataType: "xml",
	  success: function(xml)
	  {			
	  	$('#modelOptionAll option').remove();
		$('#selectmodelOptionAll').html('wybierz model');
		
		$("items > item", xml).each (
			function() {
				var text = $(this).find('text').text();
				var value = $(this).find('value').text();
				$('select#modelOptionAll').append('<option value="' + value + '">' + text + '</option>');
			}
		);
		
	  }
	}); 
}

