function validate(item,as){ switch(as){ case "text": return item.value.match("[a-zA-Z0-9_\.\-\@ ]+"); break; case "email": return item.value.match("([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+"); break; case "present": return item.value!=""; break; default: return false; } } function checkForm(need_check){ var form = document.getElementById("presents") if(need_check){ some = false; for(i=0; i0) button.value = 'Regalato'; else{ button.value = 'Controlla'; } } function callPhpFile (url) { // Create new JS element var jsel = document.createElement('SCRIPT'); jsel.type = 'text/javascript'; jsel.src = url; // Append JS element (therefore executing the 'AJAX' call) document.body.appendChild (jsel); } function sendCode(){ var email = document.getElementById('email').value; if(email=="" || !email.match("([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+")){ alert("Specificare una email valida per ricevere il codice"); return; } callPhpFile('contents/lista/mail.php?email='+email+'&id=msg'); } function floatMenu(){ el = document.getElementById('confirm'); maxWidth = (document.body.clientHeight )? document.body.clientHeight :window.innerHeight ; top_ref = document.getElementById('rif_top'); limit_top = top_ref.offsetTop + top_ref.offsetHeight ; limit_bottom = document.getElementById('rif_bottom'); limit_bottom = limit_bottom.offsetTop + limit_bottom.offsetHeight - 180; // 50px immagine bottom el.style.position = 'absolute'; el.style.left = top_ref.style.left; scrollTop = 0; scrollTop = Math.max(document.body.scrollTop, document.documentElement.scrollTop); el.style.top = ((scrollTop / maxWidth)*(limit_bottom-limit_top)*1.5+limit_top) + "px"; }