// Title : Dynamic Resolution Dependent Layout Demo Author : Kevin Hale URL : http://particletree.com
// getBrowserWidth is taken from The Man in Blue Resolution Dependent Layout Script
// http://www.themaninblue.com/experiment/ResolutionLayout/
// dynamicLayout by Kevin Hale
function getBrowserWidth(){if(window.innerWidth){return window.innerWidth;}
else if(document.documentElement&&document.documentElement.clientWidth!==0){return document.documentElement.clientWidth;}
else if(document.body){return document.body.clientWidth;}
return 0;}
function getBrowserHeight(){if(window.innerHeight){return window.innerHeight;}
else if(document.documentElement&&document.documentElement.clientHeight!==0){return document.documentElement.clientHeight;}
else if(document.body){return document.body.clientHeight;}
return 0;}
function changeLayout(description){var i,a;for(i=0;(a=document.getElementsByTagName("link")[i]);i++){if(a.getAttribute("title")===description){a.disabled=false;}
else if(a.getAttribute("title")!=="sp_main"){a.disabled=true;}}}
function dynamicLayout(){var browserWidth=getBrowserWidth();var browserHeight=getBrowserHeight();
if((browserWidth<1100)&&(browserHeight>400)&&(browserHeight<800)){changeLayout("sp_small");}
if((browserWidth>1200)&&(browserWidth<1500)&&(browserHeight<950)){changeLayout("sp_large_short");}
if((browserWidth>1500)&&(browserWidth<1900)&&(browserHeight<1150)){changeLayout("sp_large");}
if((browserWidth>1900)&&(browserWidth<2800)&&(browserHeight>800)&&(browserHeight<1200)){changeLayout("sp_ex_large");}
if((browserWidth>2800)&&(browserHeight>1050)){changeLayout("sp_ex_ex_large");}
if((browserWidth>1100)&&(browserWidth<1400)&&(browserHeight>800)&&(browserHeight<1050)){changeLayout("sp_main");}
}
function addEvent(obj,type,fn){if(obj.addEventListener){obj.addEventListener(type,fn,false);}
else if(obj.attachEvent){obj["e"+type+fn]=fn;obj[type+fn]=function(){obj["e"+type+fn](window.event);};obj.attachEvent("on"+type,obj[type+fn]);}}
addEvent(window,'load',dynamicLayout);addEvent(window,'resize',dynamicLayout);