﻿
function Carregar(page) {

    $get("conteudo").innerHTML = "";
    $("#loading").show();

    switch (page) {

        case 0:
            PageMethods.LoadHome(function (sucess) {
                $("#loading").hide();
                $get("conteudo").innerHTML = sucess;

                $("#Cliente").cycle({
                    fx: 'fade',
                    speed: 2500,
                    timeout: 4000
                });

            }, function (error) {
                $("#loading").hide();
            });
            break;
        case 1:
            PageMethods.LoadSample("Empresa.ascx", function (sucess) {
                $("#loading").hide();
                $get("conteudo").innerHTML = sucess;

            }, function (error) {
                $("#loading").hide();
            });
            break;
        case 2:
            PageMethods.LoadSample("Solucoes.ascx", function (sucess) {
                $("#loading").hide();
                $get("conteudo").innerHTML = sucess;

            }, function (error) {
                $("#loading").hide();
            });
            break;
        case 3:
            PageMethods.LoadSample("Consultoria.ascx", function (sucess) {
                $("#loading").hide();
                $get("conteudo").innerHTML = sucess;

            }, function (error) {
                $("#loading").hide();
            });
            break;
        case 4:
            PageMethods.LoadSample("Case.ascx", function (sucess) {
                $("#loading").hide();
                $get("conteudo").innerHTML = sucess;

            }, function (error) {
                $("#loading").hide();
            });
            break;
        case 5:
            PageMethods.LoadSample("Contato.ascx", function (sucess) {
                $("#loading").hide();
                $get("conteudo").innerHTML = sucess;

            }, function (error) {
                $("#loading").hide();
            });
            break;

        default:
            PageMethods.LoadSample(page, function (sucess) {
                $("#loading").hide();
                $get("conteudo").innerHTML = sucess;

            }, function (error) {
                $("#loading").hide();
            });

            break;
    }

}

function LoadCase(categoria, pagina) {

    $get("conteudo").innerHTML = "";
    $("#loading").show();

    PageMethods.LoadCase(categoria, pagina, function (sucess) {
        $("#loading").hide();
        $get("conteudo").innerHTML = sucess;
    }, function (error) {
        $("#loading").hide();
    });

}

function LoadClientes(pagina) {

    $get("conteudo").innerHTML = "";
    $("#loading").show();

    PageMethods.LoadClientes(pagina, function (sucess) {
        $("#loading").hide();
        $get("conteudo").innerHTML = sucess;
    }, function (error) {
        $("#loading").hide();
    });

}

function SendContact() {
    PageMethods.SendContact(
        $("#nome").val(),
        $("#email").val(),
        $("#cidade").val(),
        $("#uf").val(),
        $("#telefone").val(),
        $("#mensagem").val(),
    function (ret) {
        $("#nome").val("");
        $("#email").val("");
        $("#cidade").val("");
        $("#uf").val("");
        $("#telefone").val("");
        $("#mensagem").val("");
        alert('Mensagem Enviada com sucesso');
    }, function (error) {
        alert('Erro por favor tente novamente');
    });
}
