/* javascript cd-fachmarkt.de by onlinemars (www.onlinemars.de)    */

function findeFlash (flash) {
  if (document.all) {
    if (document.all[flash]) { return document.all[flash]; }
    if (document.opera) {
      var movie = eval(window.document + flash);
      if (movie.SetVariable) {return movie;}
    }
    return;
  }
  if(document.layers) {
    if(document.embeds) {
      var movie = document.embeds[flash];
      if (movie.SetVariable) {return movie;}
    }
    return;
  }
  if (!document.getElementById) {return;}
  var movie = document.getElementById(flash);
  if (movie.SetVariable) {return movie;}
  var movies = movie.getElementsByTagName('embed');
  if (!movies || !movies.length) {return;}
  movie = movies[0];
  if (movie.SetVariable) {return movie;}
  return;
}

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 MM_swapImgRestore(k) { //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 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 MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-3);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];}
}

var logoaktiv;
var speedlogo = 5;
var logoleft=0;
var logoindex=0;

function logorechts()
{
  if (logoindex<50)
    logoindex++;
  if (logoindex>=50)
  if (logoleft<140) {
    logoleft+=3;
    if ((x=MM_findObj("logo"))!=null){x.style.left=logoleft;}
  }
}

function initSeite(btn)
{
  var film = findeFlash(btn);
  if (film) {
    film.GotoFrame(15);
    film.Play();
  }
  //window.startbtn2.GotoFrame(15);
  //window.startbtn2.Play();
  MM_preloadImages();
  logoaktiv=setInterval(logorechts,speedlogo);
}

function GalerieShow(DirName,Nr,Nrs) {
  fenster = window.open("galerie.htm?dir=images/galerie/"+DirName+"/&Nr="+Nr+"&Nrs="+Nrs, "3DServiceGroup",
        "width=1024,height=750,scrollbars=yes,menubar=no,toolbar=no,location=no,statusbar=no,resizable=yes");
  fenster.focus();
  return;
}

function Details(DatName) {
  fenster = window.open(DatName, "Info",
        "width=780,height=550,scrollbars=yes,menubar=no,toolbar=no,location=no,statusbar=no,resizable=yes");
  fenster.focus();
  return;
}

function Details2(DatName) {
  fenster2 = window.open(DatName, "Details",
        "width=780,height=550,scrollbars=yes,menubar=no,toolbar=no,location=no,statusbar=no,resizable=yes");
  fenster2.focus();
  return;
}

function DetailsXY(DatName,x,y) {
  fensterXY = window.open(DatName, "Info",
        "width="+x+",height="+y+",scrollbars=yes,menubar=no,toolbar=no,location=no,statusbar=no,resizable=no");
  fensterXY.focus();
  return;
}

function DetailsKlein(DatName) {
  fensterklein = window.open(DatName, "Details2",
        "width=450,height=300,scrollbars=yes,menubar=no,toolbar=no,location=no,statusbar=no,resizable=no");
  fensterklein.focus();
  return;
}


function browser_IE()
{
  var browser;
  if (navigator.appName == "Microsoft Internet Explorer"){
    browser=true;
  }
  else{
    browser=false;
  }
  return browser;
}


function DivVis(Div,Vis)
{
  if (document.getElementById) {
    if (Vis)
         document.getElementById(Div).style.visibility="visible";
    else document.getElementById(Div).style.visibility="hidden";
  }
  else if(browser_IE()) {
    if (Vis)
         document.all[Div].style.visibility="visible";
    else document.all[Div].style.visibility="hidden";
  }
  else {
    if (Vis)
         document.layers[Div].visibility="show";
    else document.layers[Div].visibility="hide";
  }

}

function GetOIMG(source,Div,PicName)
{
  var ok;
  ok=false;
  for (i=0;i<oimg.length;i++) {
/*      alert(oimg[i].src+"---"+source);*/
    if (oimg[i].src.search(source)>0) {
      document.getElementById("d_"+PicName).firstChild.lastChild.setAttribute("src",oimg[i].src);
      ok=true;
    }
  }
  if (ok != true) {
    document.getElementById("d_"+PicName).firstChild.lastChild.setAttribute("src",source);
  }
}

