function ifChn(b,id,html){ if (b){ var obj=document.getElementById(id); if(obj){ var parent=obj.parentNode; var odiv=document.createElement('span'); parent.replaceChild(odiv, obj); odiv.innerHTML=html; } } } function getCookieVal (offset){ var endstr = document.cookie.indexOf (";", offset); if (endstr == -1) endstr = document.cookie.length; return unescape(document.cookie.substring(offset, endstr)); } function GetCookie (name) { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { var j = i + alen; if (document.cookie.substring(i, j) == arg) return getCookieVal (j); i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } return null; } function SetCookie (name, value, period) { //1.2 Изменен подсчет периуда действия var argv = SetCookie.arguments; var argc = SetCookie.arguments.length; now= new Date(); var today = new Date(); today.setTime( today.getTime() ); if ( period ){ period = period * 1000 * 60 * 60 * 24; var expires = new Date( today.getTime() + (period) ); } var path = (3 < argc) ? argv[3] : null; var domain = (4 < argc) ? argv[4] : null; var secure = (5 < argc) ? argv[5] : false; document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : ""); } function CheckForm (Frm) { var i; for (i=0; ipw) w=pw; if (h>ph) h=ph; var posy= (document.body.offsetWidth)/2-275; var posx=(document.body.offsetHeight)/2-215; var site_new_popup=window.open(url,'big','width='+w+',height='+h+', toolbar=0,location=0,status=1,menubar=0,scrollbars=1,resizable=0,left='+l+',top='+t) popuphtml=''; popuphtml+=title; popuphtml+=''; popuphtml+=''+title+''; popuphtml+=''; site_new_popup.document.open(); site_new_popup.document.write(popuphtml); site_new_popup.document.close(); site_new_popup.focus(); } var IE = (navigator.userAgent && (navigator.userAgent.indexOf("MSIE") != -1)); var FF = (navigator.userAgent && (navigator.userAgent.indexOf("Firefox") != -1)); var OP = (navigator.userAgent && (navigator.userAgent.indexOf("Opera") != -1)); if (IE || OP){ document.attachEvent("onkeydown",globalKeyCatch); }else{ document.addEventListener("keypress",globalKeyCatch,true); } function globalKeyCatch(e) { var code; elem = (!e)?window.event.srcElement:e.target; if (!e) e = window.event; if (e.keyCode) code = e.keyCode; else if (e.which) code = e.which; if (!elem || (elem.tagName!="INPUT" && elem.tagName!="TEXTAREA")){ if ((code == 37) && (e.ctrlKey == true)) { var destination = document.getElementById('previous_page'); if (destination) location.href = destination.href; } if ((code == 39) && (e.ctrlKey == true)) { var destination = document.getElementById('next_page'); if (destination) location.href = destination.href; } } } function insertFlash(bnFlash,bnW,bnH,flashV,params,nocashe,transp){ var rnd = Math.round(Math.random()*1048576); var flashID=bnFlash; if (bnFlash.indexOf('/')!=-1){ flashID=bnFlash.split('/'); flashID=flashID[flashID.length-1]; } flashID=flashID.split('.'); flashID=flashID[0]; var flashHtm=''; flashHtm+=''; flashHtm+=''; flashHtm+=(nocashe)?'':''; flashHtm+=''; flashHtm+=''; flashHtm+=''; if (!transp) flashHtm+=''; if (!transp) flashHtm+=''; else flashHtm+=''; flashHtm+=''; document.write(flashHtm); } function insertFlash2(bnFlash,bnW,bnH,flashV,params,nocashe,bgcolor){ var rnd = Math.round(Math.random()*1048576); var flashID=bnFlash; if (bnFlash.indexOf('/')!=-1){ flashID=bnFlash.split('/'); flashID=flashID[flashID.length-1]; } flashID=flashID.split('.'); flashID=flashID[0]; var flashHtm=''; flashHtm+=''; flashHtm+=''; flashHtm+=(nocashe)?'':''; flashHtm+=''; flashHtm+=''; if (!bgcolor){ flashHtm+=''; flashHtm+=''; }else{ flashHtm+=''; flashHtm+=''; } flashHtm+=''; document.write(flashHtm); } //Функция отправки запроса на удаленный URL методом GET. 2й параметр - ф-ия после выполнения запроса var ajaxReq=false; function loadXMLDoc(url,func,params) { ajaxReq = (window.XMLHttpRequest)?new XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP"); ajaxReq.onreadystatechange = func; ajaxReq.open("POST",url, true); ajaxReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); ajaxReq.setRequestHeader("Accept-Charset", "windows-1251"); ajaxReq.setRequestHeader("Content-Length",params.length); ajaxReq.send(params); } function processReqChange() { if (ajaxReq){ abort = window.setTimeout("ajaxReq.abort();", 10000); if (ajaxReq.readyState == 4) { clearTimeout(abort); if (ajaxReq.status == 200) { alert(ajaxReq.responseText); } else { alert("Неудачный запрос серверу:n" + ajaxReq.statusText); } } } } //------Упрощенная функция отправки запроса (Адрес, ID контейнера, Параметры) var sajaxReq=false; //Объект упрощенного аякс запроса var sajaxReqHTMLid=""; //Глобальная переменная идентификатора контейнера function sXMLSendReq(url,id,params){ (sajaxReq)?sajaxReq.abort():null; sajaxReqHTMLid=(id)?id:""; sajaxReq = (window.XMLHttpRequest)?new XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP"); sajaxReq.onreadystatechange = sXMLgetReq; sajaxReq.open("POST",url, true); if (params){ sajaxReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); sajaxReq.setRequestHeader("Accept-Charset", "windows-1251"); sajaxReq.setRequestHeader("Content-Length",params.length); } sajaxReq.send(params); } function sXMLgetReq(){ if (sajaxReq){ if (sajaxReq.readyState == 4){ if (sajaxReq.status == 200 && sajaxReqHTMLid && document.getElementById(sajaxReqHTMLid)){ document.getElementById(sajaxReqHTMLid).className=""; document.getElementById(sajaxReqHTMLid).innerHTML=sajaxReq.responseText; }else{ // alert("К сожалению, сервер не вернул ответа на посланный запрос. Повторите попутку позднее. " + sajaxReq.statusText); } } } } function objectHTMLById(objectHTMLByIdid,objectHTMLByIdtext){ if ((objectHTMLByIdobj=document.getElementById(objectHTMLByIdid)) && (objectHTMLByIdtext)) objectHTMLByIdobj.innerHTML=objectHTMLByIdtext; } function getObjectHTML(wid){ if (getObjectHTMLobj=document.getElementById(wid)) return (getObjectHTMLobj.innerHTML); else return false; } function objectById(objectByIdid){ return document.getElementById(objectByIdid); } //*------------Крнец функций AJAX function cfm(prt,url) { //v2.0 if (confirm(prt)) { location.href=url; }; }