if(getScreenSize(240, 320)) {
generateMobinav();
setActiveStyleSheet('Mobile');
}
If the mobile display size corresponds to the setting (in this case, QVGA),
the page generates the additional navigational tool (function
generateMobinav) and automatically switches the page to use the Mobile
stylesheet. The function below loads the alternative stylesheet (note that
the name of the stylesheet is used as an argument and originates from the
function call).
/* =v==== STYLESHEET SWITCHER =====v= */
function setActiveStyleSheet(title) {
if(document.getElementsByTagName) {
var i, a, main;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1 &&
a.getAttribute("title")) {
a.disabled = true;
if(a.getAttribute("title") == title) a.disabled = false;
}
}
}
return false;
}