// JavaScript Document var path="http://old.janotek.com"; var result=0; var MyRedirect = 'index.php'; function RedirigiHome() { if(MyRedirect=='undefined'|| MyRedirect=='') document.location = 'http://old.janotek.com/index.php'; else { var x = MyRedirect.toLowerCase().indexOf('login'); if(x>0) document.location = 'http://old.janotek.com/index.php'; else document.location = MyRedirect; } } function RiprovaLogin() { document.getElementById('username').value = ''; document.getElementById('pwd').value = ''; $("#logloader").hide("fast"); $("#divlogin").slideDown("slow"); $("#divlogin_alta").slideDown("slow"); $("#logresult").slideUp("slow"); } function AjaxLogin() { var xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { alert ("Your browser does not support AJAX!"); return; } var username = encodeURIComponent($("#username").val()); var pwd = encodeURIComponent($("#pwd").val()); if(username=="" || pwd=="") { alert("Inserire Username e Password"); return; } MyRedirect = $("#myredirect").val(); $("#logloader").show("fast"); var url=path+"/ajax.php"; url=url+"?op=setcook"; url=url+"&username="+username; url=url+"&pwd="+pwd; xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4) { var resp = xmlHttp.responseText; $("#logresult").html(resp); $("#logloader").hide("fast"); $("#divlogin").slideUp("slow"); $("#divlogin_alta").slideUp("slow"); $("#logresult").slideDown("slow"); var x = resp.indexOf('Errore'); if(x==-1) if(MyRedirect=='undefined' || MyRedirect=='') id = setTimeout(RedirigiHome, 4000); else id = setTimeout(RedirigiHome, 1000); } } xmlHttp.open("GET",url,true); xmlHttp.send(null); } function AjaxLogout() { var xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { alert ("Your browser does not support AJAX!"); return; } //Faccio il Logout eliminando i cookie setCookie("uzcacli","",-1); setCookie("uzcansi","",-1); var url="ajax.php"; url=url+"?mail=impostacookie"; url=url+"&op=unsetcook"; xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4 ) { a="LOGIN"; $("#loginlink").fadeOut("slow"); $("#loginlink").replaceWith(a); $("#loginlink").fadeIn("slow"); //$("#loginlink").text("LOGIN"); //$("#loginlink").attr("href",path+"/login"); //$("#loginlink").unbind('click', AjaxLogout); $("#divlogin").slideDown("slow"); $("#logresult").slideUp("slow"); } } xmlHttp.open("GET",url,true); xmlHttp.send(null); } function setCookie(c_name,value,expiredays) { var exdate=new Date(); exdate.setDate(exdate.getDate()+expiredays); document.cookie=c_name+ "=" +escape(value)+ ((expiredays==null) ? "" : ";expires="+exdate.toGMTString()); } function controllaIndirizzoMail(mail) { var xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { alert ("Your browser does not support AJAX!"); return; } var url="ajax.php"; url=url+"?mail="+mail; url=url+"&op=checkmail"; xmlHttp.open("GET",url,true); xmlHttp.send(null); xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4 && xmlHttp.responseText!='') { a=""; if(xmlHttp.responseText==1)$("#mailtd").append(a); else if(xmlHttp.responseText==0)$("#warimg").remove(); } } } function checkRegValues() { if($("#email").val().length<5) { alert("Inserisci la tua E-Mail!"); $("#email").focus(); return false; } if($("#nome").val().length<2) { alert("Inserisci il tuo Nome!"); $("#nome").focus(); return false; } if($("#cognome").val().length<2) { alert("Inserisci il tuo Cognome!"); $("#cognome").focus(); return false; } if($("#indirizzo").val().length<2) { alert("Inserisci il tuo Indirizzo di residenza!"); $("#indirizzo").focus(); return false; } if($("#citta").val().length<2) { alert("Inserisci il tua Citta' di residenza!"); $("#citta").focus(); return false; } if($("#provincia").val().length<1) { alert("Inserisci il tua Provincia di residenza!"); $("#provincia").focus(); return false; } if($("#cap").val().length<1) { alert("Inserisci il C.A.P. della tua citta' di residenza!"); $("#cap").focus(); return false; } if($("#nazione").val().length<1) { alert("Inserisci la tua Nazione di residenza!"); $("#nazione").focus(); return false; } if($("#piva").val().length<1) { alert("Inserisci la tua Partita IVA!"); $("#piva").focus(); return false; } if($("#tel1").val().length<1) { alert("Inserisci il tuo numero di Telefono principale!"); $("#tel1").focus(); return false; } if($("#condgen:checked").length<1) { alert("Accettare le condizioni generali per poter continuare la registrazione!"); return false; } if($("#appspec:checked").length<1) { alert("Accettare i termini di Approvazione Specifica per poter continuare la registrazione!"); return false; } if($("#seccod").val().length==0) { alert("Inserisci il Codice di Sicurezza!"); $("#seccod").focus(); return false; } $("#formnewaccount").submit(); }