﻿var imagensMenu = "/content/img/menu/";

function over(obj, imagem) {

    obj.src = imagensMenu + imagem + ".jpg";

}

function out(obj, imagem) {
    obj.src = imagensMenu + imagem + ".jpg";
}

function ir(url) {

    window.location = url;

}

function adicionaEventos() {

    var menuHome = document.getElementById("menuHome");
    var menuSobre = document.getElementById("menuSobre");
    var menuProdutos = document.getElementById("menuProdutos");
    var menuArtistas = document.getElementById("menuArtistas");
    var menuVideos = document.getElementById("menuVideos");
    var menuEventos = document.getElementById("menuEventos");
    var menuDealers = document.getElementById("menuDealers");
    var menuContato = document.getElementById("menuContato");

    var logo = document.getElementById("logo");

    menuHome.onmouseover = function () {
        over(this, 'menu_home_2');
    }

    menuHome.onmouseout = function () {
        out(this, 'menu_home');
    }

    menuSobre.onmouseover = function () {
        over(this, 'menu_sobre_2');
    }

    menuSobre.onmouseout = function () {
        out(this, 'menu_sobre');
    }

    menuProdutos.onmouseover = function () {
        over(this, 'menu_produtos_2');
    }

    menuProdutos.onmouseout = function () {
        out(this, 'menu_produtos');
    }

    menuArtistas.onmouseover = function () {
        over(this, 'menu_artistas_2');
    }

    menuArtistas.onmouseout = function () {
        out(this, 'menu_artistas');
    }

    menuVideos.onmouseover = function () {
        over(this, 'menu_videos_2');
    }

    menuVideos.onmouseout = function () {
        out(this, 'menu_videos');
    }

    menuEventos.onmouseover = function () {
        over(this, 'menu_eventos_2');
    }

    menuEventos.onmouseout = function () {
        out(this, 'menu_eventos');
    }

    menuDealers.onmouseover = function () {
        over(this, 'menu_dealers_2');
    }

    menuDealers.onmouseout = function () {
        out(this, 'menu_dealers');
    }

    menuContato.onmouseover = function () {
        over(this, 'menu_contato_2');
    }

    menuContato.onmouseout = function () {
        out(this, 'menu_contato');
    }

    logo.onclick = function () {
        ir("/");
    }
}

window.onload = function () {
    adicionaEventos();

    var telefone = document.getElementById("telefone");

    if (telefone != null)
        mascaras();




}

$(document).ready(function () {
    MarcaDagua();
});

function MarcaDagua() {
    $('#nome').watermark('nome:');
    $('#email').watermark('email:');

}


function menu(id) {
   

        var sub = document.getElementById("sub_" + id);
        var img = document.getElementById("img_" + id);

        if (sub.className == "fechado") {

            sub.className = "aberto";
            sub.style.display = "block";
            img.src = "/Content/img/flecha_menos.jpg";
        }
        else {
            sub.className = "fechado";
            sub.style.display = "none";
            img.src = "/Content/img/flecha_mais.jpg";


        }

    }


    function EnviarContato() {


        var formulario = document.getElementById("formContato");

        var nome = document.getElementById("nome");
        var email = document.getElementById("email");
        var mensagem = document.getElementById("mensagem");


        if (nome.value != '') {

            if (email.value != '') {

                if (ValidarEmail(email.value)) {

                    if (mensagem.value != '')
                        formulario.submit();
                    else {
                        alert("Informe a Mensagem");
                        mensagem.focus();
                    }


                }
                else {
                    alert("Informe um e-mail válido");
                    email.focus();
                }

            }
            else {
                alert("Informe o e-mail");
                email.focus();
            }

        }
        else {
            alert("Informe o nome");
            nome.focus();
        }

       



    }

    function ValidarEmail(email) {
        var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
        if (reg.test(email) == false) {
            return false;
        }
        else
            return true;
    }


    function mascaras() {
    
        jQuery(function ($) {
            $("#telefone").mask("(99) 9999-9999");       
        });

    }



