//var server = "http://localhost/sumopix/docs/scripts/php/";

var this_path = server + "scripts/php/";

function flashReturn(){
    startNewProject();
    /*
    $.post(this_path + "photobook_wizard.php", {
        child: "true",
        uploaded: "true"
    }, function(data){
            $("#wizard_div").html(data);
            fitUI();
        }
    );*/
}

function uploadMore(){
    $.post(this_path + "photobook_wizard.php", {
        child: "true",
        action: "upload"
    }, function(data){
            $("#wizard_div").html(data);
            fitUI();
        }
    );
}

function startNewProject (){
    $('#start_project_button').hide();
    var module_obj = document.getElementById('flash_module');
    if(module_obj != null){
        module_obj.innerHTML = '';
    }
    startProject('');
}

function startProject(module){

    var unblock = false;
    if(module == '' || module == 'undefined' || module == null){
        module = $('#module_id').html();
    }
    // Check if the module is loaded
    var module_obj = document.getElementById('flash_module');

    //$.blockUI({message:'<h3><img src=\"http://www.sumopix.com/images/icons/loading.gif\" /> Henter softwaren, vent venligst</h3>'});

    if(module_obj != null && module_obj.innerHTML != ''){
        $.unblockUI();
        gotoEditor();
        unblock = true;
    }else{
        $("#main_content").html('');
    }
    if(!unblock){
        // Else load module
        $.post(this_path + "photobook_wizard.php", {
            start_editor: "true",
            child: "true",
            start_module: module
        }, function(data){
                $("#main_content").html(data);
                $.unblockUI();
                gotoEditor();
                resizePage();
            }
        );
    }else{
        $.unblockUI();
    }
}

function selectFolder(id){
    $.post(this_path + "photobook_wizard.php", {
        album: id,
        child: "true"
    }, function(data){
            $("#wizard_div").html(data);
            fitUI();
        }
    );
}
