function user_firsttimer() {
	alert("Ön először lépett be rendszerünkbe, üdvözöljük!\nKérem, változtassa meg jelszavát a következő űrlapon!\nValamint többi adatát is ellenőrizze, és szükség esetén helyesbítse (pl. ékezethibák, email cím)!");
    document.location.href = "profil.php";
}

function ajaxlogin() {
    $.ajax({
        type: "POST",
        url: "functions_login_fromweb.php",
        data: $("#login-form").serialize(),
        success: function(data){
            var response = data || "no response text";
            if (response.substr(0,6) === "ERROR:") { alert(response.substr(7)); return false; }
            if (response.substr(0,15) === "USER_FIRSTTIMER") { response = response.substr(15); user_firsttimer(); }
            if (response.substr(0,6) === "RELOAD") { response = response.substr(6); document.location.reload(); }
            document.getElementById('login-box').innerHTML = response;
        },
        error: function() {
            alert('A belépési FORM (Ajax) inicializálása nem sikerült...');
        }
    });
}

function ajaxlogout() {
    $.ajax({
        type: "POST",
        url: "functions_logout_fromweb.php",
        success: function(data){
            var response = data || "no response text";
            if (response.substr(0,6) === "RELOAD") { response = response.substr(6); document.location.reload(); }
            document.getElementById('login-box').innerHTML = response;
        },
        error: function() {
            alert('A belépési FORM (Ajax) inicializálása nem sikerült...');
        }
    });
}

function ajax_galbase(mit) {
    $.ajax({
        type: "POST",
        url: "functions_ajaxhandlers.php",
        data: {callfunc: 'gallist', kapcsok: mit},
        success: function(data){
            var response = data || "no response text";
            document.getElementById('ajaxgaleria').innerHTML = response;
        },
        error: function() {
            alert('A felvitt cikkek megjelenítéséhez használt ajax\nscript inicializálása nem sikerült...');
        }
    });
}

function ajax_cikkbase(mit) {
    $.ajax({
        type: "POST",
        url: "functions_ajaxhandlers.php",
        data: {callfunc: 'cikklist', kapcsok: mit},
        success: function(data){
            var response = data || "no response text";
            document.getElementById('ajaxprobalo').innerHTML = response;
        },
        error: function() {
            alert('A felvitt cikkek megjelenítéséhez használt ajax\nscript inicializálása nem sikerült...');
        }
    });
}

function ajax_helybase() {
    $.ajax({
        type: "POST",
        url: "functions_ajaxhandlers.php",
        data: {callfunc: 'helylist'},
        success: function(data){
            var response = data || "no response text";
            document.getElementById('ajaxhely').innerHTML = response;
        },
        error: function() {
            alert('A felvitt cikkek megjelenítéséhez használt ajax\nscript inicializálása nem sikerült...');
        }
    });
}
