/* ------------------------------------------- /
	Funções Principais
	Sgobin Studio
	
	Autor: Richard Sgobin
	
	Use esse arquivo para apreender, mas não copie
	e se copiar cite a fonte.

	(CC)
/ ------------------------------------------- */

// Hover News Itens
function hoverPacotes() {
	var caixas = $("ul.usahover li");

	caixas

	.hover(function () {
	    $(this)
				.addClass("bg-hover")
	}, function () {
	    $(this)
				.removeClass("bg-hover")
	})

	.click(function () {
	    window.location = $(this).find("a").attr("href");
	});
}

// Anima Menu Outros Destinos
function menuOutrosDestinos() {
    // Esconde o div se o javascript está habilitado
    //$("#destinos ul").addClass("escondido");

    // Mostra menu somente quando clica
    $("a#but-destinos").click(function () {
        $(this).addClass("selecionado");
        $("#destinos ul").slideDown(200);
        return false;
    });
    $("div#destinos").hover(
	  function () {
	      /* $("ul#lista-destinos").slideDown(200); */
	  },
	  function () {
	      $("#destinos ul").slideUp(300); /* Esconde o menu quando sai de cima */
	      setTimeout(function () {
	          $("a#but-destinos").removeClass("selecionado");
	      }, 320);
	  }
	);
}

//Slider Home
function iniciaSlider() {
    $("#slider").easySlider({
        auto: true,
        continuous: true,
        pause: 5000,
        controlsShow: false
    });
}

// Titulo para a Galeria de Imagens
function formatTitle(title, currentArray, currentIndex, currentOpts) {
    return '<div id="tip7-title">' + (title && title.length ? '<b>' + title + '</b>' : '') + 'Imagem ' + (currentIndex + 1) + ' de ' + currentArray.length + '</div>';
}

// hover tabela
function destacaLinha(tblNome) {
    $(tblNome).delegate('td', 'mouseover mouseleave', function (e) {
        if (e.type == 'mouseover') {
            $(this).parent().addClass("mouseSobre");
        }
        else {
            $(this).parent().removeClass("mouseSobre");
        }
    });
}

function modalMsg() {
    $("#diagModal").dialog({
        autoOpen: false,
        modal: true,
        title: 'So-Suiça',
        buttons: {
            OK: function () {
                $(this).dialog('close');
            }
        }
    });
}

//Google Maps
function initialize() {
    var latlng = new google.maps.LatLng(-22.978948, -47.000314);
    var myOptions = {
        zoom: 19,
        center: latlng,
        mapTypeId: google.maps.MapTypeId.HYBRID
    };

    var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

    var icone = 'imagens/icone-mapa.png';
    var marker = new google.maps.Marker({
        position: latlng,
        map: map,
        icon: icone,
        title: 'Canada Viagens e Turismo'
    });
};

// CALENDARIO HOTEL
function calendarioHotel() {
    $('.hotelCheck').datepicker({
        minDate: 0,
        //Datas Brazil
        dateFormat: 'dd/mm/yy',
        dayNames: [
					'Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado', 'Domingo'
					],
        dayNamesMin: [
					'D', 'S', 'T', 'Q', 'Q', 'S', 'S', 'D'
					],
        dayNamesShort: [
					'Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb', 'Dom'
					],
        monthNames: [
					'Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro',
					'Outubro', 'Novembro', 'Dezembro'
					],
        monthNamesShort: [
					'Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set',
					'Out', 'Nov', 'Dez'
					],
        nextText: 'Proximo',
        prevText: 'Anterior',

        //Esconde Botao Next/Prev
        hideIfNoPrevNext: true
    });
};

// Dimensiona modais e carrega conteudo
function preparaModal(Arquivo, Altura, Largura) {
    $("#modalGeral").load(Arquivo);
    $("#modalGeral").dialog({
        height: Altura,
        width: Largura,
        modal: true,
        title: 'So-Suiça',
        close: function () {
            $('#modalConteudo').remove();
        }
    });
    $("#modalGeral").dialog("open");
}
