(function() {
  var adElement = document.createElement('div')
      body = document.getElementsByTagName('body')[0],
      stylesheet = document.createElement('link'),
      head = document.getElementsByTagName('head')[0],
      thisScript = document.getElementById('ZURBmobileAd'),
      orientation = thisScript.getAttribute('data-orientation');
  
  stylesheet.rel = 'stylesheet';
  stylesheet.type = 'text/css';
  stylesheet.href = 'http://www.zurb.com:80/stylesheets/ads.css';
  
  adElement.id = 'zurbAd';
  adElement.className = '';
  if (orientation !== 'vertical') {
  	adElement.innerHTML = '<div id=\"sidebarAd\" class=\"cleanslate\">\n	<div class=\"row\">\n		<div class=\"seven columns\">\n			<a href=\"http://www.campaignmonitor.com\"><img src=\"http://www.zurb.com/images/cm-sponsor.png\"><\/a>\n\n		<\/div>\n 		<div class=\"five columns\">\n			<ul><h6><a href=\"http://www.campaignmonitor.com\">Email Marketing<\/a><\/h6>\n				<li><a href=\"http://www.campaignmonitor.com\">Send beautiful <br/>email newsletters with ease.<\/a><\/li>\n				<li><a href=\"http://www.zurb.com/expo\"><span class=\"ad-sponsor\">ZURBexpo Sponsor<\/span><\/a><\/li>\n			<\/ul>\n		<\/div>\n	<\/div>\n<\/div>\n\n';
  } else {
  	adElement.innerHTML = '\n<div id=\"sidebarAdVertical\" class=\"cleanslate\">\n\n	<div class=\"ad-spaceTop\">\n	<a href=\"http://www.campaignmonitor.com/ \"><img src=\"http://www.zurb.com/images/cm-sponsor.png\">\n	<h6>Email Marketing<\/h6>\n	<p>Send beautiful email newsletters with ease.<\/p><\/a>\n	<a href=\"http://www.zurb.com/expo\"><span class=\"ad-sponsor\">ZURBexpo Sponsor<\/span><\/a>\n	<\/div>\n\n<\/div>\n\n';
  }

  thisScript.parentNode.insertBefore(adElement, thisScript);
  head.insertBefore(stylesheet, null);
})();
