var aInstalledStyles = new Array ('mariopartyde_classic_original',
                                  'mariopartyde_classic_revised',
                                  'mariopartyde_2008');
var aInstalledStylesCopyright = new Array ('&quot;MPDE Classic Original&quot;, seit 19.05.2004; (c) 2004-2008; TheUnknown',
                                           '&quot;MPDE Classic Revised&quot;, seit 02.09.2008; (c) 2008; TheUnknown',
                                           '&quot;MPDE 2008&quot;, seit 02.09.2008; (c) 2008; Luigi-The-Best, TheUnknown, Pyrou');
var aInstalledStylesIE6Support = new Array (true,
                                            true,
                                            false);
var sValue = 'none';

// STYLE AUSWÄHLEN - STYLE AUSWÄHLEN - STYLE AUSWÄHLEN
var sStyle = LoadSettingFromCookie('mpde_style', aInstalledStyles[1]);

// SOLLTE ein Style im Cookie stehen, den es jetzt aber (warum auch immer)
// nicht mehr gibt, dann wieder den StandardStyle nehmen.
if (String(aInstalledStyles).indexOf(sStyle) == -1)
  {
  alert('Der marioparty.de-Style, den Du zuletzt verwendet hattest, ist nicht mehr verfügbar, darum erhälst Du nun den Standard-Style!\n\nAber Du kannst Dir natürlich auch wieder einen anderen aussuchen! :)');
  sStyle = aInstalledStyles[1];
  SaveSetting('mpde_style', aInstalledStyles[1], false);
  }

document.writeln('<script src="' + sPathCorrection + 'styles/' + sStyle + '/style.js" type="text/javascript"></script>');

if (sStyle != aInstalledStyles[0])
  {
  document.writeln('<link rel="stylesheet" media="all" type="text/css" href="' + sPathCorrection + 'styles/' + sStyle + '/style.css" />');
  }

  // DESIGN-BREITE ERZWINGEN - DESIGN-BREITE ERZWINGEN - DESIGN-BREITE ERZWINGEN
  sValue = LoadSettingFromCookie('mpde_style_force_width', 'none');
  if (sValue != 'none')
    document.writeln('<link rel="stylesheet" media="all" type="text/css" href="' + sPathCorrection + 'styles/' + sStyle + '/force_width_' + sValue + '.css" />');


  // NAVIGATION-SCROLLING AUSWÄHLEN - NAVIGATION-SCROLLING AUSWÄHLEN - NAVIGATION-SCROLLING AUSWÄHLEN
sValue = LoadSettingFromCookie('mpde_style_navigation_scrolling', 'none');
if (sValue != 'none')
  document.writeln('<link rel="stylesheet" media="all" type="text/css" href="' + sPathCorrection + 'styles/_customs/navigation_scrolling_' + sValue + '.css" />');



  // BACKGROUND-IMAGE AUSWÄHLEN - BACKGROUND-IMAGE AUSWÄHLEN - BACKGROUND-IMAGE AUSWÄHLEN
sValue = LoadSettingFromCookie('mpde_style_background_image', 'none');
if (sValue != 'none')
  document.writeln('<link rel="stylesheet" media="all" type="text/css" href="' + sPathCorrection + 'styles/_customs/background_image_' + sValue + '.css" />');

  // BACKGROUND-IMAGE-SCROLLING AUSWÄHLEN - BACKGROUND-IMAGE-SCROLLING AUSWÄHLEN - BACKGROUND-IMAGE-SCROLLING AUSWÄHLEN
sValue = LoadSettingFromCookie('mpde_style_background_image_scrolling', 'none');
if (sValue != 'none')
  document.writeln('<link rel="stylesheet" media="all" type="text/css" href="' + sPathCorrection + 'styles/_customs/background_image_scrolling_' + sValue + '.css" />');

// BACKGROUND-COLOR AUSWÄHLEN - BACKGROUND-COLOR AUSWÄHLEN - BACKGROUND-COLOR AUSWÄHLEN
sValue = LoadSettingFromCookie('mpde_style_background_color', 'none');
if (sValue != 'none')
  document.writeln('<link rel="stylesheet" media="all" type="text/css" href="' + sPathCorrection + 'styles/_customs/background_color_' + sValue + '.css" />');



// BODY-FONT-FAMILY AUSWÄHLEN - BODY-FONT-FAMILY AUSWÄHLEN - BODY-FONT-FAMILY AUSWÄHLEN
sValue = LoadSettingFromCookie('mpde_style_body_font_family', 'none');
if (sValue != 'none')
  document.writeln('<link rel="stylesheet" media="all" type="text/css" href="' + sPathCorrection + 'styles/_customs/body_font_family_' + sValue + '.css" />');

  // BODY-FONT-SIZE AUSWÄHLEN - BODY-FONT-FAMILY SIZE - BODY-FONT-FAMILY AUSWÄHLEN
