var aktiv;
var subnavnummer;
var lastaktiv=100;
var mainactive=1;


function changeVis(nr)
	{
	obji = document.getElementById("antwort_"+nr);
	if(obji.style.display == 'none')
		obji.style.display = 'block';
	else
		obji.style.display = 'none';
	}

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 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-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 doActive(nr)
{
	mainactive=nr;
	MM_swapImage('n'+mainactive,'','/de/i/n'+mainactive+'o.gif',0);
		
}





function getNav(nr)
{
 document.getElementById(nr).style.background="#FABF01";
 document.getElementById(nr).style.color="#000000";
 window.clearTimeout(aktiv);
 MM_swapImage('n'+subnavnummer,'','/de/i/n'+subnavnummer+'o.gif',0);

}

function wegNav(nr)
{
 //document.getElementById(nr).style.background="#C0D4CB";
 aktiv = window.setTimeout("subnavweg()",100);
 
  document.getElementById(nr).style.background="#FCD501";
 
 document.getElementById(nr).style.color="#000000";
}


function subnavsweg()
{
 for(var i=1;i<9;i++)
 { 
  document.getElementById("layer"+i).style.visibility="hidden";	
  
 }
 if(lastaktiv!=100 && lastaktiv!=mainactive)document.getElementById("n"+lastaktiv).src="/de/i/n"+lastaktiv+".gif";	

}


function subnavweg()
{
document.getElementById("layer"+subnavnummer).style.visibility="hidden";	
if(subnavnummer!=mainactive)document.getElementById("n"+subnavnummer).src="/de/i/n"+subnavnummer+".gif";

lastaktiv=100;
}

function subnavwegtimer(nr)
{
lastaktiv=subnavnummer;
subnavnummer=nr;
aktiv = window.setTimeout("subnavweg()",100);	
}


function getSubNav(nr)
{
subnavsweg();
lastaktiv=subnavnummer;
subnavnummer=nr;
window.clearTimeout(aktiv);
document.getElementById("layer"+subnavnummer).style.visibility="visible";
MM_swapImage('n'+subnavnummer,'','/de/i/n'+subnavnummer+'o.gif',0);		
}











function doLink(link)
{
 document.location.href=link;
}

function scroller()
{
	x = document.body.scrollLeft;
	y = document.body.scrollTop;
	step = 2;

	while ((x != 0) || (y != 0)) {
		scroll (x, y);
		step += (step * step / 100);
		x -= step;
		y -= step;
		if (x < 0) x = 0;
		if (y < 0) y = 0;
	} 
	scroll (0, 0);
}


function startSearch()
	{
	error = "Bitte geben Sie einen Suchbegriff ein.";
	f = document.we_global_form;
	if(f.we_lv_search_0.value=='')
		{
		alert(error);
		f.we_lv_search_0.focus();
		return;		
		}
	f.submit();
	}


function isInt(myNum) {
         // get the modulus: if it's 0, then it's an integer
         var myMod = myNum % 1;

         if (myMod == 0) {
                 return true;
         } else {
                 return false;
         }
}



function sendShopData()
{
	f = document.ticket;
	f.submit();	
}


function calculateNew()
{
f = document.artikel;
f.submit();
}

function addToWarenkorb(nam)
{

f = document.artikel;
if(!(parseInt(document.getElementById(nam).value)>=0))
{
alert('Bitte geben Sie eine Zahl ein!');
		document.getElementById(nam).focus();
		return;	
}
	
if(!(isInt(document.getElementById(nam).value)))
{
alert('Bitte geben Sie eine ganze Zahl ein!');
		document.getElementById(nam).focus();
		return;	
}



if(f.maxanzahl.value!='0' && parseInt(document.getElementById(nam).value)>parseInt(f.maxanzahl.value))
		{
		alert('Max. bestellbare Artikelmenge überschritten!');
		document.getElementById(nam).focus();
		return;		
		}
	f.submit();
}


function checkfeld()
	{
	error = "Sie haben keine Email-Adresse angegeben";
	f = document.abmelden;
	if(f.emailabmelden.value=='')
		{
		alert(error);
		f.emailabmelden.focus();
		return;		
		}
	f.submit();
	}


function changeGalleryImage(rang,name)
	{
	document.getElementById('legende'+document.gallery.actualbildname.value).style.visibility= 'hidden';
         document.getElementById('legende'+document.gallery.actualbildname.value).style.display = 'none';	
             
document.getElementById('legende'+name).style.visibility= 'visible';
document.getElementById('legende'+name).style.display = 'block';

	document.gallery.actualbildname.value=name;
	bild = document.images['vorschau'];
	document.gallery.bild_id.value = rang;
	bild.src = "/gallery/images/th_"+name+".jpg";       
	}

function changeGalleryImage2(rang,name)
	{
	document.gallery.actualbildname.value=name;
	bild = document.images['vorschau'];
	document.gallery.bild_id.value = rang;
	bild.src = "/gallery/images/th_"+name+".jpg";       
	}

function showNextPic()
{


document.gallery.bild_id.value=document.gallery.bild_id.value;
var actual=parseInt(document.gallery.bild_id.value);
actual=actual+1;
if(actual>parseInt(document.gallery.anzahlpics.value))actual=1;
document.gallery.bild_id.value=actual;
document.gallery.actualbildname.value=picnames=document.getElementById("picnames"+actual).value;
bild = document.images['vorschau'];

bild.src = "/gallery/images/th_"+document.gallery.actualbildname.value+".jpg";       
}


function showBackPic()
{
document.gallery.bild_id.value=document.gallery.bild_id.value;
var actual=parseInt(document.gallery.bild_id.value);
actual=actual-1;
if(actual==0)actual=document.gallery.anzahlpics.value;
document.gallery.bild_id.value=actual;
document.gallery.actualbildname.value=picnames=document.getElementById("picnames"+actual).value;
bild = document.images['vorschau'];

bild.src = "/gallery/images/th_"+document.gallery.actualbildname.value+".jpg";       
}


function gallery()
	{
	gallerie = document.gallery.gallery_id.value;
	bild = document.gallery.bild_id.value;
	lang = document.gallery.sprache.value;
	pfad = "/gallery/index.php?gid=" + gallerie + "&nr=" + bild + "&lang=" + lang;
	

	width = 602;
	height= 550;
	links  = (screen.width-width)/2;
	oben  = (screen.height-height)/2;
	galler = window.open(pfad,"Fotogalerie","width="+width+",height="+height+",left="+links+",top="+oben);
	galler.focus();	

	}

