function getElement(id) { var itm = null; if (document.getElementById) { itm = document.getElementById(id); } else if (document.all) { itm = document.all[id]; } else if (document.layers) { itm = document.layers[id]; } return itm; } function show_phone(phone_id, phone_hash) { var div_phones = getElement(phone_id); div_phones.innerHTML = "Ждите..."; var req = new JsHttpRequest(); req.onreadystatechange = function() { if (req.readyState == 4) { if (req.responseJS.success) { div_phones.innerHTML = req.responseJS.phones; } else { div_phones.innerHTML = "Информация не найдена!"; } } } req.open('GET', '/phone/', true); req.send( { id: phone_hash } ); } var temImg = new Image(); var to; function checkLoad() { if (!temImg.complete) { to = setTimeout("checkLoad()", 300); } else { clearTimeout(to); var photos_src_show = document.getElementById('photos_src_show'); photos_src_show.src = temImg.src; } } function js_photo_handler(url) { temImg.src = url; to = setTimeout("checkLoad()", 300); return false; }