sValue = LoadSettingFromCookie('mpde_style_body_font_size', 'none');
if (sValue != 'none')
  document.writeln('<link rel="stylesheet" media="all" type="text/css" href="' + sPathCorrection + 'styles/_customs/body_font_size_' + sValue + '.css" />');

// BODY-FONT-COLOR AUSWÄHLEN - BODY-FONT-COLOR AUSWÄHLEN - BODY-FONT-COLOR AUSWÄHLEN
sValue = LoadSettingFromCookie('mpde_style_body_font_color', 'none');
if (sValue != 'none')
  document.writeln('<link rel="stylesheet" media="all" type="text/css" href="' + sPathCorrection + 'styles/_customs/body_font_color_' + sValue + '.css" />');

// A-FONT-COLOR AUSWÄHLEN - A-FONT-COLOR AUSWÄHLEN - A-FONT-COLOR AUSWÄHLEN
sValue = LoadSettingFromCookie('mpde_style_a_font_color', 'none');
if (sValue != 'none')
  document.writeln('<link rel="stylesheet" media="all" type="text/css" href="' + sPathCorrection + 'styles/_customs/a_font_color_' + sValue + '.css" />');

// COMMENT-FONT-COLOR AUSWÄHLEN - COMMENT-FONT-COLOR AUSWÄHLEN - COMMENT-FONT-COLOR AUSWÄHLEN
sValue = LoadSettingFromCookie('mpde_style_comment_font_color', 'none');
if (sValue != 'none')
  document.writeln('<link rel="stylesheet" media="all" type="text/css" href="' + sPathCorrection + 'styles/_customs/comment_font_color_' + sValue + '.css" />');

// HIGHLIGHTED-FONT-COLOR AUSWÄHLEN - HIGHLIGHTED-FONT-COLOR AUSWÄHLEN - HIGHLIGHTED-FONT-COLOR AUSWÄHLEN
sValue = LoadSettingFromCookie('mpde_style_highlighted_font_color', 'none');
if (sValue != 'none')
  document.writeln('<link rel="stylesheet" media="all" type="text/css" href="' + sPathCorrection + 'styles/_customs/highlighted_font_color_' + sValue + '.css" />');

// HEADLINE-FONT-COLOR AUSWÄHLEN - HEADLINE-FONT-COLOR AUSWÄHLEN - HEADLINE-FONT-COLOR AUSWÄHLEN
sValue = LoadSettingFromCookie('mpde_style_headline_font_color', 'none');
if (sValue != 'none')
  document.writeln('<link rel="stylesheet" media="all" type="text/css" href="' + sPathCorrection + 'styles/_customs/headline_font_color_' + sValue + '.css" />');

  // DIV-HEADLINE-FONT-COLOR AUSWÄHLEN - DIV-HEADLINE-FONT-COLOR AUSWÄHLEN - DIV-HEADLINE-FONT-COLOR AUSWÄHLEN
sValue = LoadSettingFromCookie('mpde_style_div_headline_font_color', 'none');
if (sValue != 'none')
  document.writeln('<link rel="stylesheet" media="all" type="text/css" href="' + sPathCorrection + 'styles/_customs/div_headline_font_color_' + sValue + '.css" />');



function SaveSetting(sValueName, sValueString, bAutoReload) {
  SaveSettingToCookie(sValueName, sValueString, 365);

  if (sValueName == 'mpde_style')
    {
    SaveSettingToCookie('mpde_style_navigation_scrolling', 'none', 365);
    SaveSettingToCookie('mpde_style_force_width', 'none', 365);

    SaveSettingToCookie('mpde_style_background_image', 'none', 365);
    SaveSettingToCookie('mpde_style_background_image_scrolling', 'none', 365);
    SaveSettingToCookie('mpde_style_background_color', 'none', 365);

    SaveSettingToCookie('mpde_style_body_font_size', 'none', 365);
    SaveSettingToCookie('mpde_style_body_font_family', 'none', 365);
    SaveSettingToCookie('mpde_style_body_font_color', 'none', 365);
    SaveSettingToCookie('mpde_style_a_font_color', 'none', 365);
    SaveSettingToCookie('mpde_style_comment_font_color', 'none', 365);
    SaveSettingToCookie('mpde_style_highlighted_font_color', 'none', 365);
    SaveSettingToCookie('mpde_style_headline_font_color', 'none', 365);
    SaveSettingToCookie('mpde_style_div_headline_font_color', 'none', 365);
    }

  if (bAutoReload == true)
    document.location.reload();
}

