 function show_loading() {
        
     $('#contactlist').html('<img src="images/ajax_load.gif" id="main_loader" />');
    
 }
 
  $(function(){
       
        $('#error_form').dialog({
            modal: true,
            autoOpen: false,
            width: 400,
            buttons: {
                "Bezár": function() { 
                    $(this).dialog("close"); 
                }
            }
        });
        
        $('#errorvisszahivas').dialog({
            modal: true,
            autoOpen: true,
            width: 400,
            buttons: {
                "Bezár": function() { 
                    $(this).dialog("close"); 
                }
            }
        });
        
        $('#errorvisszahivassuccess').dialog({
            modal: true,
            autoOpen: true,
            width: 400,
            buttons: {
                "Bezár": function() { 
                    $(this).dialog("close"); 
                }
            }
        });

    });
    
    $(function() {
        $( "#tabs" ).tabs();
    });
    
 function selectAllContact() {
        
     var status = $('#invitation_select_all').is(':checked');
     var contact_count =  $('#contact_counter').val();
     if(status == true){
          
        for ($i = 1; $i <= contact_count; $i++){
                
             $('#contact_'+$i).attr('checked', true);
        }
         
     }else{
            
            for ($i = 1; $i <= contact_count; $i++){
                
                 $('#contact_'+$i).attr('checked', false);
            }   
     }
}
       
       
$(document).ready(function() {
        
    $("#elkuld").click(function () { 
        
       var name = $('#nev').val();  
       var email = $('#email').val();
       var phone = $('#telefon').val();
       var item_1 = $('#grafikai_tervezes').is(':checked');
       var item_2 = $('#honlapkeszites').is(':checked');
       var item_3 = $('#webaruhaz_keszites').is(':checked');
       var item_4 = $('#seo').is(':checked');
       var item_5 = $('#facebook').is(':checked'); 
       var message = $('#reszletek').val();
       var help =''; 
       var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; 
           
       // Name validation
       
        if (name == null || name=='') {                        
          $("#error_form").html('Kérem adja meg a nevét!').dialog("open");
          $('#nev').focus(); 
          return false;
       }
              
       // Email validation
          
       if(reg.test(email) == false) {
          $("#error_form").html('Érvénytelen e-mail cím!').dialog("open");     
          $('#email').focus(); 
          return false;
       }
       
       if (phone == null || phone=='') {                        
          $("#error_form").html('Kérem adja meg a telefonszámát!').dialog("open");     
          $('#phone').focus(); 
          return false;
       }
       

       // Checkbox validation
       
       if( item_1 == false && item_2 == false && item_3 == false && item_4 == false && item_5 == false){
          
           $("#error_form").html('Kérem válasszon hogy miben segíthetünk Önnek!').dialog("open"); 
            $('#grafikai_tervezes').focus();
           return false;   
       }
       
       if(item_1 == true){
           
         help+='- Grafikai tervezés<br/>';  
           
       }
       
       if(item_2 == true){
           
         help+='- Honlapkészítés<br/>';  
           
       }
       
       if(item_3 == true){
           
         help+='- Webáruház készítés <br/>';  
           
       }
       
        if(item_4 == true){
           
         help+='- Keresőoptimalizálás (SEO)<br/>';  
           
       }
       
       if(item_5 == true){
           
         help+='- Facebook fejlesztés<br/>';  
           
       }

        // Send data with Ajax
       
        $.post("includes/interface.php",{   
                  send: "true",
                  name: ""+name+"",
                  email: ""+email+"",
                  phone: ""+phone+"",
                  help: ""+help+"",
                  message: ""+message+""
                   
              
       }, function(data){
                             
           
            $('#nev').val('');  
            $('#email').val('');    
            $('#telefon').val('');   
            $('#reszletek').val(''); 
            $("#error_form").html('Köszönjük megkeresését! Munkarársunk hamarosan felveszi Önnel a kapcsolatot!').dialog("open");
            return true;  
                 

       });       
            
      }); 
    
 });
 
 

 function callback(){
        
       var name = $('#nev').val();  
       var phone = $('#telefonszam').val();
       var callbackTime = $('#idopont').val(); 
           
       // Name validation
       
        if (name == null || name=='' || name=='név') {                        
          $("#error_form").html('Kérem adja meg a nevét!').dialog("open");
          $('#nev').focus(); 
          return false;
       }
              
       
       if (phone == null || phone=='') {                        
          $("#error_form").html('Kérem adja meg a telefonszámát!').dialog("open");     
          $('#phone').focus(); 
          return false;
       }
       
        if (callbackTime == null || callbackTime=='') {                        
          $("#error_form").html('Kérem adja meg a visszahívás idejét!').dialog("open");     
          $('#idopont').focus(); 
          return false;
       }

        // Send data with Ajax
       
        $.post("includes/interface.php",{   
                  callback: "true",
                  name: ""+name+"",
                  email: ""+email+"",
                  phone: ""+phone+"",
                  item_1: ""+item_1+"",
                  item_2: ""+item_2+"",
                  item_3: ""+item_3+"", 
                  item_4: ""+item_4+"",
                  item_5: ""+item_5+"",
                  message: ""+message+""
                   
              
       }, function(data){
                             
            alert(data);
            $('#nev').val('');  
            $('#email').val('');    
            $('#telefon').val('');   
            $('#reszletek').val(''); 
            $("#error_form").html('Köszönjük megkeresését! Munkarásunk hamarosan felveszi Önnel a kapcsolatot!').dialog("open");
            return true;  
                 

       });       
            
}

