﻿/// <reference name="MicrosoftAjax.js"/>

var status = null;
var postparams = null;

//add a window.load handler to init any necessary controls
Sys.Application.add_load(initializeControls);

function initializeControls(e) {
}

//call the service
function GetAsync(params, resultpanel) {

    postparams = params;
    /*Sys.Net.WebServiceProxy.invoke(
       page,
       method,
       false,
       params,
    onSuccess, onFailure, resultpanel, 10000);*/
    ws_ajax_load.Kontrol_Method(params.target, params.argument, params.prono, params.issecure,
                               onSuccess, onFailure, [resultpanel], 10000);
}

//this is our handler that will fire when the call to the page-method was successful.
function onSuccess(result, resultpanel, methodName) {

    var resultpanelid;

    if (resultpanel.sepetDivid != null)
        resultpanelid = resultpanel.sepetDivid;

    if (resultpanelid != null) {
        var obj = $get(resultpanelid);
        while (obj.firstChild)
            obj.removeChild(obj.firstChild);

        var ndiv = document.createElement('div');
        ndiv.innerHTML = result;

        obj.appendChild(ndiv);
    }
}

function onFailure(result, panelidarray, methodName) {

    //Ajax Failure Olur İse , JS Post Methodu Çalışır.
    if (postparams != null && postparams.target != null && postparams.argument != null)
        Post(postparams.target, postparams.argument);
}