$(document).ready(function() { //Start gallery links $("a.group").fancybox( { 'zoomSpeedIn': 500, 'zoomSpeedOut': 500, 'overlayShow': false }); $("a.iframebilde").fancybox( { 'zoomSpeedIn': 500, 'zoomSpeedOut': 500, 'overlayShow': false }); $('#mycarousel').jcarousel({ scroll: 1, animation: "slow", wrap: "both" }); start_grozu(); }); //Form sending script function sendform() { loading(); var alias = $("#aliasplace").html(); var data = $("#messageformsend").serialize(); $.post('?p='+alias+'&sys=send', { "data" : data }, function(data) { $("#good").slideDown("slow"); setTimeout(function() { $("#good").slideUp("slow"); }, 4000); $(':input','#formplace form') .not(':button, :submit, :reset, :hidden') .val('') .removeAttr('checked') .removeAttr('selected'); $("#loadingplace").hide(); }); } //function loading function loading() { $("#loadingplace").html(''); $("#loadingplace").show(); } //Groza parlade laba puse function start_grozu() { $.get('?page=smallgrozs', function(data) { $('.iepirkumu_grozs_info').html(data); }); } //Add product function add_product(id) { $.get('?page=grozs&add='+id, function() { alert('Produkts pievienots.'); start_grozu(); }); } //add commetns function add_comment(id) { var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; var ok = true; if(reg.test($("#email").val()) == false) { alert('Parbaudiet e-pastu!!!'); var ok = false; } if(ok==true) { $('#comment_list').html("Loading..."); $.post("?page=comments&sys=save", { id: id, name: $("#name").val(), email: $("#email").val(), comment: $("#text").val() }, function(data) { $("#name").val(''); $("#email").val(''); $("#text").val(''); load_commentlist(id); }); } } //Load comment list function load_commentlist(id) { $.get('?page=comments&id='+id, function(data) { $('#comment_list').html(data); }); } function save_editcomment(id, ids) { var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; var ok = true; if(reg.test($("#email"+ids).val()) == false) { alert('Parbaudiet e-pastu!!!'); var ok = false; } if(ok==true) { var name = $("#name"+ids).val(); var email = $("#email"+ids).val(); var comment = $("#text"+ids).val(); $('#comment'+ids).html("Loading..."); $.post("?page=comments&sys=save_edit&id="+ids, {id: id, name: name, email: email, comment: comment }, function(data) { $('#comment'+ids).html(data); }); } } //Edit comment function edit_comment(id, ids) { $.get('?page=comments&sys=edit&&id='+id+'&ids='+ids, function(data) { $('#comment'+ids).html(data); }); } //Delete comment function delete_comment(id, ids) { $.get('?page=comments&sys=delete&&id='+id+'&ids='+ids, function(data) { $('#comment'+ids).fadeOut("slow"); }); }