 var flag=true;
        jQuery(document).ready(function(){
            jQuery("#btn").click(function(){
                
                if(jQuery("#poppup").length)
                {
                    var options = {};
                    jQuery("#poppup").toggle('drop', options, 500); 
                    return false;
                }
                
            });
            jQuery(document).click(function(e){
                    jQuery("#poppup").hide();   
            });
            
                

            jQuery("#poppup a").click(function(){
                
                    var url=jQuery(this).attr('href');
                    var sub = url.substr(0,4);
                    if(sub!='http')
                    {
                        url='http://tuning-market.od.ua'+url;
                    }
                  location=url;  
            }); 
            
                                           
            jQuery("#poppup").click(function(){
                return false;    
            });   
            
            
            jQuery("area").tooltip({
                bodyHandler: function() {
                        h=jQuery(this).attr("href");
                        h=h.replace("index.php","index2.php");
                		return jQuery.get(h, function(data){
                		      jQuery('#tooltip .body').html(data);   });
                           //return  jQuery(jQuery(this).attr("href")).html(); 
                		
                	},
                
                left: -100,
                showURL: false,  
                opacity: 0.95
            });     
            
            jQuery("a.pop").tooltip({
                bodyHandler: function() {
                        h=jQuery(this).attr("href");
                        h=h.replace("index.php","index2.php");
                		return jQuery.get(h, function(data){
                		      jQuery('#tooltip .body').html(data);   });
                           //return  jQuery(jQuery(this).attr("href")).html(); 
                		
                	},
                
                left: -170,
                showURL: false,  
                opacity: 0.85,
                extraClass: "dostavka2"
            });       
     });
     
     
     
     
     
     
function ShowReserv()
{
    jQuery( "#dialog:ui-dialog" ).dialog( "destroy" );  
    $url=window.location;
    $name=jQuery('#div0 .col2 .product_name').html();
    jQuery.ajax({
           type: "POST",
           url: "/reserv.php",
           data: "action=get_form&name_product="+$name+"&url="+$url,
           success: function(msg){
             jQuery( "#dialog" ).html(msg);
           }
     });
 
 
    /*jQuery.get("", {"action":"get_form", 'url':$url},
                      function(returned_data)
                      {
                          jQuery( "#dialog" ).html(returned_data);
                      });*/
                      
         
    jQuery( "#dialog" ).dialog( {
            modal: true,
            width: 750,
            minWidth: 400,
            resizable: false,
            show: 'slide',
            title: 'В Резерв',
    
            buttons: { "В резерв": function() { 
                            
                            
                            $isValid=true;
                            if(jQuery("#dialog form").length)
                            {
                               jQuery("#dialog form .m").css('display','none');
                               
                               if(jQuery("#dialog form #reserv_user_name").val()=='')
                               {
                                    jQuery("#dialog form #reserv_user_name").parent().parent().find('.m').css('display','block');
                                    $isValid=false;
                               }
                               if(jQuery("#dialog form #reserv_user_phone").val()=='')
                               {
                                    jQuery("#dialog form #reserv_user_phone").parent().parent().find('.m').css('display','block');
                                    $isValid=false;
                               }
                               
                               if($isValid==true)
                               {
                                   jQuery.ajax({
                                           type: "POST",
                                           url: "/reserv.php",
                                           data: jQuery( "#dialog form" ).serialize(),
                                           success: function(msg){
                                             jQuery( "#dialog" ).html(msg);
                                             jQuery(".ui-dialog-buttonset button").eq(0).css('display','none');
                                           }
                                     }); 
                                 }
                            
                            }
                        },
                        "Отмена":function() { 
                            jQuery(this).dialog("close"); 
                            }
            }
        } );
} 


     
function ShowShortOrder()
{
    jQuery( "#dialog:ui-dialog" ).dialog( "destroy" );  
    $url=window.location;
    $name=jQuery('#div0 .col2 .product_name').html();
    jQuery.ajax({
           type: "POST",
           url: "/short_order.php",
           data: "action=get_form&name_product="+$name+"&url="+$url,
           success: function(msg){
             jQuery( "#dialog" ).html(msg);
           }
     });
 
 
    /*jQuery.get("", {"action":"get_form", 'url':$url},
                      function(returned_data)
                      {
                          jQuery( "#dialog" ).html(returned_data);
                      });*/
                      
         
    jQuery( "#dialog" ).dialog( {
            modal: true,
            width: 750,
            minWidth: 400,
            resizable: false,
            show: 'slide',
            title: 'Заказ',
    
            buttons: { "Заказать": function() { 
                            
                            
                            $isValid=true;
                            if(jQuery("#dialog form").length)
                            {
                               jQuery("#dialog form .m").css('display','none');
                               
                               if(jQuery("#dialog form #short_order_user_name").val()=='')
                               {
                                    jQuery("#dialog form #short_order_user_name").parent().parent().find('.m').css('display','block');
                                    $isValid=false;
                               }
                               if(jQuery("#dialog form #short_order_user_phone").val()=='')
                               {
                                    jQuery("#dialog form #short_order_user_phone").parent().parent().find('.m').css('display','block');
                                    $isValid=false;
                               }
                               
                               if($isValid==true)
                               {
                                   jQuery.ajax({
                                           type: "POST",
                                           url: "/short_order.php",
                                           data: jQuery( "#dialog form" ).serialize(),
                                           success: function(msg){
                                             jQuery( "#dialog" ).html(msg);
                                             jQuery(".ui-dialog-buttonset button").eq(0).css('display','none');
                                           }
                                     }); 
                                 }
                            
                            }
                        },
                        "Отмена":function() { 
                            jQuery(this).dialog("close"); 
                            }
            }
        } );
} 
