var manual_or_random="manual",randomsetting="3 days";function getCookie(b){var a=new RegExp(b+"=[^;]+","i");if(document.cookie.match(a))return document.cookie.match(a)[0].split("=")[1];return null}function setCookie(d,c,b){var a=new Date,e=typeof b!="undefined"?a.setDate(a.getDate()+parseInt(b)):a.setDate(a.getDate()-5);document.cookie=d+"="+c+"; expires="+a.toGMTString()+"; path=/"}function deleteCookie(a){setCookie(a,"moot")}function setStylesheet(h,f){var e="undefined",d="title";for(var a,b=[""],g=0;a=document.getElementsByTagName("link")[g];g++)if(a.getAttribute("rel").toLowerCase()=="alternate stylesheet"&&a.getAttribute(d)){a.disabled=true;b.push(a);if(a.getAttribute(d)==h)a.disabled=false}if(typeof f!=e){var c=Math.floor(Math.random()*b.length);b[c].disabled=false}return typeof f!=e&&b[c]!=""?b[c].getAttribute(d):""}function chooseStyle(a,b){if(document.getElementById){setStylesheet(a);setCookie("mysheet",a,b)}}function indicateSelected(a){var c="select-one";if(selectedtitle!=null&&(a.type==undefined||a.type==c))for(var a=a.type==c?a.options:a,b=0;b<a.length;b++)if(a[b].value==selectedtitle){if(a[b].tagName=="OPTION")a[b].selected=true;else a[b].checked=true;break}}if(manual_or_random=="manual"){var selectedtitle=getCookie("mysheet");document.getElementById&&selectedtitle!=null&&setStylesheet(selectedtitle)}else if(randomsetting.search(/^[1-9]+ days/i)!=-1)if(getCookie("mysheet_r")==null||parseInt(getCookie("mysheet_r_days"))!=parseInt(randomsetting)){setCookie("mysheet_r",setStylesheet("","random"),parseInt(randomsetting));setCookie("mysheet_r_days",randomsetting,parseInt(randomsetting))}else setStylesheet(getCookie("mysheet_r"));
