//näyttää tuotekuvan
function showProductImg(id,element){
	if(id!="0" && id!=""){ 
		document.getElementById("img"+element).style.display="block"; 
	}
}

//piilottaa tuotekuvan
function hideProductImg(id,element){
	if(id!="0" && id!=""){ 
		document.getElementById("img"+element).style.display="none"; 
	}
}

//haetaan vaihtoehdot
function lookup(inputString) {
 	var ryhma = document.getElementById("ryhma").value;
	if(inputString.length == 0) {
		// Hide the suggestion box.
		$('#suggestions').hide();
	}else{
		$.post("http://kauppa.cityplus.fi/fin/ajax_query.php", {queryString: ""+inputString+"",queryRyhma: ""+ryhma+""}, function(data){
		if(data.length >0) {
				$('#suggestions').show();
				$('#autoSuggestionsList').html(data);
			}
		});
	}
} // lookup

//haetaan vaihtoehdot etusivulla
function lookup2(inputString) {
 	var ryhma = document.getElementById("ryhma").value;
	if(inputString.length == 0) {
		// Hide the suggestion box.
		$('#suggestions').hide();
	}else{
		$.post("http://kauppa.cityplus.fi/fin/ajax_query.php", {queryString: ""+inputString+"",queryRyhma: ""+ryhma+""}, function(data){
			if(data.length >0) {
				$('#suggestions').show();
				$('#autoSuggestionsList').html(data);
			}
		});
	}
} // lookup

//valitaan vaihtoehto	
function fill(thisValue) {
	$('#haku_fix').val(thisValue);
	$('#haku').val(thisValue);
	setTimeout("$('#suggestions').hide();", 200);
}

//syötetään hakuarvo piilokenttään
function updateValue(thisValue){
	document.getElementById("haku").value = thisValue;
}

//purkka kun ei muuten meinaa toimia ääkköset
function fillIt(thisValue){
	document.getElementById("haku_fix").value = document.getElementById("val"+thisValue).value;
	document.getElementById("haku").value = document.getElementById("val"+thisValue).value;

	var hakusana 	= document.getElementById("haku_fix").value;
	var ryhma = document.getElementById("ryhma").value;
	hakusana = '/tuote/' + hakusana
	window.location = "http://kauppa.cityplus.fi/fin"+hakusana;
}

//haku
function searchProduct(){
	var hakusana 	= document.getElementById("haku_fix").value;
	var ryhma		= document.getElementById("ryhma").value;
	window.location = "http://kauppa.cityplus.fi/fin/index.php?ryhma="+ryhma+"&hae=1&haku="+hakusana;
}

function searchProduct2(value){
	var hakusana 	= document.getElementById("haku_fix").value;
	var ryhma		= document.getElementById("ryhma").value;
	window.location = "http://kauppa.cityplus.fi/fin/index.php?ryhma="+ryhma+"&hae=1&haku="+hakusana;
}

function searchProduct3(){
	var hakusana 	= document.getElementById("haku_fix").value;
	var ryhma		= document.getElementById("ryhma").value;
	window.location = "http://kauppa.cityplus.fi/fin/index.php?ryhma="+ryhma+"&hae=1&haku="+hakusana;
}