/* START MAIN SCRIPT FOR ALL PAGES */ var base_url = 'http://times.ua'; var browser_type = 'msie'; var W=navigator.userAgent.toLowerCase(); if(W.indexOf("opera")!=-1){browser_type='opera';}else if(W.indexOf("msie")!=-1){browser_type='msie';} else if(W.indexOf("mozilla")!=-1){browser_type='firefox';} var pic1 = new Image(); var pic2 = new Image(); var pic3 = new Image(); var pic4 = new Image(); var pic5 = new Image(); var pic6 = new Image(); var pic7 = new Image(); var pic8 = new Image(); var pic9 = new Image(); var pic10 = new Image(); pic1.src = "/images/home_block/sel/001.jpg"; pic2.src = "/images/home_block/sel/002.jpg"; pic3.src = "/images/home_block/sel/003.jpg"; pic4.src = "/images/home_block/sel/004.jpg"; pic5.src = "/images/home_block/sel/005.jpg"; pic6.src = "/images/home_block/sel/006.jpg"; pic7.src = "/images/home_block/sel/007.jpg"; pic8.src = "/images/home_block/sel/008.jpg"; pic9.src = "/images/home_block/sel/009.jpg"; pic10.src = "/images/home_block/sel/010.jpg"; function addBookmark() { var url = location.href; var title = document.title; //Gecko if (browser_type == 'firefox') window.sidebar.addPanel (title, url, ""); //IE4+ else if (browser_type == 'msie') window.external.AddFavorite(url, title); //Opera7+ else if (browser_type == 'opera') { var a = document.createElement('A'); a.setAttribute('rel','sidebar'); a.setAttribute('href',url); a.setAttribute('title',title); a.click(); } } function makeHomePage(obj) { obj.style.behavior='url(#default#homepage)'; obj.setHomePage(location.href); return false; } function closeNotice() { document.getElementById('notice_div').style.display = "none"; } function sign_in() { document.getElementById('sign_in_div').style.display = "block"; } function closeSignIn() { document.getElementById('sign_in_div').style.display = "none"; } function closeSignInRegistration(){ document.getElementById('sign_in_block_div').style.display = 'none' } function pop_up(url, width, height) { var left = (screen.width - width) / 2; var top = (screen.height - height) / 3 + document.body.scrollTop; document.getElementById('pop_up_div').style.top = top+"px"; document.getElementById('pop_up_div').style.left = left+"px"; document.getElementById('pop_up_div').style.width = width+"px"; document.getElementById('pop_up_div').style.height = height+"px"; document.getElementById('pop_up_div').style.display = "block"; document.getElementById('pop_up_frame').src = url; } function closePopUp() { parent.document.getElementById('pop_up_div').style.display = "none"; } function confirmdel(url) { message = 'Вы уверены что хотите удалить?'; if (confirm(message)) { if (browser_type == "firefox") { self.location.href = url; } else { document.getElementById('link').href = url; document.getElementById('link').click(); } } } function createPrivateMessage() { document.getElementById('div_trans').style.height = document.body.scrollHeight+"px"; document.getElementById('div_trans').style.display = "block"; //alert(2); var width = "700"; var height = "380"; var left = (screen.width - width) / 2; var top = (screen.height - height) / 3 + document.body.scrollTop; document.getElementById('div_create_pm').style.width = width+"px"; document.getElementById('div_create_pm').style.height = height+"px"; document.getElementById('div_create_pm').style.left = left+"px"; document.getElementById('div_create_pm').style.top = top+"px"; //alert(3); showEditor('pm_content', 'ClientShort', 360, 200); //alert(4); document.getElementById('div_create_pm').style.display = "block"; loadPMFriendList(); } function loadPMFriendList() { var url = base_url+"/js/PM_load_friend_list.js"; var jsel = document.createElement('SCRIPT'); jsel.type = 'text/javascript'; jsel.src = url; document.getElementById('js').appendChild(jsel); } function addPMFrindToSendToFrd(id) { if (browser_type == 'msie') var nick_name = document.getElementById('pm_frd_list_'+id).innerText; else var nick_name = document.getElementById('pm_frd_list_'+id).textContent; if (document.getElementById('to_nick_name')) { document.getElementById('to_nick_name').value = nick_name; validPMField('to_nick_name'); } } function pm_close() { document.getElementById('div_create_pm').style.display = "none"; document.getElementById('div_trans').style.display = "none"; } function replyPm(parent_id) { var url = base_url+"/js/pm_reply.js&parent_id="+parent_id; var jsel = document.createElement('SCRIPT'); jsel.type = 'text/javascript'; jsel.src = url; document.getElementById('js').appendChild(jsel); } function sendPrivateMessage(nick_name) { document.getElementById('to_nick_name').value = nick_name; validPMField('to_nick_name'); //alert(1); createPrivateMessage(); } function validPMField(fld) { var var_data = "fld="+fld; var_data += "&value="+document.getElementById(fld).value; var gotError = function(err) { //alert("System Error"); return; } var gotInfo = function(data) { if (data.success == "1") { //alert('1'); changePmIco(fld, true); } if (data.error == "1") { //alert('0'); changePmIco(fld, false); } return; } var url = "/ajax_request/check_registration.php"; var opts = { "data": var_data, "method": "POST", "url": url, "onError": gotError, "onData": gotInfo }; HTTPReq.getJSON(opts); } function changePmIco(fld, res) { if (res == true) document.getElementById('img_pm_'+fld).src = "/images/tick.png"; else document.getElementById('img_pm_'+fld).src = "/images/publish_x.png"; } function checkPmForm() { var message = ""; var nickNameImgArr = document.getElementById('img_pm_to_nick_name').src.split('/'); //alert(nickNameImgArr.length); if (document.getElementById('to_nick_name').value == "") { message += 'Введите Имя Получателя'; } else if (nickNameImgArr[nickNameImgArr.length - 1] != "tick.png") { message += 'Несуществующее Имя Получателя'; } if (document.getElementById('pm_header').value == "") { if (message != "") message += "\n"; message += 'Выберите Тему Сообщения'; } if (FCKeditorAPI.GetInstance('pm_content').GetXHTML(true) == "") { if (message != "") message += "\n"; message += 'Введите Тело Сообщения'; } if (message == "") { return true; } else { alert(message); return false; } } function changeBorder(change, blc, id) { //alert(change+":"); document.getElementById('td_border_'+blc+'_'+id+'_lt').style.backgroundImage = "url(/images/home_block/"+change+"001.jpg)"; document.getElementById('td_border_'+blc+'_'+id+'_t').style.backgroundImage = "url(/images/home_block/"+change+"003.jpg)"; document.getElementById('td_border_'+blc+'_'+id+'_rt').style.backgroundImage = "url(/images/home_block/"+change+"002.jpg)"; document.getElementById('td_border_'+blc+'_'+id+'_l').style.backgroundImage = "url(/images/home_block/"+change+"004.jpg)"; document.getElementById('td_border_'+blc+'_'+id+'_r').style.backgroundImage = "url(/images/home_block/"+change+"005.jpg)"; document.getElementById('td_border_'+blc+'_'+id+'_lb').style.backgroundImage = "url(/images/home_block/"+change+"006.jpg)"; document.getElementById('td_border_'+blc+'_'+id+'_b').style.backgroundImage = "url(/images/home_block/"+change+"008.jpg)"; document.getElementById('td_border_'+blc+'_'+id+'_rb').style.backgroundImage = "url(/images/home_block/"+change+"007.jpg)"; document.getElementById('td_border_'+blc+'_'+id+'_lg').style.backgroundImage = "url(/images/home_block/"+change+"009.jpg)"; document.getElementById('td_border_'+blc+'_'+id+'_rg').style.backgroundImage = "url(/images/home_block/"+change+"010.jpg)"; } var sBasePath = "/library/FCKeditor/"; function showEditor(id, toolbar, width, height) { if (document.getElementById(id).style.display != "none") { var oFCKeditor = new FCKeditor(id); oFCKeditor.ToolbarSet = toolbar; oFCKeditor.BasePath = sBasePath; oFCKeditor.Height = height; oFCKeditor.Width = width; oFCKeditor.ReplaceTextarea(); } else FCKeditorAPI.GetInstance(id).EditorDocument.body.innerHTML = document.getElementById(id).value; } function pop_up_login() { var width = 330; var height = 410; var left = (screen.width - width) / 2; var top = (screen.height - height) / 3 + document.body.scrollTop; document.getElementById('sign_in_block_div').style.top = top+"px"; document.getElementById('sign_in_block_div').style.left = left+"px"; document.getElementById('sign_in_block_div').style.width = width+"px"; document.getElementById('sign_in_block_div').style.height = height+"px"; document.getElementById('reg_node').value = 'no_open_block'; document.getElementById('sign_in_node').value = 'no_open_block'; document.getElementById('sign_in_block_div').style.display = "block"; }