//site.js function noenter(e) { var key; if(window.event){ key = window.event.keyCode;//IE } else{ key = e.which;//firefox } if(key == 13){ return false; } else{ return true; } } function toggleForgottenPassword(){ var oFPDiv = document.getElementById('forgotten_password_box'); var strDisp = oFPDiv.style.display; if(strDisp == 'block'){ oFPDiv.style.display = 'none'; } else{ oFPDiv.style.display = 'block'; } } function sendNewPassword(){ var oLogin = document.getElementById('forgotten_pass_login'); var oEmail = document.getElementById('forgotten_pass_email'); var oSentBox = document.getElementById('forgotten_email_sent'); var strLogin = oLogin.value; var strEmail = oEmail.value; var contentType = "application/x-www-form-urlencoded; charset=UTF-8"; var oXmlHttp = zXmlHttp.createRequest(); oXmlHttp.open("GET",'send_new_password.php?u=' + strLogin + '&e=' + strEmainl, true); oXmlHttp.onreadystatechange = function(){ //we currently ignore all readyStates other than 4 var httpStatus = 0; if(oXmlHttp.readyState == 4){ try { if(oXmlHttp.status !== undefined && oXmlHttp.status != 0){ httpStatus = oXmlHttp.status; } else{ httpStatus = 13030; //alert('FireFox Error: Processing Stage 1'); } } catch(e){ // 13030 is the custom code to indicate the condition -- in Mozilla/FF -- // when the o object's status and statusText properties are // unavailable, and a query attempt throws an exception. httpStatus = 13030; oXmlHttp.abort(); //alert('FireFox Error: Processing Stage 2'); } if (httpStatus == 200) { //success var myText = oXmlHttp.responseText; if(myText == 'OK'){ //password changed and sent - update box oSentBox.innerHTML = 'Password reset and email sent, look for it in the next few minutes.'; } else if(myText.length > 2){ //user does not exist, that's good oSentBox.innerHTML = myText; } else{ //this is something other than T or F, that's bad oSentBox.innerHTML = 'Something odd just happened - your password was not changed and you were not sent an email.'; } } } }; setTimeout(function(){oXmlHttp.send(null)},75);//time in ms to wait } function checkNewUser(strLogin){ var oLoginErrDiv = document.getElementById('login_error'); var contentType = "application/x-www-form-urlencoded; charset=UTF-8"; var oXmlHttp = zXmlHttp.createRequest(); oXmlHttp.open("GET",'check_if_user_exists.php?u=' + strLogin, true); oXmlHttp.setRequestHeader("Content-Type", contentType); oXmlHttp.onreadystatechange = function(){ //we currently ignore all readyStates other than 4 var httpStatus = 0; if(oXmlHttp.readyState == 4){ try { if(oXmlHttp.status !== undefined && oXmlHttp.status != 0){ httpStatus = oXmlHttp.status; } else{ httpStatus = 13030; //alert('FireFox Error: Processing Stage 1'); } } catch(e){ // 13030 is the custom code to indicate the condition -- in Mozilla/FF -- // when the o object's status and statusText properties are // unavailable, and a query attempt throws an exception. httpStatus = 13030; oXmlHttp.abort(); //alert('FireFox Error: Processing Stage 2'); } if (httpStatus == 200) { //success var myText = oXmlHttp.responseText; if(myText == 'T'){ //user exists, that's bad oLoginErrDiv.innerHTML = 'This username already exists, please select something else.'; } else if(myText == 'F'){ //user does not exist, that's good oLoginErrDiv.innerHTML = ''; } else{ //this is something other than T or F, that's bad } } } }; setTimeout(function(){oXmlHttp.send(null)},75);//time in ms to wait } //this takes in the two form element names to compare values on, the error id to output any errors into, and the form to submit on success function processUserForm(strForm, strInput1, strInput2, strErrID, strErrMsg){ var oForm = document.getElementById(strForm); var oErrOut = document.getElementById(strErrID); var val1 = oForm.elements[strInput1].value; var val2 = oForm.elements[strInput2].value; if(val1 != val2){ //failure, write an error message oErrOut.innerHTML = strErrMsg; } else{ //things are good, we can submit the form oErrOut.innerHTML = ''; oForm.submit(); } } function deleteMovie(strMovieID){ var answer = confirm("Are you sure you want to delete this movie?") if (!answer){ return; } var oDelBox = document.getElementById(strMovieID); var oOutputBox = document.getElementById(strMovieID + '_wait'); var iMovieID = strMovieID.substring(9); oOutputBox.innerHTML = ''; oOutputBox.value = '... Please Wait, Processing ...'; //pass these off to the processor to be queued var oXmlHttp = zXmlHttp.createRequest(); var strQryStr = '?m=' + iMovieID; oXmlHttp.open("GET",'del_movie.php' + strQryStr, true); oXmlHttp.onreadystatechange = function(){ //we currently ignore all readyStates other than 4 var httpStatus = 0; if(oXmlHttp.readyState == 4){ try { if(oXmlHttp.status !== undefined && oXmlHttp.status != 0){ httpStatus = oXmlHttp.status; } else{ httpStatus = 13030; //alert('FireFox Error: Processing Stage 1'); } } catch(e){ // 13030 is the custom code to indicate the condition -- in Mozilla/FF -- // when the o object's status and statusText properties are // unavailable, and a query attempt throws an exception. httpStatus = 13030; oXmlHttp.abort(); //alert('FireFox Error: Processing Stage 2'); } if (httpStatus == 200) { //success var myText = oXmlHttp.responseText; if(myText == 'S'){ //Success, that's good //visually remove the box from the UI since it is no longer in the db, //on the next reload the html will go away oDelBox.style.display = 'none'; } else if(myText.length > 1){ //Err oOutputBox.innerHTML = myText; } else{ //this is something, that's bad alert('There was an unknown error. The worst type of error, if you think about it.'); } } } }; setTimeout(function(){oXmlHttp.send(null)},75);//time in ms to wait } function deleteStamp(strStampID){ //this is passed in the div ID of the stamp, we will need to remove its actual stamp id from that var answer = confirm("Are you sure you want to delete this movie stamp?") if (!answer){ return; } var oDelBox = document.getElementById(strStampID); var iStampID = strStampID.substring(13); //pass these off to the processor to be queued var oXmlHttp = zXmlHttp.createRequest(); var strQryStr = '?t=' + iStampID; oXmlHttp.open("GET",'del_stamp.php' + strQryStr, true); oXmlHttp.onreadystatechange = function(){ //we currently ignore all readyStates other than 4 var httpStatus = 0; if(oXmlHttp.readyState == 4){ try { if(oXmlHttp.status !== undefined && oXmlHttp.status != 0){ httpStatus = oXmlHttp.status; } else{ httpStatus = 13030; //alert('FireFox Error: Processing Stage 1'); } } catch(e){ // 13030 is the custom code to indicate the condition -- in Mozilla/FF -- // when the o object's status and statusText properties are // unavailable, and a query attempt throws an exception. httpStatus = 13030; oXmlHttp.abort(); //alert('FireFox Error: Processing Stage 2'); } if (httpStatus == 200) { //success var myText = oXmlHttp.responseText; if(myText == 'S'){ //Success, that's good //visually remove the box from the UI since it is no longer in the db, //on the next reload the html will go away oDelBox.parentNode.removeChild(oDelBox); } else if(myText.length > 1){ //Err //for now we will just use FireBug to track if there was an error output } else{ //this is something, that's bad alert('There was an unknown error. The worst type of error, if you think about it.'); } } } }; setTimeout(function(){oXmlHttp.send(null)},75);//time in ms to wait } function deleteMovieTag(strTagID, strMovieID){ //we generate the div needed from these numbers -> "tag_(tag_id)_(movie_id)" var answer = confirm("Are you sure you want to delete this movie tag?") if (!answer){ return; } var oDelBox = document.getElementById('tag_' + strTagID + '_' + strMovieID); //pass these off to the processor to be queued var oXmlHttp = zXmlHttp.createRequest(); var strQryStr = '?t=' + strTagID + '&m=' + strMovieID + '&s=0&p=0&type=M'; oXmlHttp.open("GET",'del_tag.php' + strQryStr, true); oXmlHttp.onreadystatechange = function(){ //we currently ignore all readyStates other than 4 var httpStatus = 0; if(oXmlHttp.readyState == 4){ try { if(oXmlHttp.status !== undefined && oXmlHttp.status != 0){ httpStatus = oXmlHttp.status; } else{ httpStatus = 13030; //alert('FireFox Error: Processing Stage 1'); } } catch(e){ // 13030 is the custom code to indicate the condition -- in Mozilla/FF -- // when the o object's status and statusText properties are // unavailable, and a query attempt throws an exception. httpStatus = 13030; oXmlHttp.abort(); //alert('FireFox Error: Processing Stage 2'); } if (httpStatus == 200) { //success var myText = oXmlHttp.responseText; if(myText == 'S'){ //Success, that's good //visually remove the box from the UI since it is no longer in the db, //on the next reload the html will go away oDelBox.style.display = 'none'; } else if(myText.length > 1){ //Err //for now we will just use FireBug to track if there was an error output } else{ //this is something, that's bad alert('There was an unknown error. The worst type of error, if you think about it.'); } } } }; setTimeout(function(){oXmlHttp.send(null)},75);//time in ms to wait } function deleteStampTag(strTagID, strMovieID, strStampID){ //we generate the div needed from these numbers -> "_stamp_tag_(stamp_id)_(tag_id)" var answer = confirm("Are you sure you want to delete this stamp tag?") if (!answer){ return; } var oDelBox = document.getElementById('stamp_tag_' + strStampID + '_' + strTagID); //pass these off to the processor to be queued var oXmlHttp = zXmlHttp.createRequest(); var strQryStr = '?t=' + strTagID + '&m=' + strMovieID + '&s=' + strStampID + '&p=0&type=S'; oXmlHttp.open("GET",'del_tag.php' + strQryStr, true); oXmlHttp.onreadystatechange = function(){ //we currently ignore all readyStates other than 4 var httpStatus = 0; if(oXmlHttp.readyState == 4){ try { if(oXmlHttp.status !== undefined && oXmlHttp.status != 0){ httpStatus = oXmlHttp.status; } else{ httpStatus = 13030; //alert('FireFox Error: Processing Stage 1'); } } catch(e){ // 13030 is the custom code to indicate the condition -- in Mozilla/FF -- // when the o object's status and statusText properties are // unavailable, and a query attempt throws an exception. httpStatus = 13030; oXmlHttp.abort(); //alert('FireFox Error: Processing Stage 2'); } if (httpStatus == 200) { //success var myText = oXmlHttp.responseText; if(myText == 'S'){ //Success, that's good //visually remove the box from the UI since it is no longer in the db, //on the next reload the html will go away oDelBox.style.display = 'none'; } else if(myText.length > 1){ //Err //for now we will just use FireBug to track if there was an error output } else{ //this is something, that's bad alert('There was an unknown error. The worst type of error, if you think about it.'); } } } }; setTimeout(function(){oXmlHttp.send(null)},75);//time in ms to wait } function deletePostTag(strTagID, strMovieID, strStampID, strPostID){ var answer = confirm("Are you sure you want to delete this post tag?") if (!answer){ return; } var oDelBox = document.getElementById('post_tag_' + strPostID + '_' + strTagID); //pass these off to the processor to be queued var oXmlHttp = zXmlHttp.createRequest(); var strQryStr = '?t=' + strTagID + '&m=' + strMovieID + '&s=' + strStampID + '&p=' + strPostID + '&type=P'; oXmlHttp.open("GET",'del_tag.php' + strQryStr, true); oXmlHttp.onreadystatechange = function(){ //we currently ignore all readyStates other than 4 var httpStatus = 0; if(oXmlHttp.readyState == 4){ try { if(oXmlHttp.status !== undefined && oXmlHttp.status != 0){ httpStatus = oXmlHttp.status; } else{ httpStatus = 13030; //alert('FireFox Error: Processing Stage 1'); } } catch(e){ // 13030 is the custom code to indicate the condition -- in Mozilla/FF -- // when the o object's status and statusText properties are // unavailable, and a query attempt throws an exception. httpStatus = 13030; oXmlHttp.abort(); //alert('FireFox Error: Processing Stage 2'); } if (httpStatus == 200) { //success var myText = oXmlHttp.responseText; if(myText == 'S'){ //Success, that's good //visually remove the box from the UI since it is no longer in the db, //on the next reload the html will go away oDelBox.style.display = 'none'; } else if(myText.length > 1){ //Err //for now we will just use FireBug to track if there was an error output } else{ //this is something, that's bad alert('There was an unknown error. The worst type of error, if you think about it.'); } } } }; setTimeout(function(){oXmlHttp.send(null)},75);//time in ms to wait } function deleteScreenshotTag(strTagID, strSSID){ var answer = confirm("Are you sure you want to delete this screenshot tag?") if (!answer){ return; } var oDelBox = document.getElementById('screenshot_tag_' + strTagID); //pass these off to the processor to be queued var oXmlHttp = zXmlHttp.createRequest(); var strQryStr = '?t=' + strTagID + '&m=0&s=0&p=0&type=Z&ss=' + strSSID; oXmlHttp.open("GET",'del_tag.php' + strQryStr, true); oXmlHttp.onreadystatechange = function(){ //we currently ignore all readyStates other than 4 var httpStatus = 0; if(oXmlHttp.readyState == 4){ try { if(oXmlHttp.status !== undefined && oXmlHttp.status != 0){ httpStatus = oXmlHttp.status; } else{ httpStatus = 13030; //alert('FireFox Error: Processing Stage 1'); } } catch(e){ // 13030 is the custom code to indicate the condition -- in Mozilla/FF -- // when the o object's status and statusText properties are // unavailable, and a query attempt throws an exception. httpStatus = 13030; oXmlHttp.abort(); //alert('FireFox Error: Processing Stage 2'); } if (httpStatus == 200) { //success var myText = oXmlHttp.responseText; if(myText == 'S'){ //Success, that's good //visually remove the box from the UI since it is no longer in the db, //on the next reload the html will go away oDelBox.style.display = 'none'; } else if(myText.length > 1){ //Err //for now we will just use FireBug to track if there was an error output } else{ //this is something, that's bad alert('There was an unknown error. The worst type of error, if you think about it.'); } } } }; setTimeout(function(){oXmlHttp.send(null)},75);//time in ms to wait } function addNewStampPost(newPostID){ var oObj = document.getElementById(newPostID); oObj.style.display = 'block'; } function closeNewStampPost(newPostID){ var oObj = document.getElementById(newPostID); oObj.style.display = 'none'; } function deletePost(iPostID){ var answer = confirm("Are you sure you want to delete this post?") if (!answer){ return; } var oDelBox = document.getElementById('stamp_post_' + iPostID); //pass these off to the processor to be queued var oXmlHttp = zXmlHttp.createRequest(); var strQryStr = '?i=' + iPostID; oXmlHttp.open("GET",'del_post.php' + strQryStr, true); oXmlHttp.onreadystatechange = function(){ //we currently ignore all readyStates other than 4 var httpStatus = 0; if(oXmlHttp.readyState == 4){ try { if(oXmlHttp.status !== undefined && oXmlHttp.status != 0){ httpStatus = oXmlHttp.status; } else{ httpStatus = 13030; //alert('FireFox Error: Processing Stage 1'); } } catch(e){ // 13030 is the custom code to indicate the condition -- in Mozilla/FF -- // when the o object's status and statusText properties are // unavailable, and a query attempt throws an exception. httpStatus = 13030; oXmlHttp.abort(); //alert('FireFox Error: Processing Stage 2'); } if (httpStatus == 200) { //success var myText = oXmlHttp.responseText; if(myText == 'S'){ //Success, that's good //visually remove the box from the UI since it is no longer in the db, //on the next reload the html will go away oDelBox.style.display = 'none'; } else if(myText.length > 1){ //Err //for now we will just use FireBug to track if there was an error output } else{ //this is something, that's bad alert('There was an unknown error. The worst type of error, if you think about it.'); } } } }; setTimeout(function(){oXmlHttp.send(null)},75);//time in ms to wait }