function PicPic(Div,PicNr,PicName,zusatz1,zusatz2)
{
  if (document.getElementById) {
    GetOIMG("images/"+PicName+zusatz2+zusatz1+".gif",Div,PicName);
  }
  else if(browser_IE())
    document.images[PicName].src="images/"+PicName+zusatz1+".gif";
  else {
    document.layers[Div].document.images[PicNr].src="images/"+PicName+zusatz2+zusatz1+".gif";
  }
}

function PicPic2(Div,PicNr,PicName,zusatz1,zusatz2)
{
  if (document.getElementById) {
    GetOIMG("images/"+PicName+zusatz2+zusatz1+"2.gif",Div,PicName);
  }
  else if(browser_IE())
    document.images[PicName].src="images/"+PicName+zusatz1+"2.gif";
  else
    document.layers[Div].document.images[PicNr].src="images/"+PicName+zusatz2+zusatz1+"2.gif";
}


function auf(Div1,Div2)
{
  DivVis(Div2,true);
}

function res(Div1,Div2)
{
  DivVis(Div2,false);
}

function auf0(Div1,PicNr1,PicName1)
{
  PicPic(Div1,PicNr1,PicName1,"r","");
  for (i=1;i<=20;i++) {
    if (document.getElementById(Div1+i)) {
      DivVis(Div1+i,true);
    }
  }
}

function aufd0(Div1,PicNr1)
{
  if (document.getElementById(Div1+PicNr1)) {
    document.getElementById(Div1+PicNr1).style.backgroundColor='#FF0000';
    if (document.getElementById(Div1+PicNr1).firstChild) {
      document.getElementById(Div1+PicNr1).firstChild.style.backgroundColor='#FF0000';
      document.getElementById(Div1+PicNr1).firstChild.style.color='#FFFFFF';
      document.getElementById(Div1+PicNr1).firstChild.style.fontWeight='bold';
    }
  }
  for (i=1;i<=20;i++) {
    if (document.getElementById(Div1+i)) {
      DivVis(Div1+i,true);
    }
  }
}

function auf1(Div1,PicNr1,PicName1)
{
  PicPic(Div1,PicNr1,PicName1,"r","");
  DivVis(Div1,true);
}

function auf2(Div1,PicNr1,PicName1,VisibleDIV1,VisibleDIV2)
{
  PicPic(Div1,PicNr1,PicName1,"r","");
  DivVis(VisibleDIV1,true);
  DivVis(VisibleDIV2,true);
}

function res0(Div1,PicNr1,PicName1)
{
  PicPic(Div1,PicNr1,PicName1,"","");
  for (i=1;i<=20;i++) {
    if (document.getElementById(Div1+i)) {
      DivVis(Div1+i,false);
    }
  }
}

function resd0(Div1,PicNr1)
{
  if (document.getElementById(Div1+PicNr1)) {
    document.getElementById(Div1+PicNr1).style.backgroundColor='#E7F0F9';
    if (document.getElementById(Div1+PicNr1).firstChild) {
      document.getElementById(Div1+PicNr1).firstChild.style.backgroundColor='#E7F0F9';
      document.getElementById(Div1+PicNr1).firstChild.style.color='#000000';
      document.getElementById(Div1+PicNr1).firstChild.style.fontWeight='normal';
    }
  }
  for (i=1;i<=20;i++) {
    if (document.getElementById(Div1+i)) {
      DivVis(Div1+i,false);
    }
  }
}

function res1(Div1,PicNr1,PicName1)
{
  DivVis(Div1,false);
  PicPic(Div1,PicNr1,PicName1,"","");
}

function res2(Div1,PicNr1,PicName1,VisibleDIV1,VisibleDIV2)
{
  DivVis(VisibleDIV2,false);
  DivVis(VisibleDIV1,false);
  PicPic(Div1,PicNr1,PicName1,"","");
}
