var homeDomain = "www.uther3d.com";
function getAjax() {
var xhr;
try {
xhr = new ActiveXObject('Msxml2.XMLHTTP');
} catch (e) {
try {
xhr = new ActiveXObject('Microsoft.XMLHTTP');
} catch (e2) {
try {
xhr = new XMLHttpRequest();
} catch (e3) {
xhr = false;
}
}
}
if (!xhr) {
alert(":(");
} else {
return xhr;
}
}
function ReplaceClass(theID, oldClass, newClass) {
var i = document.getElementById(theID);
var c = i.className;
var r = "";
var s = c.split(" ");
for (var x = 0; x < s.length; x++) {
if (s[x] != oldClass) {
r += " " + s[x];
}
}
r += " " + newClass;
i.className = r;
}
function FlipTo(srcID, Img) {
var d;
d = document.getElementById(srcID);
d.src = Img;
}
// thanks wimp.com
function SelectAll(id) {
document.getElementById(id).focus();
document.getElementById(id).select();
}
// quick thanks to http://stackoverflow.com/questions/18082/validate-numbers-in-javascript-isnumeric
function isNumber(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
}
// CleanInput
// 16 = " ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789[]-.?:'`&()!/,_~#$;:%*"
// 29 = " ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789[]-.?:'`&()!/,_~#$;:%*"
// 36 = " ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789[]-.?:'`&()!/,_~#$;:%*"
// 70 = " ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; // add
// 71 = " ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789[]-=.?:`&()!~/,_#$;:%*@" + String.fromCharCode(10); // add
// 75 = " ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789[]-=.`&()!/,_#$;:%*@" + String.fromCharCode(10);
function CleanTheInput(e, ab) {
var d, v, x, n, tn, s;
d = document.getElementById(e);
v = d.value;
n = "";
tn = "";
for (x = 0; x < v.length; x++) {
if (ab.indexOf(v.charAt(x)) != -1) {
tn = tn + v.charAt(x);
}
}
n = tn;
s = 0;
tn = "";
// remove leading and trailing spaces
for (x = 0; x < n.length; x++) {
if ((n.charAt(x) != " ") && (s == 0)) {
s = 1;
}
if (s == 1) {
tn = tn + n.charAt(x);
}
}
n = tn;
s = 0;
tn = "";
for (x = (n.length - 1); x >= 0; x--) {
if ((n.charAt(x) != " ") && (s == 0)) {
s = 1;
}
if (s == 1) {
tn = n.charAt(x) + tn;
}
}
n = tn;
s = 0;
tn = "";
d = document.getElementById(e);
d.value = n;
}
function MakeMeNumber(i, digits) {
var n = document.getElementById(i).value;
if (!isNumber(n)) {
n = "0.00";
}
n = Math.abs(n);
n = n * Math.pow(10, digits);
n = Math.floor(n);
n = n / Math.pow(10, digits);
if (n > 999999.99) {
n = 999999.99;
}
n = n.toFixed(2);
document.getElementById(i).value = n;
}
function DoBackground() {
var w = document.getElementById('popupBackground');
wWidth = document.body.scrollWidth;
wHeight = document.body.scrollHeight;
w.style.width = wWidth + "px";
w.style.height = wHeight + "px";
w.style.marginTop = "-" + (wHeight / 2) + "px";
w.style.marginLeft = "-" + (wWidth / 2) + "px";
w.style.display = 'block';
if (document.getElementById('swfUploader')) {
document.getElementById('swfUploader').style.visibility = 'hidden';
}
}
function CloseWindow() {
var w = document.getElementById('PopupWindow');
w.innerHTML = '';
w.style.display = 'none';
document.getElementById('popupBackground').style.display = 'none';
if (document.getElementById('swfUploader')) {
document.getElementById('swfUploader').style.visibility = 'visible';
}
}
function Area_Show(id) {
var e = document.getElementById(id);
e.style.display = 'block';
}
function Area_Hide(id) {
var e = document.getElementById(id);
e.style.display = 'none';
}
////////////////////////////////////////////////////////////////////////////////
// menu stuff
var menutimer = new Array(); // init menu array
// menutimer[1]-[4] are menus, menutimer[5] is account area
menutimer[1] = 0;
menutimer[2] = 0;
menutimer[3] = 0;
menutimer[4] = 0;
menutimer[5] = 0; // init menus
function menupop(m, a) { // menu control (1,2), action ([i]n, [o]ut, [t]imer)
// default hidden, unless explicitly set to visible
d = document.getElementById("menu" + m);
// if timer hit, it's bye bye unless explicitly cancelled by event
if (a == "t") {
d.style.visibility = 'hidden';
return;
}
// out events set timer to call this function after 1000ms with 't' param to make menu invisible
if (a == "o") {
menutimer[m] = setTimeout("menupop('" + m + "', 't');", 750);
return;
}
// all in events show control and cancel pending timer
if (a == "i") {
d.style.visibility = 'visible';
clearTimeout(menutimer[m]);
return;
}
}
////////////////////////////////////////////////////////////////////////////////
function ShowLogin() {
d = document.getElementById("loginpopup");
if (d.style.visibility == 'visible') {
d.style.visibility = 'hidden';
return;
}
d.style.visibility = 'visible';
}
function CheckLogin() {
d = document.getElementById("login_user");
v = d.value;
if (v == "") {
alert("Please provide your email address");
d.focus();
return false;
}
d = document.getElementById("login_pass");
v = d.value;
if (v == "") {
alert("Please provide your password");
d.focus();
return false;
}
// add GMT offset in minutes to hidden field
var d = new Date();
var gmtMinutes = -d.getTimezoneOffset();
document.getElementById("gmtoffset").value = gmtMinutes;
return true;
}
function ForgotPassword() {
d = document.getElementById("login_user");
v = d.value;
if (v == "") {
alert("Please enter the email address that you registered with.");
d.focus();
return;
}
window.location = "https://" + homeDomain + "/?page=1&globalaction=forgotpass&email=" + v;
return;
}
function ResendConfirm() {
d = document.getElementById("login_user");
v = d.value;
if (v == "") {
alert("Please enter the email address that you registered with.");
d.focus();
return;
}
window.location = "https://" + homeDomain + "/?page=1&globalaction=resend&email=" + v;
return;
}
function flipProfileSelector() {
d = document.getElementById('ProfileSwapperArea');
s = d.style.display;
if (s != "block") {
d.style.display = "block";
} else {
d.style.display = "none";
}
}