
/*******************************************
 JavaScript www.ComputerService-Fiedler.de
 
 © 2007  Bernhard Schmidt
   http://www.schmidt-sachsen.de
  
  
 Dynamic Menue / Hover Effects / Dynamic Position / Login by Bernhard Schmidt

 getPageScroll() Core code from - quirksmode.org
 getPageSize() Core code from - quirksmode.org; Edited for Firefox by pHaez
 
 *********************************************/

/*html, body, div, p, h1, h2, h3, ul, ol, 
span, a, table, td, form, img, li { margin: 0; padding: 0; /*font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; }*/

/*html, body { height: 100%; } */

///////////////////////////////////////////////////////////////////////////////////////////////////////////

Namen=new Array("Index","PC-Service","Webdesign","Hilfen","Kontakt","Login");

Thema=new Array; Verweis=new Array;

Thema[0]=new Array("Schreiben Sie uns: Kontaktformular","Unsere Anschrift / Adresse","Jobangebote");
Verweis[0]=new Array("kontakt.htm","kontadresse.htm","jobangebote.htm");

Thema[1]=new Array("System / Netzwerkmanagement","PC-Installation","Linux & Co.","Backup","Software Development");
Verweis[1]=new Array("pcnetzwerk.htm","pc-install.htm","pclinux.htm","pcbackup.htm","pcsoftware.htm");

Thema[2]=new Array("Paket I: Web.Basic","Paket II: Web.Professional","Paket III: Web.Premium","Portfolio / Referenzen");
Verweis[2]=new Array("webbasic.htm","webprof.htm","webpremium.htm","webreferenz.htm");

Thema[3]=new Array("Allgemeine Hilfe / FAQ","Die Ersteinrichtung","Bei Fehlern: Was wir benötigen");
Verweis[3]=new Array("install.htm","install-erst.htm","install-fehler.htm");

Thema[4]=new Array("Schreiben Sie uns: Kontaktformular","Unsere Anschrift / Adresse","Anfahrtskarte","Das CSF-Team");
Verweis[4]=new Array("kontakt.htm","kontadresse.htm","kmap.htm","kteam.htm");

Thema[5]=new Array("Aktueller PC / Wartungsstatus","Bisher getätigte Aufträge","Neuen Auftrag buchen");
Verweis[5]=new Array("login-status.php","login-auftrag.php","login-buchen.php");


MenueAnzeigeDauer="3000"; //Anzeigedauer des Menüs in Millisekunden
///////////////////////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////////////////////

function Label(Aktuelles_Thema) { // Dynamisches Erstellen der Sub-Menü Elemente
 var Ausgabe="";
 
 
 for (a=0; a <= Namen.length-1; a++) { //Namen.length-1 wegen Thema[a][i]
  var Puzzle="";

  for (i=0; i<= Thema[a].length-1; i++) { // Erstellen der einzelnen Links
   if (i==Thema[a].length-1) { Trennstrich=""; }
   else Trennstrich="<li>|</li>";  

   if ( typeof Subthema == "undefined" ) { var Subthema; }   
   if (Thema[a][i]==Subthema) { LinkStyle=" class=Active"; }  // Link Hervorgehoben bei aktuellem Thema
   else { LinkStyle=""; }
   
   LinkHTML=new Array(
   "<li><a href='", Verweis[a][i] ,"'", LinkStyle, 
   " onmouseover='UpdateHide()'>",Thema[a][i], "</a></li>",
   Trennstrich);
   
   DynLinks=Puzzle+LinkHTML.join("");
   Puzzle=DynLinks;
  }


  MaskeHTML=new Array("<style type='text/css'>",
  "#SN-",Namen[a]," { position: absolute; left: 0px; top: -5000px; padding-top: 2px; width: 550px;",
  "                   font-family: Arial,Helvetica; font-size: 11px; color: #3b4451;",
  "                   filter: blendTrans(Duration=0.4, Transition=16); }",
  "#SN-",Namen[a],"  .Rechts { text-align: right;  margin-right: 14px; }",
  "#SN-",Namen[a],"  ul {  float: right; display: inline; list-style: none; margin: 0px; padding: 0px; }",
  "#SN-",Namen[a],"  li {  float: left; display: inline; list-style: none; padding: 2px 0px 4px 0px; }",
  "#SN-",Namen[a],"  a { color: #3b4451; text-decoration: none; padding: 8px 7px 4px 7px; }",
  "#SN-",Namen[a],"  a:hover { background-image: url(img/submenue-bg.gif); background-repeat: repeat-x;", 
  "                            background-position: 0px 6px; }",
  "#SN-",Namen[a],"  a.Active { background-image: url(img/submenue-bg.gif); background-repeat: repeat-x;", 
  "                            background-position: 0px 6px; }",
  "</style>",  
  
  "<div id='SN-"+Namen[a]+"'><div class=Rechts>",
  "<ul>", DynLinks, "</ul></div></div>");
      
  Tabelle=MaskeHTML.join("");
      
  var Setzer=Ausgabe+Tabelle;
  Ausgabe=Setzer;
 }
   
 /*if (URL!="") {
  Ausgabe=Ersetzen(Ausgabe,"href='",URL);
  Ausgabe=Ersetzen(Ausgabe,"src='",URL);
  Ausgabe=Ersetzen(Ausgabe,"background='",URL)
 }*/
 document.write(Ausgabe);
}


