var tm;var lState=null;function sh(i1,i2){hide(i1);show(i2);};function hide(i){document.getElementById(i).style.display='none';};function show(i){document.getElementById(i).style.display='inline';};function sendMessage(){var txt=document.getElementById("message").value;if(txt.length>0){var btnS=document.getElementById('btnSMess');btnS.disabled=true;hText("Изпращане","white","#5eaf19");var frm=document.getElementById('mForm');var sBody=getRequestBody(frm);setTimeout((function(){btnS.disabled=false;}),7000);httpRequest('sqMsg.php',sBody,"sSendMessage");}else{alert('Въведете текст на съобщението');fm();};};function setInfo(msg){clearTimeout(tm);var e=document.getElementById('infoMsg');e.style.color='#008000';e.style.display='';e.innerHTML=msg;tm=setTimeout((function(){document.getElementById('infoMsg').style.display='none';}),10000);}function sSendMessage(x){hText('','','');document.getElementById('btnSMess').disabled=false;document.getElementById("message").value='';showBox();setInfo('Съобщението беше изпратено успешно!');};function addUser(uid){hText("Добавяне","white","#66a7ff");httpRequest('userlist.php?ua=fav&uid='+uid,'',"sUser");};function blockUser(uid){hText("Добавяне","white","#66a7ff");httpRequest('userlist.php?ua=block&uid='+uid,'',"sUser");};function sUser(x){hText('','','');if(x=='block'){sh('stndLinks','bList');setInfo('Потребителят беше блокиран');}else if(x=='fav'){sh('stndLinks','cList');setInfo('Потребителят беше добавен в контакти');}else{alert('Промените не можаха да бъдат записани!');};};function showBox(){var el=document.getElementById('msg');if(el.style.display=='')el.style.display='none';else{el.style.display='';};hideEmotions();};function showComment(tList){var e1=document.getElementById('shcomments');var e2=document.getElementById('addComments');if(tList==lState){lState=null;e1.style.display='none';e2.style.display='none';}else{lState=tList;if(tList){var ck=readCookie("cmSent");if(ck==null){e1.style.display='none';e2.style.display='';}else{e1.style.display='none';e2.style.display='';e2.innerHTML="Може да въвеждате 1 коментар на 2 часа";};}else{e1.style.display='';e2.style.display='none';
var rp=document.getElementById("sendTo"); shLComment(rp.value,"");};};};function shLComment(rp,lm){httpRequest('getComm.php?rp='+rp+'&lm='+lm,"","sGetComment");};function sendComment(){var txt=document.getElementById("cmm").value;if(txt.length>0){var btnS=document.getElementById('btnSComm');btnS.disabled=true;var frm=document.getElementById('cForm');var sBody=getRequestBody(frm);setTimeout((function(){btnS.disabled=false;}),7000);httpRequest('sqComm.php',sBody,"sSendComment");}else{alert('Въведете коментар');fcm();};};function ago(timestamp){var difference=timestamp;var txt="(преди: ";var sec=min=hour=day=week=month=null;if(difference<60)sec=difference;else{difference=Math.round(difference/60);if(difference<60)min=difference;else{difference=Math.round(difference/60);if(difference<24)hour=difference;else{difference=Math.round(difference/24);if(difference<7)day=difference;else{difference=Math.round(difference/7);if(difference<4)week=difference;else{difference=Math.round(difference/7);month=difference;};};};};};if(month!=null){txt+=month;txt+=(month==1)?" месец":" месеца";}else if(week!=null){txt+=week;txt+=(week==1)?" седмица":" седмици";}else if(day!=null){txt+=day;txt+=(day==1)?" ден":" дена";}else if(hour!=null){txt+=hour;txt+=(hour==1)?" час":" часа";}else if(min!=null){txt+=min;txt+=(min==1)?" минута":" минути";}else{txt+=sec;txt+=(sec==1)?" секунда":" секунди";};txt+=" )";return txt;};function sGetComment(x){var lst=x.getElementsByTagName("root");var txtL="";var dt;var br=15;if(lst[0]){var aList=lst[0].getElementsByTagName("lst");var mComm=lst[0].getElementsByTagName("lm");if(aList[0]){br=0;for(var i=0;i<aList.length;i++){br+=15;dt=aList[i].getAttribute("dt");txtL+="<div  style='float: left;display: inline; width: 340px; text-align: left;background: #f9f3e1;'>";txtL+="<a style='color: #274daf;' href='users.php?uid="+aList[i].getAttribute("id")+"' target='_blank'>"+aList[i].getAttribute("nName")+"</a> <b>каза:</b><font color='#71716a'> "+ago(dt)+"</font>";txtL+="<br />"+aList[i].firstChild.nodeValue;txtL+="</div>";};if(mComm[0].getAttribute("vl")=='y'){txtL+="<div  style='float: left;display: inline; width: 340px; text-align: left;background: #f9f3e1;'>";txtL+="<a style='color: #274daf;' href='#' onclick='shLComment("+mComm[0].getAttribute('id')+",\"n\"); return false;'>Всички коментари("+mComm[0].firstChild.nodeValue+")</a>";txtL+="</div>";};}else{txtL='Няма коментари';};}else txtL='Няма коментари';var e1=document.getElementById('shcomments');e1.innerHTML=txtL;};function sSendComment(x){createCookie("cmSent",1,2);document.getElementById('btnSComm').disabled=false;document.getElementById("cmm").value='';hide('shcomments');var e2=document.getElementById('addComments');e2.style.display='';e2.innerHTML="Коментарът беше добавен";};function fcm(){document.getElementById("cmm").focus();};function createCookie(name,value,hours){if(hours){var date=new Date();date.setTime(date.getTime()+(hours*60*60*1000));var expires="; expires="+date.toGMTString();}else var expires="";document.cookie=name+"="+value+expires+"; path=/";};function readCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);};return null;};function eraseCookie(name){createCookie(name,"",-1);};
function openalbwindow(location,sWidth,sHeight)
{
   winLeft = (screen.width-sWidth)/2;
   winTop = (screen.height-sHeight)/2;
   window.open( location ,"ForteGamesPhotos","width="+sWidth+",height="+sHeight+",left="+winLeft+",top="+winTop+",directories=no,menubar=no,location=no,scrollbars=no,resizable=no,status=0");
}

