
    function add_2_basket(product_id, quantity)
    {
        xajax_add_2_basket(product_id, quantity);
        return false;
    }
    
    var quantity_objs= new Object();
    var price_objs= new Object();
    var total_price_objs= new Object();
    var total_obj;
    
    function change_quantity(a_object)
    {
        var tmp= a_object.id.split('_');
        var direction= tmp[1]=='up' ? 1 : -1;
        var product_id= tmp[2];
        
        if ( !quantity_objs[product_id] )
            quantity_objs[product_id]= document.getElementById('quantity_' + product_id);
        if ( !price_objs[product_id] )
            price_objs[product_id]= document.getElementById('price_' + product_id);
        if ( !total_price_objs[product_id] )
            total_price_objs[product_id]= document.getElementById('total_' + product_id);
        if ( !total_obj )
            total_obj= document.getElementById('total');
        
        var current_quantity= parseInt(quantity_objs[product_id].innerHTML);
        var next_quantity= current_quantity + direction;
        
        if ( next_quantity>0 )
        {
            quantity_objs[product_id].innerHTML= next_quantity;
            var price_per_one= parseInt(price_objs[product_id].innerHTML);
            total_price_objs[product_id].innerHTML= price_per_one*next_quantity;
            
            var total_price= parseInt(total_obj.innerHTML);
            total_price-= price_per_one*current_quantity;
            total_price+= price_per_one*next_quantity;
            total_obj.innerHTML= total_price;
            
            xajax_update_basket(product_id, next_quantity);
        }
        
        return false;
    }
    
    function delete_product(object)
    {
        var params= object.id.split('_');
        var product_id= parseInt(params[1]);

        if ( !quantity_objs[product_id] )
            quantity_objs[product_id]= document.getElementById('quantity_' + product_id);
        if ( !price_objs[product_id] )
            price_objs[product_id]= document.getElementById('price_' + product_id);
        if ( !total_obj )
            total_obj= document.getElementById('total');

        var quantity= parseInt(quantity_objs[product_id].innerHTML);
        var price_per_one= parseInt(price_objs[product_id].innerHTML);
        var total_price= parseInt(total_obj.innerHTML);
        
        total_obj.innerHTML= total_price - price_per_one*quantity;

        xajax_update_basket(product_id, 0);
        
        var basket_table= document.getElementById('basket');
        var row_index= object.parentNode.parentNode.rowIndex;
        basket_table.deleteRow(row_index);
        if ( basket_table.rows.length==1 )
            document.getElementById('basket_div').innerHTML= '<p>Ваша корзина пуста. Пройдитесь по каталогу и купите что-нибудь.</p>';
        
        return false;
    }
    
    /**
    *   Email address validation
    */
    function is_valid_email(email)
    {
        var email_regexp = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
        return email_regexp.test(email)==false ? false : true;
    }



//------------search---------------

function searchStart()
{
    $("input[@name='searchStartName']").val(""); 
}

function searchButName()
{
    
  var name=$("input[@name='searchStartName']").val();
   
  $.ajax(
    {
        type: "GET",
        url: "/includes/ajax/ajax_img_rating.php",
        async: false, 
        data: "mode=ajax_search_mode&name="+name,
        success: function(res)
        {
            $("input[@name='searchHidden']").val(res);
            //alert($("input[@name='searchHidden']").val());
        }
    }
  );

  if($("input[@name='searchHidden']").val()!="") 
    return true;
  else return false;  
 
}
//------------search---------------

//-----------feedback--------------

function feedbackStart()
{
    
    $("#feedbackStartDiv").css("display", "block");
	$("#feedbackStartDivLogin").css("display", "block");
	
   
}
//-----------feedback--------------
//-----------CloseFeedback---------

function funCloseFeedback()
{
     $("#feedbackStartDivLogin").hide(); 
         
     $("#feedbackStartDiv").hide(); 
}
//-----------CloseFeedback---------
