﻿function rr52_openDialog(divDialog, divdialogtext, dialogText, typ, postBackMethod) {

    $(divdialogtext).text(dialogText);

    $(divDialog).css({ 'width': 300, 'height': 500 });

    $(divDialog).centerInClient({ container: window, forceAbsolute: true });

    $(divDialog).css({ 'height': 0 });

    $(divDialog).css({ 'display': 'block' });

    dialog_screen_on();

    $(divDialog).animate({ "height": "200px" }, "slow");
    //$(divDialog).animate({ "width": "300px" }, "fast");

    // PageMethod("GetMessage", ["message", "leer"], MessageOK, MessageFalse);
}

function closeDialog(divDialog) {

    $(divDialog).css({ 'display': 'none' });

    dialog_screen_off();

    //   $("#block2").animate({ width: "90%" }, 1000)
    //.animate({ fontSize: "24px" }, 1000)
    //.animate({ borderLeftWidth: "15px" }, 1000);

    $(divDialog).css({ 'display': 'none' });
}

function closeDialogWithPostBack(divDialog,labelPostBack,labelParams) {


    $.get("/dialog?operation=" + $(labelPostBack).text() + "&value=" + $(labelParams).text());

    dialog_screen_off();

    $(divDialog).css({ 'display': 'none' });


    location.reload(true);
        
    //   $("#block2").animate({ width: "90%" }, 1000)
    //.animate({ fontSize: "24px" }, 1000)
    //.animate({ borderLeftWidth: "15px" }, 1000);



    $(divDialog).css({ 'display': 'none' });
}


function dialog_screen_off() {
    $('#screen').css({ opacity: 0, 'width': 0, 'height': 0 });

}

function dialog_screen_on() {
    $('#screen').css({ opacity: 0.5, 'width': $(document).width(), 'height': $(document).height() });
}


function MessageOK(result) {

    alert(result.d);
}

function MessageFalse(result) {

    alert('False');
}



//http://code-inside.de/blog/artikel/howto-microsoft-aspnet-ajax-clientseitiger-aufruf-von-webmethoden/
function PageMethod(fn, paramArray, successFn, errorFn) {
    var pagePath = window.location.pathname;
    pagePath = '/Sites/TeamProfil.aspx';
    //Create list of parameters in the form:  
    //{"paramName1":"paramValue1","paramName2":"paramValue2"}  
    var paramList = '';
    if (paramArray.length > 0) {
        for (var i = 0; i < paramArray.length; i += 2) {
            if (paramList.length > 0) paramList += ',';
            paramList += '"' + paramArray[i] + '":"' + paramArray[i + 1] + '"';
        }
    }
    paramList = '{' + paramList + '}';
    //Call the page method  
    $.ajax({
        type: "POST",
        url: pagePath + "/" + fn,
        contentType: "application/json; charset=utf-8",
        data: paramList,
        dataType: "json",
        success: successFn,
        error: errorFn
    })
 ;
}  
