var languages = { lv : { pleaseFillFields: 'L\u016bdzu aizpildiet visus laukus!' }, ru: { pleaseFillFields: 'Mandatory fields should be filled!' }, en: { pleaseFillFields: 'Mandatory fields should be filled!' } }; $('document').ready(function(){ // set target _blank $(".external").click(function(){this.target = '_blank';}); // update meteo table every minute if ($('#meteo').length) { setInterval(function() { $.post('/modules/mod_Everypage.php', { getMeteo: 1 }, function (data) { $('#meteo').replaceWith(data); }); }, 60000); } }); $(function() { /*$('#animation img').click(function() { slideSwitch(); });*/ //var playing = false; var playing = true; playSlideshow = setInterval('slideSwitch()', 5000); $('#animation li').click(function() { if (playing) { playing = false; clearInterval(playSlideshow); } else { playing = true; playSlideshow = setInterval('slideSwitch()', 5000); } }); }); function slideSwitch() { if ($('#animation li').length < 2) return; var $active = $('#animation li.active'); if ($active.length == 0) $active = $('#animation li:last'); var $next = $active.next().length ? $active.next() : $('#animation li:first'); $active.addClass('last-active'); $next.css({opacity: 0.0}) .addClass('active') .animate({opacity: 1.0}, 300, function() { $active.removeClass('active last-active'); }); /*$next.addClass('active'); $('img', $next).css({opacity: 0.0}).animate({opacity: 1.0}, 1000, function() { $active.removeClass('active last-active'); })*/ } $(function() { if ($('#google-map').length) { // initialize gmaps var latlng = new google.maps.LatLng(56.52628, 20.999504); var myOptions = { zoom: 12, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById("google-map"), myOptions); var marker = new google.maps.Marker({ map: map, position: latlng }); } $('#contact-form').submit(function() { contacts.send(); return false; }); }); contacts = { send: function() { if ($('#name').val() == '' || $('#email').val() == '' || $('#question').val() == '') { alert(eval('languages.' + global.language + '.pleaseFillFields')); return; } $.post('/modules/mod_Contacts.php', { name: $('#name').val(), email: $('#email').val(), question: $('#question').val(), ajax: 1 }, function (data) { $('#contects-response').text(data); }); } };