﻿// JScript File
function createXHR() 
{
    var xhr;
    try 
    {
        xhr = new ActiveXObject("Msxml2.XMLHTTP");
    } 
    catch (e) 
    {
        try 
        {
            xhr = new ActiveXObject("Microsoft.XMLHTTP");
        } 
        catch (E) 
        {
            xhr = false;
        }
    }
    
    if (!xhr && typeof XMLHttpRequest != 'undefined') 
    {
        xhr = new XMLHttpRequest();
    }
    
    return xhr;
}

function getInnerText (node) {
        if (typeof node.textContent != 'undefined') {
        return node.textContent;
        }
        else if (typeof node.innerText != 'undefined') {
        return node.innerText;
        }
        else if (typeof node.text != 'undefined') {
        return node.text;
        }
        else {
        switch (node.nodeType) {
        case 3:
        case 4:
        return node.nodeValue;
        break;
        case 1:
        case 11:
        var innerText = '';
        for (var i = 0; i < node.childNodes.length; i++) {
        innerText += getInnerText(node.childNodes[i]);
        }
        return innerText;
        break;
        default:
        return '';
        }
        }
        }
        
function clearSpaces(root) {
    for (var iNode = 0; iNode < root.childNodes.length; iNode++) 
        {
            var node = root.childNodes.item(iNode);
            
            if (node.nodeType == 3)
            {
                root.removeChild(root.childNodes.item(iNode));
                iNode--;
            }
            else
            {
                _pagecount++;
            }
        }
        
        return root;
}


function Replaceand(str)
{
    str.replace("&","||");
    //str.replace("'","~");
    return str.replace("&","||");
}

function Replacequote(str)
{
    str.replace("'","\'");
   
    return str.replace("'","\'");
}
