var dslOptionDialog;
showOptionDialog = function(url) {
    jQuery.ajax(
    {
        url: url,
        dataType: 'html',
        success: function(data) {
            dslOptionDialog = $('<div></div>')
            .html(data)
            .dialog({
                autoOpen: false,
                modal: true,
                width: 510,
                height: 650,
                cache: false,
                close: function(ev, ui) { $(this).remove(); }, 
                title: "DSL Tarifrechner",
                buttons: {

                    "Ok": function() {
                        $(dslOptionDialog).dialog("widget").find("form").submit();
                    },
                    "Abbrechen": function() {
                        $(this).dialog("close");
                    }
                }
            });
            dslOptionDialog.dialog('open');
        }
    }
    );
    return false;
};



showPrepaidOptionDialog = function(url) {
    jQuery.ajax(
    {
        url: url,
        dataType: 'html',
        success: function(data) {
            $dialog = $('<div></div>')
            .html(data)
            .dialog({
                autoOpen: false,
                modal: true,
                width: 400,
                height: 480,
                close: function(ev, ui) { $(this).remove(); }, 
                cache: false,
                title: "Prepaid Tarifrechner",
                buttons: {

                    "Ok": function() {
                        $(this).dialog("widget").find("form").submit();
                    },
                    "Abbrechen": function() {
                        $(this).dialog("close");
                    }
                }
            });
            $dialog.dialog('open');
        }
    }
    );
    return false;
};

showDetailDialog = function(el, tarif_url) {
    url = $(el).attr("href") + '?ajax=true';

    jQuery.ajax(
    {
        url: url,
        dataType: 'html',
        success: function(data) {

            $dialog = $('<div></div>')
            .html(data)
            .dialog({
                autoOpen: false,
                modal: true,
                width: 450,
                close: function(ev, ui) { $(this).remove(); },
                height: 350,
                title: $(el).text(),
                buttons: {

                    "zum Tarif": function() {
                        window.open(tarif_url);
                        $(this).dialog("close");
                    }
                }
            });
            $dialog.dialog('open');
        }
    }
    );
};

showTelefonberatungDialog = function(el) {
    url = $(el).attr("href") + '?ajax=true';

    jQuery.ajax(
    {
        url: url,
        dataType: 'html',
        success: function(data) {

            $dialog = $('<div></div>')
            .html(data)
            .dialog({
                autoOpen: false,
                modal: true,
                width: 450,
                close: function(ev, ui) { $(this).remove(); },
                height: 350,
                title: "Telefonische Beratung",
                buttons: {
                    "Schließen": function() {
                        $(this).dialog("close");
                    }
                }
            });
            $dialog.dialog('open');
        }
    }
    );
};

showAskDialog = function(url) {

    jQuery.ajax(
    {
        url: url,
        dataType: 'html',
        success: function(data) {

            $dialog = $('<div></div>')
            .html(data)
            .dialog({
                autoOpen: false,
                modal: true,
                width: 450,
                close: function(ev, ui) { $(this).remove(); },
                height: 350,
                title: "Frag deine Freunde nach Ihrer Meinung!",
                buttons: {
                    "Schließen": function() {
                        $(this).dialog("close");
                    }
                }
            });
            $dialog.dialog('open');
        }
    }
    );
};

showDslDetailDialog = function(url, tarif_url) {
    jQuery.ajax(
    {
        url: url,
        success: function(data) {
            $dialog = $('<div></div>')
            .html(data)
            .dialog({
                autoOpen: false,
                modal: true,
                width: 450,
                close: function(ev, ui) { $(this).remove(); },
                height: 470,
                title: "Tatsächliche Kosten",
                buttons: {
                    "zum Tarif": function() {
                        $(this).dialog("close");
                        window.open(tarif_url);
                    }
                }
            });
            $dialog.dialog('open');
        }
    });
}


showQuestionDialog = function(url, tags) {
//    url = $(el).attr("href") + '?ajax=true';

    jQuery.ajax(
    {
        url: url,
        dataType: 'html',
        success: function(data) {

            $dialog = $('<div></div>')
            .html(data)
            .dialog({
                autoOpen: false,
                modal: true,
                width: 500,
                height: 400,
                close: function(ev, ui) { $(this).remove(); }, 
                title: "Eine Frage stellen",
                buttons: {

                    "Frage stellen": function() {
                        $(this).dialog("widget").find("form").submit();
                    }
                }

               
            });
            $dialog.dialog('open');
        }
    }
    );
};
