/* Zugehoerigkeit: www.jr-bmc.de
   Autor: J. Rudolf; jr-bmc
   Erstellungsdatum: (siehe Dateidatum der aufrufenden htm) */

var BrowserOk = false;
var ColorB = 68;
var ColorB_downwards = true;
var ColorG = 68;
var ColorG_downwards = true;
var ColorR = 68;
var ColorR_downwards = true;
var ColorChangeB;
var ColorChangeG;
var ColorChangeR;
var FMB = new Array();
var NQA_TCB = 101;
var NQA_TCCB;
var NQA_TCCo;
var NQA_TCG = 32;
var NQA_TCR = 37;
var SemCode;
var StartTextHeadlineLetter = "Willkommen auf meiner Homepage!";
var StartTextHeadlineLetterNo = 0;
var StartTextHeadline_run;
var STC = 231;/* StartTextColor */
var STCBG = 255;/* StartTextBackgroundColor */
var STCC;
var STCCBG;
var STCCgo = false;
var STL = new Array();
var STNC = 1;/* StartTextNumberCounter */
var STNCBG = 1;/* StartTextNumberBackgroundCounter */

FMB[0] = ["but_fm1", "./button_tea_0.gif", "./button_tea_1.gif", "./button_tea_ok.gif", "Für Seminare, die nicht aufgeführt sind, fragen Sie mich bitte!", "./jr-bmc_tea.htm"];
FMB[1] = ["but_fm2", "./button_nqa_0.gif", "./button_nqa_1.gif", "./button_nqa_max.gif", "Fehler in der elektrischen Anlage? Reden Sie mit mir!", "./jr-bmc_nqa.htm"];
FMB[2] = ["but_fm3", "./button_post_0.gif", "./button_post_anim.gif", "./button_post_1.gif", "Meine Kontaktdaten, etwas über mich, Validierungsnachweis", "./jr-bmc_post.htm"];
FMB[3] = ["but_fm4", "./button_blog_0.gif", "./button_blog_1.gif", "./button_blog_1.gif", "Messgeräteeinsatz, Unfallauswertung, Lustiges, Kolumnen...", "http://www.jr-bmc.blogspot.com"];
FMB[4] = ["but_fm5", "./button_wiki_0.gif", "./button_wiki_1.gif", "./button_wiki_1.gif", "Ihr Fach-Lexikon - ergänzend zu meinen Seminaren und Protokollen", "http://www.jr-bmc.de/mediawiki"];

STL[0] = ["StartTextBullet1", "./bul_arr8.gif", "./bul_arr4.gif", "./bul_arr1.gif", "./jr-bmc_intro.htm"];
STL[1] = ["StartTextBullet2", "./bul_arr8.gif", "./bul_arr4.gif", "./bul_arr1.gif", "./jr-bmc_learn.htm"];
STL[2] = ["StartTextBullet3", "./bul_arr8.gif", "./bul_arr4.gif", "./bul_arr1.gif", "./jr-bmc_play.htm"];
STL[3] = ["StartTextBullet4", "./bul_arr8.gif", "./bul_arr4.gif", "./bul_arr1.gif", "./jr-bmc_tea-sem_vefk.htm"];

window.onload = WindowLoaded;
window.onunload = TidyUp;

function WindowLoaded() {
  window.setTimeout("FirstMenuButtonSet()", 1200);
  window.setTimeout("ShowStartTextHeadline()", 2000);
  window.setTimeout("ShowStartText()", 3800);
  ColorChangeB = window.setInterval("FirmColorChangeBlue()", 17);
  ColorChangeG = window.setInterval("FirmColorChangeGreen()", 53);
  ColorChangeR = window.setInterval("FirmColorChangeRed()", 103);
  window.status = "Sie befinden sich auf der Begrüßungsseite der 'jr-bmc'.";
  for (i = 0; i < FMB.length; i++) {
    new Image().src = FMB[i][5];
    var ButPic = document.getElementById(FMB[i][0]);
    ButPic.onmouseout = FirstMenu_mouseout;
    ButPic.onmouseover = FirstMenu_mouseover;
    ButPic.onmousedown = FirstMenu_mousedown;
    var ButPicAdd = document.getElementById("mas_fm3");
    ButPicAdd.onmouseout = FirstMenuAdd_mouseout;
    ButPicAdd.onmouseover = FirstMenuAdd_mouseover;
    ButPicAdd.onmousedown = FirstMenuAdd_mousedown;
  }
  for (j = 0; j < STL.length; j++) {
    new Image().src = STL[j][3];
    var ButSTL = document.getElementById(STL[j][0]);
    ButSTL.onmouseout = StartTextLink_mouseout;
    ButSTL.onmouseover = StartTextLink_mouseover;
    ButSTL.onmousedown = StartTextLink_mousedown;
  }
}

