<?php
/*=======================================================================
 *
 * js_framework.inc.php
 *
 * Autor: Marc Vollmann
 *
 =======================================================================*/

if ($usedFramework != "1" && $usedFramework != "2") :
   $usedFramework = getParameterValue("0", "FRAMEWORK_USED", "0", "0");
   if ($usedFramework != "1" && $usedFramework != "2") : 
      $usedFramework = "1"; 
   endif;
endif;

// JQuery (Default)
$frameworkFile = "../js/jquery.js";
$menuJSFile = "menu.js.php";
if ($usedFramework == "2") :
   // Prototype
   $frameworkFile = "../js/prototype.js";
   $menuJSFile = "menu_prototype.js.php";
endif;

// Check for meta tag if menu is disabled regardin used charset
if (true) :
   if ($htmlDefaultCharset == "") : $htmlDefaultCharset = "iso-8859-1"; endif;
   echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=" . $htmlDefaultCharset . "\">\n";
endif;

// Framework
echo "<script src=\"" . $frameworkFile . "\"></script>\n";
// echo "<script src=\"../js/jquery-migrate-1.2.1.js\"></script>\n";

// Menu
echo "<script type=\"text/javascript\">\n";
include_once ("../include/" . $menuJSFile);
echo "</script>\n";

if ($usedFramework == "1") :
   // JQuery 
   echo "<script type=\"text/javascript\" src=\"../js/jquery-ui.custom.min.js\"></script>\n";
   echo "<link rel=\"stylesheet\" href=\"../css/jquery-ui.custom.min.css\" type=\"text/css\" />\n";
endif;

// Ticker
echo "<script type=\"text/javascript\">\n";
include_once ("../js/ticker.js.php");
echo "</script>\n";

// For body onload
echo "\n";
echo "<script type=\"text/javascript\">\n";
echo "function adjustWidthsOnLoad() {\n";
echo "  const fullContentWidth = document.body.scrollWidth;\n";
echo "  if ($('#page_headline')) {\n";
echo "    $('#page_headline').css('width', fullContentWidth + 'px');\n";
echo "  }\n";
echo "  $('#mc_page-header').css('width', (fullContentWidth - 35) + 'px');\n";
echo "}\n";
echo "window.addEventListener('load', adjustWidthsOnLoad);\n";
echo "window.addEventListener('resize', adjustWidthsOnLoad);\n";
echo "</script>\n\n";
?>