var savedTarget=null;var orgCursor=null;var dragOK=false;var dragXoffset=0;var dragYoffset=0;var xrayType=1;function moveHandler(a){if(a==null){a=window.event}if(a.button<=1&&dragOK){savedTarget.style.left=a.clientX-dragXoffset+"px";savedTarget.style.top=a.clientY-dragYoffset+"px";return false}}function cleanup(a){document.onmousemove=null;document.onmouseup=onNeedXRay;savedTarget.style.cursor="move";dragOK=false;didDrag=true}function dragHandler(b){if(xrayType==2){return}if(b==null){b=window.event}var a=b.target!=null?b.target:b.srcElement;orgCursor=a.style.cursor;if(isInspector(a)){a=document.getElementById("XRInspector");savedTarget=a;a.style.cursor="move";dragOK=true;dragXoffset=b.clientX-a.offsetLeft;dragYoffset=b.clientY-a.offsetTop;document.onmousemove=moveHandler;document.onmouseup=cleanup;return false}else{hideAll()}}function getOffsetCoords(b){if(b.currentStyle){if(b.currentStyle.position=="relative"){b.style.zoom="100%"}}var c=0;var a=0;if(b.offsetParent){c=b.offsetLeft;a=b.offsetTop;
while(b=b.offsetParent){if(b.currentStyle){if(b.currentStyle.position=="relative"){b.style.zoom="100%"}}c+=b.offsetLeft;a+=b.offsetTop}}return[c,a]}function getCssProperty(c,b){if(!document.defaultView){b=cssToName(b)}if(c.currentStyle){var d=c.currentStyle[b]}else{if(window.getComputedStyle){var d=document.defaultView.getComputedStyle(c,null).getPropertyValue(b)}else{var a=document.defaultView.getComputedStyle(c,null);d=a.getPropertyValue(b)}}return d}function cssToName(d){if(d.indexOf("-")!=0){var a=new Array();a=d.split("-")}var c=a[0];for(var b=1;b<a.length;b++){var e=a[b].substring(0,1).toUpperCase();c=c+e+a[b].substring(1,a[b].length)}if(c=="float"){c="styleFloat"}return c}function toIntVal(a){if(a=="medium"){return 4}if(a=="thin"){return 2}if(a=="thick"){return 6}var b=a.substr(0,a.length-2).valueOf();if(isNaN(b)){return 0}else{return parseInt(b)}}function getClientSize(){var b=0;var a=0;if(typeof(window.innerWidth)=="number"){b=window.innerWidth;a=window.innerHeight}else{if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){b=document.documentElement.clientWidth;
a=document.documentElement.clientHeight}else{if(document.body&&(document.body.clientWidth||document.body.clientHeight)){b=document.body.clientWidth;a=document.body.clientHeight}}}return[a,b]}function getClientWidth(){if(document.body.scrollWidth){return document.body.scrollWidth}else{return document.documentElement.offsetWidth}}function getClientHeight(){if(document.body.scrollHeight){return document.body.scrollHeight}else{return document.documentElement.offsetHeight}}function makeOrGetElem(a){var b=document.getElementById(a);if(!b){var b=document.createElement("div");document.body.appendChild(b);b.id=a;b.onmousedown=hideAll}return b}function findNextSibling(a){if(a){for(a=a.nextSibling;(a&&a.nodeType==3);a=a.nextSibling){}}if(!a){return(a)}if(a.nodeName=="SCRIPT"){return}if(a.id=="XRBaseDiv"){return}return(a)}function findPreviousSibling(a){for(a=a.previousSibling;(a&&a.nodeType==3);a=a.previousSibling){}return(a)}function findFirstChild(c){var b=c.childNodes;if(!b){return c}if(c.nodeName=="HTML"){return document.body
}for(var a=0;a<b.length;a++){var d=b[a];if(d.nodeName!=="#text"){break}}if(!d){return c}if(d.nodeName=="SCRIPT"){return c}if(d.nodeName=="#text"){return c}return d}function isInspector(a){if(a.id=="XRInspector"){return true}if(a.parentNode){while(a=a.parentNode){if(a.id=="XRInspector"){return true}}}}function hideAll(){hideOverlays();hideHints();hideInspector()}function makeOverlays(){var a=document.createElement("div");document.body.appendChild(a);a.id="XRBaseDiv";a.onmousedown=hideAll;var b=document.createElement("div");a.appendChild(b);b.id="XRTopDiv";b.onmousedown=hideAll;b.innerHTML="<!-- empty -->";var b=document.createElement("div");a.appendChild(b);b.id="XRLeftDiv";b.onmousedown=hideAll;var b=document.createElement("div");a.appendChild(b);b.id="XRBottomDiv";b.onmousedown=hideAll;var b=document.createElement("div");a.appendChild(b);b.id="XRRightDiv";b.onmousedown=hideAll;var b=document.createElement("div");a.appendChild(b);b.id="XRTopMargin";b.onmousedown=hideAll;var b=document.createElement("div");
a.appendChild(b);b.id="XRLeftMargin";b.onmousedown=hideAll;var b=document.createElement("div");a.appendChild(b);b.id="XRBottomMargin";b.onmousedown=hideAll;var b=document.createElement("div");a.appendChild(b);b.id="XRRightMargin";b.onmousedown=hideAll;var b=document.createElement("div");a.appendChild(b);b.id="XRTopPadding";b.onmousedown=hideAll;var b=document.createElement("div");a.appendChild(b);b.id="XRLeftPadding";b.onmousedown=hideAll;var b=document.createElement("div");a.appendChild(b);b.id="XRBottomPadding";b.onmousedown=hideAll;var b=document.createElement("div");a.appendChild(b);b.id="XRRightPadding";b.onmousedown=hideAll}function hideOverlays(){var a=null;try{a=document.getElementById("XRBaseDiv");a.style.visibility="hidden";a=document.getElementById("XRTopDiv");a.style.visibility="hidden";a=document.getElementById("XRLeftDiv");a.style.visibility="hidden";a=document.getElementById("XRBottomDiv");a.style.visibility="hidden";a=document.getElementById("XRRightDiv");a.style.visibility="hidden";
a=document.getElementById("XRTopMargin");a.style.visibility="hidden";a=document.getElementById("XRLeftMargin");a.style.visibility="hidden";a=document.getElementById("XRBottomMargin");a.style.visibility="hidden";a=document.getElementById("XRRightMargin");a.style.visibility="hidden";a=document.getElementById("XRTopPadding");a.style.visibility="hidden";a=document.getElementById("XRLeftPadding");a.style.visibility="hidden";a=document.getElementById("XRBottomPadding");a.style.visibility="hidden";a=document.getElementById("XRRightPadding");a.style.visibility="hidden"}catch(b){}}function setHintStyle(b){try{b.style.position="absolute";b.style.border="1px solid #FFFFFF";b.style.backgroundColor="#3399FF";b.style.color="#FFFFFF";b.style.fontFamily="Tahoma";b.style.fontSize="9pt";b.style.padding="2px"}catch(a){}}function makeHints(){var a=document.createElement("div");document.body.appendChild(a);a.id="XRWidthBox";setHintStyle(a);a.onmousedown=hideAll;var a=document.createElement("div");document.body.appendChild(a);
a.id="XRHeightBox";setHintStyle(a);a.onmousedown=hideAll;var a=document.createElement("div");document.body.appendChild(a);a.id="XRPosBox";setHintStyle(a);a.onmousedown=hideAll}function hideHints(){var a=null;if(xrayType==2){return}try{a=document.getElementById("XRWidthBox");a.style.visibility="hidden";a=document.getElementById("XRHeightBox");a.style.visibility="hidden";a=document.getElementById("XRPosBox");a.style.visibility="hidden"}catch(b){}}function makeInspector(){var a=document.createElement("div");document.body.appendChild(a);a.id="XRInspector";a.style.position="absolute";a.style.fontFamily="Tahoma";a.style.fontSize="8pt";a.style.color="#333333";a.style.display="inline";a.style.textAlign="left";a.style.border="solid 1px #CCCCCC";a.style.backgroundColor="#E8F3FF";a.style.left=10;a.style.top=10;a.style.width=180;a.style.visibility="hidden";a.style.cursor="move";a.style.zindex="1111";a.onmousedown=hideAll}function hideInspector(){if(xrayType==2){return}try{var a=document.getElementById("XRInspector");
a.style.visibility="hidden"}catch(b){}}function showInspector(c){var a=document.getElementById("XRInspector");a.style.visibility="visible";var b='<div style="padding: 5px; color: white; background-color: #3399FF"><b>XRay Inspector</b> [drag & drop]</div>';b=b+'<div style="padding: 5px"><b>element:</b> '+c.tagName+"<br>";if(c.className!=""){b=b+"<b>class:</b> "+c.className+"<br>"}if(c.id!=""){b=b+"<b>id:</b> "+c.id+"<br>"}b=b+"<b>width:</b> "+getCssProperty(c,"width")+" ("+c.offsetWidth+"px)<br>";b=b+"<b>height:</b> "+getCssProperty(c,"height")+" ("+c.offsetHeight+"px)<br>";b=b+"<b>position:</b> "+getCssProperty(c,"position")+"<br>";b=b+"<b>float:</b> "+getCssProperty(c,"float")+"<br>";b=b+'<hr style="color: #CCCCCC; height: 1px">';b=b+'<div style="width: 160px;">';b=b+'<div style="text-align: center; width: 80px; float: left">';b=b+"<b>margin</b><br>";b=b+"top: "+getCssProperty(c,"margin-top")+"<br>";b=b+"right: "+getCssProperty(c,"margin-right")+"<br>";b=b+"bottom: "+getCssProperty(c,"margin-bottom")+"<br>";
b=b+"left: "+getCssProperty(c,"margin-left")+"<br>";b=b+"</div>";b=b+'<div style="text-align: center; width: 80px; float: left">';b=b+"<b>padding</b><br>";b=b+"top: "+getCssProperty(c,"padding-top")+"<br>";b=b+"right: "+getCssProperty(c,"padding-right")+"<br>";b=b+"bottom: "+getCssProperty(c,"padding-bottom")+"<br>";b=b+"left: "+getCssProperty(c,"padding-left")+"<br>";b=b+"</div>";b=b+"</div>";if(c.style.cssText!=""){b=b+'<hr style="color: #CCCCCC; height: 1px">';b=b+"<b>style code:</b><br>"+c.style.cssText.toLowerCase()+"<br>"}a.innerHTML=b+"</div>"}function showWHint(b){var a=document.getElementById("XRWidthBox");if(!a||!a.style){return}a.style.visibility="visible";var f=getOffsetCoords(b);var e=b.offsetWidth;var d=f[0]+(e/2)-(a.offsetWidth/2);var c=b.offsetHeight+f[1]+10;if(d<0){d=50}if(d>window.innerWidth){d=window.innerWidth-a.offsetWidth-10}if(c<0){c=10}a.style.left=d+"px";a.style.top=c+"px";a.innerHTML=getCssProperty(b,"width")}function showHHint(c){var b=document.getElementById("XRHeightBox");
if(!b||!b.style){return}b.style.visibility="visible";var f=getOffsetCoords(c);var a=c.offsetHeight;var e=f[0]-(b.offsetWidth)-10;var d=f[1]+(a/2)-(b.offsetHeight/2);if(e<0){e=10}if(e>window.innerWidth){e=window.innerWidth-b.offsetWidth-10}if(d<0){d=10}b.style.left=e+"px";b.style.top=d+"px";b.innerHTML=getCssProperty(c,"height")}function showPosHint(b){var a=document.getElementById("XRPosBox");if(!a||!a.style){return}a.style.visibility="visible";var e=getOffsetCoords(b);var d=e[0]-(a.offsetWidth/2);var c=e[1]-(a.offsetHeight)-10;if(d<0){d=50}if(d>window.innerWidth){d=window.innerWidth-a.offsetWidth-10}if(c<0){c=10}a.style.left=d+"px";a.style.top=c+"px";a.innerHTML=e[1]+"px, "+e[0]+"px"}function setMainOverlay(f,b,h,i){var d=makeOrGetElem("XRBaseDiv");d.style.visibility="visible";d.style.left="0px";d.style.top="0px";if(f<0){f=0}if(i<0){i=0}if(f>0){var j=makeOrGetElem("XRTopDiv");j.style.position="absolute";j.style.left="0px";j.style.top="0px";j.style.width=getClientWidth();j.style.height=f+"px";
j.style.visibility="visible";j.style.backgroundColor="#000000";j.style.fontSize=0;j.style.lineHeight=0;j.style.opacity=0.5;j.style.filter="alpha(opacity=50)"}if(getClientHeight()-(f+i)>0){var e=getClientHeight()-(f+i)}else{e=0}if(e>0){var c=makeOrGetElem("XRBottomDiv");c.style.position="absolute";c.style.left="0px";c.style.height=e+"px";c.style.top=i+f+"px";c.style.width=getClientWidth();c.style.visibility="visible";c.style.backgroundColor="#000000";c.style.fontSize=0;c.style.lineHeight=0;c.style.opacity=0.5;c.style.filter="alpha(opacity=50)"}if((i>0)&&(b>0)){var k=makeOrGetElem("XRLeftDiv");k.style.position="absolute";k.style.left="0px";k.style.top=f+"px";k.style.width=b+"px";k.style.height=i+"px";k.style.visibility="visible";k.style.backgroundColor="#000000";k.style.fontSize=0;k.style.lineHeight=0;k.style.opacity=0.5;k.style.filter="alpha(opacity=50)";var g=makeOrGetElem("XRRightDiv");g.style.position="absolute";g.style.left=b+h+"px";g.style.top=f+"px";var a="0px";if(getClientWidth()-(b+h)>0){a=getClientWidth()-(b+h)+"px"
}g.style.width=a;g.style.height=i+"px";g.style.visibility="visible";g.style.backgroundColor="#000000";g.style.fontSize=0;g.style.lineHeight=0;g.style.opacity=0.5;g.style.filter="alpha(opacity=50)"}}function setOverlay(a,g,d,f,c,b){if((f<1)||(c<1)){return}if(g<0){g=0}var e=makeOrGetElem(a);e.style.position="absolute";e.style.visibility="visible";e.style.left=d+"px";e.style.top=g+"px";e.style.width=c+"px";e.style.height=f+"px";e.style.backgroundColor=b;e.style.fontSize=0;e.style.lineHeight=0;e.style.opacity=0.5;e.style.filter="alpha(opacity=50)"}function doXRay(h){if(!h){return}xrayedElement=h;hideAll();var g=getOffsetCoords(h);var l=parseInt(g[1]);var d=parseInt(g[0]);var n=h.offsetWidth.valueOf();var o=h.offsetHeight.valueOf();var b=toIntVal(getCssProperty(h,"margin-top"));var j=toIntVal(getCssProperty(h,"margin-bottom"));var i=toIntVal(getCssProperty(h,"margin-left"));var m=toIntVal(getCssProperty(h,"margin-right"));var p=toIntVal(getCssProperty(h,"padding-top"));var c=toIntVal(getCssProperty(h,"padding-bottom"));
var f=toIntVal(getCssProperty(h,"padding-left"));var e=toIntVal(getCssProperty(h,"padding-right"));var k=n+i+m;var a=o+b+j;setMainOverlay(l-b,d-i,k,a);setOverlay("XRTopMargin",l-b,d-i,b,k,"#0066FF");setOverlay("XRLeftMargin",l,d-i,o,i,"#0066FF");setOverlay("XRBottomMargin",l+o,d-i,j,k,"#0066FF");setOverlay("XRRightMargin",l,d+n,o,m,"#0066FF");setOverlay("XRTopPadding",l,d,p,n,"#FF6600");setOverlay("XRLeftPadding",l+p,d,o-p-c,f,"#FF6600");setOverlay("XRBottomPadding",l+o-c,d,c,n,"#FF6600");setOverlay("XRRightPadding",l+p,d+n-e,o-p-c,e,"#FF6600");showInspector(h);showWHint(h);showHHint(h);showPosHint(h)}function onNeedXRay(b){if(!b){var b=window.event}var a=null;if(b.target){a=b.target}else{if(b.srcElement){a=b.srcElement}}while(a.nodeName=="#text"){a=a.parentNode}if(isInspector(a)){return false}doXRay(a);return false}function onKeyPress(b){var a;if(window.event){a=window.event.keyCode}else{if(b){a=b.which}}switch(a){case 37:if(findPreviousSibling(xrayedElement)){doXRay(findPreviousSibling(xrayedElement))
}return false;break;case 39:if(findNextSibling(xrayedElement)){doXRay(findNextSibling(xrayedElement))}return false;break;case 38:if(xrayedElement.parentNode){while(xrayedElement.parentNode.nodeName=="#text"){xrayedElement=xrayedElement.parentNode}if(!(xrayedElement.nodeName=="HTML")){doXRay(xrayedElement.parentNode)}return false}break;case 40:if(findFirstChild(xrayedElement)){doXRay(findFirstChild(xrayedElement))}return false;break;default:return true}}function enableXRay(){xrayType=1;makeOverlays();makeHints();makeInspector();if(document.detachEvent){document.detachEvent("onclick")}window.onresize=null;document.onclick=onNeedXRay;document.onmouseup=onNeedXRay;document.onkeydown=onKeyPress;document.onmousedown=dragHandler;var a=document.getElementById("XRInspector");a.onmousedown=dragHandler;window.onresize=hideAll;return true}function doXRay2(F){while(F.nodeName=="#text"){F=F.parentNode}if(!F){return}hideAll2();var E=getOffsetCoords(F);var D=parseInt(E[1]);var C=parseInt(E[0]);var B=F.offsetWidth.valueOf();
var A=F.offsetHeight.valueOf();var z=toIntVal(getCssProperty(F,"margin-top"));var y=toIntVal(getCssProperty(F,"margin-bottom"));var x=toIntVal(getCssProperty(F,"margin-left"));var w=toIntVal(getCssProperty(F,"margin-right"));var v=toIntVal(getCssProperty(F,"padding-top"));var u=toIntVal(getCssProperty(F,"padding-bottom"));var t=toIntVal(getCssProperty(F,"padding-left"));var s=toIntVal(getCssProperty(F,"padding-right"));var r=B+x+w;var q=A+z+y;setMainOverlay(D-z,C-x,r,q);setOverlay("XRTopMargin",D-z,C-x,z,r,"#0066FF");setOverlay("XRLeftMargin",D,C-x,A,x,"#0066FF");setOverlay("XRBottomMargin",D+A,C-x,y,r,"#0066FF");setOverlay("XRRightMargin",D,C+B,A,w,"#0066FF");setOverlay("XRTopPadding",D,C,v,B,"#FF6600");setOverlay("XRLeftPadding",D+v,C,A-v-u,t,"#FF6600");setOverlay("XRBottomPadding",D+A-u,C,u,B,"#FF6600");setOverlay("XRRightPadding",D+v,C+B-s,A-v-u,s,"#FF6600")}function hideAll2(){if(xrayType==1){return}try{hideOverlays()}catch(a){}}function documentClickListener(d){hideAll2();var c=(window.event)?window.event.srcElement:d.target;
var a=document.getElementsByTagName(c.tagName);for(var b=0;b<a.length;++b){if(a[b]==c&&console&&console.log){console.log("WB Sync:"+(b+1)+":"+c.tagName)}}return false}function enableXRay2(){if(c){return}var a=document.getElementById("XRBaseDiv");if(!a){makeOverlays()}window.onresize=hideAll2;if(document.attachEvent){document.attachEvent("onclick",hideAll2)}else{document.onclick=documentClickListener}document.onmouseup=hideAll2;document.onkeydown=hideAll2;var c=true;return true}function findPosX(a){var b=0;if(a.offsetParent){b=a.offsetLeft;while(a=a.offsetParent){b+=a.offsetLeft}}return[b]}function findPosY(b){var a=0;if(b.offsetParent){a=b.offsetTop;while(b=b.offsetParent){a+=b.offsetTop}}return[a]}function xRayElementBySourceIdx(e,b){xrayType=b;var a=e;var f=document.all[e];while(f&&e>0&&f.sourceIndex>a){e--;f=document.all[e]}if(!f){return}var d=findPosX(f);f.scrollIntoView("true");var c=findPosY(f);self.scroll(d-300,c-100);if(b==1){enableXRay();doXRay(f)}else{enableXRay2();doXRay2(f)}}function xRayElementByXPath(f,a){xrayType=a;
var c=document.evaluate(f,document,null,XPathResult.ANY_TYPE,null);var e=c.iterateNext();if(!e){return}var d=findPosX(e);e.scrollIntoView("true");var b=findPosY(e);self.scroll(d-300,b-100);if(a==1){enableXRay();doXRay(e)}else{enableXRay2();doXRay2(e)}}function xRayInit(a){if(a==1){enableXRay()}else{enableXRay2()}};