/* Erster Button-Wechsel */
function FirstMenuButtonSet() {
  for (i = 0; i < FMB.length; i++) {
    document.getElementById(FMB[i][0]).src = FMB[i][1];
  }
  document.getElementById("mas_fm3").src = "./mask_nqaT_empty.gif";
  if (Image && document.getElementById) {
    BrowserOk = true;
  } else {
    return false;
  }
}

/* Menü-Aktionen */
function FirstMenu_mouseout() {
  if (BrowserOk) {
    clearTimeout(NQA_TCCB);
    clearTimeout(NQA_TCCo);
    NQA_TCB = 101;
    NQA_TCG = 32;
    NQA_TCR = 37;
    document.getElementById("ButtonNQA-Title").style.color = "rgb(37,32,101)";
    for (i = 0; i < FMB.length; i++) {
      document.getElementById(FMB[i][0]).src = FMB[i][1];
    }
  }
  window.status = "Auf eine gute Zusammenarbeit - Ihr Jörg Rudolf.";
}

function FirstMenuAdd_mouseout() {
  if (BrowserOk) {
    clearTimeout(NQA_TCCB);
    clearTimeout(NQA_TCCo);
    NQA_TCB = 101;
    NQA_TCG = 32;
    NQA_TCR = 37;
    document.getElementById("ButtonNQA-Title").style.color = "rgb(37,32,101)";
    document.getElementById(FMB[1][0]).src = FMB[1][1];
  }
  window.status = "Auf eine gute Zusammenarbeit - Ihr Jörg Rudolf.";
}

function FirstMenu_mouseover() {
  if (BrowserOk) {
    for (i = 0; i < FMB.length; i++) {
      if (this.id != FMB[i][0]) {
        document.getElementById(FMB[i][0]).src = FMB[i][1];
      } else {
        document.getElementById(FMB[i][0]).src = FMB[i][2];
	if (i == 1) {
	  NQA_TCCB = window.setInterval("NQA_TextColorBlue()", 70);
	  NQA_TCCo = window.setInterval("NQA_TextColor_other()", 10);
	}
	window.status = FMB[i][4];
      }
    }
  }
}

function FirstMenuAdd_mouseover() {
  if (BrowserOk) {
    document.getElementById(FMB[1][0]).src = FMB[1][2];
    NQA_TCCB = window.setInterval("NQA_TextColorBlue()", 70);
    NQA_TCCo = window.setInterval("NQA_TextColor_other()", 10);
  }
  window.status = "Fehler in der elektrischen Anlage? Reden Sie mit mir!";
}

function FirstMenu_mousedown() {
  if (BrowserOk) {
    for (i = 0; i < FMB.length; i++) {
      if (this.id != FMB[i][0]) {
        document.getElementById(FMB[i][0]).src = FMB[i][1];
      } else {
        document.getElementById(FMB[i][0]).src = FMB[i][3];
	if (i == 1) {
	  if (navigator.userAgent.indexOf("MSIE") != -1) {
	    document.location.href = "./jr-bmc_nqa-ie.htm";
	  } else {
	    document.location.href = "./jr-bmc_nqa.htm";
	  }
	} else {
	  document.location.href = FMB[i][5];
	}
      }
    }
  }
}

function FirstMenuAdd_mousedown() {
  if (BrowserOk) {
    document.getElementById("but_fm2").src = "./button_nqa_max.gif";
    if (navigator.userAgent.indexOf("MSIE") != -1) {
      document.location.href = "./jr-bmc_nqa-ie.htm";
    } else {
      document.location.href = "./jr-bmc_nqa.htm";
    }
  }
}

function NQA_TextColorBlue() {
  if (NQA_TCB == 71) {
  } else {
    document.getElementById("ButtonNQA-Title").style.color = "rgb(" + NQA_TCR + "," + NQA_TCG + "," + NQA_TCB + ")";
    NQA_TCB -= 3;
  }
}

function NQA_TextColor_other() {
  if (NQA_TCG == 242) {
  } else {
    document.getElementById("ButtonNQA-Title").style.color = "rgb(" + NQA_TCR + "," + NQA_TCG + "," + NQA_TCB + ")";
    NQA_TCG += 3;
    NQA_TCR += 3;
  }  
}

function StartTextLink_mouseout() {
  if (BrowserOk) {
    for (j = 0; j < STL.length; j++) {
      document.getElementById(STL[j][0]).src = STL[j][1];
    }
  }
  window.status = "Sie sehen die Begrüßungsseite mit den Menüs und News-Links."; 
}

