/* springpad Springer (c) Copyright 2009 */
var SP_DOMAIN=/springpadapp\.com$/i.test(window.location.host)?window.location.host:"springpadit.com",SP_HOST="http://"+SP_DOMAIN,SP_LOGO=SP_HOST+"/springpad/images/elements/logo.springpad_beta.110.png",SP_BROWSER={Engine:{name:"unknown",version:0},Platform:{name:(window.orientation!=undefined)?"ipod":(navigator.platform.match(/mac|win|linux/i)||["other"])[0].toLowerCase()},Features:{xpath:!!(document.evaluate),air:!!(window.runtime),query:!!(document.querySelector)},Plugins:{},Engines:{presto:function(){return(!window.opera)?false:((arguments.callee.caller)?960:((document.getElementsByClassName)?950:925))},trident:function(){return(!window.ActiveXObject)?false:((window.XMLHttpRequest)?((document.querySelectorAll)?6:5):4)},webkit:function(){return(navigator.taintEnabled)?false:((SP_BROWSER.Features.xpath)?((SP_BROWSER.Features.query)?525:420):419)},gecko:function(){return(!document.getBoxObjectFor&&window.mozInnerScreenX==null)?false:((document.getElementsByClassName)?19:18)}}},SP_OPTIONS=typeof(SPRING_OPTIONS)!="undefined"?SPRING_OPTIONS:(typeof(SP_OPTIONS)!="undefined"?SP_OPTIONS:{}),sp_getRGB=function(d){var j,h,f,a;try{if(d.indexOf("rgb")===0){if(j=d.match(/^.*rgba?\((\d{1,3}),(\d{1,3}),(\d{1,3}).*/i)){h=j[1]?sp_getColorLevel(j[1]):null;f=j[2]?sp_getColorLevel(j[2]):null;a=j[3]?sp_getColorLevel(j[3]):null}}else{if(d.indexOf("#")===0&&(d.length==4||d.length==7)){if(j=d.match(/^\#([\dA-F])([\dA-F])([\dA-F])([\dA-F])?([\dA-F])?([\dA-F])?$/i)){h=j[4]?parseInt(""+j[1]+j[2],16):parseInt(""+j[1]+j[1],16);f=j[4]?parseInt(""+j[3]+j[4],16):parseInt(""+j[2]+j[2],16);a=j[4]?parseInt(""+j[5]+j[6],16):parseInt(""+j[3]+j[3],16)}}}if(h!=null&&f!=null&&a!=null){return{r:h,g:f,b:a}}}catch(i){}return null},sp_getCssRGB=function(d,e){var f,b;if((f=sp_getRGB(d))){return"rgb"+(e?"a":"")+"("+f.r+","+f.g+","+f.b+(e?(","+(b=parseFloat(e)&&b>=0&&b<=1?parseFloat(e):"0.5")):"")+")"}return null},sp_getColorLevel=function(a){var b=parseInt(a);return(b<0?0:(b>255?255:b))},sp_isDark=function(a){var b;if(b=sp_getRGB(a)){return !((b.r+b.g+b.b)>((255*3)/2))}return null},sp_newDiv=function(c,a){var b=window.document.createElement("div");b.id=c;b.style.border="0";b.style.margin="0";b.style.padding="0";b.style.position="relative";if(a){a.appendChild(b)}return b},sp_scrollTop=function(e){var c,a,b;c=e.pageYOffset||0;a=e.document.documentElement?e.document.documentElement.scrollTop:0;b=e.document.body?e.document.body.scrollTop:0;var d=c?c:0;if(a&&(!d||(d>a))){d=a}return b&&(!d||(d>b))?b:d},sp_getEvent=function(a){return !a?a=window.event:a},sp_preventEventDefault=function(a){if(a.preventDefault){a.preventDefault()}else{a.returnValue=false;a.cancelBubble=true}},sp_getEventTarget=function(a){if(a.target){targ=a.target}else{if(a.srcElement){targ=a.srcElement}}if(targ.nodeType==3){targ=targ.parentNode}return targ},sp_onClosePop=function(a){var a=sp_getEvent(a);sp_preventEventDefault(a);sp_closePop()},sp_closePop=function(){if(SP_OPTIONS.refreshOnComplete&&SP_OPTIONS.isSpringComplete){window.location.reload()}else{var a;if(document.getElementById("sp_pop")){a=document.getElementById("sp_pop").parentNode;a.removeChild(document.getElementById("sp_pop"));if(SP_OPTIONS.isSpringComplete&&SP_OPTIONS.runOnComplete){SP_OPTIONS.runOnComplete()}}if(document.getElementById("sp_modal")){a=document.getElementById("sp_modal").parentNode;a.removeChild(document.getElementById("sp_modal"))}}},sp_showPop=function(k){if(!!sp_getSpring(k)){var n=SP_HOST+"/on/s?";if(SP_OPTIONS.bannerImage){n+="bannerImage="+SP_OPTIONS.bannerImage+"&"}if(SP_OPTIONS.bannerLink){n+="bannerLink="+SP_OPTIONS.bannerLink+"&"}n+=sp_getSpring(k);if(navigator.appVersion.indexOf("AppleWebKit")!==-1&&SP_HOST!=="http://"+window.location.host){if(SP_OPTIONS.headerBackgroundColor){n+="&headerBackgroundColor="+SP_OPTIONS.headerBackgroundColor+"&isDark="+(sp_isDark(SP_OPTIONS.headerBackgroundColor)?"true":"false")}if(SP_OPTIONS.headerLogo){n+="&headerLogo="+SP_OPTIONS.headerLogo}if(SP_OPTIONS.borderColor){n+="&borderColor="+SP_OPTIONS.borderColor}if(SP_OPTIONS.headerLogo!==SP_LOGO){n+="&showPoweredBy=true"}window.open(n,"sp_pop","height=525,width=520,resizable=no,status=no,scrollbars=no,status=no");return}sp_closePop();if(SP_OPTIONS.showModal){var m;m=sp_newDiv("sp_modal");m.style.background="#000000 none";var h=0.33;if(m.style.opacity!==undefined){m.style.opacity=h}else{if(m.style.MozOpacity!==undefined){m.style.MozOpacity=h}else{if(m.style.filter!==undefined){m.style.filter="alpha(opacity="+(h*100)+")"}}}m.style.height="100%";m.style.left="0px";m.style.position="fixed";m.style.top="0px";m.style.width="100%";m.style.zIndex=100000;window.document.body.appendChild(m)}var a;a=sp_newDiv("sp_pop");a.style.width="504px";a.style.padding="8px";a.style.position="absolute";a.style.zIndex=100001;a.style.top=(sp_scrollTop(window)+10)+"px";a.style.left="50%";a.style.marginLeft="-260px";a.style.backgroundColor=SP_OPTIONS.shadowColor;try{a.style.backgroundColor=sp_getCssRGB(SP_OPTIONS.shadowColor,"0.5")}catch(j){a.style.backgroundColor=SP_OPTIONS.shadowColor}a.style.backgroundRepeat="repeat";a.style.backgroundPosition="center center";if(document.body.style.MozBorderRadius!==undefined){a.style.MozBorderRadius="8px"}else{if(document.body.style.WebkitBorderRadius!==undefined){a.style.WebkitBorderRadius="8px"}}var l;l=sp_newDiv("sp_pop_view",a);l.style.backgroundColor="white";l.style.zIndex=2;l.style.textAlign="left";l.style.padding="0px";l.style.borderWidth="1px";l.style.borderStyle="solid";l.style.borderColor=SP_OPTIONS.borderColor;var g;g=sp_newDiv("sp_pop_header",l);g.style.backgroundColor=SP_OPTIONS.headerBackgroundColor;g.style.minHeight="30px";g.style.borderWidth="0px";g.style.borderBottomWidth="1px";g.style.borderStyle="solid";g.style.borderColor=SP_OPTIONS.borderColor;var d=window.document.createElement("img");d.src=SP_OPTIONS.headerLogo;d.style.margin="4px 4px 4px 10px";g.appendChild(d);if(SP_OPTIONS.headerLogo!==SP_LOGO){var f=window.document.createElement("div");f.style.fontSize="10px";f.style.color=sp_isDark(SP_OPTIONS.headerBackgroundColor)?"#FFFFFF":"#000000";f.style.fontSize="10px";f.style.position="absolute";f.style.right="4px";f.style.bottom="4px";f.innerHTML='powered by springpad <sup style="font-size:8%; vertical-align:super;">TM</sup>';g.appendChild(f)}var b=window.document.createElement("img");b.src=SP_HOST+"/springpad/images/icons/icon.11.x."+(sp_isDark(SP_OPTIONS.headerBackgroundColor)?"white":"black")+".gif";b.style.cursor="pointer";b.style.position="absolute";b.style.right="5px";b.style.top="5px";if(b.addEventListener){b.addEventListener("click",sp_onClosePop,false)}else{if(b.attachEvent){b.attachEvent("onclick",sp_onClosePop)}else{b.onclick=sp_onClosePop}}g.appendChild(b);var c=(SP_BROWSER.Engine.name=="trident");var i;i=sp_newDiv("sp_pop_content",l);i.style.height="400px";i.innerHTML='<iframe id="sp_iframe" name="sp_iframe" src="'+n+'" scrolling="no" frameborder="0" style="border:0px; width:'+(c?"95%":"100%")+'; height:100%; border:1px; padding:0px; margin:0px"></iframe>';window.document.body.appendChild(a)}},sp_getSpring=function(b){if(b&&b.href){var a=new RegExp("^https?:/(?:/my\\.|/www\\.|/)"+SP_DOMAIN+"/s\\?","i");if(a.test(b.href)){return b.href.replace(a,"")}else{if(SP_HOST.indexOf(window.location.host)!==-1&&b.href.indexOf("/s?")!==-1){return b.href.replace(/^.*?\/s\?/i,"")}}}return false},sp_onClick=function(b){var b=sp_getEvent(b);var a=sp_findParent(sp_getEventTarget(b),"a");sp_preventEventDefault(b);sp_showPop(a)},sp_findParent=function(a,b){while(a&&(a.nodeType!=1||(a.localName&&a.localName.toLowerCase()!=b)||(a.nodeName&&a.nodeName.toLowerCase()!=b))){a=a.parentNode}return a},sp_addEvent=function(b,c,a){if(b.addEventListener){b.addEventListener(c,a,false)}else{if(window.attachEvent){b.attachEvent("on"+c,a)}else{b["on"+c]=a}}},sp_add=function(a){if(!!sp_getSpring(a)){sp_addEvent(a,"click",sp_onClick)}},sp_scan=function(g){var c=[],b=document.getElementsByTagName("a");for(var f=0,a=b.length;f<a;f++){var d=b[f];sp_add(d)}};SP_OPTIONS={showModal:typeof(SP_OPTIONS.showModal)=="boolean"?SP_OPTIONS.showModal:true,shadowColor:SP_OPTIONS.shadowColor&&sp_getCssRGB(SP_OPTIONS.shadowColor)?sp_getCssRGB(SP_OPTIONS.shadowColor):"rgb(0,0,0)",borderColor:SP_OPTIONS.borderColor&&sp_getCssRGB(SP_OPTIONS.borderColor)?sp_getCssRGB(SP_OPTIONS.borderColor):"rgb(0,0,0)",headerBackgroundColor:SP_OPTIONS.headerBackgroundColor&&sp_getCssRGB(SP_OPTIONS.headerBackgroundColor)?sp_getCssRGB(SP_OPTIONS.headerBackgroundColor):"rgb(255,255,255)",headerLogo:SP_OPTIONS.headerLogo?SP_OPTIONS.headerLogo:SP_LOGO,autoScan:typeof(SP_OPTIONS.autoScan)=="boolean"?SP_OPTIONS.autoScan:true,refreshOnComplete:typeof(SP_OPTIONS.refreshOnComplete)=="boolean"?SP_OPTIONS.refreshOnComplete:false,runOnComplete:SP_OPTIONS.runOnComplete?SP_OPTIONS.runOnComplete:null,bannerImage:typeof(SP_OPTIONS.bannerImage)=="string"?SP_OPTIONS.bannerImage:false,bannerLink:typeof(SP_OPTIONS.bannerLink)=="string"?SP_OPTIONS.bannerLink:false,isSpringComplete:false};SP_BROWSER.Platform[SP_BROWSER.Platform.name]=true;SP_BROWSER.detect=function(){for(var b in this.Engines){var a=this.Engines[b]();if(a){this.Engine={name:b,version:a};this.Engine[b]=this.Engine[b+a]=true;break}}return{name:b,version:a}};SP_BROWSER.detect();if(SP_OPTIONS.autoScan){(function(){var a=function(){if(SP_BROWSER.loaded){return}SP_BROWSER.loaded=true;sp_scan()},c=function(){try{b.doScroll();return((document.body.appendChild(b))&&(b.innerHTML="temp")&&(b.parentNode)&&(b.parentNode.removeChild(b)))}catch(d){return false}return false};sp_addEvent(window,"load",a);if(SP_BROWSER.Engine.trident){var b=document.createElement("div");(function(){(c())?a():setTimeout(arguments.callee,50)})()}else{if(SP_BROWSER.Engine.webkit&&SP_BROWSER.Engine.version<525){(function(){(["loaded","complete"].indexOf(document.readyState)!=-1)?a():setTimeout(arguments.callee,50)})()}else{sp_addEvent(document,"DOMContentLoaded",a)}}})()};
