function newXMLHttpObject() {
    var xmlHttp;
    try {
        xmlHttp = new XMLHttpRequest();
    }
    catch (e) {
        try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e) {
                return false;
            }
        }
    }
    return xmlHttp;
}


//***********************************************************************************************
// Objetivo  : Função para Verificar o Acesso
// Autor     : LinxShop
// Adaptação : fnVerificaAcesso()
// OBS       :
// Retorno   : 0 - Usuário não esta Logado
//             1 - Usuário Logado.   
// Data      : 26/10/2008
//***************************************************************************
function fnVerificaAcesso() {

    var pObjXMLParametro = '';
    var pObjPagina = 'VerificaAcesso.aspx';
    var pObjRetorno = '';

    var xmlHttp = newXMLHttpObject();

    if (xmlHttp) {
        xmlHttp.open("GET", "VerificaAcesso.aspx", false)
        xmlHttp.send("");
        pObjRetorno = xmlHttp.responseText;
    }
    else {
        pObjRetorno = 0;
    }
    return pObjRetorno;
}



/***********************************************************************************************
 Objetivo  : Desabilita CTRL + V (colar) 
***********************************************************************************************/

function DesabilitarCTRL_V(Obj, e) 
{
    var TeclaProibida = "v";
    var key;
    var isCtrl;
    
    //Verifica qual browser usado e marca como verdadeiro ou falso o clique na tecla ctrl.
    if (window.event) {
        key = window.event.keyCode;     //IE
        if (window.event.ctrlKey)
            isCtrl = true;
        else
            isCtrl = false;
    }
    else {
        key = e.which;     //Firefox
        if (e.ctrlKey)
            isCtrl = true;
        else
            isCtrl = false;
    }

    
    //Caso ctrl tenha sido pressionado. 
    if (isCtrl)
    {
        //Caso a tecla combinada a tecla CTRL seja 'V', então limpar buffer com o coteudo copiado 
        if (TeclaProibida.toLowerCase() == String.fromCharCode(key).toLowerCase()) {

            if (window.event)   //IE
            {
                //Limpa buffer
                window.clipboardData.setData('text', '');
                //window.clipboardData.clearData();
            }
            else 
            {
                 //alert('ff');
                //Firefox

                //                var str = Components.classes["@mozilla.org/supports-string;1"].
                //                       createInstance(Components.interfaces.nsISupportsString);
                //                if (!str) return false; // couldn't get string obj   
                //                str.data = textUnicode; // unicode string?   



                //                // add Unicode & HTML flavors to the transferable widget   
                //                var trans = Components.classes["@mozilla.org/widget/transferable;1"].
                //                       createInstance(Components.interfaces.nsITransferable);
                //                if (!trans) return false; //no transferable widget found   

                //                trans.addDataFlavor("text/unicode");
                //                trans.setTransferData("text/unicode", str, 50); // *2 because it's unicode   

                //                trans.addDataFlavor("text/html");
                //                trans.setTransferData("text/html", copytext, 50); // *2 because it's unicode    

                //                var clipboard = Components.classes["@mozilla.org/widget/clipboard;1"].
                //                       getService(Components.interfaces.nsIClipboard);
                //                if (!clipboard) return false; // couldn't get the clipboard   

                //                clipboard.setData(trans, null, Components.interfaces.nsIClipboard.kGlobalClipboard);
            }

            return false;
        }

    }

    return true;
}