///////////////////////////////////////////////////////////////////////////////////////////////////////////

function Ersetzen(VString,Begriff,URL) {
var Ersatzausgabe="";
 for (b=0; b<=5; b++) {

  if (VString.indexOf(Begriff) != -1) {
   if (b==0) Ersatzausgabe=VString.substr(0,VString.indexOf(Begriff));
   else Ersatzausgabe=Ersatzausgabe+VString.substr(0,VString.indexOf(Begriff));
   var Ersatztext=VString.substr(VString.indexOf(Begriff),Begriff.length);
   VString=VString.substr(VString.indexOf(Begriff) +Begriff.length,VString.length);

   Ersatztext=Ersatztext.replace(Begriff,Begriff+URL);
   Ersatzausgabe=Ersatzausgabe+Ersatztext;
   b=1;
  }
  else {
   if (Ersatzausgabe=="") {
    Ersatzausgabe=VString;
    b=5;
   }
   else {
    Ersatzausgabe=Ersatzausgabe+VString;
    b=5;
   }
  }
 }
 return Ersatzausgabe;
}


///////////////////////////////////////////////////////////////////////////////////////////////////////////

Position_Counter=150; // Abstand nach Rechts Oben für den Login-Effekt

function Login() {
 with (document) {
  Write=new Array("<div id='BG-Transparent' onclick='HideLogin()'></div>",
  "<div id='Login-Effekt'><div id='Login-Effekt-Ausblenden'>",
  "<img width=380 height=125 src='img/window-effekt.gif'></div></div>",
  "<div id='Eingabeaufforderung-BG'></div>",
  "<div id='Eingabeaufforderung'>",
  "<p class='Login-Titel' style=''>Kundenlogin</p>",
  "<form action='login.php' name='Login' method=get onsubmit='return LoginFormCheck()'>",
  "<p class='Login-Benutzername'>Benutzername</p>",
  "<input type=text name='Benutzer' value='' maxlength=30 class='Benutzer'>",
  "<input type=password name='Passwort' value='' maxlength=30 class='Password'>",
  "<p class='Login-Passwort'>Passwort</p>",
  "<input type=image width=22 height=21 name='Login' alt='Anmelden' src='img/leer.gif' class=Submit>",
  "<a href='JavaScript:HideLogin()'><img width=19 height=18 border=0 alt='Fenster schließen'",
  " src='img/leer.gif'></a>",
  "</form>",
  "</div>");

  Write=Write.join("");
  write(Write);
 }
 WriteLoginCheck();
}


///////////////////////////////////////////////////////////////////////////////////////////////////////////

function ResizeLoginBG() { // Transparenz-Hintergrund auf 100% setzen
 var PageSize = getPageSize();
 if (document.getElementById) { document.getElementById('BG-Transparent').style.height = (PageSize[1] + 'px'); }
 else if (document.all) { document.all['BG-Transparent'].style.height = (PageSize[1] + 'px'); }
}

function ScrollCheck() { // Fehlerhafte Höhenberechnung bei absoluter DIV-Positionierung unter IE
 document.getElementById('BG-Transparent').style.top=getPageScroll();
 ResizeLoginBG();
 ScrollCheckTimeout=window.setTimeout("ScrollCheck()",10);
}


///////////////////////////////////////////////////////////////////////////////////////////////////////////

