var verticals_layer_stat = "closed";
var allow_status_change = true;

function showVerticals() {   
   document.getElementById('verticals').style.visibility = 'visible';
   verticals_layer_stat = "open";
   allow_status_change = false;
}

function holdVerticals() {   
   if(verticals_layer_stat == "open") {
      verticals_layer_stat = "open";
      allow_status_change = false;
      document.getElementById('verticals').style.visibility = 'visible';
   }
}

function hideVerticals() {
   allow_status_change = true;   
   window.setTimeout("changeVisibility()", 100);
}

function changeVisibility() {   
   if(allow_status_change) {
      verticals_layer_stat = "closed";
      document.getElementById('verticals').style.visibility = status;
   }
}

function setState(id, name)
	{	var el=document.getElementById(id);
		if (document.createAttribute)
		{	var at=document.createAttribute("class");
			if (el&&at)
			{	at.nodeValue=name;
				document.getElementById(id).setAttributeNode(at);
			}
		}
	}

   function bildar(url1, url2)
   { 	if (bildnr==0)
   	{	document.artbild.src=url1;
	}
	else
   	{	document.artbild.src=url2;
	}
	bildnr=(bildnr+1) % 2;
  }

	function Zeit()
	{	var Element;
		var Zeit=new Date();
		var Sekunden=""+((Zeit.getSeconds()>9)?Zeit.getSeconds():
			"0"+Zeit.getSeconds());
		var Minuten=""+((Zeit.getMinutes()>9)?Zeit.getMinutes():
			"0"+Zeit.getMinutes());
		var Stunden=""+((Zeit.getHours()>9)?Zeit.getHours():
			"0"+Zeit.getHours());
		Element=document.getElementById("ZT");
		if ((gratbilder.length>0)&&((Zeit.getSeconds()%5)==0))
		{	var bildgrat;
			bildgrat=document.getElementById("bildgrat");
			if (bildgrat)
			{	bildgrat.src=gratbilder[gratbild];
				gratbild++;
				if (gratbild>=gratbilder.length)
					gratbild=0;
			}
		}
		if(Element) Element.firstChild.data=""+Stunden+":"+Minuten+":"+Sekunden;
		window.setTimeout('Zeit()',1000);
	}

    function bildvo(an, url, x)
    { var Element1;
      var Element2;
      Element1=document.getElementById("bilddiv");
      Element2=document.getElementById("bildgr");
      if(Element2) Element2.src=url;
	var y=100;
	if (window.pageYOffset)
		y+=window.pageYOffset;
	else
		y+=document.body.scrollTop;
	Element1.style.top=y+"";
	if (x>0)
		Element1.style.left=x+"";
      switch(an)
      {		case "1":Element1.style.visibility = 'visible';;
      			 break;
		default :Element1.style.visibility = 'hidden';
      }
    }

    function knob(nr, feld, param)
    {	if ((nr>2)&&(nr!=1000))
			document.nav_form.action="https://www.best-of-dress.de/shop/page.php";
		else
			document.nav_form.action="http://www.best-of-dress.de/shop/page.php";
		switch(feld)
		{	case "1":	document.nav_form.grp.value=param;
					document.nav_form.label.value=0;
					document.nav_form.wgrp.value=0;
					document.nav_form.art.value=0;
					document.nav_form.from.value=0;
					document.nav_form.cmd.value=nr;
					document.nav_form.submit();
					break;
			case "2":	document.nav_form.art.value=param;
							document.nav_form.cmd.value=nr;
							document.nav_form.submit();
							break;
			case "3":	document.nav_form.from.value=param;
							document.nav_form.art.value=0;
							document.nav_form.cmd.value=nr;
							document.nav_form.submit();
							break;
 			case "5": window.open("empfehlen.php?art="+document.nav_form.art.value+"&grp="+document.nav_form.grp.value+"&from="+document.nav_form.from.value,"Weiteremfehlen","width=450,height=350,scrollbars=yes");
							break;
			case "8":	document.nav_form.from1.value=param;
							document.nav_form.cmd.value=nr;
							document.nav_form.submit();
							break;
			case "16":	document.nav_form.wgrp.value=param;
							document.nav_form.label.value=0;
							document.nav_form.cmd.value=nr;
							document.nav_form.submit();
							break;
			case "17":	document.nav_form.label.value=param;
							document.nav_form.cmd.value=nr;
							document.nav_form.submit();
							break;
			case "18":	document.nav_form.from1.value=param;
							document.nav_form.cmd.value=nr;
							document.nav_form.submit();
							break;
			case "19":	document.nav_form.wgrp.value=0;
						 	document.nav_form.label.value=0;
						 	document.nav_form.size.value=0;
						 	document.nav_form.find.value="";
							document.nav_form.cmd.value=nr;
							document.nav_form.submit();
							break;
			case "20":	document.nav_form.wgrp.value=0;
						 	document.nav_form.label.value=0;
							document.nav_form.grp.value=0;
							document.nav_form.cmd.value=nr;
							document.nav_form.submit();
							break;
			case "21":	document.nav_form.label.value=param;
							document.nav_form.wgrp.value=0;
							document.nav_form.cmd.value=nr;
							document.nav_form.submit();
							break;
			default:		document.nav_form.cmd.value=nr;
							document.nav_form.submit();
							break;
		}
    }

    function fenster(url, title, width, height, scroll)
    {	var s="width="+width+", height="+height+", scrollbars="+scroll;
    	open(url, title, s);
    }

function enterInput(name)
{	var el=document.nav_form.elements[name];
	if (el.value.charCodeAt(0)==32)
		el.value="";
}

function releaseInput(name, text)
{	var el=document.nav_form.elements[name];
	if (el.value.length==0)
		el.value=text;
}
