/*

stain.js

steuerlogik und variablen fuer stain.html (Fleckendetektiv)

erstellt 03-07-2003 oBu
letzte Aenderung 03-07-2003 oBu
*/

function ActivateLayer() 
{
  var i, p, v, obj, args = ActivateLayer.arguments;
  
  for (i=0; i<(args.length-2); i+=3) 
  
    if ((obj=FindObject(args[i]))!=null) 
    { 
      v=args[i+2];
    
      if (obj.style) 
      { 
        obj = obj.style; 
        v=(v=='show')?'visible':(v='hide')?'hidden':v;        
      }
      obj.visibility=v; 
    }
}
function FindObject(n, d)
{
  var p, i, x;  

  if (!d) d = document;

  if ((p = n.indexOf("?")) > 0 && parent.frames.length) 
  {
    // in een frame?
    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 = FindObject (n , d.layers[i].document); 
    
  // netscape 6.0  
  if (!x && d.getElementById) x = d.getElementById(n);
      
  return x;
}

//**************************************

var strLayer = "";
var strType = "";

function evtStainChange(obj){
	var iSelect = obj.selectedIndex;
	if (strLayer != ""){
		ActivateLayer(strLayer,'','hide');  	
		if (strType != ""){
			ActivateLayer(strType,'','hide');
		}
		ActivateLayer('mlpt1','','show'); 
		ActivateLayer('mlpt2','','hide'); 
	}
	if (iSelect !=0){ 
		ActivateLayer('mlp-' + obj.options[iSelect].value,'','show');
		strLayer = 'mlp-' + obj.options[iSelect].value;
	}
	return true;
}


function evtTypeChange(obj)
{
  var iSelect = obj.selectedIndex;
  
  if (strType != "") 
  {
  	ActivateLayer(strType,'','hide');  	
        ActivateLayer('mlpt1','','show'); 
        ActivateLayer('mlpt2','','hide'); 
  }

  if (iSelect !=0) 
  { 
  	ActivateLayer('mlpt-' + obj.options[iSelect].value,'','show');
  	strType = 'mlpt-' + obj.options[iSelect].value;
        ActivateLayer('mlpt1','','hide'); 
        ActivateLayer('mlpt2','','show'); 
  }
       
  return true;
}
