	function HideSuggestions(){
				$('#Sugestions').html('');
				$('#txtsearch').val('');
				$('#Sugestions').hide();
			}
			function Search(str,e)
			{
				if(e.keyCode != 38 && e.keyCode != 40 &&  e.keyCode != 13){
					if(e.keyCode == 46){
						if(str == ""){
							$('#Sugestions').html('');
							$('#Sugestions').hide();
						}
					}
					if (str.length>2)
				  	{ 
						var url = 'includes/actions.php';
						$('#loader').html('<img src="images/loading.gif" width="20">');
						$.post(url,{action:"Search",string:str}, function(data){
						//alert(data);
							$('#loader').html('');
							$('#Sugestions').html(data);
							$('#Sugestions').show();
							new autocomplete( 'txtsearch', 'Sugestions' );
						});
				  	}
				}else if (e.keyCode == 13){
					if($('.suggestedSearch-active').attr('idprod') != -1 && $('.suggestedSearch-active').attr('idprod') != undefined){
						document.location = 'product-details.php?id='+$('.suggestedSearch-active').attr('idprod');
					}else{
						document.location = 'list.php?q='+$('#txtsearch').val();
					}
					
				}
				if(str=='' ||str.length<2){
					$('#Sugestions').html('');
					$('#Sugestions').hide();	
				}
			}
			
			function autocomplete( textBoxId, containerDivId ) {
			    var ac = this;
			    this.textbox     = document.getElementById(textBoxId);
			    this.div         = document.getElementById(containerDivId);
			    this.list        = $('.suggestedSearch');
			    this.pointer     = null;

			    this.textbox.onkeydown = function( e ) {
			        e = e || window.event;
			        switch( e.keyCode ) {
			            case 38: //up
			                ac.selectDiv(-1);
			                break;
			            case 40: //down
			                ac.selectDiv(1);
			                break;
			        }
			    }

			    this.selectDiv = function( inc ) {
			        if( this.pointer !== null && this.pointer+inc >= 0 && this.pointer+inc < this.list.length ) {
			            this.list[this.pointer].className = 'suggestedSearch';
			            this.pointer += inc;
			            this.list[this.pointer].className = 'suggestedSearch-active';
			        }
			        if( this.pointer === null ) {
			            this.pointer = 0;
			            this.list[this.pointer].className = 'suggestedSearch-active';
			        }
			    }
			} 
			function GrabarHotsales(id,type){
				var url = 'includes/actions.php';
				$.post(url,{action:"SaveHot",type:type,id:id}, function(data){
				});
				document.location='/product-details.php?id='+id;
			}