function LoginEffekt(Position_Oben,Position_Links) { // Einblendeeffekt für Internet Explorer
 
 Position_Counter-=10; // Pixel die "gesprungen werden" pro Durchlauf
 
 if (Position_Counter <= -2) { // Animation an ihren Platz
  document.all['Login-Effekt'].style.visibilty="hidden";
  
  MoveWindow('Eingabeaufforderung-BG',Position_Oben-63,Position_Links-200);
  MoveWindow('Eingabeaufforderung',Position_Oben-63,Position_Links-200);
  document.Login.Benutzer.focus();
  window.clearTimeout(LoginEffektTimeout);
  Position_Counter=150;
  document.all['Login-Effekt'].style.visibility="hidden";
 }
 else {
  document.all['Login-Effekt'].style.left = Position_Links -200 + Position_Counter + "px";
  document.all['Login-Effekt'].style.top = Position_Oben -63 - Position_Counter + "px";
  LoginEffektTimeout=window.setTimeout("LoginEffekt(Position_Oben,Position_Links)",10); // Wierhohlung in Millisekunden
 }
}


///////////////////////////////////////////////////////////////////////////////////////////////////////////

function ShowLogin() {
 var PageSize = getPageSize();
 Position_Links=Math.round(PageSize[2]/2);
 Position_Oben=Math.round(PageSize[3]/2);

 MoveWindow('BG-Transparent',0);
 ResizeLoginBG();
 
 // Fehlerhafte Höhenberechnung bei absoluter DIV-Positionierung (CSS 2) unter Internet Explorer
 // Wichtig für den Transparenz-Hintergrund, da dieser auf eine 100% Höhe gesetzt wird
 if (navigator.appName=="Microsoft Internet Explorer") { ScrollCheck(); }
 
 // Übergangseffekt für Internet Explorer
 if (navigator.appName=="Microsoft Internet Explorer") {
  with (document.all['Login-Effekt']) {
    style.visibility="hidden";
    LoginEffekt(Position_Oben,Position_Links);
    filters.blendTrans.Apply();
    style.visibility="visible";
    filters.blendTrans.Play();
  }
 }
 
 if (navigator.appName!="Microsoft Internet Explorer") { // Übergangseffekt für Internet Explorer
  MoveWindow('Eingabeaufforderung-BG',Position_Oben-63,Position_Links-200);
  MoveWindow('Eingabeaufforderung',Position_Oben-63,Position_Links-200);
  document.Login.Benutzer.focus();
 }
}


///////////////////////////////////////////////////////////////////////////////////////////////////////////

function HideLogin() {
 HideAlertLogin() //Eingabeüberprüfung
 MoveWindow('BG-Transparent',-100000);
 MoveWindow('Eingabeaufforderung-BG',-100000);
 MoveWindow('Eingabeaufforderung',-100000);

  // Übergangseffekt für Internet Explorer
 if (navigator.appName=="Microsoft Internet Explorer") { 

   with (document.all['Login-Effekt']) {
    style.visibility="visible";
    filters.revealTrans.Apply();
    style.visibility="hidden";
    filters.revealTrans.Play();
  } 
  window.clearTimeout(ScrollCheckTimeout);
 }
 window.focus();
}


function MoveWindow(Objekt,Oben,Links) {
 if (document.layers) { oben=document.layers[Objekt].top = Oben + "px"; } // NS 4
 if (document.all) { document.all[Objekt].style.pixelTop = Oben + "px"; } // IE 4
 if (document.getElementById) { document.getElementById(Objekt).style.top = Oben + "px"; } // DOM
 
 if (Links) {
  if (document.layers) { oben=document.layers[Objekt].left = Links + "px"; } // NS 4
  if (document.all) { document.all[Objekt].style.pixelLeft = Links + "px"; } // IE 4
  if (document.getElementById) { document.getElementById(Objekt).style.left = Links + "px"; } // DOM
 }
}


///////////////////////////////////////////////////////////////////////////////////////////////////////////

function Copyjahr() { // Copyright Jahresangabe
 CJahr=new Date();
 document.write("© "+CJahr.getFullYear());
}


// Bilder Menü vorladen
if (document.images) {
 b1=new Image(); b1.src="img/b1o.gif";
 b2=new Image(); b2.src="img/b2o.gif";
 b3=new Image(); b3.src="img/b3o.gif";
 b4=new Image(); b4.src="img/b4o.gif";
}


///////////////////////////////////////////////////////////////////////////////////////////////////////////

