function loadHora(){ jQuery.ajax({url : 'webservices/ws_servertime.php', success : function (data) { jQuery('#clock').html(data); } }); } function createObject() { var request_type; var browser = navigator.appName; if(browser == 'Microsoft Internet Explorer'){ request_type = new ActiveXObject('Microsoft.XMLHTTP'); } else { request_type = new XMLHttpRequest(); } return request_type; } var http = createObject(); var nocache = 0; function login(dist) { document.getElementById('login_response').innerHTML = ""; document.getElementById('login_response').style.visibility='visible'; document.getElementById('login_response').style.display='block'; var user = encodeURI(document.getElementById('userLogin').value); var pass = encodeURI(document.getElementById('passLogin').value); var dist = dist; nocache = Math.random(); http.open('get', 'webservices/ws_login.php?user='+user+'&pass='+pass+'&dist='+dist+'&nocache='+nocache); http.onreadystatechange = loginReply; http.send(null); } function loginReply() { if(http.readyState === 4){ var response = http.responseText; var conf = { frequency: 5000, spread: 5, duration: 500 }; if(response === 0 || response == 0 ){ // login falhou document.getElementById('login_response').innerHTML = "Utilizador ou Senha não válidos!"; } else { // login com sucesso var sURL = '?session=entrar'; window.location.replace( sURL ); } } } // Altera a firma corrente function alterafirma(firma){ $('#page_effect').show(); nocache = Math.random(); http.open('get', 'webservices/ws_login.php?firma='+firma+'&nocache = '+nocache); http.onreadystatechange = alterafirmaReply; http.send(null); } function alterafirmaReply(){ if(http.readyState === 4){ var response = http.responseText; if(response === 0){ alerta('Não tem permissões'); var sURL = "?"; window.location.replace( sURL ); } else { // sucesso var sURL = '?session=entrar'; window.location.replace( sURL ); } } } // Chamar ajaxLoader dependente de string inserida em formulário function enviarVarsForm(id,url,loadto) { var strget = encodeURI(document.getElementById('strget').value); var loadto = encodeURI(document.getElementById('loadto').value); var url = encodeURI(document.getElementById('url').value); ajaxLoader(url+strget,loadto); } function janelaOculta(button,tohide,width,height,buttons) { $('#'+tohide).dialog({ autoOpen: false, width: width, height: height, buttons: buttons, modal: true, overlay: {opacity: 0.95,background:'black'} }); $('#'+button).mouseover(function(){ $('#'+button).css('cursor','pointer'); }); $('#'+button).click(function(){ $('#'+tohide).dialog('open'); return false; }); }; function encerrarSessao(){ jQuery('#divalerta').html("
'+dump(arr)+''); }