$(document).ready(function(){

   // main menu
   $("ul.MainMenu > li").hover(
       function() {
          $(this).find("div.Sub").show();
          $(this).find("a.Main").addClass("hover");
       },
       function() {
          $("div.Sub").hide();
          $(this).find("a.Main").removeClass("hover");
       }
    );

    $('#SubsidiariesDropdown').change(function() {
      var url = $(this).val();
      if(url.length > 1)  window.location = url;
    });

     $("#posljiMail").click(function(){

              var seria = $('form[name="kontakt"]').serialize();
              $.post('model/_ajax.sendmail.model.php', seria, function(data) {
                 if(data == '1')
                 {
                   // ok
                   jAlert('Vaše sporočilo je bilo poslano.','Uspešno');
                 }
                 else
                 {
                   // napacni podatki
                   jAlert('Prosimo izpolnite polja.','Napaka',  function(e){
                 });
                 }
              });

        return false;
     });

    // teaser
    $('li.TeaserLi').click(function(){
       var id = $(this).attr("id");
       $(this).parent().find("li.TeaserLi").removeClass("active");
       $(this).parent().parent().find(".MiniBox").hide();
       $(this).addClass("active");
       $(this).parent().parent().find(".MiniBox#mini"+id).show();
    });

    $(".Footer2 .FooterContainer").masonry({itemSelector: '.Lefty', columnWidth: 240});

});



function clearMe(formfield)
{
  if (formfield.defaultValue==formfield.value)
  formfield.value = "";
}

function restoreMe(formfield)
{
  if (""==formfield.value)
  formfield.value = formfield.defaultValue;
}
