/*---------------------------------------------------------------------
akea multimediascript: frame.js

(c) gina steiner, akea webdesign, info@akea.de
03-06-28
version 1.0

-----------------------------------------------------------------------*/

// Set window- and layer-related variables
var curSlide     = 0;
var zIdx          = 0;
var isVis          = false;

// Set browser-determined global variables
var hideName     ='hidden';
var showName     ='visible';

// Define a function to generate layers
function genLayer(sName, sVis, copy, above) {
     document.writeln('<DIV ID="' + sName +
     '" CLASS="' + sName + '" STYLE="visibility:' + sVis + ';');
     if (above) {
          document.writeln(' z-Index:0;">' + copy + '</DIV>');
     }
     else {
          document.writeln(' z-Index:' + (++zIdx) + ';">' + copy + '</DIV>');
     }
}

// Define an object constructor for each slide
function slide(imgStr, haupttext, link1, text1, link2, text2, link3, text3) {
        this.name    = imgStr;
        this.structure = '<table><tr><td class="roll">' + haupttext + '<a href=' + link1 + ' class="roll">' + text1 + '</a><br><a href=' + link2 + ' class="roll">' + text2 + '</a><br><a href=' + link3 + ' class="roll">' + text3 + '</a></td></tr></table>';
        return this;
}

// Define an array to store all of the slide objects
var slideShow  = new Array(
                        new slide(),
                        new slide('zelt', 'Zeltverleih und Zeltverkauf<br>Brauchen Sie ', '"zelte.html" onClick="javascript:parent.links.Textersetzen(\'Zelte\');"', 'mehr Information?', '"uebersicht.html" onClick="javascript:parent.links.Textersetzen(\'Zelte | &Uuml;bersicht\');"', '<br>Zelt&uuml;bersicht', '"zubehoer.html" onClick="javascript:parent.links.Textersetzen(\'Zelte | Zubeh&ouml;r\');"', 'Zubeh&ouml;r'),
                        new slide('textilkonfektion', 'Textile &Uuml;berdachun- gen, Planen, Bootspersen- ningen<br>Brauchen Sie ', '"textil.html" onClick="javascript:parent.links.Textersetzen(\'Textilkonfek- tion\');"', 'mehr Information?', '', '', '', ''),
                        new slide('sonnenschutz', 'Markisen, &Uuml;berdachun- gen, Sonnen- und Gro&szlig;schirme<br>Brauchen Sie ', '"sonne.html" onClick="javascript:parent.links.Textersetzen(\'Sonnen- schutz\');"', 'mehr Information?', '', '', '', ''),
                        new slide('polsterungen', 'Aufarbeiten und Neubeziehen von Polsterm&ouml;beln<br>Brauchen Sie ', '"polster.html" onClick="javascript:parent.links.Textersetzen(\'Polsterungen\');"', 'mehr Information?', '', '', '', ''),
                        new slide('fahrzeugtextilien', 'Motorradsitze, T&uuml;rverkleidung, Innenhimmel, Oldtimer- restaurierung<br>Brauchen Sie ', '"fahrzeuge.html" onClick="javascript:parent.links.Textersetzen(\'Textiles in Fahrzeugen\');"', 'mehr Information?', '', '', '', ''),
                        new slide('cabrioletverdecke', 'Verdecke f&uuml;r alle Cabriolets, Ma&szlig;gefertigte Verdecke<br>Brauchen Sie ', '"cabrio.html" onClick="javascript:parent.links.Textersetzen(\'Cabriolet- verdecke\');"', 'mehr Information?', '"../flash/verdeck_konfigurator_sattler.html" target="_blank"', 'Konfigurator', '', '')
                        );

// This generates all layers (or styles) to display for the screen
function genScreen() {
        for (var i = 0; i < slideShow.length; i++) {
                        // Create all of the slide layers
                        if ( i == "0") {
                        genLayer('slide0', showName, '', false);
                         }
                        else {
                        genLayer('slide' + i, hideName, slideShow[i].structure, false);
                        }
        }
}

// Define a function to hide layers
function hideLayer(name) {
        refLayer(name).visibility = hideName;
}

// Define a function to reveal layers
function showLayer(name) {
        refLayer(name).visibility = showName;
}

// Define a central function to reference layers
function refLayer(name) {
if (navigator.family == 'nn4'){return document.layers[name]; }
else {return document.getElementById(name).style;}
}

// Function to change the slide
function setSlide(ref) {
        hideLayer('slide' + curSlide);
        curSlide = ref;
        showLayer('slide' + curSlide);
}

// Function to hide the slide
function hideSlide(ref) {
        hideLayer('slide' + ref);
}

//------------------------------------------------------------------------------

// Function to preload the arrow images
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

// Function to restore the arrow images
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

// Function to find the object
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

// Function to swap the arrow images
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//------------------------------------------------------------------------------

// Function to show images by random
function runden () {
   var linknummer = 2;
   var zufall = Math.random();
   var linkselect = Math.round((linknummer-1) * zufall)+1;
   if(linkselect == 1) {
   document.writeln('<head><meta http-equiv="refresh" content="0; URL=../inhalt/1.html"></head>');
   }
   if(linkselect == 2) {
   document.writeln('<head><meta http-equiv="refresh" content="0; URL=../inhalt/2.html"></head>');
   }
   if(linkselect == 3) {
   document.writeln('<head><meta http-equiv="refresh" content="0; URL=../inhalt/3.html"></head>');
   }
   if(linkselect == 4) {
   document.writeln('<head><meta http-equiv="refresh" content="0; URL=../inhalt/4.html"></head>');
   }
   if(linkselect == 5) {
   document.writeln('<head><meta http-equiv="refresh" content="0; URL=../inhalt/5.html"></head>');
   }
   if(linkselect == 6) {
   document.writeln('<head><meta http-equiv="refresh" content="0; URL=../inhalt/6.html"></head>');
   }
   if(linkselect == 7) {
   document.writeln('<head><meta http-equiv="refresh" content="0; URL=../inhalt/7.html"></head>');
   }
   if(linkselect == 8) {
   document.writeln('<head><meta http-equiv="refresh" content="0; URL=../inhalt/8.html"></head>');
   }
   if(linkselect == 9) {
   document.writeln('<head><meta http-equiv="refresh" content="0; URL=../inhalt/9.html"></head>');
   }
   if(linkselect == 10) {
   document.writeln('<head><meta http-equiv="refresh" content="0; URL=../inhalt/10.html"></head>');
   }
}

//------------------------------------------------------------------------------

// Function to replace html-text
function Textersetzen(text)
{
 var Anzahl = document.getElementsByTagName('P')[0].firstChild.nodeValue.length;
 document.getElementsByTagName('P')[0].firstChild.replaceData(0,Anzahl,text);
}

//------------------------------------------------------------------------------

// Function to popup a defined window
var newwin;
function popup(url,name,eigenschaften)
   {
   newwin = window.open(url,name,eigenschaften);
      if(version > 1.0)
      {
      setTimeout('newwin.focus();',200);
      }
}