﻿/*
    Global script for Habanero's User Experience Done Right! website
    Author: Christopher Parsons
*/
(function(){function l(d){try{m=document.getElementsByTagName("body")[0].clientHeight,k=document.getElementsByTagName("body")[0].clientWidth,n=document.documentElement.clientHeight}catch(b){return d&&d(),false}d&&d();return true}function o(){var d=document.getElementById("classupcoming"),b=document.getElementById("header-image"),f=document.getElementById("header"),a,i=document.getElementById("intro"),c,g=document.getElementById("registernow"),e=document.getElementById("twitter-panel");try{a=window.matchMedia("(max-width: 599px)").matches}catch(h){a=
k<580}g&&a?document.getElementById("classinfo").appendChild(g):(c=document.getElementById("prices"),c.parentNode.insertBefore(g,c.nextSibling));d&&i&&a?i.parentNode.insertBefore(d,i.nextSibling):(i=document.getElementById("register"),i.parentNode.insertBefore(d,i));e&&(a?document.getElementById("sidebar").appendChild(e):document.getElementById("main-column").appendChild(e));if(!b&&!a)d=document.createElement("img"),d.src=f&&f.getAttribute("class")?"assets/images/bkgd_header_photo_"+f.getAttribute("class")+
".jpg":"assets/images/bkgd_header_photo_main.jpg",d.alt="User Experience - DONE RIGHT!",d.id="header-image",d.setAttribute("class","photo"),document.getElementById("photo-container").appendChild(d)}var m,k,j,n;(function(){function d(){window.open(this.getAttribute("href")).focus();return false}(function(){var b=document.getElementsByTagName("a"),f,a;for(a=0;a<b.length;a++)if(f=b[a],f.getAttribute("rel")==="external")f.onclick=d})()})();showModal=function(){var d=document.body,b,f,a={},i,c,g,e,h;a.columnHeight=
function(){var a,c=0;if(g=document.getElementById("modal-content")){a=g.getElementsByTagName("dl");for(b=0;b<a.length;b++)a[b].style.height="auto";for(b=0;b<a.length;b++)if(c<a[b].clientHeight)c=a[b].clientHeight;for(b=0;b<a.length;b++)a[b].style.height=c+"px"}};a.onresize=function(){var d=0;g=document.getElementById("modal-content");if(e)e.style.width=k+"px",e.style.height=m+"px";if(c){if(g){c.style.width="";c.style.top="0";c.style.left="0";c.style.width=g.clientWidth+"px";if(typeof window.pageYOffset!=
"undefined")d=window.pageYOffset;else if(typeof document.documentElement.scrollTop!="undefined")d=document.documentElement.scrollTop;c.style.top=d+(n-c.offsetHeight)/2+"px";c.style.left=(k-c.offsetWidth)/2+"px"}a.columnHeight()}};a.getModal=function(a,c){h=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");h.open("GET",a);h.onreadystatechange=c;h.send(null);return h};a.createOverlay=function(){e=document.createElement("div");e.setAttribute("id","overlay");e.style.width=
k+"px";e.style.height=m+"px";d.appendChild(e);return true};a.menuClick=function(){var a=this.getAttribute("name"),a=document.getElementById(a),c;c=document.getElementById("modal-nav").getElementsByTagName("a");for(var d=document.getElementById("modal-content"),b=0;b<c.length;b++)c[b].removeAttribute("class");this.setAttribute("class","active");if(d){c=d.getElementsByTagName("div");for(b=0;b<c.length;b++)c[b].removeAttribute("class")}a&&a.setAttribute("class","active")};a.createModal=function(){var b,
e;c=document.createElement("div");try{if(h.readyState===4&&(h.status===200||h.status===304))c.innerHTML=h.responseText,c.setAttribute("id","modal"),c.setAttribute("tabindex","-1"),c.setAttribute("role","dialog")}catch(g){return false}d.appendChild(c);if(f=document.getElementById("modal-container"))c.innerHTML=f.innerHTML;if(i=document.getElementById("modal-close"))document.getElementById("modal-close").onclick=a.closeModal;if(b=document.getElementById("modal-nav")){e=b.getElementsByTagName("a");for(b=
0;b<e.length;b++)e[b].onclick=a.menuClick,e[b].removeAttribute("href")}a.columnHeight();l(a.onresize)};a.openModal=function(){a.createOverlay();a.getModal("register.aspx",a.createModal);return false};a.closeModal=function(){document.body.removeChild(c);document.body.removeChild(e);return false};return a}();if(j=document.getElementById("registertoggle"))j.onclick=showModal.openModal,j.setAttribute("href","#");j=function(){l(o);l(showModal.onresize)};window.onresize=j;j()})();
