/* выводим источник */ function www_view(id){ var req = new JsHttpRequest(); req.onreadystatechange = function(){ var obj=document.getElementById('www_load'+id); obj.innerHTML=''; if(req.readyState == 4){ document.getElementById('www_result'+id).innerHTML = req.responseJS.q; document.getElementById('www_load'+id).innerHTML = ''; } }; req.caching=true; req.open("POST",'http://r93.ru/ajax_news.php?act=www_view&id='+id, true); req.send(null); }; /* конец */ /* Подгружаем инфу: при поиске, в разделах, букмариках, и т.п.. */ function showInfo(id,tpl){ var req = new JsHttpRequest("UTF-8"); req.onreadystatechange = function(){ if(req.readyState == 4) { if(req.responseJS){ document.getElementById(id).innerHTML = req.responseJS.q; document.getElementById('view_info'+id).innerHTML = req.responseText; } } } req.caching = true; req.open("POST",'http://r93.ru/ajax_news.php?act=view_id&id='+id+'&tpl='+tpl, true); req.send(null); } function ShowExtInfo(blockid,tpl){ document.getElementById("info-block" + blockid).style.display = 'block'; document.getElementById("info_" + blockid).style.display = 'none'; showInfo(blockid,tpl); return false; } function HideExtInfo(blockid){ document.getElementById("info-block" + blockid).style.display = 'none'; document.getElementById("info_" + blockid).style.display = 'block'; return false; } /* конец */ /* Подгружаем блоки */ function loadBlock(id,tpl){ var req = new JsHttpRequest("UTF-8"); req.onreadystatechange = function(){ if(req.readyState == 4) { if(req.responseJS){ document.getElementById(id).innerHTML = req.responseJS.q; document.getElementById('view_block-'+id).innerHTML = req.responseText; } } } req.caching = true; req.open("POST",'http://r93.ru/ajax_news.php?act=block_load&tpl='+tpl, true); req.send(null); } function ShowBlock(blockid,tpl){ document.getElementById("block-" + blockid).style.display = 'block'; document.getElementById("load_" + blockid).style.display = 'none'; loadBlock(blockid,tpl); return false; } function HideBlock(blockid){ document.getElementById("block-" + blockid).style.display = 'none'; document.getElementById("load_" + blockid).style.display = 'block'; return false; } /* конец */ /* Подгружаем форму - отправить другу новость */ function sendForm() { send_form_res = document.getElementById('send_result'); send_load_res = document.getElementById('send_load'); u_id = document.getElementById("u_id"); name_from = document.getElementById("name_from"); email_from = document.getElementById("email_from"); name_to = document.getElementById("name_to"); email_to = document.getElementById("email_to"); title = document.getElementById("title"); captcha = document.getElementById("captcha"); send_form_res.className = 'form_info_loading'; send_load_res.innerHTML = 'Загрузка...'; JsHttpRequest.query( 'http://r93.ru/ajax_news.php?act=send_mail', { 'u_id': u_id.value, 'name_from': name_from.value, 'email_from': email_from.value, 'name_to': name_to.value, 'email_to': email_to.value, 'title': title.value, 'captcha': captcha.value }, function(result, errors) { send_form_res.innerHTML = ''; if (result['q']) { send_form_res.innerHTML = '
Ошибка:
' +result['q']+ '
'; send_form_res.className = 'send_form_error'; send_load_res.innerHTML = ''; document.getElementById("send_form").style.display = 'block'; }else{ send_form_res.innerHTML = '
Сообщение:
Новость была успешна отправлена получателю.
'; send_form_res.className = 'send_form_ok'; send_load_res.innerHTML = ''; document.getElementById("send_form").style.display = 'none'; } }, false // не кэшировать ); } /* конец */ /* Подгружаем форму - коментарии */ function commentForm() { comment_form_res = document.getElementById('comment_result'); comment_load_res = document.getElementById('comment_load'); u_id = document.getElementById("u_id"); cname = document.getElementById("cname"); email = document.getElementById("email"); url = document.getElementById("url"); text = document.getElementById("text"); captcha = document.getElementById("captcha"); comment_form_res.className = 'form_info_loading'; comment_load_res.innerHTML = 'Загрузка...'; JsHttpRequest.query( 'http://r93.ru/ajax_news.php?act=comment_add', { 'u_id': u_id.value, 'cname': cname.value, 'email': email.value, 'url': url.value, 'text': text.value, 'captcha': captcha.value }, function(result, errors) { comment_form_res.innerHTML = ''; if (result['q']) { comment_form_res.innerHTML = '
Ошибка:
' +result['q']+ '
'; comment_form_res.className = 'comment_form_error'; comment_load_res.innerHTML = ''; document.getElementById("comment_form").style.display = 'block'; }else{ comment_form_res.innerHTML = '
Сообщение:
Ваш коментарий был успешно добавлен.
'; comment_form_res.className = 'comment_form_ok'; comment_load_res.innerHTML = ''; document.getElementById("comment_form").style.display = 'none'; } }, false // не кэшировать ); } /* конец */