Академический Документы
Профессиональный Документы
Культура Документы
do {
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
if (isNaN(chr2))
{
enc3 = enc4 = 64;
}
else if (isNaN(chr3))
{
enc4 = 64;
}
return output;
}
function decode64(input)
{
var output = "";
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
do
{
enc1 = keyStr.indexOf(input.charAt(i++));
enc2 = keyStr.indexOf(input.charAt(i++));
enc3 = keyStr.indexOf(input.charAt(i++));
enc4 = keyStr.indexOf(input.charAt(i++));
chr1 = (enc1 << 2) | (enc2 >> 4);
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
chr3 = ((enc3 & 3) << 6) | enc4;
if (enc3 != 64)
{
output = output + String.fromCharCode(chr2);
}
if (enc4 != 64)
{
output = output + String.fromCharCode(chr3);
}
} while (i < input.length);
return output;
}
function getXmlHttpRequest()
{
// create a XMLHttpRequest object
try
{
xmlHttpRequest = new XMLHttpRequest();
}
catch ( error )
{
return xmlHttpRequest;
}
xmlHttpRequest.send(null);
}
var alertXmlHttpRequest;
var alreadyWarned = false;
function alertQueryCallback()
{
var debugMessage;
if (alertXmlHttpRequest.readyState == 4)
{
if (alertXmlHttpRequest.status == 200)
{
// pull out the status and the next time to check
var xmlDocument = alertXmlHttpRequest.responseXML;
var alertCode =
xmlDocument.getElementsByTagName('statusCode').item(0).firstChild.data;
var timeRemaining =
xmlDocument.getElementsByTagName('timeRemaining').item(0).firstChild.data;
var refreshMillis =
xmlDocument.getElementsByTagName('refreshMillis').item(0).firstChild.data;
debugMessage = "alertCode=" + alertCode + " refreshMillis=" +
refreshMillis;
//window.status = debugMessage;
//alert( debugMessage );
}
}
}
function doXmlPoll()
{
alertXmlHttpRequest = getXmlHttpRequest();
url = /*URL*/ "/cp/alert/as?getAlertMessage=true";
httpGet( alertXmlHttpRequest, url, alertQueryCallback );
}
function checkForWindowClosing()
{
var browser=navigator.userAgent.toLowerCase();
if ( typeof mainWindow == "boolean" &&
mainWindow == true && // only main window
(browser.indexOf("msie") != -1) && // only Internet Explorer
window.event.clientX < 0 && // denotes that they did not click inside
window.event.clientY < 0 ) // the browser window
{
logoutXmlHttpRequest = getXmlHttpRequest();
httpGet( logoutXmlHttpRequest, /*URL*/
"http://blaze.cortland.edu/cp/home/logout?src=timeout.jsp" );
}
}
autoLogoutInternetExplorer = false;
if ( autoLogoutInternetExplorer &&
typeof window.attachEvent != "undefined" )
{
window.attachEvent( "onunload", checkForWindowClosing, true );
}
doXmlPoll();