
      $(function() {
		$("#tabs").tabs();
		});

		//------------------------------------------
		function cart_pos_count() {
			$.ajax({
				url: 'php/cart/fltr.php',
				type: "POST",
				data: "cart_count=",
				success: function(msg){
					var qw = msg;
					qw = jQuery.trim(qw);
					$("#cart_count").text('('+qw+')');
				}
			})
		}
		//select in cart
		$("#site_ord").click(function(){
			$.ajax({
				url: 'php/select.php',
				type: "GET",
				success: function(sel){
					$("#cl_info").html(sel);
				}
			})
		});
		//---------------------------------------------
		$(document).ready(function(){
           	$('#Form').submit(function(){
            	$.ajax({
                     type: "POST",
                     async: true,
                     url: "php/query.php",
                     data: "srch="+$("#srch").val(),
                     beforeSend: function(html){
                         $('#content').css("display","inline");
						 update();},
                     success: function(html){
                         $('#comm').fadeOut(1000);
                    	 $('#words').css("display","none");
						 $('#content').css("display","inline");
                     	 $('#tabs-1').html(html);
					 	//--------------------CART ADD-------------------------
						$( "img[id^='into_cart']" ).click(function(){
							var in_cart = $(this).attr("id");
							$(this).attr("disabled","disabled");
							$.ajax({
								url: 'php/cart/fltr.php',
								type: "POST",
								data: "cart_add=" + in_cart,
								success: function(){
									cart_pos_count();
								}
							})
						});
                     	 $(document).ready(function(){
                     	 	$('tr:odd').addClass('odd');
						    $('tr:even').addClass('even');
							$("input#filter").quicksearch("table#ans tbody tr");
                     	 //	$('a.iframe').fancybox({
                     	 //		"frameWidth" : 650,
                     	 //		"frameHeight" : 480,
                     	 //		hideOnContentClick: false,
                     	 //		centerOnScroll: false});
                     		$('#ans > * tr:not(:first)').hover(function(){$(this).css({'color' : 'red'});},function(){$(this).css({'color' : 'black'});});
	  	                   	});
                     	;}
                     });
				 //srchinm();
                 return false;
             });
           });
	/*function srchinm(){
		$.ajax({
           	type: "POST",
           	async: true,
           	url: "php/queryinm.php",
           	data: "srch="+$("#srch").val()+"&prov=1",
           	beforeSend: function(html){
           		//$('#comm').css("display","inline"),
				$('#content').css("display","inline");
				updateinm();},
				success: function(html){
                  	$('#comm').fadeOut(1000);
               		$('#content').css("display","inline");
               		$('#tabs-2').html(html);
               		$(document).ready(function(){
               			$('tr:odd').addClass('odd');
	    				$('tr:even').addClass('even');
						$("input#filter").quicksearch("table#ans tbody tr");
                	 	$('a.iframe').fancybox({
                	 		"frameWidth" : 650,
  	             	 		"frameHeight" : 480,
      	         	 		hideOnContentClick: false,
          	     	 		centerOnScroll: false});
              	 		$('#ans > * tr:not(:first)').hover(function(){$(this).css({'color' : 'red'});},function(){$(this).css({'color' : 'black'});});

               	 	});
               	;}
        });
	}*/
	function update()
	{	var loader='<div style="position: relative; padding: 2% 50%; "><img align="top" src="php/loader.gif"></div>';
		$('#tabs-1').html(loader);
	}
	function updateinm()
	{	var loader='<div style="position: relative; padding: 2% 50%; "><img align="top" src="php/loader.gif"></div>';
		$('#tabs-2').html(loader);
	}
	function lookup(srch) {
		if(srch.length == 0) {
			$('#suggestions').hide();
		} else {
			$.post("php/autocomplete.php", {queryString: ""+srch+""}, function(data){
				if(data.length >0) {
					$('#suggestions').show();
					$('#autoSuggestionsList').html(data);
				}
			});
		}
	} // lookup

	function fill(thisValue) {
		$('#srch').val(thisValue);
		setTimeout("$('#suggestions').hide();", 200);
	}
