function loadPictures(mode, value,page, container) {
	var req = new JsHttpRequest();
    // Code automatically called on load finishing.
    req.onreadystatechange = function() {
        if (req.readyState == 4) {
            pics = req.responseJS.pics;
            pics_n = req.responseJS.pics_n;
            // alert("Page: "+page+"Pics: "+pics.length);
            html = '<table><tr>';
            if(page > 0 ) {
            	html += '<td class="pic_arrow"><a href="#" onClick="loadPictures(\''+mode+'\',\''+value+'\','+ (page-1);
            	html += ', \'photo_box\')"><img src="/img/left_pic.png"></a></td>';
            } else {
            	html += '<td class="pic_arrow"><img src="/img/z.gif" width="50" alt="Распорка"></td>';
            }
            for(var i=0; i<pics.length;i++) {
               	html += '<td class="pic_box"><div class="photo_el"><a href="/page.php?id='+ pics[i]['article']
               	html += '"><img src="/img/content/pic/search/'+pics[i]['id'];
               	html += '.jpg" alt="'+pics[i]['name'];
               	html += '" /></a></div></td>';
            }
            if((page*2 + 3) < pics_n) {
	            html += '<td class="pic_arrow"><a href="#" onClick="loadPictures(\''+mode+'\',\''+value+'\','+ (page+1)
	           	html += ', \'photo_box\')"><img src="/img/right_pic.png"></a></td>'
            } else {
            	html += '<td class="pic_arrow"><img src="/img/z.gif" width="50" alt="Распорка"></td>';
            }
            html += '</tr></table>';
            document.getElementById(container).innerHTML = html;
        }
     }
	req.open(null, '/backend.php', true);
	req.send( { type:mode,value:value, page:page} );
}