var xmlHttp = false; var sGlobalHelpReceiverObjectId; //set in AjaxHelp /* Создание нового объекта XMLHttpRequest для общения с Web-сервером */ /*@cc_on @*/ /*@if (@_jscript_version >= 5) try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e2) { xmlHttp = false; } } @end @*/ if (!xmlHttp && typeof XMLHttpRequest != 'undefined') { xmlHttp = new XMLHttpRequest(); } function CallServer(strUrl, strParams,strMethod,fOnUpdate) { // var xmlHttp = false; if (window.XMLHttpRequest) { // Mozilla, Safari,... xmlHttp = new XMLHttpRequest(); if (xmlHttp.overrideMimeType) { // set type accordingly to anticipated content type //xmlHttp.overrideMimeType('text/xml'); // xmlHttp.overrideMimeType('text/html'); } } else if (window.ActiveXObject) { // IE try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!xmlHttp) { var oGlobalHelpObject = document.getElementById(sGlobalHelpReceiverObjectId); document.body.style.cursor='default'; // oGlobalHelpObject.innerHTML="AJAX not available"; alert("Data Fetch Error \nAJAX not available"); return false; } //AjaxToTrof("callServer
" +strMethod + "
" + strParams + "
" + xmlHttp); // Создать URL для подключения var url = strUrl; //"AjaxHelp.php"; // Установить функцию для сервера, которая выполнится после его ответа xmlHttp.onreadystatechange = fOnUpdate; //updateHelpPage; if(strMethod == "GET") { url = url + "?" + strParams + "&r=" + Math.random(); var oGlobalHelpObject = document.getElementById(sGlobalHelpReceiverObjectId); // oGlobalHelpObject.innerHTML="Loading " + url; xmlHttp.open("GET", url, true); xmlHttp.send(null); } // Открыть соединение с сервером if(strMethod == "POST") { reqTimeout = setTimeout("TrofAjaxTimeout();", 9000); xmlHttp.open("POST", url, true); xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded, charset=utf-8"); xmlHttp.setRequestHeader("Content-length", strParams.length); xmlHttp.setRequestHeader("Connection", "close"); xmlHttp.send(strParams); //AjaxToTrof("callServer
" +strMethod + "
" + strParams + "
LEN(" + strParams.length +")
" + xmlHttp); } } function TrofAjaxTimeout() { xmlHttp.abort; AjaxToTrof("\n\n Server does not respond for too long.\n\n Sorry, but you probably will have to retry your request.\n"); } function AjaxToTrof(sM) { var od = document.getElementById('trof_debug'); if(!od) {return;} od.innerHTML = od.innerHTML + '\n
\n' + sM; } function TrofFetchFeeds(strRarams) { try { var sParams = "" + strRarams; CallServer("AjaxShowFeeds.php","p=" + encodeURIComponent(sParams),"POST",TrofAjaxIsDone); } catch(e) { AjaxToTrof(e); } } function TrofAjaxIsDone() { if (xmlHttp.readyState == 4) { var response = xmlHttp.responseText; xmlHttp.abort(); //opera clearTimeout(reqTimeout); //alert(response); if(response.length > 0) { // AjaxToTrof(response); var od = document.getElementById('feed_place_holder'); if(!od) {return;} od.innerHTML = response; rssPit.parsePage(); // rssPit.setCallerStyle('color','yellow'); /* if(tv_bTrof) { rssPit.setLanguage('ja'); } */ } document.body.style.cursor='default'; return; } }