var moz = (navigator.userAgent.indexOf("Gecko")>-1)?true:false; var msie = (navigator.userAgent.indexOf('MSIE')>-1)?true:false; var main_content_orig_w = 0; var id; function getFlashMediaPlayer() { if(msie) { return document.getElementById('ieFMPlayer'); } else { return document.getElementById('FMPlayer'); } } function play_media(tp,p_id) { request_mode_media = tp; id = p_id; document.getElementById('for_player').innerHTML = ''; document.getElementById('view_panel1').style.display = 'block'; makeRequestMedia('/add_click.php?'+tp+'='+p_id); /* var pl = getFlashMediaPlayer(); var view_panel1 = document.getElementById('view_panel1'); view_panel1.style.display = "block"; if(pl) { request_mode_media = tp; id = p_id; pl.loadMedia(tp,p_id); show_busy_layer(); makeRequestMedia('/add_click.php?'+tp+'='+p_id); } else { alert('No Flash Media Player!'); } */ } // Loading START function show_busy_layer() { //alert('show'); var busy_layer = document.getElementById('busy_layer'); var loading_layer = document.getElementById('loading-layer'); var loading_layer_text = document.getElementById('loading-layer-text'); loading_layer.style.position = "absolute"; loading_layer.style.left = (document.body.offsetWidth/2-100+document.body.scrollLeft)+"px"; var y = document.documentElement.scrollTop+300-25; loading_layer.style.top = (y)+"px"; busy_layer.style.width = document.body.offsetWidth+"px"; busy_layer.style.height = document.body.offsetHeight+"px"; busy_layer.style.visibility = 'visible'; loading_layer.style.display = 'block'; } function hide_busy_layer() { //alert('hide'); var busy_layer = document.getElementById('busy_layer'); var loading_layer = document.getElementById('loading-layer'); var loading_layer_text = document.getElementById('loading-layer-text'); loading_layer.style.display = 'none'; busy_layer.style.width = '100%'; busy_layer.style.height = '100%'; busy_layer.style.visibility = 'hidden'; } // Loading END function show_panel() { //reload_fav(); var view_panel1 = document.getElementById('view_panel1'); view_panel1.style.display = "block"; var view_panel2 = document.getElementById('view_panel2'); var td_view_panel2 = document.getElementById('td_view_panel2'); view_panel2.style.display = "block"; td_view_panel2.style.width = "250px"; } var load_id; var load_url; function ajax_load2(url,toID) { request_mode_media = "ajax_load2"; load_id = toID; load_url = url; show_busy_layer(); makeRequestMedia(url); } var request_mode_media; var http_request_media = false; function makeRequestMedia(url) { http_request_media = false; if (window.XMLHttpRequest) { // Mozilla, Safari,... http_request_media = new XMLHttpRequest(); if (http_request_media.overrideMimeType) { http_request_media.overrideMimeType('text/html'); } } else if (window.ActiveXObject) { // IE try { http_request_media = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request_media = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!http_request_media) { alert('Cannot create XMLHTTP instance'); return false; } http_request_media.onreadystatechange = alertContentsMedia; http_request_media.open('GET', url, true); http_request_media.send(null); } function alertContentsMedia() { if (http_request_media.readyState == 4) { if (http_request_media.status == 200) { result = http_request_media.responseText; switch(request_mode_media) { case "audio": switch(result) { case "true": show_panel(); ajax_load2('/block_comments.php?type=audio&id='+id,'div_comments'); break; case "false": break; } break; case "nashud": switch(result) { case "true": show_panel(); ajax_load2('/block_comments.php?type=nashud&id='+id,'div_comments'); break; case "false": break; } break; case "lection": switch(result) { case "true": show_panel(); ajax_load2('/block_comments.php?type=lection&id='+id,'div_comments'); break; case "false": break; } break; case "pp": switch(result) { case "true": show_panel(); ajax_load2('/block_comments.php?type=pp&id='+id,'div_comments'); break; case "false": break; } break; case "sura": switch(result) { case "true": show_panel(); break; case "false": break; } break; case "ajax_load2": document.getElementById(load_id).innerHTML = result; break; default: alert("result:"+result+"\nmode:"+request_mode_media); } hide_busy_layer(); } else { alert('There was a problem with the request.'); hide_busy_layer(); } } } //////////////////////////////////////END OF view_video(), view_audio(), view_photo() //////////////////////////////////////START OF reload_fav() var http_request_fav = false; function makeRequestFav(url) { http_request_fav = false; if (window.XMLHttpRequest) { // Mozilla, Safari,... http_request_fav = new XMLHttpRequest(); if (http_request_fav.overrideMimeType) { http_request_fav.overrideMimeType('text/html'); } } else if (window.ActiveXObject) { // IE try { http_request_fav = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request_fav = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!http_request_fav) { alert('Cannot create XMLHTTP instance'); return false; } http_request_fav.onreadystatechange = alertContentsFav; http_request_fav.open('GET', url, true); http_request_fav.send(null); } function alertContentsFav() { if (http_request_fav.readyState == 4) { if (http_request_fav.status == 200) { result = http_request_fav.responseText; document.getElementById('div_fav').innerHTML = result; hide_busy_layer(); } else { alert('There was a problem with the request.'); hide_busy_layer(); } } } function reload_fav() { show_busy_layer(); makeRequestFav('http://audio.islamindex.ru/cabinet/block_user_favorites.php'); } //////////////////////////////////////END OF reload_fav() //////////////////////////////////////START OF addComment(form_obj) var http_request_ac = false; function makeRequestAddComment(url) { http_request_ac = false; if (window.XMLHttpRequest) { // Mozilla, Safari,... http_request_ac = new XMLHttpRequest(); if (http_request_ac.overrideMimeType) { http_request_ac.overrideMimeType('text/html'); } } else if (window.ActiveXObject) { // IE try { http_request_ac = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request_ac = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!http_request_ac) { alert('Cannot create XMLHTTP instance'); return false; } http_request_ac.onreadystatechange = alertContentsAddComment; http_request_ac.open('GET', url, true); http_request_ac.send(null); } function alertContentsAddComment() { if (http_request_ac.readyState == 4) { if (http_request_ac.status == 200) { result = http_request_ac.responseText; document.getElementById('div_comments').innerHTML = result; hide_busy_layer(); } else { alert('There was a problem with the request.'); hide_busy_layer(); } } } function addComment(form_id) { show_busy_layer(); var form_obj = document.getElementById(form_id); var type = form_obj.elements['type'].value; var id = form_obj.elements['id'].value; var content = encodeURI(form_obj.elements['content'].value); var comment_action = form_obj.elements['comment_action'].value; //alert('type='+type+'\nid='+id+'\nsrc_content='+form_obj.elements['content'].value+'\nenc_content='+content+'\ncomment_action='+comment_action); var str = '/block_comments.php?type='+type+'&id='+id+'&content='+content+'&comment_action='+comment_action; if(comment_action == "reply_comment") { var comment_id = form_obj.elements['comment_id'].value; str += '&comment_id='+comment_id; } makeRequestAddComment(str); } //////////////////////////////////////END OF addComment(form_obj) function ch_reply_img(img_obj,div_id) { var dv = document.getElementById(div_id); if(dv.style.display != 'block') { dv.style.display = 'block'; img_obj.src = '/images/reply_button_m.gif'; } else { dv.style.display = 'none'; img_obj.src = '/images/reply_button.gif'; } }