function trim(inputString) { if (typeof inputString != "string") { return inputString; } var retValue = inputString; var ch = retValue.substring(0, 1); while (ch == " ") { retValue = retValue.substring(1, retValue.length); ch = retValue.substring(0, 1); } ch = retValue.substring(retValue.length-1, retValue.length); while (ch == " ") { retValue = retValue.substring(0, retValue.length-1); ch = retValue.substring(retValue.length-1, retValue.length); } while (retValue.indexOf(" ") != -1) { retValue = retValue.substring(0, retValue.indexOf(" ")) + retValue.substring(retValue.indexOf(" ")+1, retValue.length); } return retValue; } function updateCounts(link) { var theUrl = 'index.php?updateCounts='+link; http.open("GET",theUrl,true); http.onreadystatechange = function() { if (http.readyState == 4) { if (http.status == 200) { return true; } } } http.send(null); } function getHTTPObject() { var xmlhttp; /*@cc_on @if (@_jscript_version >= 5) try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } @else xmlhttp = false; @end @*/ if (!xmlhttp && typeof XMLHttpRequest != 'undefined') { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp = false; } } return xmlhttp; } var http = getHTTPObject(); function checkContact(form) { if (trim(form.email.value) == "") { alert( "Please enter an email address" ); form.email.focus(); return false; } if (form.email.value != "") { var email=form.email.value; var check_space = email.indexOf(' '); var check_ast = email.indexOf('@'); var check_dot = email.indexOf('.'); if ((check_space != -1) || (check_ast == -1) || (check_dot == -1)) { alert( "Please enter a valid email address" ); form.email.focus(); return false; } } if (trim(form.question.value) == "") { alert( "Please enter a question" ); form.question.focus(); return false; } return true; } function checkReview(form,name) { if (trim(form.reviewText.value) == "") { alert( "Please enter a review" ); form.reviewText.focus(); return false; } if (trim(form.reviewValidation.value) == "") { alert( "Please enter the validation code" ); form.reviewValidation.focus(); return false; } if(name == 1 && trim(form.reviewName.value) == "") { alert( "Please enter your name" ); form.reviewName.focus(); return false; } return true; } function checkReset(form) { if (trim(form.email.value) == "") { alert( "Please enter your email address" ); form.email.focus(); return false; } if (form.email.value != "") { var email=form.email.value; var check_space = email.indexOf(' '); var check_ast = email.indexOf('@'); var check_dot = email.indexOf('.'); if ((check_space != -1) || (check_ast == -1) || (check_dot == -1)) { alert( "Please enter a valid email address" ); form.email.focus(); return false; } } return true; } function checkResetVerify(form) { if (trim(form.code.value) == "") { alert( "Please enter the validation code emailed to you." ); form.code.focus(); return false; } if (trim(form.pwd1.value) == "") { alert( "Please enter a password" ); form.pwd1.focus(); return false; } if (trim(form.pwd2.value) == "") { alert( "Please verify your password" ); form.pwd2.focus(); return false; } if (trim(form.pwd1.value) != trim(form.pwd2.value)) { alert( "The passwords entered do not match. Please try again." ); form.pwd1.focus(); return false; } return true; } function checkLogin(form) { if (trim(form.username.value) == "") { alert( "Please enter your username" ); form.username.focus(); return false; } if (trim(form.password.value) == "") { alert( "Please enter your password" ); form.password.focus(); return false; } return true; } function checkCreate(form) { if (trim(form.realname.value) == "") { alert( "Please enter your name" ); form.realname.focus(); return false; } if (trim(form.username.value) == "") { alert( "Please enter a username for your account" ); form.username.focus(); return false; } if (trim(form.email.value) == "") { alert( "Please enter your email address" ); form.email.focus(); return false; } if (form.email.value != "") { var email=form.email.value; var check_space = email.indexOf(' '); var check_ast = email.indexOf('@'); var check_dot = email.indexOf('.'); if ((check_space != -1) || (check_ast == -1) || (check_dot == -1)) { alert( "Please enter a valid email address" ); form.email.focus(); return false; } } if (trim(form.password1.value) == "") { alert( "Please enter a password" ); form.password1.focus(); return false; } if (trim(form.password2.value) == "") { alert( "Please verify your password" ); form.password2.focus(); return false; } if (trim(form.password1.value) != trim(form.password2.value)) { alert( "The passwords entered do not match. Please try again." ); form.password1.focus(); return false; } return true; } function checkSub1(form) { if (trim(form.linkTitle.value) == "") { form.linkTitle.focus(); return false; } if (trim(form.linkUrl.value) == "" || trim(form.linkUrl.value) == "http://") { form.linkUrl.focus(); return false; } return true; } function checkSub2(form,maxChars,msg) { if (trim(form.linkKeywords.value) == "") { form.linkKeywords.focus(); return false; } if (trim(form.linkDescription.value) == "") { form.linkDescription.focus(); return false; } if (maxChars != 0 && form.linkDescription.value.length > maxChars) { alert( msg ); form.linkDescription.focus(); return false; } var selObj = form['newCategory[]']; var retVal = false; for (var i = 0; i < selObj.length; i++) { if (selObj.options[i].selected){ retVal = true; } } if(retVal != true) { return false; } return true; } function checkSub3(form) { if (trim(form.recipLink.value) == "") { form.recipLink.focus(); return false; } if (trim(form.recipLink.value) == "" || trim(form.recipLink.value) == "http://") { form.recipLink.focus(); return false; } return true; } function checkEdit(form,maxChars,msg) { if (trim(form.newTitle.value) == "") { form.newTitle.focus(); return false; } if (trim(form.newUrl.value) == "") { form.newUrl.focus(); return false; } if (trim(form.newLinkKeywords.value) == "") { form.newLinkKeywords.focus(); return false; } if (trim(form.newLinkDescription.value) == "") { form.newLinkDescription.focus(); return false; } if (maxChars != 0 && form.newLinkDescription.value.length > maxChars) { alert( msg ); form.newLinkDescription.focus(); return false; } return true; } function checkSearch ( form ) { if (trim(form.criteria.value) == "") { alert( "Please enter a search" ); form.criteria.focus(); return false; } return true; } function checkCompare ( form ) { if (form.compIDs.checked == false) { alert( "Select more than 1 item to compare" ); form.compare.focus(); return false; } return true; } function checkadvSearch ( form ) { if ((trim(form.title.value) == "") && (trim(form.desc.value) == "") && (trim(form.review.value) == "") && (trim(form.keywords.value) == "")) { form.title.focus(); return false; } return true; } function checkEdit2(form,maxChars,msg) { if (trim(form.newTitle.value) == "") { form.newTitle.focus(); return false; } if (trim(form.newUrl.value) == "") { form.newUrl.focus(); return false; } if (trim(form.newRecipLink.value) == "") { form.newRecipLink.focus(); return false; } if (trim(form.newLinkKeywords.value) == "") { form.newLinkKeywords.focus(); return false; } if (trim(form.newLinkDescription.value) == "") { form.newLinkDescription.focus(); return false; } if (maxChars != 0 && form.newLinkDescription.value.length > maxChars) { alert( msg ); form.newLinkDescription.focus(); return false; } return true; } function validateForm(f) { for (var i=0; i') pointerUrl( link ); } function pointerUrl( link ) { url = new String(window.location); if(url.lastIndexOf('#') == -1) end = url.length; else end = url.lastIndexOf('#'); window.location = url.substr(0, end) + '#i' + link; } function pointer( current ) { current.style.cursor = 'pointer'; } function findNextWithType( i , type ) { go = i;//.nextSibling; while( go.nodeName != type) { go = go.nextSibling; } return go; } function findFirstChildWithType( targetNode, type ) { for(var i = 0; i < targetNode.childNodes.length; i++) { var child = targetNode.childNodes[i]; if (child.nodeName == type ) return child; } return false; } function findLastChildWithType( targetNode, type ) { for(var i = targetNode.childNodes.length - 1; i >= 0; i--) { var child = targetNode.childNodes[i]; if (child.nodeName == type ) return child; } return false; } function hideIt(current) { inverseDisplay(current); } function inverseSpan( cur ) { if(cur.innerHTML == 'view coupons') { cur.innerHTML = 'view coupons'; } else { cur.innerHTML = 'view coupons'; } } function getDisplay( i ) { d = i.style.display; if(d == 'none') return 'none'; else return ''; } function inverseDisplay( i ) { if(getDisplay(i)=='') { newD = 'none'; returned = false; } else { newD = ''; returned = true; } setDisplay(i, newD); return returned; } function setDisplay(i, d) { i.style.display = d; }