var BUILD_DATE = "20081117160443"; /*copyright 2008 wetpaint.com, inc.*/ String.parseQueryParams=function(params,prefix){ var query=""; for(var key in params){ var value=params[key]; switch(typeof(value)){ case "undefined": case "function": break; case "string": case "number": case "boolean": query+=encodeURIComponent((key.charAt(0)=="#")?prefix:(prefix?prefix+'.':'')+key.replace(new RegExp("^@"),""))+"="+encodeURIComponent(value)+"&"; break; case "object": if(value instanceof Array){ for(var i=0;i0)?document.documentElement.scrollLeft:document.getElementById("allcontent").scrollLeft; pos.top=(window.scrollY)?window.scrollY:(document.documentElement.scrollTop>0)?document.documentElement.scrollTop:document.getElementById("allcontent").scrollTop; return pos; } utils.getWindowDimensions=function(){ var dim={x:null,y:null}; if(self.innerHeight){ dim.x=self.innerWidth-18; dim.y=self.innerHeight; }else if(document.documentElement&&document.documentElement.clientHeight){ if(this.isMSIE7){ dim.x=document.documentElement.clientWidth; }else{ dim.x=document.documentElement.clientWidth-18; } dim.y=document.documentElement.clientHeight; }else if(document.body){ dim.x=document.body.clientWidth-18; dim.y=document.body.clientHeight; } return dim; }; utils.getParentElement=function(node,names,attrib_name,attrib_value,stop_node){ if(this.isMSIE&&attrib_name=='class') attrib_name='className'; if(node==null) return null; if(typeof(names)=="undefined"||names==null){ if(node.nodeType==1) return node; while((node=node.parentNode)!=null&&node.nodeType!=1); return node; } var namesAr=names.split(','); do{ for(var i=0;i1&&docFragment.childNodes[0].nodeType==3&&docFragment.childNodes[0].length==0){ return this.getTextElement(range.startContainer.nextSibling); }else if(docFragment.childNodes.length==1&&docFragment.childNodes[0].nodeName.toLowerCase()=='img'){ var fragSrc=utils.regexpReplace(docFragment.childNodes[0].src,'^http://(.*?)/','','i') var imageMatches=this.getElementsByAttributeValue(range.startContainer,'img','src',fragSrc) for(var i=0;i1&&docFragment.childNodes[docFragment.childNodes.length-1].nodeType==3&&docFragment.childNodes[docFragment.childNodes.length-1].length==0){ return this.getTextElement(range.endContainer.previousSibling); }else if(docFragment.childNodes.length==1&&docFragment.childNodes[docFragment.childNodes.length-1].nodeName.toLowerCase()=='img'){ var fragSrc=utils.regexpReplace(docFragment.childNodes[docFragment.childNodes.length-1].src,'^http://(.*?)/','','i') var imageMatches=this.getElementsByAttributeValue(range.endContainer,'img','src',fragSrc) for(var i=0;i=0){ if(warnHTML){ messageNode.innerHTML=messageNode.innerHTML=warnHTML.replace('[REMCHARS]',remaining); }else{ messageNode.innerHTML="Note: You can enter up to "+remaining+" additional characters."; } return true; }else{ if(limitHTML){ messageNode.innerHTML=limitHTML.replace('[CURCHARS]',currLength).replace('[MAXCHARS]',maxchars); }else{ messageNode.innerHTML="You have entered "+currLength+" characters. The limit is "+maxchars+"."; } return false; } } function RGBColor(color_string){ this.ok=false; if(color_string.charAt(0)=='#'){ color_string=color_string.substr(1,6); } color_string=color_string.replace(/ /g,''); color_string=color_string.toLowerCase(); var color_defs=[ { re:new RegExp("^rgb\\((\\d{1,3}),\\s*(\\d{1,3}),\\s*(\\d{1,3})\\)$"),example:['rgb(123, 234, 45)','rgb(255,234,245)'],process:function(bits){ return [ parseInt(bits[1]),parseInt(bits[2]),parseInt(bits[3]) ]; } },{ re:new RegExp("^(\\w{2})(\\w{2})(\\w{2})$"),example:['#00ff00','336699'],process:function(bits){ return [ parseInt(bits[1],16),parseInt(bits[2],16),parseInt(bits[3],16) ]; } },{ re:new RegExp("^(\\w{1})(\\w{1})(\\w{1})$"),example:['#fb0','f0f'],process:function(bits){ return [ parseInt(bits[1]+bits[1],16),parseInt(bits[2]+bits[2],16),parseInt(bits[3]+bits[3],16) ]; } } ]; for(var i=0;i255)?255:this.r); this.g=(this.g<0||isNaN(this.g))?0:((this.g>255)?255:this.g); this.b=(this.b<0||isNaN(this.b))?0:((this.b>255)?255:this.b); this.toRGB=function(){ return 'rgb('+this.r+', '+this.g+', '+this.b+')'; } this.toHex=function(){ var r=this.r.toString(16); var g=this.g.toString(16); var b=this.b.toString(16); if(r.length==1) r='0'+r; if(g.length==1) g='0'+g; if(b.length==1) b='0'+b; return '#'+r+g+b; } this.colorDistance=function(r2,g2,b2){ var a=r2-this.r; var b=g2-this.g; var c=b2-this.b; return Math.sqrt(a*a+b*b+c*c); } this.dToWhite=this.colorDistance(255,255,255); this.dToBlack=this.colorDistance(0,0,0); this.isDark=function(){ return this.dToBlack(dToGray-this.dToWhite)){ return(dToGray>this.dToBlack)?'Gray':'White'; }else{ return(dToGray>this.dToWhite)?'Gray':'Black'; } } } function HSVColor(initial_color_string){ this.ok=false; this.color_defs=[ { re:new RegExp("^hsv\\((\\d{1,3}),\\s*(\\d{1,3}),\\s*(\\d{1,3})\\)$"),example:['hsv(360, 100, 100)','hsv(243,67,60)'],process:function(bits){ return [ parseInt(bits[1]),parseInt(bits[2]),parseInt(bits[3]) ]; } },{ re:new RegExp("^(\\w{2})(\\w{2})(\\w{2})$"),example:['#00ff00','336699'],process:function(bits){ var hsvR=Math.round(parseInt(bits[1],16)/.255)/1000; var hsvG=Math.round(parseInt(bits[2],16)/.255)/1000; var hsvB=Math.round(parseInt(bits[3],16)/.255)/1000; var max=Math.max(Math.max(hsvR,hsvG),hsvB); var min=Math.min(Math.min(hsvR,hsvG),hsvB); var hue=0; var saturation=0; var brightness=Math.round(max*100)/100; var delta=Math.round((max-min)*1000)/1000; if(max!=0){ saturation=Math.round((delta/max)*100)/100; }else{ saturation=0; hue=-1; } if(hsvR==max){ hue=(Math.round((hsvG-hsvB)*100)/100)/delta; }else if(hsvG==max){ hue=2+(Math.round((hsvB-hsvR)*100)/100)/delta; }else{ hue=4+(Math.round((hsvR-hsvG)*100)/100)/delta; } hue*=60; if(hue<0) hue+=360; return [ Math.round(hue),parseInt(saturation*100),parseInt(brightness*100) ]; } } ]; this.setValues=function(color_string){ if(color_string.charAt(0)=='#'){ color_string=color_string.substr(1,6); } color_string=color_string.replace(/ /g,''); color_string=color_string.toLowerCase(); for(var i=0;i360)?360:this.hue); this.saturation=(this.saturation<0||isNaN(this.saturation))?0:((this.saturation>100)?100:this.saturation); this.brightness=(this.brightness<0||isNaN(this.brightness))?0:((this.brightness>100)?100:this.brightness); } this.toHex=function(){ var red; var green; var blue; var hue=this.hue; var saturation=this.saturation/100; var brightness=this.brightness/100; var i,f,p,q,t; if(saturation==0){ red=green=blue=brightness; } hue/=60; i=Math.floor(hue); f=hue-i; p=brightness*(1-saturation); q=brightness*(1-saturation*f); t=brightness*(1-saturation*(1-f)); switch(i){ case 0:red=brightness;green=t;blue=p;break; case 1:red=q;green=brightness;blue=p;break; case 2:red=p;green=brightness;blue=t;break; case 3:red=p;green=q;blue=brightness;break; case 4:red=t;green=p;blue=brightness;break; default:red=brightness;green=p;blue=q;break; } red=Math.round(red*255).toString(16); green=Math.round(green*255).toString(16); blue=Math.round(blue*255).toString(16); if(red.length==1) red='0'+red; if(green.length==1) green='0'+green; if(blue.length==1) blue='0'+blue; return '#'+red+green+blue; } this.toHSV=function(){ return 'hsv('+this.hue+', '+this.saturation+', '+this.brightness+')'; } if(initial_color_string) this.setValues(initial_color_string); return this; } utils.toggleMinMax=function(who,which){ if(typeof(who)=='object'){ if(who.className.substring(0,6)=="toggle"){ switch(which){ case "min":who.className="toggleMin"; break; case "max":who.className="toggleMax"; break; default:who.className=(who.className=="toggleMin")?"toggleMax":"toggleMin"; } }else{ this.toggleMinMax(who.offsetParent,which); } }else{ } } utils.getSortUri=function(sort){ var params=location.search.getObjectFromQuerystring(); var sortParam="sort="+sort; var uri=location.href; if(params["sort"]){ uri=location.href.replace(new RegExp("\\bsort=[^\\&]*\\b"),sortParam); }else{ uri+=(location.search.length>0)?"&"+sortParam:"?"+sortParam; } var offsetRE=new RegExp("\\boffset=[^\\&]*\\b"); if(offsetRE.test(uri)) uri=uri.replace(offsetRE,"offset=0"); return uri; } utils.logMacroEvent=function(eventName,eventCode){ if(typeof(s_gi)!='undefined'){ try{ s_w=s_gi(s_account); s_w.pageName=s_w.prop1+' - UIEvents - '+eventName; s_w.prop7=eventName; s_w.eVar8=eventName; s_w.events=''; if(eventCode){s_w_addEvent(eventCode);} s_w_addEvent('event8'); s_w_addEvent('event1'); s_w.t(); }catch(s_w){return;} } } utils.logMicroEvent=function(eventName,eventCode){ if(typeof(s_gi)!='undefined'){ try{ s_w=s_gi(s_account); if(eventName.indexOf('error')!=-1){s_w.pageType='errorPage';} s_w.pageName=s_w.prop1+' - UIEvents - '+eventName; s_w.prop7=eventName; s_w.eVar8=eventName; s_w.events=''; if(eventCode){s_w_addEvent(eventCode);} s_w_addEvent('event8'); s_w.tl(); }catch(s_w){return;} } } function $(){ var results=[],element; for(var i=0;inow.getMidnightTime()) formattedDate="Today"; else if(adjusted.getTime()>now.getMidnightTime()-86000000) formattedDate="Yesterday"; else if(adjusted.getTime()>now.getMidnightTime()-(86000000*7)) formattedDate=arrDaysOfWeek[adjusted.getDay()]; formattedDate+=", "; formattedDate+=adjusted.getHours()<=12?adjusted.getHours()==0?12:adjusted.getHours():adjusted.getHours()-12; formattedDate+=":"+z(adjusted.getMinutes())+' '+(adjusted.getHours()<12?"am":"pm"); return formattedDate+(!noTimeZone?" "+DEFAULT_TIME_STRING:""); }; Date.prototype.getStaticTime=function(noTimeZone){ var arrMonths=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"); var formattedDate=arrMonths[this.getMonth()]+" "+this.getDate()+" "+this.getFullYear(); formattedDate+=", "; formattedDate+=(this.getHours()<=12)?(this.getHours()==0)?'12':this.getHours():(this.getHours()-12); formattedDate+=":"; formattedDate+=(this.getMinutes()<10)?"0"+this.getMinutes():this.getMinutes(); formattedDate+=(this.getHours()<12)?" am":" pm"; var timeZone=(noTimeZone)?'':DEFAULT_TIME_STRING; return formattedDate+" "+timeZone; }; String.prototype.newlinesToHTML=function(){ var cleanedText=this.replace(/\r/gi,""); return cleanedText.replace(/\n/gi,"
"); } String.prototype.newlinesToUnicode=function(){ return this.replace(//gi,"\n"); } String.prototype.capitalize=function(){ var charRE=/^[a-z]/ if(!charRE.test(this)) return this; try{ return this.replace(charRE,function(c){return c.toUpperCase();}); }catch(e){ var capChar=charRE.exec(this)[0].toUpperCase(); return this.replace(charRE,capChar); } } String.prototype.trim=function(in_str){ in_str=this!=window?this:in_str; return in_str.replace(/^\s+/g,'').replace(/\s+$/g,''); }; String.prototype.encodeCDATA=function(){ return this.replace(/]]>/g,"]]&gt;"); }; String.prototype.encodeHTML=function(){ return this.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"); }; String.prototype.decodeHTML=function(){ return this.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'"); }; String.prototype.getObjectFromQuerystring=function(){ var map={}; var str=this.replace(/^\?/,""); var pairs=str.split("&"); for(var i=0;i1)?decodeURIComponent(utils.regexpReplace(keyValue[1],"\\+"," ","gi")):null; value=(value=="true")?true:((value=="false")?false:value); if(map[keyValue[0]]&&(map[keyValue[0]] instanceof Array)) map[keyValue[0]].push(value); else map[keyValue[0]]=value; } return map; }; utils.getQueryStringFromObject=function(obj,prefix){ var queryString=""; for(var key in obj){ var value=obj[key]; if(prefix) key=key; switch(typeof(value)){ case "undefined": case "function": break; case "string": case "number": case "boolean": queryString+=encodeURIComponent((prefix?prefix+'.':'')+key)+"="+encodeURIComponent(value)+"&"; break; case "object": if(value instanceof Array){ for(var i=0;i=0;i--) z+=x.charAt(i); z=z.replace(/(\d{3})/g,"$1"+sep); if(z.slice(-sep.length)==sep) z=z.slice(0,-sep.length); x=""; for(i=z.length-1;i>=0;i--) x+=z.charAt(i); if(typeof(y)!="undefined"&&y.length>0) x+=decpoint+y; } return x; } /*copyright 2008 wetpaint.com, inc.*/ window.ClassLoader={ dependencies:{ "CYOAutoLookup":[ "AutoLookup" ],"TagAutoLookup":[ "AutoLookup" ],"Editor":[ "Area","Toolbar" ],"Toolbar":[ "ToolbarInput" ] }, load:function(classId,callback,loaded){ var loadable=true; if(loaded){if(typeof(callback)==="function") callback();} else{ var dependencies=this.dependencies[classId]; for(var i=0;dependencies&&i=date; if(Cookie.get("wpptrk2d")["coppa"]==1||!result.valid&&confirm("Please confirm that your date of birth is: "+date.getMonth()+'/'+date.getDate()+'/'+date.getFullYear()+"\n\nIf that's correct, click OK. To change it, click Cancel.")){ Cookie.set("wpptrk2d",String.parseQueryParams({"coppa":1})); setTimeout(function(){validator.form.innerHTML="Based on the information you have supplied, you are ineligible to create a Wetpaint account.";},0); Logger.logMicroEvent("COPPA_Blocked"); } } return result; } }, match:function(value1,value2,token){ var result={ valid:value1==value2,messages:[] }; if(!result.valid) result.messages.push(String.format($("unmatched.error").innerHTML,[ token.replace(new RegExp("[A-Z].+$",'g'),"") ])); return result; }, require:function(value){ var result={ valid:value!==undefined&&value!==null&&value!=="",messages:[] }; if(!result.valid) result.messages.push($("required.error").innerHTML); return result; }, validate:function(form,fieldName){ this.form=form; var validateField=function(element,disableRemoting){ var result=true; if(element){ var rel=(element.getAttribute&&element.getAttribute("rel"))||element.rel||""; if(rel.value) rel=rel.value; var params=rel.toQueryParams(); this.clearErrors(element.name); this.clearMessaging("success",element.name); if(params["required"]){ var results=this.require(element.value); if(disableRemoting) this.logError(element.name,results.messages); result=results.valid; } if(params["validation"]){ var results=this.routines[ params["validation"] ].call(this,element.name,element.value,disableRemoting); if(disableRemoting) this.logError(element.name,results.messages); if(results.ignoreList) ignoreList.concat(results.ignoreList); result=results.valid&&result; } } return result; }; var result=true; var ignoreList=[]; if(arguments.length<2){ for(var id in form.elements){ var found=false; for(var i=0;i0){ var console=$(messageType+"_"+id); if(console){ console.style.display="inline"; for(var i=0;i=0){ return(childNode.nodeValue)?childNode.nodeValue:childNode.text; }else{ var childObj=this.parseXmlToObject(childNode); if(typeof obj[childNodeName]=="undefined"){ try{ obj[childNodeName]=childObj; if(typeof obj[childNodeName]=="undefined"){ obj[childNodeName]=''; }else{ obj[childNodeName].length=1; obj[childNodeName][0]=obj[childNodeName]; } }catch(e){ alert(e); } }else{ if(obj[childNodeName].length==1){ tmp=obj[childNodeName]; obj[childNodeName]=new Array(); obj[childNodeName][obj[childNodeName].length]=tmp; } obj[childNodeName][obj[childNodeName].length]=childObj; } } } } return obj; } /*copyright 2008 wetpaint.com, inc.*/ var tooltip=null; function Tooltip(referenceElement,xhtml,xOffset,yOffset,pitch,className){ if(!arguments.length) return; this.referenceElement=referenceElement; this.referencePosition=utils.getAbsolutePosition(referenceElement); this.pitch=(typeof(pitch)!='undefined'&&pitch.toLowerCase()=='left')?'Left':'Right'; this.tooltipDiv=document.createElement("div"); this.tooltipDiv.id="tooltipDiv"; this.tooltipDiv.className=(typeof(className)!='undefined')?className:''; Element.extend(this.tooltipDiv); this.ttTopDiv=document.createElement("div"); this.ttTopDiv.id="ttTopDiv"; this.ttTopDiv.className="ttTop"+this.pitch; this.ttMidDiv=document.createElement("div"); this.ttMidDiv.id="ttMidDiv"; this.ttBotDiv=document.createElement("div"); this.ttBotDiv.id="ttBotDiv"; this.ttCloseDiv=document.createElement("div"); this.ttCloseDiv.id="ttCloseDiv"; this.ttCloseDiv.className="ttClose"+this.pitch; this.ttContentDiv=document.createElement("div"); this.ttContentDiv.id="ttContentDiv"; this.ttTopDiv.appendChild(this.ttCloseDiv); this.tooltipDiv.appendChild(this.ttTopDiv); this.ttMidDiv.appendChild(this.ttContentDiv); this.tooltipDiv.appendChild(this.ttMidDiv); this.tooltipDiv.appendChild(this.ttBotDiv); this.tooltipDiv.style.visibility='hidden'; document.body.appendChild(this.tooltipDiv); this.tooltipDiv.style.top=this.referencePosition.absTop+'px'; this.tooltipDiv.style.left=this.referencePosition.absLeft+'px'; this.ttContentDiv.innerHTML=xhtml; this.xOffset=(typeof(xOffset)!='undefined')?parseInt(xOffset):0; this.yOffset=(typeof(yOffset)!='undefined')?parseInt(yOffset):0; if(this.pitch=='Left') this.xOffset=this.xOffset-parseInt(this.tooltipDiv.scrollWidth); this.tooltipDiv.style.marginLeft=this.xOffset+'px'; this.tooltipDiv.style.marginTop=this.yOffset+'px'; if(tooltip){ tooltip.close(true) }; tooltip=this; Event.observe(this.ttCloseDiv,"click",function(e){if(window.tooltip) tooltip.close();}); this.open(); } Tooltip.prototype.setContent=function(xhtml){ this.xhtml=xhtml; this.ttContentDiv.innerHTML=this.xhtml; }; Tooltip.prototype.getContent=function(){ return this.xhtml; }; Tooltip.prototype.close=function(opening){ var tooltipToClose=tooltip; if(!opening) tooltip=null; new Effect.Fade(this.tooltipDiv,{duration:.3,afterFinish:function(){ document.body.removeChild(tooltipToClose.tooltipDiv); } }); return false; }; Tooltip.prototype.open=function(){ this.tooltipDiv.style.display='none'; this.tooltipDiv.style.visibility='visible'; new Effect.Appear(this.tooltipDiv,{duration:.3,afterFinish:function(){ } }); return false; }; /*copyright 2008 wetpaint.com, inc.*/ application=new function(){ this.requests=new Object; this.initRequest=function(requestReference){ if(this.requests[requestReference]){ if(this.requests[requestReference].req.readyState!=0) this.requests[requestReference].req.abort(); if(this.requests[requestReference].timeoutSend) clearTimeout(this.requests[requestReference].timeoutSend); }else{ this.requests[requestReference]=new Request(requestReference); } return this.requests[requestReference]; }; this.attachedEvents=new Array(); this.detachEvents=function(){ for(var i=application.attachedEvents.length-1;i>=0;i--){ if(application.attachedEvents[i]["elem"].removeEventListener){ application.attachedEvents[i]["elem"].removeEventListener(application.attachedEvents[i]["evtName"],application.attachedEvents[i]["handler"],false); }else if(application.attachedEvents[i]["elem"].detachEvent){ application.attachedEvents[i]["elem"].detachEvent("on"+application.attachedEvents[i]["evtName"],application.attachedEvents[i]["handler"]); } application.attachedEvents.length=i; } } init('setTimeout("Event.observe(window, \'unload\', application.detachEvents)" , 0)'); }