function PutStyleSettingsToForm() {
var sString = '';

  sString = 'mpde_style: ' + LoadSettingFromCookie('mpde_style', sStyle) + '\n' +
            'mpde_style_navigation_scrolling: ' + LoadSettingFromCookie('mpde_style_navigation_scrolling', 'none') + '\n' +

            'mpde_style_background_image: ' + LoadSettingFromCookie('mpde_style_background_image', 'none') + '\n' +
            'mpde_style_background_image_scrolling: ' + LoadSettingFromCookie('mpde_style_background_image_scrolling', 'none') + '\n' +
            'mpde_style_background_color: ' + LoadSettingFromCookie('mpde_style_background_color', 'none') + '\n' +

            'mpde_style_body_font_size: ' + LoadSettingFromCookie('mpde_style_body_font_size', 'none') + '\n' +
            'mpde_style_body_font_family: ' + LoadSettingFromCookie('mpde_style_body_font_family', 'none') + '\n' +
            'mpde_style_body_font_color: ' + LoadSettingFromCookie('mpde_style_body_font_color', 'none') + '\n' +
            'mpde_style_a_font_color: ' + LoadSettingFromCookie('mpde_style_a_font_color', 'none') + '\n' +
            'mpde_style_comment_font_color: ' + LoadSettingFromCookie('mpde_style_comment_font_color', 'none') + '\n' +
            'mpde_style_highlighted_font_color: ' + LoadSettingFromCookie('mpde_style_highlighted_font_color', 'none') + '\n' +
            'mpde_style_headline_font_color: ' + LoadSettingFromCookie('mpde_style_headline_font_color', 'none') + '\n' +
            'mpde_style_div_headline_font_color: ' + LoadSettingFromCookie('mpde_style_div_headline_font_color', 'none');

  return sString;
}

function PostColorListToDocument (sCookieName) {
with (document)
  {
  writeln('<span class="selectcolor" onclick="javascript:SaveSetting(\'' + sCookieName + '\', \'white\', true);" style="background-color:#ffffff; color:#000000;">Weiss</span>');
  writeln('<span class="selectcolor" onclick="javascript:SaveSetting(\'' + sCookieName + '\', \'lightgray\', true);" style="background-color:#efefef; color:#000000;">Hellgrau</span>');
  writeln('<span class="selectcolor" onclick="javascript:SaveSetting(\'' + sCookieName + '\', \'gray\', true);" style="background-color:#bfbfbf; color:#000000;">Grau</span>');
  writeln('<span class="selectcolor" onclick="javascript:SaveSetting(\'' + sCookieName + '\', \'lightgreen\', true);" style="background-color:#00ff00; color:#000000;">Hellgrün</span>');
  writeln('<span class="selectcolor" onclick="javascript:SaveSetting(\'' + sCookieName + '\', \'green\', true);" style="background-color:#008000; color:#000000;">Grün</span>');
  writeln('<span class="selectcolor" onclick="javascript:SaveSetting(\'' + sCookieName + '\', \'darkgreen\', true);" style="background-color:#001f00; color:#ffffff; border-color:#ffffff;">Dunkelgrün</span>');
  writeln('<span class="selectcolor" onclick="javascript:SaveSetting(\'' + sCookieName + '\', \'yellow\', true);" style="background-color:#ffff00; color:#000000;">Gelb</span>');
  writeln('<span class="selectcolor" onclick="javascript:SaveSetting(\'' + sCookieName + '\', \'orange\', true);" style="background-color:#ff8000; color:#000000;">Orange</span>');
  writeln('<span class="selectcolor" onclick="javascript:SaveSetting(\'' + sCookieName + '\', \'red\', true);" style="background-color:#ff0000; color:#000000;">Rot</span>');
  writeln('<span class="selectcolor" onclick="javascript:SaveSetting(\'' + sCookieName + '\', \'fuchsia\', true);" style="background-color:#ff00ff; color:#000000;">Rosa</span>');
  writeln('<span class="selectcolor" onclick="javascript:SaveSetting(\'' + sCookieName + '\', \'violett\', true);" style="background-color:#9000e0; color:#ffffff; border-color:#ffffff;">Violett</span>');
  writeln('<span class="selectcolor" onclick="javascript:SaveSetting(\'' + sCookieName + '\', \'lightblue\', true);" style="background-color:#00ffff; color:#000000;">Hellblau</span>');
  writeln('<span class="selectcolor" onclick="javascript:SaveSetting(\'' + sCookieName + '\', \'blue\', true);" style="background-color:#0000ff; color:#ffffff; border-color:#ffffff;">Blau</span>');
  writeln('<span class="selectcolor" onclick="javascript:SaveSetting(\'' + sCookieName + '\', \'darkblue\', true);" style="background-color:#00006f; color:#ffffff; border-color:#ffffff;">Dunkelblau</span>');
  writeln('<span class="selectcolor" onclick="javascript:SaveSetting(\'' + sCookieName + '\', \'black\', true);" style="background-color:#000000; color:#ffffff; border-color:#ffffff;">Schwarz</span>');
  }
}