function StartTextLink_mouseover() {
  if (BrowserOk) {
    for (j = 0; j < STL.length; j++) {
      if (this.id != STL[j][0]) {
        document.getElementById(STL[j][0]).src = STL[j][1];
      } else {
        document.getElementById(STL[j][0]).src = STL[j][2];
	window.status = "Hier gelangen Sie zu den zugehörigen Seiten.";
      }
    }
  }
}

function StartTextLink_mousedown() {
  if (BrowserOk) {
    for (j = 0; j < STL.length; j++) {
      if (this.id != STL[j][0]) {
        document.getElementById(STL[j][0]).src = STL[j][1];
      } else {
        document.getElementById(STL[j][0]).src = STL[j][3];
	if (j == 3) {
	  SemCode = prompt("Tippen Sie den im Seminar mitgeteilten Dateinamen nach dem '/' ohne '.htm' ein und bestätigen mit <OK>!", "");
	  if (SemCode == "jr-bmc_tea-sem_vefk") {
	    document.location.href = STL[3][4];
	  }
	} else {
	  document.location.href = STL[j][4];
	}
      }
    }
  }
}

/* Farbwechsel in Firmierung */
function FirmColorChangeBlue() {
  if (ColorB == 0) {
    ColorB_downwards = false;
  }
  if (ColorB == 255) {
    ColorB_downwards = true;
  }
  if (!ColorB_downwards) {
    ColorB += 1;
  } else {
    ColorB -= 1;
  }
  document.getElementById("Firm").style.color = "rgb(" + ColorR + "," + ColorG + "," + ColorB + ")";
}

function FirmColorChangeGreen() {
  if (ColorG == 0) {
    ColorG_downwards = false;
  }
  if (ColorG == 255) {
    ColorG_downwards = true;
  }
  if (!ColorG_downwards) {
    ColorG += 1;
  } else {
    ColorG -= 1;
  }
  document.getElementById("Firm").style.color = "rgb(" + ColorR + "," + ColorG + "," + ColorB + ")";
}

function FirmColorChangeRed() {
  if (ColorR == 0) {
    ColorR_downwards = false;
  }
  if (ColorR == 255) {
    ColorR_downwards = true;
  }
  if (!ColorR_downwards) {
    ColorR += 1;
  } else {
    ColorR -= 1;
  }
  document.getElementById("Firm").style.color = "rgb(" + ColorR + "," + ColorG + "," + ColorB + ")";
}

/* Textaufblendungen */
function ShowStartTextHeadline() {
  StartTextHeadline_run = window.setInterval("StartTextHeadlineContent()", 47);
}

function StartTextHeadlineContent() {
  document.getElementById("StartTextHeadline").innerHTML = StartTextHeadlineLetter.substring(0,StartTextHeadlineLetterNo);
  StartTextHeadlineLetterNo++;
  if (StartTextHeadlineLetterNo > 31) {
    clearTimeout(StartTextHeadline_run);
  }
}

function ShowStartText() {
  STCC = window.setInterval("StartTextColorChange()", 31);
  STCCBG = window.setInterval("StartTextBackgroundColorChange()", 59);
}

function StartTextColorChange() {
  if (STC == 23) {
    STNC += 1;
    STC = 231;
    document.getElementById("StartTextBullet" + (STNC-1)).src = "./bul_arr8.gif";
    if (STNC == (STL.length+1)) {
      clearTimeout(STCC);
    }
  } else {
    if (STCCgo == true) {
      document.getElementById("StartText" + STNC).style.color = "rgb(" + STC + "," + STC + "," + STC + ")";
      STC -= 8;
    }
  }
}

function StartTextBackgroundColorChange() {
  if (STCBG == 231) {
    STNCBG += 1;
    STCBG = 255;
    STCCgo = true;
    if (STNCBG == (STL.length+1)) {
      clearTimeout(STCCBG);
    }
  } else {
    document.getElementById("StartText" + STNCBG).style.background = "rgb(" + STCBG + "," + STCBG + "," + STCBG + ")";
    STCBG -= 2;
    document.getElementById("StartText" + STNCBG).style.color = "rgb(" + STCBG + "," + STCBG + "," + STCBG + ")";
  }
}

/* Aufräumen */
function TidyUp() {
  clearTimeout(ColorChangeB);
  clearTimeout(ColorChangeG);
  clearTimeout(ColorChangeR);
  clearTimeout(StartTextHeadline_run);
  clearTimeout(STCC);
  clearTimeout(STCCBG);
}
