// Preload Images if (document.images) { nav_link = new Image(); nav_link.src = "images/nav_link.gif"; nav_over = new Image(); nav_over.src = "images/nav_over.gif"; } function fixCookieDate (date) { var base = new Date(0); var skew = base.getTime(); // dawn of (Unix) time - should be 0 if (skew > 0) // Except on the Mac - ahead of its time date.setTime (date.getTime() - skew); } function setCookie (name, value, expires, path, domain, secure) { document.cookie = name + "=" + escape(value).replace("%3D", "=") + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); } function getCookie(strName, strSubName) { if (document.cookie.length>0) { c_start=document.cookie.indexOf(strName + "=") if (c_start!=-1) { c_start=c_start + strName.length+1 c_end=document.cookie.indexOf(";",c_start) if (c_end==-1) c_end=document.cookie.length var sub = document.cookie.substring(c_start,c_end); if (strSubName > "") { sub = sub + "&"; sub = sub.substring(sub.indexOf(strSubName), sub.length); sub = sub.substring(sub.indexOf(strSubName)+(strSubName.length+1), sub.indexOf("&")); } return unescape(sub); } } return ""; } function getTZD() { var dateServer = new Date('8/28/2008 9:06:55 PM'); var dateUser = new Date(); var difference = Math.round((dateServer-dateUser) / 3600000); return "tzd="+difference; } var expdate = new Date(); fixCookieDate (expdate); expdate.setTime (expdate.getTime() + (24 * 60 * 60 * 1000)); // 24 hrs from now setCookie("Prefs", getTZD(), expdate); // Read Query Strings function getQS(strString) { var query = window.location.search.substring(1); var parms = query.split('&'); for (var i=0; i < parms.length; i++) { var pos = parms[i].indexOf('='); if (pos > 0) { var key = parms[i].substring(0,pos); var val = parms[i].substring(pos+1); if (strString == key) { return val; } } } return false; } // Bookmark Link function setBookmark() { var site = 'Youpolls.com'; var url = 'http://www.youpolls.com'; if (document.all) { // IE window.external.AddFavorite(url, site); } else if (window.sidebar) { // Firefox window.sidebar.addPanel(site, url, ""); } else if (window.opera && window.print) { // Opera var elem = document.createElement('a'); elem.setAttribute('href', url); elem.setAttribute('title', site); elem.setAttribute('rel', 'sidebar'); elem.click(); } else { // Everyone Else alert('Could not set Youpolls.com as a bookmark.'); } } // Set Homepage Link function setHomepage() { if (document.all) { // IE document.body.style.behavior='url(#default#homepage)'; document.body.setHomePage('http://www.youpolls.com'); } else if (document.getElementById) { // Firefox alert('To make Youpolls.com your homepage, simply drag the bookmark icon onto the home button in your browser.'); } else { // Everyone Else alert('Your browser doesn\'t support this action.'); } } function isAlphanumeric(strString) { var regString = /^([a-zA-Z0-9_]+)$/g; if (regString.test(strString)) { return true; } else { return false; } } function validateFormField(blnValid, objFormField, strAlert) { if (blnValid) { if (objFormField) { if (objFormField.value.replace(" ", "") == "") { if (strAlert != "") { alert(strAlert); } objFormField.focus(); return false; } } } else { return false; } return true; } function validateFormMatch(blnValid, objFormField, objFormField2, strAlert) { if (blnValid) { if (objFormField) { if (objFormField.value.replace(" ", "") != objFormField2.value.replace(" ", "")) { if (strAlert != "") { alert(strAlert); } objFormField.value = ""; objFormField2.value = ""; objFormField.focus(); return false; } } } else { return false; } return true; } function validateFormCheck(blnValid, objFormField, strAlert) { if (blnValid) { if (objFormField) { if (objFormField.checked == false) { if (strAlert != "") { alert(strAlert); } return false; } } } else { return false; } return true; } function validateFormAlpha(blnValid, objFormField, strAlert) { if (blnValid) { if (objFormField) { if (isAlphanumeric(objFormField.value) == false) { if (strAlert != "") { alert(strAlert); } objFormField.value = ""; objFormField.focus(); return false; } } } else { return false; } return true; } function validateLogin(theForm) { var blnValid = true; if (theForm) { blnValid = validateFormField(blnValid, theForm.strUsername, "Please enter your username!"); blnValid = validateFormField(blnValid, theForm.strPassword, "Please enter your password!"); } if (blnValid) theForm.signin.disabled = 'disabled'; return blnValid; } function validateReminder(theForm) { var blnValid = true; if (theForm) { blnValid = validateFormField(blnValid, theForm.strUsername, "Please enter your username!"); } return blnValid; } function validateJoin(theForm) { var blnValid = true; if (theForm) { blnValid = validateFormField(blnValid, theForm.strEmail, "You must enter your email address."); blnValid = validateFormField(blnValid, theForm.strUsername, "You must enter a username."); blnValid = validateFormAlpha(blnValid, theForm.strUsername, "Your username can only contain letters, numbers, and underscores."); blnValid = validateFormField(blnValid, theForm.strPassword, "You must enter a password."); blnValid = validateFormAlpha(blnValid, theForm.strPassword, "Your password can only contain letters, numbers, and underscores."); blnValid = validateFormMatch(blnValid, theForm.strPassword, theForm.strPassword2, "Your passwords did not match."); blnValid = validateFormField(blnValid, theForm.str1, "You must enter the security phrase."); blnValid = validateFormMatch(blnValid, theForm.str1, theForm.str2, "Please enter the correct security phrase!\n\nRemember that the phrase is case-sensitive."); blnValid = validateFormCheck(blnValid, theForm.strAgree, "You must agree to the terms of service and privacy policy to contine."); } if (blnValid) theForm.signup.disabled = 'disabled'; return blnValid; } function formatPhone(field) { var temp = field.value.replace(/[^0-9_]/g, ""); var cursor = temp.length; temp = temp.replace(/^([0-9_]{0,3})([0-9_]{0,3})([0-9_]{0,4})([0-9_]*)/, "($1) $2-$3 x $4"); if (cursor < 11) temp = temp.replace(/\s*x\s*$/, ""); if (cursor < 7) temp = temp.replace(/\-\s*$/, ""); if (cursor < 3) temp = temp.replace(/\)\s*$/, ""); if (! cursor) temp = ""; field.value = temp; return true; } function formatURL(field) { var temp = field.value.replace(/(http\:\/\/)/g, ""); if (temp != "") temp = "http://" + temp field.value = temp; return true; } function formatDate(field) { //var temp = field.value.replace(/[^0-9]/g, ""); //var cursor = temp.length; //temp = temp.replace( /^([2-9]{1})(\d{0,2})(\d{0,4})/, 0+temp); //temp = temp.replace( /^([0]{1}[0]{1})(\d{0,2})(\d{0,4})/, "01$2$3"); //temp = temp.replace(/^([1]{1}[3-9]{1})(\d{0,2})(\d{0,4})/, "12$2$3"); //temp = temp.replace(/^(\d{2})([3-9]{1}[2-9]{1})(\d{0,4})/, "$131$3"); //temp = temp.replace(/^(\d{2})([0]{1}[0]{1})(\d{0,4})/, "$101$3"); //temp = temp.replace( /^(\d{2})(\d{2})([0-1]{1}[0-9]{3})/, "$1$22007"); //temp = temp.replace( /^(\d{2})(\d{2})([2-9]{1}[1-9]{1}[0-9]{2})/, "$1$22007"); //temp = temp.replace( /^(\d{1,2})(\d{0,2})(\d{0,4})/, "$1/$2/$3"); //if (cursor < 5) // temp = temp.replace(/\/$/, ""); //if (cursor < 3) // temp = temp.replace(/\/$/, ""); //field.value = temp; return true; } function formatTime(objField) { var temp = objField.value.replace(/[^0-9]/g, ""); var cursor = temp.length; var exp, str if (cursor == 2) { temp = temp.replace(/^(\d{0,2})/, ":$1"); } else if (cursor == 3) { temp = temp.replace(/^(\d{0,1})(\d{0,2})/, "$1:$2"); } else if (cursor >= 4) { temp = temp.replace(/^(\d{0,2})(\d{0,2})/, "$1:$2"); } objField.value = temp; } function redirectJoin(theElement) { if (theElement.value == 'i') window.location.href = 'join.asp'; else window.location.href = 'join.asp?type=m'; } var newwindow; function openWindow(url, width, height) { newwindow = window.open(url, 'youpolls', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,height='+height+',width='+width); if (window.focus) {newwindow.focus()} } function closeWindow() { window.close(); } function getMonthYear(strDate) { var d = new Date(strDate); return ((d.getMonth)+"/"+(d.getFullYear)); } function dateChange(strDate, intDays) { var d = new Date(strDate); d.setDate((d.getDate())+intDays); return ((d.getMonth)+"/"+(d.getDate())+"/"+(d.getFullYear)); } YAHOO.namespace("example.calendar"); function init() { YAHOO.example.calendar.cal1 = new YAHOO.widget.Calendar("cal1","cal1Container", { title:"Choose a date:", close:true } ); YAHOO.example.calendar.cal1.hide(); var mySelectHandler = function(type,args,obj) { var selected = args[0]; var category = getQS("cid"); var sPage = getCookie("pages", "current"); var blnSearch = false; if (sPage.indexOf("search.asp") > -1) { blnSearch = true; } YAHOO.example.calendar.cal1.hide(); if (category) { window.location.href="category.asp?cid="+category+"&view=day&day="+this._toNewDate(selected[0]); } else if (blnSearch) { var sView = sPage; sView = sView.replace("view=", "ov="); sView = sView.replace("day=", "od="); window.location.href=sView+"&view=day&day="+this._toNewDate(selected[0]); } else { window.location.href="category.asp?view=day&day="+this._toNewDate(selected[0]); } }; var myRenderHandler = function() { if (this.oDomContainer.style.display == "none") { YAHOO.example.calendar.cal1.show(); } else { YAHOO.example.calendar.cal1.hide(); } }; YAHOO.util.Event.addListener("nav_calendar", "click", myRenderHandler, YAHOO.example.calendar.cal1, true); YAHOO.example.calendar.cal1.selectEvent.subscribe(mySelectHandler, YAHOO.example.calendar.cal1, true); YAHOO.example.calendar.cal1.render(); } YAHOO.util.Event.addListener(window, "load", init); function init_cal2() { // Starting Poll Date var d = new Date(); YAHOO.example.calendar.cal2 = new YAHOO.widget.Calendar("cal2","cal2Container", { title:"Starts:", pagedate: d, mindate:d, close:true } ); YAHOO.example.calendar.cal2.hide(); var mySelectHandler = function(type,args,obj) { var selected = args[0]; YAHOO.example.calendar.cal2.hide(); YAHOO.example.calendar.cal3.cfg.setProperty("mindate", this._toNewDate(selected[0]), false); YAHOO.example.calendar.cal3.render(); document.getElementById("strStartDate").value = this._toNewDate(selected[0]); checkDateValidity(); }; var myRenderHandler = function() { if (this.oDomContainer.style.display == "none") { YAHOO.example.calendar.cal2.show(); } else { YAHOO.example.calendar.cal2.hide(); } }; YAHOO.util.Event.addListener("calendarStart", "click", myRenderHandler, YAHOO.example.calendar.cal2, true); YAHOO.util.Event.addListener("calendarEnd", "click", YAHOO.example.calendar.cal2.hide, YAHOO.example.calendar.cal2, true); YAHOO.example.calendar.cal2.selectEvent.subscribe(mySelectHandler, YAHOO.example.calendar.cal2, true); YAHOO.example.calendar.cal2.cfg.setProperty("selected", YAHOO.example.calendar.cal2._toFieldArray(d), false); YAHOO.example.calendar.cal2.render(); } function init_cal3() { // Ending Poll Date var d = new Date(); var e = new Date(); d.setDate((d.getDate())+30); YAHOO.example.calendar.cal3 = new YAHOO.widget.Calendar("cal3","cal3Container", { title:"Ends:", pagedate: d, mindate: e, close:true } ); YAHOO.example.calendar.cal3.hide(); var mySelectHandler = function(type,args,obj) { var selected = args[0]; YAHOO.example.calendar.cal3.hide(); document.getElementById("strEndDate").value = this._toNewDate(selected[0]); checkDateValidity(); }; var myRenderHandler = function() { if (this.oDomContainer.style.display == "none") { YAHOO.example.calendar.cal3.show(); } else { YAHOO.example.calendar.cal3.hide(); } }; YAHOO.util.Event.addListener("calendarEnd", "click", myRenderHandler, YAHOO.example.calendar.cal3, true); YAHOO.util.Event.addListener("calendarStart", "click", YAHOO.example.calendar.cal3.hide, YAHOO.example.calendar.cal3, true); YAHOO.example.calendar.cal3.selectEvent.subscribe(mySelectHandler, YAHOO.example.calendar.cal3, true); YAHOO.example.calendar.cal3.cfg.setProperty("selected", YAHOO.example.calendar.cal3._toFieldArray(d), false); YAHOO.example.calendar.cal3.render(); } function checkDateValidity() { var today = new Date(); var startdate = new Date(document.getElementById("strStartDate").value); var enddate = new Date(document.getElementById("strEndDate").value); if (startdate > enddate) { var d = new Date(document.getElementById("strStartDate").value); d.setMonth((d.getMonth())+1); d.setDate((d.getDate())+1); document.getElementById("strEndDate").value = (d.getMonth())+"/"+(d.getDate())+"/"+(d.getFullYear()); d.setMonth((d.getMonth())-1); YAHOO.example.calendar.cal3.cfg.setProperty("selected", YAHOO.example.calendar.cal3._toFieldArray(d), false); YAHOO.example.calendar.cal3.render(); } else if ((startdate.getMonth() == enddate.getMonth()) && (startdate.getDate() == enddate.getDate()) && (startdate.getFullYear() == enddate.getFullYear())) { if (document.getElementById("strStartTime").value >= document.getElementById("strEndTime").value) { if (document.getElementById("strStartAMPM").value == document.getElementById("strEndAMPM").value || document.getElementById("strStartAMPM").value == "PM") { var d = new Date(document.getElementById("strStartDate").value + " " + document.getElementById("strStartTime").value + " " +document.getElementById("strStartAMPM").value); var h = d.getHours(); if (h >= 13) { h = h-12; } var m1 = d.getMinutes(); var m2 = m1; if (m1 >= 1) { m1--; } else { m2++; } if (m1 <= 9) m1 = "0"+m1; if (m2 <= 9) m2 = "0"+m2; document.getElementById("strStartTime").value = (h)+":"+(m1); document.getElementById("strEndTime").value = (h)+":"+(m2); } } else if (document.getElementById("strStartAMPM").value == "PM" && document.getElementById("strEndAMPM").value == "AM") { var d = new Date(document.getElementById("strStartDate").value); d.setMonth((d.getMonth())+1); d.setDate((d.getDate())-1); document.getElementById("strStartDate").value = (d.getMonth())+"/"+(d.getDate())+"/"+(d.getFullYear()); d.setMonth((d.getMonth())-1); YAHOO.example.calendar.cal2.cfg.setProperty("selected", YAHOO.example.calendar.cal2._toFieldArray(d), false); YAHOO.example.calendar.cal2.render(); YAHOO.example.calendar.cal3.cfg.setProperty("mindate", YAHOO.example.calendar.cal3._toNewDate(d), false); YAHOO.example.calendar.cal3.render(); } } else if (startdate < today) { document.getElementById("strStartDate").value = (today.getMonth()+1)+"/"+(today.getDate())+"/"+(today.getFullYear()); YAHOO.example.calendar.cal2.cfg.setProperty("selected", YAHOO.example.calendar.cal2._toFieldArray(today), false); YAHOO.example.calendar.cal2.render(); YAHOO.example.calendar.cal3.cfg.setProperty("mindate", YAHOO.example.calendar.cal3._toNewDate(today), false); YAHOO.example.calendar.cal3.render(); } } function toggleSub(strItem) { strElement = strItem.parentNode.firstChild; if (strElement.alt == "Open") { strElement.alt = "Close"; strElement.src = "images/sub_close.gif"; for (i=0; i < strElement.parentNode.childNodes.length; i++) { if (strElement.parentNode.childNodes[i].nodeName == "UL") { strElement.parentNode.childNodes[i].style.display = "block"; } } } else { strElement.alt = "Open"; strElement.src = "images/sub_open.gif"; for (i=0; i < strElement.parentNode.childNodes.length; i++) { if (strElement.parentNode.childNodes[i].nodeName == "UL") { strElement.parentNode.childNodes[i].style.display = "none"; } } } } function clearInput(strElement) { strElement.value = ""; if (strElement.className == "input2 gray") { strElement.className = "input2 black"; } } function clearOption(strElement) { if (strElement.className != "input2 black") { strElement.value = ""; strElement.className = "input2 black"; } } function checkOptions(intNumber) { var strElement = ""; for (i=1; i<(intNumber+1); i++) { strElement = "option"+i; if (document.getElementById(strElement).value == "Option #"+i) { changeValue(strElement, ""); } else { changeClass(strElement, "input2 black"); } } } function changeValue(strElement, strValue) { document.getElementById(strElement).value = strValue; } function changeClass(strElement, strClass) { document.getElementById(strElement).className = strClass; } function changeText(strElement, strText) { document.getElementById(strElement).innerHTML = strText; } function hideParent(strParent) { document.getElementById(strParent).style.display = "none"; } function docElement(strContainerID) { return document.getElementById(strContainerID); } function validateInfo(strForm) { if (strForm == "addPoll") { document.getElementById("js_noticeDiv").className = "js_nostatus"; var theForm = document.getElementById(strForm); var intErrors = 0; var intCount = 0; if (theForm.strCategory.value.replace(" ", "") == "") { docElement("valid_img1").src = "images/icon_error.gif"; intErrors++; } else { docElement("valid_img1").src = "images/icon_success.gif"; } if (theForm.strTitle.value.replace(" ", "") == "") { docElement("valid_img2").src = "images/icon_error.gif"; intErrors++; } else { docElement("valid_img2").src = "images/icon_success.gif"; } if (theForm.strDescription.value.replace(" ", "") == "") { docElement("valid_img5").src = "images/icon_error.gif"; intErrors++; } else { docElement("valid_img5").src = "images/icon_success.gif"; } if (theForm.strQuestion.value.replace(" ", "") == "") { docElement("valid_img6").src = "images/icon_error.gif"; intErrors++; } else { docElement("valid_img6").src = "images/icon_success.gif"; } if (theForm.strStartDate.value.replace(" ", "") == "") { docElement("valid_img8").src = "images/icon_error.gif"; intErrors++; if (theForm.strStartTime.value.replace(" ", "") == "") intErrors++; } else { if (theForm.strStartTime.value.replace(" ", "") == "") { docElement("valid_img8").src = "images/icon_error.gif"; intErrors++; } else { docElement("valid_img8").src = "images/icon_success.gif"; } } if (theForm.strEndDate.value.replace(" ", "") == "") { docElement("valid_img9").src = "images/icon_error.gif"; intErrors++; if (theForm.strEndTime.value.replace(" ", "") == "") intErrors++; } else { if (theForm.strEndTime.value.replace(" ", "") == "") { docElement("valid_img9").src = "images/icon_error.gif"; intErrors++; } else { docElement("valid_img9").src = "images/icon_success.gif"; } } if (theForm.option1.value != "Option #1") intCount++ if (theForm.option2.value != "Option #2") intCount++ if (theForm.option3.value != "Option #3") intCount++ if (theForm.option4.value != "Option #4") intCount++ if (theForm.option5.value != "Option #5") intCount++ if (theForm.option6.value != "Option #6") intCount++ if (theForm.option7.value != "Option #7") intCount++ if (theForm.option8.value != "Option #8") intCount++ if (theForm.option9.value != "Option #9") intCount++ if (theForm.option10.value != "Option #10") intCount++ if (intCount < 2) { docElement("valid_img7").src = "images/icon_error.gif"; intErrors++; } else { docElement("valid_img7").src = "images/icon_success.gif"; } if (intErrors > 0) { document.getElementById("js_submitButton").disabled = "disabled"; document.getElementById("js_noticeDiv").innerHTML = "Poll not yet valid, "+intErrors+" errors found."; document.getElementById("js_noticeDiv").className = "js_error"; return false; } else { document.getElementById("js_submitButton").disabled = ""; document.getElementById("js_noticeDiv").innerHTML = "Poll information successfully validated!"; document.getElementById("js_noticeDiv").className = "js_success"; } } else { return false; } } function checkPoll(theForm) { for (i=0; i < theForm.childNodes.length; i++) { if (theForm.childNodes[i].className == "details_list" || theForm.childNodes[i].className == "details_list_small" || theForm.childNodes[i].className == "details_list_small marginleft5") { for (j=0; j < theForm.childNodes[i].childNodes.length; j++) { if (theForm.childNodes[i].childNodes[j].checked) { theForm.submit.disabled = 'disabled'; return true; } } } } alert("Make a selection before submitting your poll."); return false; } function moveRating(strElement, intRating) { document.getElementById(strElement).style.backgroundPosition = (intRating) + "px 0"; } var bustcachevar = 1; var bustcacheparameter = ""; function doRequest(strFile, strElement) { var xmlHttp; try { // Firefox, Opera 8.0+, Safari xmlHttp = new XMLHttpRequest(); } catch (e) { try { // Internet Explorer 6.0+ xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { // Internet Explorer 5.5 xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Your browser does not support AJAX!"); return false; } } } xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4 && (xmlHttp.status == 200 || window.location.href.indexOf("http") == -1)) { var myElement = document.getElementById(strElement); myElement.innerHTML = xmlHttp.responseText; } } if (bustcachevar) bustcacheparameter = (strFile.indexOf("?") != -1)? "&" + new Date().getTime() : "?" + new Date().getTime() xmlHttp.open("GET", strFile, true); xmlHttp.send(null); } function approveComment(strStatus, intPollID, intCommentID, intMemberID) { if (strStatus == "approve") { document.getElementById("cid"+intCommentID+"title").className = "comment_title_1"; document.getElementById("cid"+intCommentID+"content").className = "comment_content_1"; document.getElementById("cid"+intCommentID+"notice").className = "green"; doRequest("process_comments.asp?pid="+intPollID+"&mid="+intMemberID+"&cid="+intCommentID+"&do="+strStatus+"", "cid"+intCommentID+"notice"); document.getElementById("cid"+intCommentID+"noticeParent").className = ""; document.getElementById("cid"+intCommentID+"approveDiv").style.width = document.getElementById("cid"+intCommentID+"approveDiv").offsetWidth + "px"; document.getElementById("cid"+intCommentID+"approve").innerHTML = "Comment Approved!"; } else if (strStatus == "remove") { document.getElementById("cid"+intCommentID+"title").className = "comment_title_2"; document.getElementById("cid"+intCommentID+"content").className = "comment_content_2"; document.getElementById("cid"+intCommentID+"notice").className = "darkred"; doRequest("process_comments.asp?pid="+intPollID+"&mid="+intMemberID+"&cid="+intCommentID+"&do="+strStatus+"", "cid"+intCommentID+"notice"); document.getElementById("cid"+intCommentID+"noticeParent").className = ""; document.getElementById("cid"+intCommentID+"removeDiv").style.width = document.getElementById("cid"+intCommentID+"removeDiv").offsetWidth + "px"; document.getElementById("cid"+intCommentID+"remove").innerHTML = "Comment Removed!"; document.getElementById("cid"+intCommentID+"approveDiv").style.visibility = "hidden"; } else { document.getElementById("cid"+intCommentID+"title").className = "comment_title_3"; document.getElementById("cid"+intCommentID+"content").className = "comment_content_3"; document.getElementById("cid"+intCommentID+"notice").className = "orange"; doRequest("process_comments.asp?pid="+intPollID+"&mid="+intMemberID+"&cid="+intCommentID+"&do="+strStatus+"", "cid"+intCommentID+"notice"); document.getElementById("cid"+intCommentID+"noticeParent").className = ""; document.getElementById("cid"+intCommentID+"reportDiv").style.width = document.getElementById("cid"+intCommentID+"reportDiv").offsetWidth + "px"; document.getElementById("cid"+intCommentID+"report").innerHTML = "Comment Reported!"; } } function showAddComment() { changeClass("addCommentLink", "hidden_preload"); changeClass("addComment", "form1"); } function removeFav(intPollID, intFavID, intMemberID) { document.getElementById("fid"+intFavID+"title").className = "comment_title_2"; document.getElementById("fid"+intFavID+"content").className = "comment_content_2"; doRequest("remove_favorites.asp?pid="+intPollID+"&fid="+intFavID+"&mid="+intMemberID+"", "fid"+intFavID+"Notice"); } function checkPage() { // Disabled because certain pages would forward to itself... its weird var sCurrent = getCookie("pages", "current") var sPath = window.location.href; var sPage = sPath.substring(sPath.lastIndexOf('/') + 1); } function getElementsByClassName(oElm, strTagName, strClassName){ var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName); var arrReturnElements = new Array(); strClassName = strClassName.replace(/-/g, "\-"); var oRegExp = new RegExp("(^|\s)" + strClassName + "(\s|$)"); var oElement; for(var i=0; i < arrElements.length; i++){ oElement = arrElements[i]; if(oRegExp.test(oElement.className)){ arrReturnElements.push(oElement); } } return (arrReturnElements); } function resizePreview() { // Resize all preview divs on default.asp to be the same var sPath = window.location.href; var sPage = sPath.substring(sPath.lastIndexOf('/') + 1); var aryElements = getElementsByClassName(document, "div", "poll_preview"); if (sPage == "default.asp") { var aryElements = getElementsByClassName(document, "div", "poll_preview"); for(var i=0; i < aryElements.length; i++) { if (document.all) { // Disabled because it jacked with floats //aryElements[i].style.pixelHeight = "45"; //aryElements[i].style.overflow = "hidden"; } } } } function showAnswerBox(strElement) { if (strElement.value == "11") { document.getElementById("add_answer_1").style.display = ""; document.getElementById("add_answer_2").style.display = ""; document.getElementById("add_answer_3").style.display = ""; document.getElementById("add_answer_input").style.display = ""; } else { document.getElementById("add_answer_1").style.display = "none"; document.getElementById("add_answer_2").style.display = "none"; document.getElementById("add_answer_3").style.display = "none"; document.getElementById("add_answer_input").value = ""; } } function blockMember(intPID, intCID, intBID) { var answer = confirm("Permanently block this user from commenting on this poll?") if (answer) { document.getElementById("cid"+intCID+"title").className = "comment_title_2"; document.getElementById("cid"+intCID+"content").className = "comment_content_2"; document.getElementById("cid"+intCID+"notice").className = "red"; doRequest("block_member.asp?pid="+intPID+"&bid="+intBID+"", "cid"+intCID+"notice"); } } function showHelp(strElement) { document.getElementById(strElement).style.display = "block"; } function hideHelp(strElement) { document.getElementById(strElement).style.display = "none"; } function formatDateMonth(intMonth) { var aryMonths = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] if (intMonth == 0) { return aryMonths[intMonth]; } else { return aryMonths[intMonth-1]; } } function formatDateDay(intDay) { switch(intDay) { case 1: return (""+intDay+"st") break case 21: return (""+intDay+"st") break case 31: return (""+intDay+"st") break case 2: return (""+intDay+"nd") break case 22: return (""+intDay+"nd") break case 3: return (""+intDay+"rd") break case 23: return (""+intDay+"rd") break default: return (""+intDay+"th") } } function formatTimestamp(dtmDate) { var date = new Date(dtmDate); var month = formatDateMonth((date.getMonth()) + 1); var day = formatDateDay(date.getDate()); var year = date.getFullYear(); return month + " " + day + ", " + year; } function previewPoll(strElement) { var theForm = document.getElementById("addPoll") document.getElementById("previewAdd_title").innerHTML = "Title Goes Here"; document.getElementById("previewAdd_desc").innerHTML = "This is where your description will go. Use this space to describe what your poll is about or to quote an article."; document.getElementById("previewAdd_question").innerHTML = "Your question will go here?"; if (theForm.strTitle.value != "") document.getElementById("previewAdd_title").innerHTML = theForm.strTitle.value; if (theForm.strDescription.value != "") document.getElementById("previewAdd_desc").innerHTML = '
'+theForm.strDescription.value+'
'; if (theForm.strQuestion.value != "") document.getElementById("previewAdd_question").innerHTML = theForm.strQuestion.value; if (theForm.strStartDate.value != "") { document.getElementById("previewAdd_date").innerHTML = "Starts on "+formatTimestamp(theForm.strStartDate.value); document.getElementById("previewAdd_date2").innerHTML = "Starts on "+formatTimestamp(theForm.strStartDate.value); } else { var myDate = new Date(); document.getElementById("previewAdd_date").innerHTML = "Starts on "+formatTimestamp(myDate); document.getElementById("previewAdd_date2").innerHTML = "Starts on "+formatTimestamp(myDate); } if (theForm.strFlashVideo.value != "") { var flashVideo = theForm.strFlashVideo.value; if (flashVideo.indexOf("youtube.com") >= 0) { flashVideo = flashVideo.replace("/watch?v=", "/v/"); flashVideo = flashVideo.replace("/view_play_list?p=", "/p/"); if (flashVideo.indexOf("youtube.com/v/") >= 0 || flashVideo.indexOf("youtube.com/p/") >= 0) { document.getElementById("previewAdd_flash").innerHTML = '
'; document.getElementById("previewAdd_flash").innerHTML += '
'; document.getElementById("previewAdd_flash").innerHTML += '
To view this video, your browser must support Javascript and Flash 9.
'; document.getElementById("previewAdd_flash").innerHTML += '
'+theForm.strFlashVideo.value+''; document.getElementById("previewAdd_flash").innerHTML += '
'; var soHeight = "333"; if (flashVideo.indexOf("youtube.com/p/") >= 0) { soHeight = "350"; } var so = new SWFObject(flashVideo, "YouTube", "405", soHeight, "9", "#FFFFFF"); so.addParam("quality", "high"); so.write("flashmovie"); } } else if (flashVideo.indexOf("metacafe.com") >= 0) { flashVideo = flashVideo.replace("/watch/", "/fplayer/"); if (flashVideo.substr(0, flashVideo.length-4) != ".swf") { flashVideo = flashVideo.substr(0, flashVideo.length-1) + ".swf"; } if (flashVideo.indexOf("metacafe.com/fplayer/") >= 0) { document.getElementById("previewAdd_flash").innerHTML = '
'; document.getElementById("previewAdd_flash").innerHTML += '
'; document.getElementById("previewAdd_flash").innerHTML += '
To view this video, your browser must support Javascript and Flash 9.
'; document.getElementById("previewAdd_flash").innerHTML += '
'+theForm.strFlashVideo.value+''; document.getElementById("previewAdd_flash").innerHTML += '
'; var so = new SWFObject(flashVideo, "Metacafe", "400", "345", "9", "#FFFFFF"); so.addParam("quality", "high"); so.write("flashmovie"); } } else if (flashVideo.indexOf("brightcove.com") >= 0) { if (flashVideo.indexOf("brightcove.com/title.jsp?title=") >= 0) { var initVideoId = flashVideo.substr((flashVideo.indexOf("brightcove.com/title.jsp?title=")+31), flashVideo.length); if (initVideoId.indexOf("&") >= 0) { initVideoId = initVideoId.substr(0, initVideoId.indexOf("&")); } document.getElementById("previewAdd_flash").innerHTML = '
'; document.getElementById("previewAdd_flash").innerHTML += '
'; document.getElementById("previewAdd_flash").innerHTML += '
To view this video, your browser must support Javascript and Flash 9.
'; document.getElementById("previewAdd_flash").innerHTML += '
'+theForm.strFlashVideo.value+''; document.getElementById("previewAdd_flash").innerHTML += '
'; var so = new SWFObject("http://admin.brightcove.com/destination/player/player.swf", "Brightcove", "400", "339", "9", "#FFFFFF"); so.addVariable("playerWidth", "400"); so.addVariable("playerHeight", "339"); so.addVariable("initVideoId", initVideoId); so.addVariable("cdnURL", "http://admin.brightcove.com"); so.addVariable("servicesURL", "http://www.brightcove.com"); so.addVariable("viewerSecureGatewayURL", "https://www.brightcove.com"); so.addVariable("autoStart", "false"); so.addParam("allowScriptAccess", "never"); so.addParam("quality", "high"); so.write("flashmovie"); } } } if (document.getElementById("externalimage").className == "input") { if (theForm.strExternalImage.value != "") { document.getElementById("previewAdd_img").src = theForm.strExternalImage.value.replace("\\", "\/"); var caption = theForm.strExternalImage.value.replace("\\", "\/"); caption = caption.replace("http:\/\/", ""); caption = caption.replace("www.", ""); if (caption.indexOf("/") >= 1) caption = caption.substring(0, caption.indexOf("/")); if (caption.indexOf(":") >= 1) document.getElementById("previewAdd_caption").innerHTML = "Not Available"; else document.getElementById("previewAdd_caption").innerHTML = caption; } } else if (theForm.strFakeImage.value != "") { document.getElementById("previewAdd_img").src = theForm.strFakeImage.value; document.getElementById("previewAdd_caption").innerHTML = ""; } if (theForm.strSource.value != "") { var source = theForm.strSource.value.replace("\\", "\/"); source = source.replace("http:\/\/", ""); source = source.replace("www.", ""); if (source.indexOf("/") >= 1) source = source.substring(0, source.indexOf("/")); document.getElementById("previewAdd_source").innerHTML = source; } var strOption = ""; var intCount = 0; for (i=1; i<11; i++) { strOption = document.getElementById("option"+i); if (strOption.value != "Option #"+i) intCount++; } var strOutput = ""; var intOption = 1; if (intCount > 5) { for (i=1; i<11; i++) { if (i==2) { strOption = document.getElementById("option"+(i+4)); intOption = 6; } else if (i==3) { strOption = document.getElementById("option"+(i-1)); intOption = 2; } else if (i==4) { strOption = document.getElementById("option"+(i+3)); intOption = 7; } else if (i==5) { strOption = document.getElementById("option"+(i-2)); intOption = 3; } else if (i==6) { strOption = document.getElementById("option"+(i+2)); intOption = 8; } else if (i==7) { strOption = document.getElementById("option"+(i-3)); intOption = 4; } else if (i==8) { strOption = document.getElementById("option"+(i+1)); intOption = 9; } else if (i==9) { strOption = document.getElementById("option"+(i-4)); intOption = 5; } else { strOption = document.getElementById("option"+i); intOption = i; } if (strOption.value != "Option #"+intOption && strOption.value != "") { if (i==1 || i==3 || i==5 || i==7 || i==9) { strOutput = strOutput + '
'+strOption.value+'
'; } else { strOutput = strOutput + '
'+strOption.value+'
'; } } } } else { for (i=1; i<11; i++) { strOption = document.getElementById("option"+i); if (strOption.value != "Option #"+i && strOption.value != "") { strOutput = strOutput + '
'+strOption.value+'
'; } } if (intCount < 5) { for (i=0; i<(5-intCount); i++) { strOutput = strOutput + '
Spacer
'; } } } if (strOutput != "") { document.getElementById("previewAdd_answers").innerHTML = strOutput; } } var intRecipients = 0; function addRecipient(strFrom, strElement, strHidden) { var theElement = document.getElementById(strElement); var theAddition = document.getElementById(strFrom); var theHidden = document.getElementById(strHidden); var emailReg = new RegExp("\\w+@[a-zA-Z_]+?\\.[a-zA-Z]{2,6}", "g"); var regCheck = emailReg.exec(theAddition.value); if (!regCheck) { alert("You must enter a valid email address!"); theAddition.value = ""; theAddition.focus(); } else { if (theElement.innerHTML == "Add recipients below...") { theElement.innerHTML = ""; theElement.className = "block"; } if (theHidden.value != "") { if (theHidden.value.indexOf(theAddition.value) >=0) { theAddition.value = ""; } else { theHidden.value += " "+theAddition.value+";"; theElement.innerHTML = theElement.innerHTML+''+theAddition.value+' remove'; theAddition.value = ""; intRecipients++; } } else { theHidden.value = theAddition.value+";"; theElement.innerHTML = theElement.innerHTML+''+theAddition.value+' remove'; theAddition.value = ""; intRecipients++; } } } function clearAllRecipients(strFrom, strElement, strHidden) { var theAddition = document.getElementById(strFrom); var theElement = document.getElementById(strElement); var theHidden = document.getElementById(strHidden); theElement.className = "details_gray"; theElement.innerHTML = "Add recipients below..."; theHidden.value = ""; theAddition.value = ""; theAddition.focus(); intRecipients = 0; } function clearRecipient(strFrom, strElement, strHidden, strRecipient) { var theElement = document.getElementById(strElement); var theAddition = document.getElementById(strFrom); var theHidden = document.getElementById(strHidden); document.getElementById("email_"+strRecipient).style.display = "none"; theHidden.value = theHidden.value.replace(strRecipient+';', ''); theHidden.value = theHidden.value.replace(" ", " "); theAddition.value = ""; theAddition.focus(); intRecipients--; if (intRecipients == 0) { theHidden.value = ""; theElement.className = "details_gray"; theElement.innerHTML = "Add recipients below..." } } function validateInvite(theForm) { if (theForm.strSubject.value.replace(" ", "") == "") { theForm.strSubject.value = "Invitation to join Youpolls"; } if (theForm.strRecipients.value.replace(" ", "") == "") { alert("You must add at least 1 recipient!"); theForm.addRecips.focus(); return false; } return true; } function noEnter(e, f) { var keynum; if (window.event) { keynum = e.keyCode; } else if (e.which) { keynum = e.which; } if (keynum == 13) { if (f == "addRecipient") addRecipient('addRecips', 'showRecips', 'strRecipients'); return false; } } function toggleUpload(strElement) { if (strElement == "externalimage") { docElement("externalimage").className = "input"; docElement("fileinputs").className = "none"; } else { docElement("externalimage").className = "none"; docElement("fileinputs").className = "fileinputs"; } } function fakefileReplace(strReal, strFake) { if (docElement(strReal).value != "") { docElement(strFake).value = docElement(strReal).value; } } function checkPollPage(strPage) { if (strPage == "default") { var aryRadios = getElementsByClassName(document, "input", "radio"); for (i=0; i < aryRadios.length; i++) { aryRadios[i].checked = ""; } } } function checkMaxLength(strInput, intLength) { if (strInput.value.length > intLength) { strInput.value = strInput.value.substr(0, intLength); alert("Your description must not exceed "+intLength+" characters."); } } var timer = 0; function positionPlayImage(intPollID) { var pollImage = docElement("poll"+intPollID+"image"); var playImage = docElement("poll"+intPollID+"playimage"); var marginHeight = pollImage.offsetHeight; marginHeight = (marginHeight - 39) / 2; playImage.style.marginTop = marginHeight+"px"; } function changeSecurity(strFile, strInput, strImage) { var strAlert = ""; var xmlHttp; try { // Firefox, Opera 8.0+, Safari xmlHttp = new XMLHttpRequest(); } catch (e) { try { // Internet Explorer 6.0+ xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { // Internet Explorer 5.5 xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Your browser does not support AJAX!"); return false; } } } xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4 && (xmlHttp.status == 200 || window.location.href.indexOf("http") == -1)) { strInput.value = xmlHttp.responseText; document.getElementById(strImage).src = "includes/form_validator.aspx?text="+xmlHttp.responseText+"&color=888888&fontsize=20"; } } if (bustcachevar) bustcacheparameter = (strFile.indexOf("?") != -1)? "&" + new Date().getTime() : "?" + new Date().getTime() xmlHttp.open("GET", strFile, true); xmlHttp.send(null); return false; }