LastMenue=""; StandtartMenueTimeoutStatus=""; MenueFirststart=true; // Hovereffekte Menü

function dn(i,Menue,Besonderheit) {

 if ((Menue==Hauptthema && StandtartMenueTimeoutStatus=="") || (Menue==Hauptthema && LastMenue==Menue)) {  }
 else {

 if (StandtartMenueTimeoutStatus=="neu gesetzt") { window.clearTimeout(StandtartMenueTimeout); }

 if (Menue==LastMenue && LastMenue!="") {
  StandartMenue();
  LastMenue=""; StandtartMenueTimeoutStatus="";
 }

 else if (Menue!=LastMenue || LastMenue=="") {
 
  if (navigator.appName=="Microsoft Internet Explorer") { // Übergangseffekt für Internet Explorer
   with (document.all["SN-"+Menue]) {
    style.visibility="hidden";
    filters.blendTrans.Apply();
    style.visibility="visible";
    filters.blendTrans.Play();
   }
  }
 
  if (LastMenue!="" ) HideMenue(); 

  if (document.layers) { // NS 4
   document.layers["SN-"+Menue].left="0px";
   document.layers["Sub-Navigation"].left="-5000px";
  }
  if (document.all) { // IE 4
   document.all["SN-"+Menue].style.pixelTop="0px";
   document.all["Sub-Navigation"].style.pixelTop="-5000px";
  } 
  if (document.getElementById) { // DOM
   document.getElementById("SN-"+Menue).style.top="0px";
   document.getElementById("Sub-Navigation").style.top="-5000px";
  }
 
  if (Menue!=Hauptthema) StandtartMenueTimeoutStatus="neu gesetzt";
  if (Menue!=Hauptthema)  StandtartMenueTimeout=window.setTimeout("StandartMenue();",MenueAnzeigeDauer);
  LastMenue=Menue;
  }
}

 if (document.images && i!="Index") {
  TempMenu=Menue; // Menü für Funktion up() merken
  if (Besonderheit!="Sonderthema" && Menue==Hauptthema) { document.images[i].src="img/"+i+".gif"; }
  else { document.images[i].src="img/"+i+"-over.gif"; }
 }
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////

function HideMenue() { // altes Menü ausblenden
 if (document.layers) document.layers["SN-"+LastMenue].top="-5000px"; // NS 4 
 if (document.all) document.all["SN-"+LastMenue].style.pixelTop="-5000px"; // IE 4 
 if (document.getElementById) document.getElementById("SN-"+LastMenue).style.top="-5000px"; // DOM 
}

function UpdateHide() {
 window.clearTimeout(StandtartMenueTimeout);
 StandtartMenueTimeout=window.setTimeout("StandartMenue();",MenueAnzeigeDauer);
}


///////////////////////////////////////////////////////////////////////////////////////////////////////////

function StandartMenue() {
 if (navigator.appName=="Microsoft Internet Explorer") { // Übergangseffekt für Internet Explorer
  with (document.all["Sub-Navigation"]) {
    style.visibility="hidden";
    filters.blendTrans.Apply();
    style.visibility="visible";
    filters.blendTrans.Play();
  }
 }
 
 if (document.layers) {
  document.layers["SN-"+LastMenue].top="-5000px"; 
  document.layers["Sub-Navigation"].top="0px";
 }
 if (document.all) {
  document.all["SN-"+LastMenue].style.pixelTop="-5000px"; 
  document.all["Sub-Navigation"].style.pixelTop="0px"; 
 }
 if (document.getElementById) {
  document.getElementById("SN-"+LastMenue).style.top="-5000px"; 
  document.getElementById("Sub-Navigation").style.top="0px";
 }
 LastMenue=""; StandtartMenueTimeoutStatus="";
 window.clearTimeout(StandtartMenueTimeout);
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////

function up(i,Besonderheit) { 
 if (document.images) {
  if (Besonderheit!="Sonderthema" && TempMenu==Hauptthema) { document.images[i].src="img/"+i+"-over.gif"; }
  else { document.images[i].src="img/"+i+".gif"; }
 }
}


///////////////////////////////////////////////////////////////////////////////////////////////////////////

function AlertMove(DivElement, PosTop, PosLeft) {

 if (document.layers) {
  document.layers[DivElement].style.top=PosTop;
  document.layers[DivElement].style.left=PosLeft; 
 }
 if (document.all) {
  document.all[DivElement].style.pixelTop=PosTop;
  document.all[DivElement].style.pixelLeft=PosLeft; 
 }
 if (document.getElementById) {
  document.getElementById(DivElement).style.top=PosTop;
  document.getElementById(DivElement).style.left=PosLeft; 
 }
}


///////////////////////////////////////////////////////////////////////////////////////////////////////////

function LoginFormCheck() {
 var PageSize = getPageSize();
 Position_Links=Math.round(PageSize[2]/2);
 Position_Oben=Math.round(PageSize[3]/2);
 
 if (document.Login.Benutzer.value=="") {
  AlertInnerText="Bitte geben Sie Ihren Benutzernamen ein.";
  AlertTop="61"; AlertLeft="178";
  document.Login.Benutzer.focus();
  if (document.getElementById) { document.getElementById("AlertText-Login").firstChild.nodeValue=AlertInnerText; }
  AlertMove("AlertContainer-Login",Position_Oben-AlertTop+"px",Position_Links-AlertLeft+"px");
  return false;
 }
 if (document.Login.Passwort.value=="") {
  AlertInnerText="Bitte geben Sie Ihr Passwort ein.";
  AlertTop="28"; AlertLeft="178";
  document.Login.Passwort.focus();
  if (document.getElementById) { document.getElementById("AlertText-Login").firstChild.nodeValue=AlertInnerText; }
  AlertMove("AlertContainer-Login",Position_Oben-AlertTop+"px",Position_Links-AlertLeft+"px");
  return false;
 }
}


///////////////////////////////////////////////////////////////////////////////////////////////////////////

function HideAlertLogin() {
 AlertMove("AlertContainer-Login","-50000px","");
}


///////////////////////////////////////////////////////////////////////////////////////////////////////////

function WriteLoginCheck() {
 WriteLoginCheck=new Array("<div id=AlertContainer-Login>",
   "<div id=Alert-Login></div><div id=Alert-Switched-Login></div>",
   "<div id=AlertText-Login>",
   "Bitte überprüfen Sie Ihre Eingabe.</div>",
   "<div style='position: absolute; left: 0px; top: 0px; padding: 3px 0px 0px 5px;' id=AlertLink-Login>",
   "<a onclick='JavaScript: HideAlertLogin()' style='cursor:help;'>",
   "<img width=292 height=35 border=0 src='img/leer.gif'></a></div>",
   "</div>");
 document.write(WriteLoginCheck.join(""));
}


///////////////////////////////////////////////////////////////////////////////////////////////////////////

// getPageScroll()
// Returns array with x,y page scroll values.
// Core code from - quirksmode.org

function getPageScroll () {
 var yScroll;
 
 if (self.pageYOffset) { yScroll = self.pageYOffset; }
 else if (document.documentElement && document.documentElement.scrollTop) {	 // Explorer 6 Strict
  yScroll = document.documentElement.scrollTop;
 }
 else if (document.body) {// all other Explorers
  yScroll = document.body.scrollTop;
 }
 return yScroll;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////

// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.org
// Edit for Firefox by pHaez

function getPageSize () {
 var xScroll, yScroll;
	
 if (window.innerHeight && window.scrollMaxY) {	
  xScroll = document.body.scrollWidth;
  yScroll = window.innerHeight + window.scrollMaxY; }
 else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
  xScroll = document.body.scrollWidth;
  yScroll = document.body.scrollHeight; }
 else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
  xScroll = document.body.offsetWidth;
  yScroll = document.body.offsetHeight;
 }
	
 var windowWidth, windowHeight;
 if (self.innerHeight) {	// all except Explorer
  windowWidth = self.innerWidth;
  windowHeight = self.innerHeight;
 }
 else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
  windowWidth = document.documentElement.clientWidth;
  windowHeight = document.documentElement.clientHeight;
 }
 else if (document.body) { // other Explorers
  windowWidth = document.body.clientWidth;
  windowHeight = document.body.clientHeight;
 }	
	
 // for small pages with total height less then height of the viewport
 if(yScroll < windowHeight) {  pageHeight = windowHeight; }
 else { pageHeight = yScroll; }

 // for small pages with total width less then width of the viewport
 if(xScroll < windowWidth) { pageWidth = windowWidth; }
 else { pageWidth = xScroll; }
 
 arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
 return arrayPageSize;
}


///////////////////////////////////////////////////////////////////////////////////////////////////////////


