$(document).ready(function() { 

// malsup.com/jquery/form/#code-samples

    var options = { 
        target:     '#enovice .return',   // target element(s) to be updated with server response 
        type:      'post',
        url:       '/include/ajax/ajax.prijava_enovice.php'
    }; 
 
    // bind to the form's submit event 
    $('#newsletter_prijava').submit(function() { 
        $(this).ajaxSubmit(options); 
        return false; 
    });
    
    var optionspp = { 
        target:     '#form_echo',   // target element(s) to be updated with server response 
        type:      'post'
    }; 
 
    // bind to the form's submit event 
    $('#priporoci').submit(function() { 
        $(this).ajaxSubmit(optionspp); 
        return false; 
    }); 
    
    var options2 = { 
        target:     '#form_echo',   // target element(s) to be updated with server response 
        type:      'post',
        url:       '/include/ajax/ajax.kontakt.php'
    }; 
 
    // bind to the form's submit event 
    $('#kontaktni_obrazec').submit(function() { 
        $(this).ajaxSubmit(options2); 
        return false; 
    });
    
    
    /*
    var options3 = { 
        target:     '#form_echo',  
        type:      'post',
        url:       '/include/ajax/ajax.prijavi_se.php'
    }; 
  
    $('#prijavi_se').submit(function() { 
        $(this).ajaxSubmit(options3); 
        return false; 
    })
    */
    
    
    $('#prijavi_se').ajaxForm({
        beforeSubmit: function(a,f,o) {
          //  o.dataType = $('#uploadResponseType')[0].value;
            $('#form_echo').html('Pošiljanje... ');
        },
        success: function(data) {
            var $out = $('#form_echo');
           // $out.html('Form success handler received: <strong>' + typeof data + '</strong>');
            if (typeof data == 'object' && data.nodeType)
                data = elementToString(data.documentElement, true);
            else if (typeof data == 'object')
                data = objToString(data);
            $out.append(data);  
        }  
    });    
    
    
    
    
    
    var options4 = { 
        target:     '#form_echo',   // target element(s) to be updated with server response 
        type:      'post',
        url:       '/include/ajax/ajax.registracija.php'
    }; 
 
    // bind to the form's submit event 
    $('#registriraj_se').submit(function() { 
        $(this).ajaxSubmit(options4); 
        return false; 
    }) 
    
    var options5 = { 
        target:     '#form_echo',   // target element(s) to be updated with server response 
        type:      'post',
        url:       '/include/ajax/ajax.prijava_napake.php'
    }; 
 
    // bind to the form's submit event 
    $('#prijava_napake').submit(function() { 
        $(this).ajaxSubmit(options5); 
        return false; 
    })
    
   //objavi video 
    var options6 = { 
        target:     '#form_echo',   // target element(s) to be updated with server response 
        type:      'post',
        url:       '/include/zabavne_vsebine/ajax/ajax.objavi_video.php'
    }; 
 
    // bind to the form's submit event 
    $('#objavi_video').submit(function() { 
        $(this).ajaxSubmit(options6); 
        return false; 
    })
    
    
    //objavi video 
    var options7 = { 
        target:     '#ajax_content',   // target element(s) to be updated with server response 
        type:      'post',
        url:       '/include/zabavne_vsebine/ajax/ajax.uredi_media.php'
    }; 
 
    // bind to the form's submit event 
    $('#uredi_video').submit(function() { 
        $(this).ajaxSubmit(options7); 
        return false; 
    })
    
    var options9 = { 
        target:     '#izpis_komentarjev',   // target element(s) to be updated with server response 
        type:      'post',
        url:       '/include/zabavne_vsebine/ajax/ajax.dodaj_komentar.php'
    }; 
 
    // bind to the form's submit event 
    $('#komentar_form').submit(function() { 
        $(this).ajaxSubmit(options9); 
        return false; 
    })
    
 
    
    
    var options10 = { 
      target:     '#form_echo',   // target element(s) to be updated with server response 
      type:      'post',
      url:       '/include/ajax/ajax.enovice_odjava.php'
    }; 
 
    // bind to the form's submit event 
    $('#enovice_odjava').submit(function() { 
        $(this).ajaxSubmit(options10); 
        return false; 
    })
      
      
      $('#objavi_sliko').ajaxForm({
        beforeSubmit: function(a,f,o) {
          //  o.dataType = $('#uploadResponseType')[0].value;
            $('#form_echo').html('Pošiljanje... ');
        },
        success: function(data) {
            var $out = $('#form_echo');
           // $out.html('Form success handler received: <strong>' + typeof data + '</strong>');
            if (typeof data == 'object' && data.nodeType)
                data = elementToString(data.documentElement, true);
            else if (typeof data == 'object')
                data = objToString(data);
            $out.append(data);  
        }  
    });

 });
