$(document).ready(function(){
  $(".w3-jshow").show();
  $(".w3-jhide").hide();
  $(".w3-menu li:has(ul)").hover(
    function() {
      $(this).children("ul").show();
    },
    function() {
      $(this).children("ul").hide();
  });
  $(".w3-jshowclass").click(function() {
    id = "."+$(this).attr("rel");
    $(id).show();
  });
  $(".w3-jhideclass").click(function() {
    id = "."+$(this).attr("rel");
    $(id).hide();
  });
  $(".w3-close").live("click",function() {
    $(this).parent().hide();
  });
  $(".w3-jselect").change(function(){
    rel = $(this).attr("rel");
    rel = rel.split("-");
    val = $(this).val();
    if(rel[0] == val) {
      $("."+rel[1]).show();
    }
    else {
      $("."+rel[1]).hide();
    } 
  });
  $('.j-show').click(function() {
    id = $(this).attr('href');
    $('.j-showhide').hide();
    $(id).show();
    $('.j-show').parent('li').removeClass('active');
    $(this).parent('li').addClass('active');
  });
  
  $('.contact').click(function () {
    rel = $(this).attr('rel');    
    loadmaps(rel);
  });
  $('.gallery-image a').hover(
    function() {
      href = $(this).attr('href');
      $('#large-image').attr('src',href).show();
    },function() {
      $('#large-image').hide().attr('src','');
    }
  );
  $('.icon').hover(
    function() {
      $(this).children('.title').show();
    }, function() {
      $(this).children('.title').hide();
    }
  );
});
function loadmaps(point) {
  point = point.split(';');
  GUnload();
  gload(point[0]+';'+point[1],point[2],point[3]);
} 
$(window).load(function() {
  height = $(window).height();
  $('.w3-wrap, #wrap-in').css('min-height',height);
  
  rel = $('#googlemaps').attr('rel');
  loadmaps(rel);
});