function CreateAjax(){ var xmlhttp; if(!xmlhttp && typeof XMLHttpRequest != 'undefined'){ try { xmlhttp = new XMLHttpRequest(); } catch (e) { alert("Your browser is not supporting XMLHTTPRequest"); xmlhttp = false; } }else{ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } return xmlhttp; } function CallServer(mthd,www,str,func){ request.open(mthd,www,true); if(mthd=='POST'){ request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset:UTF-8'); } request.onreadystatechange=function(){ if(request.readyState == 1){ func(0); AjaxLoading(true); } if(request.readyState == 4){ var answer = request.responseText; func(answer); AjaxLoading(false); } }; request.send(str); } function CTxt(par){ par=par.replace(/\"/g,''); par=par.replace(/:\|:/g,'\''); return par } var request = CreateAjax(); function AjaxLoading(bl){ var elm; if(document.getElementById('AjaxLoadingLbl')) { elm=document.getElementById('AjaxLoadingLbl'); } else { elm=document.createElement("span"); elm.id='AjaxLoadingLbl'; elm.style.position='absolute'; elm.style.background='#6E9230'; elm.style.bordercolor='red'; elm.style.color='white'; elm.style.padding='2px'; elm.innerHTML='ارتباط با سرور ...'; document.body.appendChild(elm); } elm.style.top=0 + document.body.scrollTop; elm.style.left=document.body.scrollLeft; if(bl){ elm.style.display='block'; }else{ elm.style.display='none'; } } function OW(page,a,b){ X=(screen.width-a)/2; Y=(screen.height-b)/2; var winO=window.open(page,'popup','scrollbars=2,addressbar=1,resizable=1,width='+a+',height='+b+',left='+X+',top='+Y);winO.focus(); } function CheckSearchLenght() { if (frmSearch.q.value.length < 2) { window.alert("کلمه مورد جستجو باید بیش از یک کاراکتر باشد"); return false; } else return true; } function CheckSearchLenghtA() { if (frmSearchA.q.value.length < 2) { window.alert("کلمه مورد جستجو باید بیش از یک کاراکتر باشد"); return false; } else return true; } function Toggle(nam){ obj=document.getElementById(nam); if(obj){ (obj.style.display=='none')?obj.style.display='block':obj.style.display='none'; } } document.onclick=function(){ if(typeof hideSub0=='function') hideSub0(); } function vote(ind,vl){ CallServer("GET","../catalog/page.asp?id="+ind+"&action=vote&val="+vl+"&rnd="+Math.random(),"",voteEnd); } function voteEnd(txt){ if(txt==0)return; obj=document.getElementById("RankBox"); if(obj) obj.innerHTML=txt; } function topicvote(ind,vl){ CallServer("GET","../forums/replies.asp?id="+ind+"&action=vote&val="+vl+"&rnd="+Math.random(),"",topicvoteEnd); } function topicvoteEnd(txt){ if(txt==0)return; obj=document.getElementById("RateBox"); if(obj) obj.innerHTML=txt; }