function mouseDown(e){e=e||window.event;var t=e.target||e.srcElement;if(_$("P_tab")){if(_$("P_tab").style.display=="block"){try{if(t.parentNode.parentNode.parentNode.parentNode.parentNode.id!="P_tab"){_$("P_tab").style.display="none"}}catch(n){_$("P_tab").style.display="none"}}}}function submitCSSEditor(){if(_$("styleTitle").value.trim().length>0){_$("formXML").submit()}else{_$("styleTitleErr").style.display="block"}}function CSSE_changeView(e){_$("A_"+currentTag).className="Aoff";_$("D_"+currentTag).className="off";_$("edit"+currentTag).style.display="none";_$("A_"+e).className="Aon";_$("D_"+e).className="on";_$("edit"+e).style.display="block";currentTag=e}function CSSE_showTag(e){if(e!=null){_$("D_"+e).style.display="block"}else{_$("D_Border").style.display="none";_$("D_Font").style.display="none";_$("D_Background").style.display="none";_$("D_Margin").style.display="none";_$("D_Padding").style.display="none";_$("D_Scale").style.display="none";_$("D_Height").style.display="none"}}function showResults(e){if(e){_$("divAnswers").style.display="none";_$("divResults").style.display="block";_$("pds-links-back").style.display="block";_$("pds-links").style.display="none";_$("pds-totalvotes-inner").style.display="block";_$("pds-question-top").innerHTML=pd_map.thankyou}else{_$("divAnswers").style.display="block";_$("divResults").style.display="none";_$("pds-links-back").style.display="none";_$("pds-links").style.display="block";_$("pds-totalvotes-inner").style.display="none";_$("pds-question-top").innerHTML=pd_map.question}}function renderStyleEdit(e){firstRun=true;switch(e){case"pds-box":{showResults(false);break};case"pds-question-top":{showResults(false);break};case"pds-box":{showResults(false);break};case"pds-answer-group":{showResults(false);break};case"pds-answer-input":{showResults(false);break};case"pds-answer":{showResults(false);break};case"pds-link":{showResults(false);break};case"pds-textfield":{showResults(false);break};case"pds-vote-button":{showResults(false);break};case"pds-answer-feedback":{showResults(true);break};case"pds-answer-feedback-bar":{showResults(true);break};case"pds-totalvotes-inner":{showResults(true);break}}_$("editBorder").style.display="none";_$("editFont").style.display="none";_$("editBackground").style.display="none";_$("editMargin").style.display="none";_$("editPadding").style.display="none";_$("editScale").style.display="none";_$("editHeight").style.display="none";CSSE_showTag(null);currentStyle=e;for(i=0;i<CSSXML.childNodes.length;i++){if(CSSXML.childNodes[i].nodeType!=3){for(x=0;x<CSSXML.childNodes[i].childNodes.length;x++){if(CSSXML.childNodes[i].childNodes[x].nodeType!=3){styleGroup=CSSXML.childNodes[i].childNodes[x];if(styleGroup.nodeName==e){for(y=0;y<styleGroup.childNodes.length;y++){for(z=0;z<styleGroup.childNodes[y].attributes.length;z++){attrName=styleGroup.childNodes[y].attributes[z].name;attrValue=styleGroup.childNodes[y].attributes[z].value;switch(_$(attrName).nodeName){case"SELECT":{for(q=0;q<_$(attrName).length;q++){if(_$(attrName).options[q].value==attrValue){_$(attrName).options[q].selected=true;break}}break};case"INPUT":{if(_$(attrName).attributes["type"].value=="checkbox"){if(attrValue!="none"&&attrValue!="normal"){_$(attrName).checked=true}else{_$(attrName).checked=false}}else{if(attrValue=="Transparent"){_$(attrName).value=""}else{_$(attrName).value=attrValue}}break}}}if(firstRun==true){switch(styleGroup.childNodes[y].nodeName){case"border":{CSSE_changeView("Border");CSSE_showTag("Border");break};case"font":{CSSE_changeView("Font");CSSE_showTag("Font");break};case"background":{CSSE_changeView("Background");CSSE_showTag("Background");break};case"margin":{CSSE_changeView("Margin");CSSE_showTag("Margin");break};case"padding":{CSSE_changeView("Padding");CSSE_showTag("Padding");break};case"scale":{CSSE_changeView("Scale");CSSE_showTag("Scale");break};case"height":{CSSE_changeView("Height");CSSE_showTag("Height");break}}firstRun=false}switch(styleGroup.childNodes[y].nodeName){case"border":{CSSE_showTag("Border");break};case"font":{CSSE_showTag("Font");break};case"background":{CSSE_showTag("Background");break};case"margin":{CSSE_showTag("Margin");break};case"padding":{CSSE_showTag("Padding");break};case"scale":{CSSE_showTag("Scale");break};case"height":{CSSE_showTag("Height");break}}}}}}break}}}function loadStyle(){loadCSSXML();for(i=0;i<CSSXML.childNodes.length;i++){if(CSSXML.childNodes[i].nodeType!=3){for(x=0;x<CSSXML.childNodes[i].childNodes.length;x++){if(CSSXML.childNodes[i].childNodes[x].nodeType!=3){currentStyle=CSSXML.childNodes[i].childNodes[x].nodeName;styleGroup=CSSXML.childNodes[i].childNodes[x];for(y=0;y<styleGroup.childNodes.length;y++){for(z=0;z<styleGroup.childNodes[y].attributes.length;z++){bind(styleGroup.childNodes[y].attributes[z].name,styleGroup.childNodes[y].attributes[z].value,true)}}}}break}}}function bindToXML(e,t){for(i=0;i<CSSXML.childNodes.length;i++){if(CSSXML.childNodes[i].nodeType!=3){for(x=0;x<CSSXML.childNodes[i].childNodes.length;x++){if(CSSXML.childNodes[i].childNodes[x].nodeType!=3){styleGroup=CSSXML.childNodes[i].childNodes[x];if(styleGroup.nodeName==currentStyle){for(y=0;y<styleGroup.childNodes.length;y++){if(styleGroup.childNodes[y].nodeType!=3){for(z=0;z<styleGroup.childNodes[y].attributes.length;z++){if(styleGroup.childNodes[y].attributes[z].name==e){switch(_$(e).nodeName){case"SELECT":{styleGroup.childNodes[y].attributes[z].value=t;break};case"INPUT":{if(_$(e).attributes["type"].value=="checkbox"){if(_$(e).id=="font-weight"&&_$(e).checked==false){styleGroup.childNodes[y].attributes[z].value="normal"}else if(_$(e).id=="font-style"&&_$(e).checked==false){styleGroup.childNodes[y].attributes[z].value="normal"}else if(_$(e).id=="text-decoration"&&_$(e).checked==false){styleGroup.childNodes[y].attributes[z].value="none"}else{styleGroup.childNodes[y].attributes[z].value=t}}else{styleGroup.childNodes[y].attributes[z].value=t}break}}break}}}}}}}break}}}function isNumeric(e){var t=/^[0-9]+$/;if(e.match(t)){return true}else{return false}}function isUrl(e){var t=/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;return t.test(e)}function isHex(e){if(e=="transparent"){return true}else{var t=/^#[0-9a-fA-F]{3,6}$/i;return t.test(e)}}function bind(e,t,n){var r=new bindObject(e,t);if(verifyBindValue(r)==null){return false}if(!n){bindToXML(r.elm,r.value)}bindToElement(r.elm,r.value,n);ShowXML()}function bindObject(e,t){this.elm=e;this.value=t}function verifyBindValue(e){elm=e.elm;value=e.value;if(!value){value=elm.value}if(elm.id){elm=elm.id}if(elm=="width"){if(isNumeric(value)==false){return null}}if(elm=="height"){if(isNumeric(value)==false){return null}}if(elm=="background-image"){if(value&&value.length&&value.length>0&&value!=elm){if(isUrl(value)==false){return null}}else return null}if(elm=="border-color"||elm=="color"||elm=="background-color"){if(value){if(value.indexOf("#")==-1)value="#"+value;if(isHex(value.toLowerCase())==false)return null}}e.elm=elm;e.value=value;return true}function bindToElement(e,t,n){var r=new bindObject(e,t);if(verifyBindValue(r)==null){return false}if(_$(currentStyle)==null||_$(currentStyle)=="undefined"){return false}var t=r.value;var i=_$(currentStyle).style;switch(r.elm){case"border-width":{i.borderWidth=t;break};case"border-radius":{i.MozBorderRadius=t;i.WebkitBorderRadius=t;break};case"border-style":{i.borderStyle=t;break};case"border-color":{if(t=="Transpa"){_$("border-color").value=""}i.borderColor=t;break};case"font-size":{i.fontSize=t;break};case"font-family":{i.fontFamily=t;break};case"font-weight":{if(n==true&&firstRun==true){i.fontWeight=t}else{if(_$(e).checked){i.fontWeight=t}else{i.fontWeight="normal"}}break};case"font-style":{if(n==true&&firstRun==true){i.fontStyle=t}else{if(_$(e).checked){i.fontStyle=t}else{i.fontStyle="normal"}}break};case"text-decoration":{if(n==true&&firstRun==true){i.textDecoration=t}else{if(_$(e).checked){i.textDecoration=t}else{i.textDecoration="none"}}break};case"line-height":{i.lineHeight=t;break};case"text-align":{i.textAlign=t;break};case"float":{i.cssFloat=t;break};case"color":{if(t=="Transpa"){_$("color").value=""}i.color=t;break};case"background-color":{if(t=="Transpa"){_$("background-color").value=""}i.backgroundColor=t;break};case"background-image":{if(t!=="undefined")i.backgroundImage="url("+t+")";break};case"background-repeat":{i.backgroundRepeat=t;break};case"background-position":{i.backgroundPosition=t;break};case"margin-top":{i.marginTop=t;break};case"margin-right":{i.marginRight=t;break};case"margin-bottom":{i.marginBottom=t;break};case"margin-left":{i.marginLeft=t;break};case"padding-top":{i.paddingTop=t;break};case"padding-right":{i.paddingRight=t;break};case"padding-bottom":{i.paddingBottom=t;break};case"padding-left":{i.paddingLeft=t;break};case"width":{i.width=t+"px";break};case"height":{i.height=t+"px";break};case"direction":{i.direction=t;break}}var s=["pds-link","pds-answer-group","pds-answer-input","pds-answer-feedback","pds-answer-feedback-bar","pds-feedback-group","pds-feedback-result","pds-feedback-per","pds-feedback-votes","pds-answer-text","pds-answer"];for(var o in s){var u=s[o];if(currentStyle.indexOf(u)==-1)continue;if(currentStyle==u){currentStyle=u+"1";if(!bindToElement(r.elm,t,n))currentStyle=u;break}else if(currentStyle==u+"1"){currentStyle=u+"2";if(!bindToElement(r.elm,t,n))currentStyle=u;break}else if(currentStyle==u+"2"){currentStyle=u+"3";if(!bindToElement(r.elm,t,n))currentStyle=u;break}else if(currentStyle==u+"3"){currentStyle=u;break}}return true}function force_rtl(){_$("style-force-rtl").style.display="none";_$("style-force-ltr").style.display="inline-block";var e=["pds-feedback-per","pds-feedback-votes"];var t=["pds-answer-input","pds-link","pds-textfield","pds-vote-button","pds-answer-feedback-bar","pds-totalvotes-inner","pds-answer-text","pds-answer-text","pds-answer"];var n=["pds-question-top","pds-answer","pds-link","pds-textfield","pds-vote-button","pds-totalvotes-inner","pds-answer-text","pds-feedback-per","pds-feedback-votes","pds-textfield"];for(var r in e){currentStyle=e[r];bind("float","left",false)}for(var r in t){currentStyle=t[r];bind("float","right",false)}for(var r in n){currentStyle=n[r];bind("text-align","right",false)}currentStyle="pds-box";bind("direction","rtl",false)}function force_ltr(){_$("style-force-rtl").style.display="inline-block";_$("style-force-ltr").style.display="none";var e=["pds-feedback-per","pds-feedback-votes"];var t=["pds-answer-input","pds-link","pds-textfield","pds-vote-button","pds-answer-feedback-bar","pds-totalvotes-inner","pds-answer-text","pds-answer-text","pds-answer"];var n=["pds-question-top","pds-answer","pds-link","pds-textfield","pds-vote-button","pds-totalvotes-inner","pds-answer-text","pds-feedback-per","pds-feedback-votes","pds-textfield"];for(var r in t){currentStyle=t[r];bind("float","left",false)}for(var r in e){currentStyle=e[r];bind("float","right",false)}for(var r in n){currentStyle=n[r];bind("text-align","left",false)}currentStyle="pds-box";bind("direction","ltr",false)}function loadCSSXML(){if(window.ActiveXObject){CSSXML=new ActiveXObject("Microsoft.XMLDOM");CSSXML.loadXML(CSSXMLString)}else{CSSXML=document.implementation.createDocument("","",null);objDOMParser=new DOMParser;CSSXML=objDOMParser.parseFromString(CSSXMLString,"text/xml")}}function ShowXML(){if(window.ActiveXObject){var e=CSSXML.xml}else if(document.implementation&&document.implementation.createDocument){var t=new XMLSerializer;var e=t.serializeToString(CSSXML)}document.getElementById("S_www").value=e}function submitStyleCSS(){pass=true;if(_$("styleName").value.trim().length==0){pass=false;_$("styleNameErr").style.display="block"}else{_$("styleNameErr").style.display="none"}if(_$("styleCSS").value.trim().length==0){pass=false;_$("styleCSSErr").style.display="block"}else{_$("styleCSSErr").style.display="none"}if(pass){_$("editStyle").submit()}}function preload_style(){if(_$("preload_value").value!="0"){var e=window.location.href.split("#");window.location=e[0].replace(/(\&preload=(\d+))/g,"")+"&preload="+_$("preload_value").value}}document.onmousedown=mouseDown;var pd_map={thankyou:"Thank you for voting!",question:"Do you mostly use the internet at work, in school or at home?"};var currentTag="Background";var currentStyle;firstRun=true