



jQuery(document).ready(function($) {
      $('a[rel*=facebox]').facebox({
        loading_image : 'loading.gif',
        close_image   : 'closelabel.gif'
      }) 
    })
    
  function del(a)
  {
  	look_basket('?del='+a,'info','ajax_basket.php');
  	setTimeout("small()",5000);
    	
  }
	
  function add_item(a)
  {
  	look_basket('?item='+a,'info','ajax_basket.php');
  	 	setTimeout("small()",5000);
  		
  }
  
  function send_order(name,email,phone,comments)
  {
  	look_basket('?send_order&name='+escape(name)+'&email='+email+'&phone='+phone+'&comments='+escape(comments),'info','ajax_basket.php');
  	setTimeout("small()",5000);
    	
  }
  function show_basket()
  {
  	look_basket('','info','ajax_basket.php');
    	
  }
function small()
  {
  	look2('?small','basket_div','ajax_basket_small.php');
    	
  }
  
  
function look_basket(text, select_id, url) {//alert (text);
        var select = document.getElementById(select_id);
        if(!this.http){
            this.http = get_http_basket();
            this.working = false; 
        }
        if (!this.working && this.http) {
        var http = this.http; 
            url = url +text;// alert(url);
            this.http.open("GET", url, true); 
            this.http.onreadystatechange = function() {
	            if (http.readyState == 4) {
	            	
                    fill_basket(select_id, http.responseText);
                    this.working = false;
                  }
            }
            this.working = false;
            this.http.send(null);
        }
        if(!this.http){
              alert('Error XMLHTTP!');
        }
    }

function  get_http_basket()
{
    var  xhr;
    if(window.XMLHttpRequest)  {
        try  {
            xhr  =  new  XMLHttpRequest();
        }  catch(e)  {
            xhr  =  false;
        }
    }  else  if(window.ActiveXObject)  { 
        try  {
            xhr  =  new  ActiveXObject("Microsoft.XMLHTTP");
        }  catch(e)  {
            xhr  =  false;
        }
    }
    return  xhr;
}
function fill_basket (select_id, data)
{ 
	 jQuery.facebox(data);
}
