--- typekit.module	2009-10-01 18:36:32.000000000 -0400
+++ typekitNew.module	2010-02-05 08:49:57.000000000 -0500
@@ -79,8 +79,12 @@ function typekit_init() {
   // Check for key
   if (!empty($key) && $page_match && $enabled) {
     // Include the TypeKit code
-    // Note that drupal_add_js does not allow for external scripts
-    drupal_set_html_head('<script type="text/javascript" src="http://use.typekit.com/' . check_plain($key) . '.js"></script>');
+	// Used code from google_analytics module and modified to add JS code to header from external source
+	// also properly handles http/https depending on current page protocol
+      $script = 'var typekitJsHost = (("https:" == document.location.protocol) ? "https://" : "http://");';
+      $script .= 'document.write(unescape("%3Cscript src=\'" + typekitJsHost + "use.typekit.com/'. check_plain($key) .'.js\' type=\'text/javascript\'%3E%3C/script%3E"));';
+      drupal_add_js($script, 'inline', 'header');
+
     drupal_add_js('try{Typekit.load();}catch(e){}', 'inline', 'header');
   }
 }
