$(document).ready(function(){
    $('#interior').everyTime(6000, function(i) {
        stamp = new Date();
        hiddenImg= new Image();
        hiddenImg.src= 'getpic.php?was='+i+'_'+stamp.getTime();
        $(this).attr('src',hiddenImg.src);
    });

    $('img.eximg').each(function(i){
        var codex = $(this).parents('tr').children('td').html().match('[0-9]{2,3}');
        $(this).replaceWith('<a href="#examplepage" class="example_btn" id="aimg_' + codex + '"><img src="../img/example.png" /></a>');
    });
    $('.example_btn').click(function(){
        var code = this.id.match('[0-9]{2,3}');
        var url = '../../ajax.php?func=1&code=' + code;
        $('#examplepage').html('<img src="img/loading.gif" />');
        $('#examplepage').load(url);
        $("#examplepage").dialog({
            height: 630,
            width: 460,
            modal: true,
            close: function(event, ui) {
                $(this).dialog('destroy');
            },
            buttons: {
                "Закрыть": function() {
                    $(this).dialog("close");
                }
            }
        });
        return false;
    });
    $('#captchahelp').click(function(){
        stamp = new Date();
        $('#norobotpic').attr('src','feedback/getcapt/' + stamp.getTime());
        return false;
    });
});