var commentsHeaderTextBackup = ''; function toggleNTB(newthreadbox_id) { var ntbID = 'NTB_' + newthreadbox_id; var ntbDialog = 'ntd_' + newthreadbox_id; var ntBOXid = 'ntBOX_' + newthreadbox_id; //var FORMNAME = 'createNewThread_'+ newthreadbox_id; //var INPUTNAME = 'newthread_postBox_'+ newthreadbox_id; var ntbProp = document.getElementById(ntbID).className; function fadeInAndOut(id, text) { var fadeOutText = { opacity: {from: 1, to: 0}}; var fadeOutRootBoxText = new YAHOO.util.Anim(id, fadeOutText, 0.2 , YAHOO.util.Easing.easeIn); fadeOutRootBoxText.animate(); //document.getElementById(id).style.display = 'none'; function fadeBackIn(id) { document.getElementById(id).innerHTML = text; var fadeInText = { opacity: {from: 0, to: 1}}; var fadeInRootBoxText = new YAHOO.util.Anim(id, fadeInText, 0.2 , YAHOO.util.Easing.easeIn); fadeInRootBoxText.animate(); } setTimeout(function(){fadeBackIn(id);}, 250); } if (ntbProp == 'new-thread-button ntb-reg') // IF BOX IS CLOSED { document.createNewThread_0.newthread_postBox_0.value = ''; document.createNewThread_0.newthread_postBox_0.focus(); commentsHeaderTextBackup = document.getElementById(ntbDialog).innerHTML; document.getElementById(ntbID).className = 'new-thread-button ntb-dis'; fadeInAndOut(ntbDialog, 'New Root Thread'); var slideDownBoxParams = { height: {from: 0, to: 217}}; var slideDownRootBox = new YAHOO.util.Anim(ntBOXid, slideDownBoxParams, 0.09 , YAHOO.util.Easing.easeIn); slideDownRootBox.animate(); } else if (ntbProp == 'new-thread-button ntb-dis') // IF BOX IS OPEN { document.getElementById(ntbID).className = 'new-thread-button ntb-reg' fadeInAndOut(ntbDialog, commentsHeaderTextBackup); var slideDownBoxParams = { height: {from: 217, to: 0}}; var slideDownRootBox = new YAHOO.util.Anim(ntBOXid, slideDownBoxParams, 0.17 , YAHOO.util.Easing.easeOut); slideDownRootBox.animate(); } } function hovRep(reply_id) { var replyLinkID = 'r-rL_' + reply_id; var innerDivID = 'r-iD_'+ reply_id; var liID = 're_' + reply_id; var liClassChecker = document.getElementById(liID).className; if (liClassChecker != 'selected') { var increasePaddingParams = { paddingLeft: {from: 29, by: 7} }; var increasePadding = new YAHOO.util.Anim(innerDivID, increasePaddingParams, 0.15 , YAHOO.util.Easing.backBoth); increasePadding.animate(); var element = document.getElementById(replyLinkID); var fadeTextParams = { color: { to: '#ffffff' } }; var fadeText = new YAHOO.util.ColorAnim(element, fadeTextParams, 0.15 , YAHOO.util.Easing.easeOut); fadeText.animate(); } } function deSelectReply(level_num, replyLinkID, innerDivID) { if (level_num == 'level0') {var regColor = '#7f8289';} if (level_num == 'level1') {var regColor = '#909398';} if (level_num == 'level2') {var regColor = '#a3a7ac';} if (level_num == 'level3') {var regColor = '#b4b8bd';} if (level_num == 'level4') {var regColor = '#ced0d5';} if (level_num == 'level5') {var regColor = '#e5e6e8';} if (level_num == 'level6') {var regColor = '#fafafb';} if (level_num == 'level7') {var regColor = '#ffffff';} var increasePaddingParams = { paddingLeft: {from: 36, by: -7} }; var increasePadding = new YAHOO.util.Anim(innerDivID, increasePaddingParams, 0.18 , YAHOO.util.Easing.backBoth); increasePadding.animate(); var element = document.getElementById(replyLinkID); var fadeTextParams = { color: { to: regColor } }; var fadeText = new YAHOO.util.ColorAnim(element, fadeTextParams, 0.18 , YAHOO.util.Easing.easeOut); fadeText.animate(); } function moutRep(reply_id,level_num) { var replyLinkID = 'r-rL_' + reply_id; var innerDivID = 'r-iD_'+ reply_id; var liID = 're_' + reply_id; var level_num = document.getElementById(liID).className; if (level_num != 'selected') { deSelectReply(level_num, replyLinkID, innerDivID); } } function changeThreadByText(id) { var threadByID = 'ThreadBy_' + id; var checkVar = document.getElementById(threadByID).innerHTML; if (checkVar == 'By:') { var slideOverParams = { width: {from: 25, to: 68}}; var slideOverByBox = new YAHOO.util.Anim(threadByID, slideOverParams, 0.21 , YAHOO.util.Easing.backOut); document.getElementById(threadByID).innerHTML = 'Reply To:'; slideOverByBox.animate(); } else if (checkVar == 'Reply To:') { var slideOverParams = { width: {from: 68, to: 24}}; var slideOverByBox = new YAHOO.util.Anim(threadByID, slideOverParams, 0.21 , YAHOO.util.Easing.backOut); document.getElementById(threadByID).innerHTML = 'By:'; slideOverByBox.animate(); } } function closeReplyBox(post_id) { var replyBoxID = 'replyBox_' + post_id; var textfieldID = 'replyfield_' + post_id; var slideDownBoxParams = { height: {from: 182, to: 0}}; var slideDownRootBox = new YAHOO.util.Anim(replyBoxID, slideDownBoxParams, 0.16 , YAHOO.util.Easing.easeBothStrong); slideDownRootBox.animate(); // document.getElementById(textfieldID).value=''; function hideBox(id) { document.getElementById(id).style.display = 'none'; } setTimeout(function(){hideBox(threadTextID);}, 280); } function openReplyBox(post_id) { var replyBoxID = 'replyBox_' + post_id; //var formNamer = 'newreply_' + post_id; var inputName = 'replyfield_' + post_id; document.getElementById(replyBoxID).style.display = 'block'; var slideDownBoxParams = { height: {from: 0, to: 182}}; var slideDownRootBox = new YAHOO.util.Anim(replyBoxID, slideDownBoxParams, 0.16 , YAHOO.util.Easing.easeBothStrong); slideDownRootBox.animate(); function focusAfter(inputName) { document.getElementById(inputName).focus(); } setTimeout(function(){focusAfter(inputName);}, 230); //document.getElementById(post_id).disabled = false; } function toggleReplyButton(post_id) { var replyButtonID = 'replyButton_' + post_id; var replyButtonClass = document.getElementById(replyButtonID).className; if (replyButtonClass == 'reply-button') { changeThreadByText(post_id); openReplyBox(post_id); document.getElementById(replyButtonID).className = 'reply-button-discard'; } else if (replyButtonClass == 'reply-button-discard') { changeThreadByText(post_id); closeReplyBox(post_id); document.getElementById(replyButtonID).className = 'reply-button'; } } function postHoverInUser(post_id) { var postUserID = 'postUserBox_' + post_id; checkVar = document.getElementById(postUserID).style.backgroundPosition; if (checkVar == 'right -20px' || checkVar == '100% -20px') { var increaseWidthParams = { paddingRight: {from: 21, by: -9}}; var increaseUserWidth = new YAHOO.util.Anim(postUserID, increaseWidthParams, 0.25 , YAHOO.util.Easing.backBoth); increaseUserWidth.animate(); function changeStyle(id) { document.getElementById(postUserID).style.backgroundPosition = 'right 0px'; } setTimeout(function(){changeStyle(postUserID);}, 120); } } function postHoverUser(post_id) { var postUserID = 'postUserBox_' + post_id; checkVar = document.getElementById(postUserID).style.backgroundPosition; if (checkVar == 'right 0px' || checkVar == '' || checkVar == '100% 0px') { var increaseWidthParams = { paddingRight: {from: 12, by: 9}}; var increaseUserWidth = new YAHOO.util.Anim(postUserID, increaseWidthParams, 0.25 , YAHOO.util.Easing.backBoth); increaseUserWidth.animate(); function changeStyle(id) { document.getElementById(postUserID).style.backgroundPosition = 'right -20px'; } setTimeout(function(){changeStyle(postUserID);}, 120); setTimeout(function(){postHoverInUser(post_id);}, 800); } } /* Declare holder variables to store data on previously selected reply */ var currentlySelectedReply = ''; var currentlySelectedLiID = ''; var currentlySelectedClass = ''; var currentlySelectedInnerDiv = ''; function openRootBox(post_id) { var rootBoxID = 'showRootPostBox_' + post_id; var rootTextID = 'showRootPostText_' + post_id; var checkVar = document.getElementById(rootBoxID).className; if (checkVar == 'thread-header backtoroot-off') { var fadeOutText = { opacity: {from: 0, to: 1}}; var fadeOutRootBoxText = new YAHOO.util.Anim(rootTextID, fadeOutText, 0.10 , YAHOO.util.Easing.easeOut); fadeOutRootBoxText.animate(); var slideUpBoxParams = { height: {from: 9, to: 31}}; var slideUpRootBox = new YAHOO.util.Anim(rootBoxID, slideUpBoxParams, 0.18 , YAHOO.util.Easing.easeOut); slideUpRootBox.animate(); function changeStyle(id, id2) { var chicken = document.getElementById(id).className; document.getElementById(id).className = 'thread-header backtoroot-on'; document.getElementById(id2).style.display = 'block'; } setTimeout(function(){changeStyle(rootBoxID, rootTextID);}, 0); } } function closeRootBox(post_id) { //Set the hidden parent value of the form to the new parent. hiddenParentField = 'parent_' + post_id; document.getElementById(hiddenParentField).value = post_id; pullComment(post_id,post_id); // Placehoder.... var rootBoxID = 'showRootPostBox_' + post_id; var rootTextID = 'showRootPostText_' + post_id; var checkVar = document.getElementById(rootTextID).style.display; var threadTextID = 'threadText_' + post_id; if (checkVar != 'none') { document.getElementById(currentlySelectedLiID).className = currentlySelectedClass; deSelectReply(currentlySelectedClass, currentlySelectedReply, currentlySelectedInnerDiv); var fadeOutText = { opacity: {to: 0}}; var fadeOutRootBoxText = new YAHOO.util.Anim(rootTextID, fadeOutText, 0.10 , YAHOO.util.Easing.easeOut); fadeOutRootBoxText.animate(); var fadeOutTextD = { opacity: {to: 0}}; var fadeOutRootBoxTextD = new YAHOO.util.Anim(threadTextID, fadeOutTextD, 0.2 , YAHOO.util.Easing.easeIn); fadeOutRootBoxTextD.animate(); var slideUpBoxParams = { height: {from: 31, to: 9}}; var slideUpRootBox = new YAHOO.util.Anim(rootBoxID, slideUpBoxParams, 0.15 , YAHOO.util.Easing.easeOut); slideUpRootBox.animate(); function afterTheFact(rootBoxID, rootTextID) { document.getElementById(rootBoxID).className = 'thread-header backtoroot-off'; document.getElementById(rootTextID).style.display = 'none'; } setTimeout(function(){afterTheFact(rootBoxID, rootTextID);}, 100); } return false; } function refreshPost(entryId, post_id, reply_id, comment_text, user_id, user_name, date, user_level) // THIS function is unfinished.... Needs the actual comments retrieval/display! { var threadTextID = 'threadText_' + post_id; var postageTextID = 'postageDate_' + post_id; var postUserID = 'postUserBox_' + post_id; var postUserHref = 'postUserHref_' + post_id; var permaLinkID = 'perma_link_' + post_id; //pullComment(post_id); // These variables dictate the contents of the updated root box. var newCommentID = reply_id; var newPostText = comment_text; var newUsername = user_name; var newUserID = user_id; var newPostDate = date; var newUserLevel = user_level; var increasePaddingParams = { paddingLeft: {from: 0, by: 8} }; var increasePadding = new YAHOO.util.Anim(postUserID, increasePaddingParams, 0.09 , YAHOO.util.Easing.easeIn); increasePadding.animate(); function bounceBack(postUserID) { //new document.getElementById(postUserID).innerHTML = newUsername; document.getElementById(postUserHref).href = g_domain + 'profile/' + newUsername; var increasePaddingParams = { paddingLeft: {from: 8, to: 0} }; var increasePadding = new YAHOO.util.Anim(postUserID, increasePaddingParams, 0.09 , YAHOO.util.Easing.easeOut); increasePadding.animate(); } setTimeout(function(){bounceBack(postUserID);}, 110); //coloranim //var fadeTextParams = { color: { to: '#818792' } }; //var fadeText = new YAHOO.util.ColorAnim(threadTextID, fadeTextParams, 0.1 , YAHOO.util.Easing.easeIn); //fadeText.animate(); function fadeBackIn(id) { //new document.getElementById(threadTextID).innerHTML = newPostText; var fadeInText = { opacity: {to: 1}}; var fadeInRootBoxText = new YAHOO.util.Anim(threadTextID, fadeInText, 0.2 , YAHOO.util.Easing.easeIn); fadeInRootBoxText.animate(); //var fadeTextParams = { color: { to: '#000000' } }; //var fadeText = new YAHOO.util.ColorAnim(threadTextID, fadeTextParams, 0.1 , YAHOO.util.Easing.easeIn); //fadeText.animate(); } setTimeout(function(){fadeBackIn(threadTextID);}, 200); //new document.getElementById(postageTextID).innerHTML = newPostDate; if(entryId != -1) { document.getElementById(permaLinkID).href = g_domain + "story=" + entryId + "/comment=" + reply_id; } else { document.getElementById(permaLinkID).href = g_domain + "chat/comment=" + reply_id; } return false; } function makeSelected(reply_id, root_id) { var liID = 're_' + reply_id; var innerDivID = 'r-iD_'+ reply_id; var replyLinkID = 'r-rL_' + reply_id; var liClassChecker = document.getElementById(liID).className; var threadTextID = 'threadText_' + root_id; // If the reply box is open, close it before loading up the post (Not done yet) /* This if statement changes the previously selected reply to an unselected state */ if (currentlySelectedReply != '' && currentlySelectedReply != replyLinkID) { document.getElementById(currentlySelectedLiID).className = currentlySelectedClass; deSelectReply(currentlySelectedClass, currentlySelectedReply, currentlySelectedInnerDiv); } if (liClassChecker != 'selected') { //Set the hidden parent value of the form to the new parent. hiddenParentField = 'parent_' + root_id; document.getElementById(hiddenParentField).value = reply_id; openRootBox(root_id); //Opens up the black bar above the root post box pullComment(reply_id, root_id); //refreshPost('1','999999'); // (root post id, reply id) var fadeOutText = { opacity: {to: 0}}; var fadeOutRootBoxText = new YAHOO.util.Anim(threadTextID, fadeOutText, 0.2 , YAHOO.util.Easing.easeIn); fadeOutRootBoxText.animate(); currentlySelectedReply = replyLinkID; currentlySelectedLiID = liID; currentlySelectedClass = liClassChecker; currentlySelectedInnerDiv = innerDivID; document.getElementById(liID).className = 'selected'; var increasePaddingParams = { paddingLeft: {from: 36, by: 4} }; var increasePadding = new YAHOO.util.Anim(innerDivID, increasePaddingParams, 0.11 , YAHOO.util.Easing.easeIn); increasePadding.animate(); function bounceBack(innerDivID) { var increasePaddingParams = { paddingLeft: {from: 40, by: -4} }; var increasePadding = new YAHOO.util.Anim(innerDivID, increasePaddingParams, 0.11 , YAHOO.util.Easing.easeOut); increasePadding.animate(); } setTimeout(function(){bounceBack(innerDivID);}, 150); var element = document.getElementById(replyLinkID); var fadeTextParams = { color: { to: '#000000' } }; var fadeText = new YAHOO.util.ColorAnim(element, fadeTextParams, 0.3 , YAHOO.util.Easing.easeOut); fadeText.animate(); return false; } return false; } function handlePost(frm,tfield) { textField = tfield.value; textField = textField.replace(/^\s+|\s+$/g, ''); if (textField.length < 3) { alert("Post must be atleast 3 characters"); return; } else { frm.submit(); } }