var xmlhttp; function getXHO() { if (window.XMLHttpRequest) { return new XMLHttpRequest(); } if (window.ActiveXObject) { return new ActiveXObject("Microsoft.XMLHTTP"); } return null; } function updateText(url, div) { xmlhttp = getXHO(); xmlhttp.onreadystatechange = function () { document.getElementById(div).innerHTML = xmlhttp.responseText; } xmlhttp.open("GET", url, false); xmlhttp.send(); } function change(x) { var e = x.split("#"); var a = e[1]; v = "textfiles/" + a + ".php"; updateText(v, 'content'); } function showInfo(person) { xmlhttp = getXHO(); xmlhttp.onreadystatechange = function () { document.getElementById('a').innerHTML = xmlhttp.responseText; } xmlhttp.open("GET", 'textfiles/bios/get.php?person=' + person, false); xmlhttp.send(); } function updateQt(qt, p) { xmlhttp = getXHO(); xmlhttp.onreadystatechange = function () { if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) { var x = xmlhttp.responseText; var e = x.split('%'); document.getElementById('p').innerHTML = '$' + e[1]; document.getElementById('t').innerHTML = '$' + e[0]; } } xmlhttp.open("GET", '/shop/update.php?qt=' + qt + '&p=' + p, false); xmlhttp.send(); } function validate(theField, name, filter) { if (theField.value == "") { theField.style.background = '#FFFFFF'; return false; } if (filter.test(theField.value)) { theField.style.background = '#D6FFD8'; } else { theField.style.background = '#FFD6D6'; alert('Invalid input in ' + name); } } function validateUsername(theField, name, filter) { if (filter.test(theField.value)) { var e = document.getElementById('email').value.split('@'); var a = e[0]; if (theField.value == a) { theField.style.background = '#FFD6D6'; alert('Username can\'t be the same as email address'); } else { theField.style.background = '#D6FFD8'; } } else { theField.style.background = '#FFD6D6'; alert('Invalid input in ' + name); } } function pass(theField) { var p = document.getElementById('password'); if (theField.value != p.value) { theField.style.background = '#FFD6D6'; p.style.background = '#FFD6D6'; alert('Passwords don\'t match!'); } else { theField.style.background = '#D6FFD8'; p.style.background = '#D6FFD8'; } }