var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false; var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false; var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false; var isSaf = (navigator.userAgent.indexOf("Apple") != -1) ? true : false; var check=false; function $(id) {return document.getElementById(id)} var Timer18 function getObj(obj) { this.get=get; this.post=post; function getTransport() { var obj; try {obj=new XMLHttpRequest()} catch(e) { try {obj=new ActiveXObject("Msxml2.XMLHTTP")} catch(e) { try {obj=new ActiveXObject("Microsoft.XMLHTTP")} catch(oc) {obj=null} } } return obj; } function get(url,response) { var transport=getTransport(); transport.open("GET",url,true); transport.setRequestHeader("Cashe-Control", "no-store, no-cashe, must-revalidate"); transport.onreadystatechange=function() { if(transport.readyState==4) { if((transport.status==200)||(transport.status==0)) { response(transport.responseText); } else {response("Ошибка получения данных:"+transport.status);}; } } transport.send(null); } function post(url,params,response) { var transport=getTransport(); transport.open("POST",url,true); transport.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); transport.setRequestHeader("Content-length", params.length); transport.setRequestHeader("Connection", "close"); transport.onreadystatechange=function() { if(transport.readyState==4) { if((transport.status==200)||(transport.status==0)) { response(transport.responseText); } else {response("Ошибка получения данных:"+transport.status);}; } } transport.send(params); } } var getObj=new getObj(); var nowText=''; var request=''; function CompareData(val,next,inside){ if(val.value!=nowText){ switch(val.id){ case 'mesta': request='/placechoose.php?f='+encodeURI($("mesta").value);var wid=val.offsetWidth; break; case 'longmet': request='/placechoose.php?q='+encodeURI($("longmet").value); break; case 'region': request='/placechoose.php?r='+encodeURI($("region").value)+'&'+'rq='+encodeURI($("longmet").value); break; case 'gorod': request='/placechoose.php?s='+encodeURI($("gorod").value)+'&'+'sr='+encodeURI($("region").value)+'&'+"qr="+encodeURI($("longmet").value);break; case 'district': request='/placechoose.php?t='+encodeURI($('district').value)+'&'+'ts='+encodeURI($("gorod").value); break; case 'metrop': request='/placechoose.php?u='+encodeURI($("metrop").value)+'&'+'ut='+encodeURI($("district").value);break; } getObj.get(request,function(inhtml){ html=inhtml.split("\n"); inhtml=inhtml.replace(html[0]+"\n"+html[1]+"\n","") inhtm=inhtml.substr(2); //alert(inhtml) if(html[0].substr(0,2)=='ok'){ inside.innerHTML=inhtm next.style.top=val.offsetTop+val.offsetHeight+'px'; next.style.left=val.offsetLeft+'px'; next.style.display="block" if(inside.offsetHeight>106) next.style.height=106+'px'; else next.style.height=inside.offsetHeight if(val.id=='mesta'&&!isIE) next.style.width=wid-3+'px'; else if(val.id=='mesta'&&isIE) next.style.width=wid+'px' } else{ next.style.display="none"; inside.innerHTML=''; } }); nowText=(val.value); } } function SelectAll(obj){ $("hidden").focus() obj.disabled=true; var zap='' var elem=obj.parentNode.previousSibling.childNodes[2]; if(obj.previousSibling.id=='metrop') elem=obj.parentNode.previousSibling.childNodes[1]; if(obj.previousSibling.id=='gorod') zap="&c="+encodeURI($("longmet").value) getObj.get('/placechoose.php?y='+obj.previousSibling.id+"&b="+encodeURI(elem.value)+zap,function(inhtml){ html=inhtml.split("\n"); inhtml=inhtml.replace(html[0]+"\n"+html[1]+"\n","") inhtm=inhtml.substr(2); if(html[0].substr(0,2)=='ok'){ obj.nextSibling.childNodes[0].innerHTML=inhtm obj.nextSibling.style.top=obj.previousSibling.offsetTop+obj.previousSibling.offsetHeight+'px'; obj.nextSibling.style.left=obj.previousSibling.offsetLeft+'px'; obj.nextSibling.style.display="block" obj.nextSibling.style.visibility="visible" if(obj.nextSibling.childNodes[0].offsetHeight>106) obj.nextSibling.style.height=106+'px'; else obj.nextSibling.style.height=obj.nextSibling.childNodes[0].offsetHeight } else{ obj.nextSibling.style.display="none"; obj.nextSibling.childNodes[0].innerHTML=''; } obj.disabled=false; check1=false; }); } function LookUp(obj){ if(obj.value=='Начните ввод города или страны') obj.value=''; switch(obj.id){ case 'mesta':Timer18=setInterval('CompareData($("mesta"),$("suggs"),$("insuggs"),request)',50); break; case 'longmet': Timer18=setInterval('CompareData($("longmet"),$("suggestions"),$("insuggest"),request)',50); break; case 'region': Timer18=setInterval('CompareData($("region"),$("rsuggestions"),$("rinsuggest"),request)',50); break; case 'gorod': Timer18=setInterval('CompareData($("gorod"),$("gsuggestions"),$("ginsuggest"),request)',50); break; case 'district': Timer18=setInterval('CompareData($("district"),$("dsuggestions"),$("dinsuggest"),request)',50); break; case 'metrop': Timer18=setInterval('CompareData($("metrop"),$("msuggestions"),$("minsuggest"),request)',50); break; } } function ChangeColor(obj){ obj.style.background='#ECEDED'; } function BackColor(obj){ obj.style.background='#FFFFFF'; } var result,result2, result3; function ChangeValue(obj){ var elem=obj.parentNode.parentNode.parentNode; var otec=elem.parentNode; var id=elem.previousSibling.previousSibling.id var reg=new RegExp("<\/?([^]+)>","g"); result=obj.innerHTML.replace(reg,''); if(id=='mesta'){ if(result.search(/(?:
)|(?:
)/)!=-1){ result2=result.split(/(?:
)|(?:
)/); result3=result2[1].split(/,/); if(result3){ $("longmet").value=result3[0];$("longmet").style.display='inline-block'; $("country").style.display='block';$("country").style.visibility='visible'; $("region").value=result3[1]; $("region").parentNode.style.display='block';$("region").parentNode.style.visibility='visible'; $("gorod").value=result2[0] $("gorod").parentNode.style.display='block';$("gorod").parentNode.style.visibility='visible'; $("allplaces").style.display='none'; if(result2[0]=='москва'){ $("okrug").style.display='block';$("okrug").style.visibility='visible'; $("metropolitan").style.display='block';$("metropolitan").style.visibility='visible'; } } } else{ $("longmet").value=result;$("longmet").style.display='inline-block'; $("country").style.display='block';$("country").style.visibility='visible'; $("region").parentNode.style.display='block';$("region").parentNode.style.visibility='visible'; $("gorod").parentNode.style.display='block';$("gorod").parentNode.style.visibility='visible'; $("allplaces").style.display='none'; } } else{ elem.previousSibling.previousSibling.value=result; while(otec.nextSibling){ if(otec.nextSibling.id=='metropolitan'){ otec.nextSibling.childNodes[1].value=''; } else otec.nextSibling.childNodes[2].value=''; otec=otec.nextSibling; } elem.style.display='none'; } if(isIE){ if((obj.parentNode.parentNode.id!='ginsuggest')||(obj.innerText.substr(0,6).toLowerCase()=='москва')) if(elem.parentNode.nextSibling){elem.parentNode.nextSibling.style.display='block'; elem.parentNode.nextSibling.style.visibility='visible';} } else{ if((obj.parentNode.parentNode.id!='ginsuggest')||(obj.textContent.substr(0,6).toLowerCase()=='москва')) if(elem.parentNode.nextSibling){elem.parentNode.nextSibling.style.display='block';elem.parentNode.nextSibling.style.visibility='visible';} } if ((($("longmet").value.toLowerCase()=='россия')&&($("region").value.toLowerCase()==' москва и московская обл.')&&($("gorod").value.toLowerCase()=='москва'))||(obj.parentNode.parentNode.id=='dinsuggest')||(obj.parentNode.parentNode.id=='minsuggest')||(result.toLowerCase()=='москва')){ $("okrug").style.display='block';$("okrug").style.visibility='visible'; $("metropolitan").style.display='block';$("metropolitan").style.visibility='visible'; if(isIE){ if($("IEcheck")){ $("IEcheck").firstChild.innerHTML='Удалённость от метро (мин)
'; } else if($("IEcheck1")){ $("IEcheck1").firstChild.innerHTML='Удалённость от метро (мин)
'; } } else{ if ($("IEcheck")) $("IEcheck").innerHTML='
Удалённость от метро(мин)
'; if ($("IEcheck1")) $("IEcheck1").innerHTML='
Удалённость от метро(мин)
'; } } else if((($("longmet").value.toLowerCase()=='россия')&&($("region").value.toLowerCase()==' москва и московская обл.')&&($("gorod").value.toLowerCase()=='москва'))&&(obj.parentNode.parentNode.id!='dinsuggest')||(obj.parentNode.parentNode.id!='minsuggest')){ $("okrug").style.display='none'; $("metropolitan").style.display='none'; $("district").value=''; $("metrop").value=''; if(isIE){ if($("IEcheck")){ $("IEcheck").firstChild.innerHTML=''; } else if($("IEcheck1")){ $("IEcheck1").firstChild.innerHTML=''; } } else{ if ($("IEcheck")) $("IEcheck").innerHTML=' '; if ($("IEcheck1")) $("IEcheck1").innerHTML=' '; } } elem.previousSibling.previousSibling.blur(); } function Hide(obj){ if(obj.value==''&&obj.id=='mesta') obj.value='Начните ввод города или страны'; if(isIE||isOpera||isSaf){ setTimeout("Disp($('"+obj.id+"')),check=false",20); } else{ if(obj.id!='hidden') setTimeout("$('"+obj.id+"').nextSibling.nextSibling.style.display='none'",200); else{ setTimeout("$('suggs').style.display='none';$('suggestions').style.display='none';$('rsuggestions').style.display='none';$('gsuggestions').style.display='none';$('dsuggestions').style.display='none';$('msuggestions').style.display='none';",200) } } } function Disp(obj){ if(check) obj.focus(); else { if(obj.id=='hidden'){ $("suggs").style.display='none'; $("suggestions").style.display='none'; $("rsuggestions").style.display='none'; $("gsuggestions").style.display='none'; $("dsuggestions").style.display='none'; $("msuggestions").style.display='none'; } else obj.nextSibling.nextSibling.style.display='none'; } } function LoadAll(obj){ $("hidden").focus() obj.disabled=true; getObj.get('/placechoose.php?l=yes',function(inhtml){ html=inhtml.split("\n"); inhtml=inhtml.replace(html[0]+"\n"+html[1]+"\n","") inhtm=inhtml.substr(2); if(html[0].substr(0,2)=='ok'){ obj.nextSibling.childNodes[0].innerHTML=inhtm obj.nextSibling.style.top=obj.previousSibling.offsetTop+obj.previousSibling.offsetHeight+'px'; obj.nextSibling.style.left=obj.previousSibling.offsetLeft+'px'; obj.nextSibling.style.display="block" obj.nextSibling.style.visibility="visible" if(obj.nextSibling.childNodes[0].offsetHeight>106) obj.nextSibling.style.height=106+'px'; else obj.nextSibling.style.height=obj.nextSibling.childNodes[0].offsetHeight } else{ obj.nextSibling.style.display="none"; obj.nextSibling.childNodes[0].innerHTML=''; } obj.disabled=false; check1=false; }); } function GetParent(obj,TagName){ return (obj.tagName==TagName)?obj:GetParent(obj.parentNode,TagName); } function addComment(obj) { obj.disabled=true; $("comment-errorm").innerHTML='
'; var request="auther="+encodeURI($("auther").value)+"&"+ "msg="+encodeURI($("message").value)+"&"+ "code="+encodeURI($("codem").value)+"&"+ "code_sid="+encodeURI($("code_sidm").value)+"&"+ "game_id="+encodeURI($("game_id").value) getObj.post('/comments.php',request,function (inhtml) { html=inhtml.split("\n"); inhtml=inhtml.replace(html[0]+"\n"+html[1]+"\n","") if(html[0].substr(0,2)=='ok') { $("code_imgm").src="/bitrix/tools/captcha.php?captcha_sid="+html[1]; $("code_sidm").value=html[1]; $("codem").value=""; $("comment-errorm").innerHTML=""; $("message").value=""; $("comment-container").innerHTML=inhtml; } else { $("code_imgm").src="/bitrix/tools/captcha.php?captcha_sid="+html[1]; $("code_sidm").value=html[1]; $("codem").value=""; $("comment-errorm").innerHTML=inhtml; } obj.disabled=false; }); }