You are on page 1of 3

var MOBILE=MOBILE||{};MOBILE.viewMode=MOBILE.viewMode||"full";MOBILE.

deviceType=
MOBILE.deviceType||"other";MOBILE.currentSection="content";MOBILE.orientation=""
;MOBILE.toolbarFactor=0;MOBILE.mobileViewHeight=0;MOBILE.footerHeight=0;MOBILE.u
serAgent=MOBILE.userAgent||"";MOBILE.toolbarEl=null;MOBILE.toolbarInnerWrapperEl
=null;MOBILE.mobileBtnEl=null;MOBILE.navBtnEl=null;MOBILE.toTopBtnEl=null;MOBILE
.contentColumnWidth=0;MOBILE.changeViewMode=function(mode){if(mode==="full"){doc
ument.cookie="fullView=true";window.location.reload();}else if(mode==="mobile"){
document.cookie="fullView=false";window.location.reload();}};MOBILE.setHeaderHei
ght=function(){var header=document.getElementById("Header");var headerLiner=head
er.querySelector(".Liner");var headerLinerBgUrl=window.getComputedStyle(headerLi
ner,null).getPropertyValue("background-image");if(headerLinerBgUrl==='none'){ret
urn;}var phantomHeaderImage=document.createElement("img");var newHeight=0;phanto
mHeaderImage.src=headerLinerBgUrl.replace(/^url\(["']?/,'').replace(/["']?\)$/,'
');phantomHeaderImage.className="phantomHeaderImage";phantomHeaderImage.width=h
eader.offsetWidth;header.appendChild(phantomHeaderImage);var readNewHeight=funct
ion(){newHeight=phantomHeaderImage.offsetHeight-3;if(newHeight>0){headerLiner.st
yle.minHeight=newHeight+"px";headerLiner.style.height="auto";if(MOBILE.viewMode=
=="mobile"){MOBILE.setFooterPosition();}}};if(phantomHeaderImage.complete){readN
ewHeight();}else{phantomHeaderImage.onload=function(){readNewHeight();}}var onRe
size=function(){phantomHeaderImage.width=header.offsetWidth;readNewHeight();};if
(MOBILE.viewMode==="mobile"){window.addEventListener("resize",onResize,true);}};
MOBILE.fullBtnText=MOBILE.fullBtnText||'Full Site';MOBILE.mobileBtnText=MOBILE.m
obileBtnText||'View Mobile Site';MOBILE.navBtnText=MOBILE.navBtnText||'Navigatio
n';MOBILE.toTopBtnText=MOBILE.toTopBtnText||'Back to Top';MOBILE.addToolbars=fun
ction(){var body=document.getElementsByTagName("body")[0];var pageWrapper=docume
nt.getElementById("PageWrapper");var navColumnEl=document.getElementById("NavCol
umn");var toolbarEl=document.createElement("div");var toolbarInnerWrapperEl=docu
ment.createElement("div");toolbarEl.setAttribute("id","toolbar");toolbarInnerWra
pperEl.setAttribute("id","toolbarInnerWrapper");toolbarInnerWrapperEl.innerHTML=
'<button id="fullBtn">'+MOBILE.fullBtnText+'</button>'+'<button id="mobileBtn">'
+MOBILE.mobileBtnText+'</button>'+'<button id="navBtn">'+MOBILE.navBtnText+'</bu
tton>'+'<button id="toTopBtn">'+MOBILE.toTopBtnText+'</button>';toolbarEl.append
Child(toolbarInnerWrapperEl);body.insertBefore(toolbarEl,pageWrapper);MOBILE.too
lbarEl=toolbarEl;MOBILE.toolbarInnerWrapperEl=toolbarInnerWrapperEl;if(MOBILE.vi
ewMode==="full"){toolbarEl.style.display="none";}var fullBtnEl=document.getEleme
ntById("fullBtn");var mobileBtnEl=document.getElementById("mobileBtn");var navBt
nEl=document.getElementById("navBtn");var toTopBtnEl=document.getElementById("to
TopBtn");MOBILE.mobileBtnEl=mobileBtnEl;MOBILE.navBtnEl=navBtnEl;MOBILE.toTopBtn
El=toTopBtnEl;fullBtnEl.onclick=function(){MOBILE.changeViewMode("full");};mobil
eBtnEl.onclick=function(){MOBILE.changeViewMode("mobile");};navBtnEl.onclick=fun
ction(){MOBILE.scrollTo(navColumnEl.offsetTop-35);MOBILE.switchButton("top");};t
oTopBtnEl.onclick=function(){MOBILE.scrollTo(0);MOBILE.switchButton("nav");};};M
OBILE.resizeToolbar=function(){var horizontalSpace=screen.width;var dpr=1;if(win
dow.devicePixelRatio!==undefined){dpr=window.devicePixelRatio;}if(MOBILE.userAge
nt.match(/iPhone/i)||(MOBILE.userAgent.match(/Android/i)&&MOBILE.userAgent.match
(/Chrome/i))){if((window.orientation===90)||(window.orientation===-90)){horizont
alSpace=screen.height;}}var toolbarFactor=window.innerWidth/(horizontalSpace/dpr
);if(toolbarFactor>3){toolbarFactor=3;}if(toolbarFactor!==MOBILE.toolbarFactor){
MOBILE.toolbarFactor=toolbarFactor;var newPadding=2*toolbarFactor;newPadding=new
Padding.toFixed(2)+"px";var newFontSize=12*toolbarFactor;newFontSize=newFontSize
.toFixed(2)+"px";MOBILE.mobileBtnEl.style.fontSize=newFontSize;MOBILE.toolbarEl.
style.padding=newPadding;MOBILE.toolbarEl.style.display="block";}};MOBILE.refres
hToolbar=function(){MOBILE.toolbarEl.style.display="none";setTimeout(function(){
MOBILE.toolbarEl.style.display="block";MOBILE.toolbarInnerWrapperEl.style.width=
window.innerWidth+"px";},500);};MOBILE.detectCurrentSection=function(){var navCo
lumnEl=document.getElementById("NavColumn");if(!navColumnEl){return;}var navColu
mnTopPosition=navColumnEl.offsetTop;if((navColumnTopPosition-window.pageYOffset-
window.innerHeight)<0){if(MOBILE.currentSection==="content"){MOBILE.switchButton
("top");MOBILE.currentSection="navigation";}}else{if(MOBILE.currentSection==="na
vigation"){MOBILE.switchButton("nav");MOBILE.currentSection="content";}}};MOBILE
.switchButton=function(targetBtn){if(targetBtn==="top"){MOBILE.navBtnEl.style.di
splay="none";MOBILE.toTopBtnEl.style.display="inline-block";}else{MOBILE.toTopBt
nEl.style.display="none";MOBILE.navBtnEl.style.display="inline-block";}};MOBILE.
scrollTo=function(y){var body=document.getElementsByTagName("body")[0];var div=d
ocument.createElement("div");div.className="iosbtnfix";body.appendChild(div);win
dow.scrollTo(0,y);setTimeout(function(){body.removeChild(document.querySelectorA
ll(".iosbtnfix")[0]);},500);};MOBILE.orientationMarker=function(){if((window.ori
entation===90)||(window.orientation===-90)){document.documentElement.className=d
ocument.documentElement.className.replace(/(^|\s+)portrait(\s+|$)/,' ');document
.documentElement.className+=" landscape";MOBILE.orientation="landscape";}else{do
cument.documentElement.className=document.documentElement.className.replace(/(^|
\s+)landscape(\s+|$)/,' ');document.documentElement.className+=" portrait";MOBIL
E.orientation="portrait";}};MOBILE.setFooterPosition=function(){var footerEl=doc
ument.getElementById("Footer");var NavColumnEl=document.getElementById("NavColum
n");var ExtraColumnEl=document.getElementById("ExtraColumn");if(!NavColumnEl&&!E
xtraColumnEl){return;}var mobileViewHeight=NavColumnEl.offsetTop-parseInt(window
.getComputedStyle(NavColumnEl,null).getPropertyValue("margin-top"),10);var foote
rHeight=footerEl.offsetHeight;if(mobileViewHeight!==MOBILE.mobileViewHeight){foo
terEl.style.top=mobileViewHeight+"px";MOBILE.mobileViewHeight=mobileViewHeight;}
if(footerHeight!==MOBILE.footerHeight){NavColumnEl.style.marginTop=footerHeight+
"px";if(ExtraColumnEl){ExtraColumnEl.style.marginTop=footerHeight+"px";}MOBILE.f
ooterHeight=footerHeight;}};MOBILE.fixImageProportions=function(){MOBILE.content
ColumnWidth=parseInt(MOBILE.contentColumnWidth);if(MOBILE.contentColumnWidth>300
){var images=document.querySelectorAll("#ContentColumn .Liner > .ItemCenter > im
g, #ContentColumn .Liner > .ItemLeft > img, #ContentColumn .Liner > .ItemRight >
img, #ContentColumn .Liner > .ImageBlock > img, #ContentColumn .Liner > .ItemCe
nter > a > img, #ContentColumn .Liner > .ItemLeft > a > img, #ContentColumn .Lin
er > .ItemRight > a > img, #ContentColumn .Liner > .ImageBlock > a > img, #Conte
ntColumn .Liner > .ImageBlock > .noalignment > a > img, #ContentColumn .Liner >
.ImageBlock > .noalignment > img");var width=0;var originalAttributeWidth=0;var
borderLeft=0;var borderRight=0;var marginLeft=0;var marginRight=0;var newWidth;v
ar parent=null;var noalignmentNode=null;var captionEl=null;function setPercentag
eWidth(img){borderLeft=parseInt(window.getComputedStyle(img,null).getPropertyVal
ue("border-left-width"),10);borderRight=parseInt(window.getComputedStyle(img,nul
l).getPropertyValue("border-right-width"),10);marginLeft=parseInt(window.getComp
utedStyle(img,null).getPropertyValue("margin-left"),10);marginRight=parseInt(win
dow.getComputedStyle(img,null).getPropertyValue("margin-right"),10);captionEl=im
g.parentNode.getElementsByClassName("Caption")[0];width=img.getAttribute('width'
)?+img.getAttribute('width'):img.naturalWidth;if(width===0){return;}if(width<MOB
ILE.contentColumnWidth){newWidth=((width+borderLeft+borderRight)/MOBILE.contentC
olumnWidth)*100;newWidth=newWidth.toFixed(2)+"%";parent=img.parentNode;if(parent
.tagName==="A"){parent=parent.parentNode;}if(parent.className==="noalignment"){n
oalignmentNode=parent;parent=parent.parentNode;}if(parent.className.match(/ItemL
eft|ItemRight|ImageBlockLeft|ImageBlockRight/i)){parent.style.width=newWidth;if(
marginLeft>0){img.style.marginLeft=0;if(captionEl){captionEl.style.marginLeft=0;
}parent.style.paddingLeft=marginLeft+"px";}if(marginRight>0){img.style.marginRig
ht=0;if(captionEl){captionEl.style.marginRight=0;}parent.style.paddingRight=marg
inRight+"px";}if(captionEl){captionEl.style.width="100%";captionEl.style.maxWidt
h='100%';}img.setAttribute("width","100%");}else{img.setAttribute("width",newWid
th);if(captionEl){captionEl.style.width=newWidth;if(parent.className.match(/Item
Center|ImageBlockCenter/i)){captionEl.style.marginLeft="auto";captionEl.style.ma
rginRight="auto";}}if(noalignmentNode){noalignmentNode.style.width="100%";}}}}fo
r(var i=0,ilen=images.length;i<ilen;i++){var widthAttribute=images[i].getAttribu
te("width");if((widthAttribute!==null)&&(widthAttribute[widthAttribute.length-1]
==="%")){continue;}(function(img){if(img.complete){setPercentageWidth(img);}else
{img.onload=function(){setPercentageWidth(img);}}}(images[i]));}}};MOBILE.fixAdA
lignment=function(){var ads;var i,ilen;ads=document.querySelectorAll("#ContentCo
lumn .wasAdSenseBoxLeft");for(i=0,ilen=ads.length;i<ilen;i++){ads[i].className=a
ds[i].className.replace(/(^|\s+)wasAdSenseBoxLeft(\s+|$)/,' ');ads[i].className+
=" AdSenseBoxLeft";}ads=document.querySelectorAll("#ContentColumn .wasAdSenseBox
Right");for(i=0,ilen=ads.length;i<ilen;i++){ads[i].className=ads[i].className.re
place(/(^|\s+)wasAdSenseBoxRight(\s+|$)/,' ');ads[i].className+=" AdSenseBoxRigh
t";}ads=document.querySelectorAll("#ContentColumn .AdSenseBoxLeft, #ContentColum
n .AdSenseBoxRight");for(i=0,ilen=ads.length;i<ilen;i++){if((ads[i].clientWidth/
MOBILE.viewportWidth())>0.6){if(/(^|\s)AdSenseBoxLeft(\s|$)/.test(ads[i].classNa
me)){ads[i].className=ads[i].className.replace(/(^|\s+)AdSenseBoxLeft(\s+|$)/,'
');ads[i].className+=" wasAdSenseBoxLeft";}else if(/(^|\s)AdSenseBoxRight(\s|$)/
.test(ads[i].className)){ads[i].className=ads[i].className.replace(/(^|\s+)AdSen
seBoxRight(\s+|$)/,' ');ads[i].className+=" wasAdSenseBoxRight";}ads[i].style.te
xtAlign="center";ads[i].style.clear="both";}}};MOBILE.startLoop=function(f,optio
ns){var counter=0;var max=options.max||120;var delay=options.delay||500;var loop
=function(){counter++;if(counter>max){if(typeof options.callback!=='undefined'){
options.callback();}return;}f();setTimeout(function(){loop();},delay);};loop();}
;MOBILE.doOnOrientationChange=function(){MOBILE.orientationMarker();MOBILE.start
Loop(MOBILE.setFooterPosition,{max:5,delay:100});MOBILE.refreshToolbar();MOBILE.
startLoop(MOBILE.fixImageProportions,{max:2,delay:1500});MOBILE.startLoop(MOBILE
.fixAdAlignment,{max:2,delay:1500});};MOBILE.removeDesktopOnly=function(){var de
sktopOnlyItems=document.querySelectorAll(".desktopOnly");for(var i=0,ilen=deskto
pOnlyItems.length;i<ilen;i++){var desktopOnlyItem=desktopOnlyItems[i];desktopOnl
yItem.parentNode.removeChild(desktopOnlyItem);}};MOBILE.doEndOfBody=function(){i
f(MOBILE.deviceType==="mobile"){MOBILE.addToolbars();if(MOBILE.userAgent.match(/
BlackBerry|Android 2/i)){MOBILE.toolbarEl.style.position="absolute";window.addEv
entListener("scroll",function(){MOBILE.toolbarEl.style.top=window.scrollY+'px';}
,false);}if(MOBILE.viewMode==="full"){setInterval(MOBILE.resizeToolbar,100);wind
ow.addEventListener("resize",MOBILE.resizeToolbar,false);}else{MOBILE.setHeaderH
eight();MOBILE.orientationMarker();window.addEventListener("orientationchange",M
OBILE.doOnOrientationChange,false);if(!MOBILE.userAgent.match(/iPhone/i)){window
.addEventListener("resize",MOBILE.refreshToolbar,false);}MOBILE.setFooterPositio
n();MOBILE.startLoop(MOBILE.setFooterPosition,{max:960,delay:500});window.addEve
ntListener("scroll",MOBILE.detectCurrentSection,false);MOBILE.removeDesktopOnly(
);MOBILE.fixImageProportions();MOBILE.fixAdAlignment();}if(typeof mobileSandBox!
=='undefined'){var navColumnEl=document.getElementById("NavColumn");var extraCol
umnEl=document.getElementById("ExtraColumn");if(navColumnEl){navColumnEl.style.d
isplay="none";}if(extraColumnEl){extraColumnEl.style.display="none";}}}};MOBILE.
viewportWidth=function(){var viewportWidth;if(typeof window.innerWidth!="undefin
ed"){viewportWidth=window.innerWidth;}else if(typeof document.documentElement!="
undefined"&&typeof document.documentElement.offsetWidth!="undefined"&&document.d
ocumentElement.offsetWidth!=0){viewportWidth=document.documentElement.offsetWidt
h;}else{viewportWidth=document.getElementsByTagName('body')[0].offsetWidth;}retu
rn viewportWidth;};

You might also like