function oldalajanlo(){
    
alert('benn');    
    
    
    
}

function openDialog(dialog){
     
     
     $( '#'+dialog ).dialog('open');  
        
 }
 
 $(function() {
        // a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore!
        $( "#dialog:ui-dialog" ).dialog( "destroy" );

        $( "#dialog-form" ).dialog({
            autoOpen: false,
            height: 400,
            width: 550,
            modal: true,
            buttons: {
                "Ajánlom": function() {
                    var bValid = true;
                   
                    var fromName = $("#from_name").val(); 
                    var fromEmail = $("#from_email").val();
                    var toName = $("#to_name").val(); 
                    var toEmail = $("#to_email").val();
                    var toNameSec = $("#to_name_sec").val(); 
                    var toEmailSec = $("#to_email_sec").val();
                    var message = $("#messageajanlo").val();  
                    var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; 
                    
                     if (fromName == null || fromName=='') {                        
                        $("#error_form").html('Kérem adja meg a nevét!').dialog("open");
                        $('#fromName').focus(); 
                        return false;
                     }
              
                    // Email validation
          
                    if(reg.test(fromEmail) == false) {
                         $("#error_form").html('Érvénytelen e-mail cím!').dialog("open");     
                         $('#fromEmail').focus(); 
                         return false;
                  }
                  
                  if (toName == null || toName=='') {                        
                        $("#error_form").html('Kérem adja meg az 1. Partner nevét!').dialog("open");
                        $('#to_name').focus(); 
                        return false;
                     }
                     
                     if(reg.test(toEmail) == false) {
                         $("#error_form").html('Érvénytelen e-mail cím!').dialog("open");     
                         $('#to_email').focus(); 
                         return false;
                   }

                    if(bValid){

                         // Send data with Ajax
                         
                        $.post("includes/interface.php",{   
                         oldalajanlo: "true",
                         fromName: ""+fromName+"",
                         fromEmail: ""+fromEmail+"",
                         toName: ""+toName+"",  
                         toEmail: ""+toEmail+"",
                         toNameSec: ""+toNameSec+"", 
                         toEmailSec: ""+toEmailSec+"",
                         message: ""+message+""   
  
                         }, function(data){

                         
                            $('#error_form').html(data).dialog('open');
                            return true;  
            
                        });        
                        
                        // Close window
                        $( this ).dialog( "close" ); 
                    } 
                   
                   
                   
                },
                Bezár: function() {
                    $( this ).dialog( "close" );
                }
            },
            close: function() {
                allFields.val( "" ).removeClass( "ui-state-error" );
            }
        });

        $( "#create-user" )
            .button()
            .click(function() {
                $( "#dialog-form" ).dialog( "open" );
            });
    });
    
 
