
$(function(){

  $( "#search_term" ).autocomplete({
			source: "/include/search_result.php",
			minLength: 2,
			select: function( event, ui ) {
        this.value = ui.item.value;
        document.search.submit();
			}
		});

});

function link_oeffnen(linkstr)
	{
		if(linkstr.substr(0,4)=="www.") {
			linkstr="http://"+linkstr
		}
		if(linkstr.substr(0,5)=="http:") {
			window.open(linkstr,"","");
		}else{
			document.location.href=linkstr;
		}
	}


function big_img(image,zielformat){
	window.open("/include/big_img.php?image="+image+"&zielformat="+zielformat+"",'Image','width=500,height=500');
}

function print_site(content_id,sprache){
	window.open("/include/print_site.php?content_id="+content_id+"&sprache="+sprache,'Printversion','menubar=yes,toolbar=yes,scrollbars=yes,width=600,height=550');
}

function show_whole_address(land) {
  $('#box_adresse_1').load('/include/ajax/show_whole_address.php?land='+land, {});
}

function notice_product(id,kat) {
	if(int_check(id)) {
    
    img = $('#notice_button_'+id);
    if(img.attr('src').indexOf('check.gif')>0){
      img.attr('src','/layout/icons/check1.gif');
      set = 1;
    }else{
      img.attr('src','/layout/icons/check.gif');
      set = 0;
    }
    $('#box_merkliste').load('/include/ajax/notice_product.php?id='+id+'&set='+set+'&kat='+kat, {});
	}
}

function extended_search(set, farbe) {
  $('#produkt_suche').load('/include/ajax/produkt_suche.php?farbe='+farbe+'&set='+set, {});
}

function int_check(tmp) {
	checkvar=1;
	for (i = 0; i < tmp.length; ++i) {
    	if (tmp.charAt(i) < "0" || tmp.charAt(i) > "9") {
			checkvar = -1;
		}
	}
  if (checkvar == -1) {
    return false;
  } else {
    return true;
	}
}


