
// Needed at checkReqFields()
function explodeArray( item, delimiter )
{
 tempArray = new Array(1);
 var Count = 0;
 var tempString = new String(item);

 while ( tempString.indexOf(delimiter) > 0 )
 {
  tempArray[Count] = tempString.substr(0,tempString.indexOf(delimiter));
  tempString       = tempString.substr(tempString.indexOf(delimiter)+1,tempString.length-tempString.indexOf(delimiter)+1); 
  Count            = Count+1
 }

 tempArray[Count] = tempString;
 return tempArray;
}

/* changePage() resides directly within functions-Class */

// Parses whole XHTML-Doc and highlights missing fields
function checkReqFields( fields, userlang ) {
	var m,ok,obj,mfocus,frm,ok=true,there;

 // Colors
 var bgcolor = "#b0dc02";
 var hicolor = "transparent";
 
 // Explode ONLY if minimum two elements
 there = fields.indexOf(",");

 if ( there != -1 )
  fields = explodeArray( fields, "," );
	else
  fields = explodeArray( fields, "" );

 frm = document.forms[1];

 with ( frm ) { 
	for ( i=0;i<fields.length;i++ ) {
	
			field = fields[i];

			obj = elements[''+field+''];

   //wenn radio box dann dyn. durchklappern
   if ( typeof(obj) != "undefined" )
   {
    if ( obj.type != "text"  && obj.type != "password" && obj.type != "file" && obj.type != "textarea" && obj.type != "select-one" )
    {
     if ( obj[0].type == "radio" )
     {
      var check = 0;
      for (k=0;k<obj.length;k++)
      {
       if ( obj[k].checked == true ) { check++; }
      }
      if ( check == 0 )
      {
       ok=false;
 
       for ( k=0; k<obj.length; k++ )
       {
        obj[k].style.backgroundColor=bgcolor;
       }
      }
      else
      {
       for (k=0;k<obj.length;k++)
       {
        obj[k].style.backgroundColor=hicolor;
       }
      }
     }
    }
    else if ( obj.type == "select-one" )
    {
     if ( obj.value == "" )
     {
      ok = false;
      obj.style.backgroundColor=bgcolor;
     }
     else
     {
      obj.style.backgroundColor=hicolor;
     }
    }      
    else
    {
     if ( !obj.value )
     { 
      ok = false;
      obj.style.backgroundColor=bgcolor;
     }
     else
     {
      obj.style.backgroundColor=hicolor;
     }
    }	
   }		
		}

  // Show Error-GIF
		if ( !ok ) {
			document.getElementById("jsalert").src = '/pix/errors/'+userlang+'/2_.png';
			document.getElementById("jsalert").width = 394;
			document.getElementById("jsalert").height = 123;
			document.getElementById("jsalert").style.visibility = 'visible';
			return false;
		}
  else
   return true;
	}
	
	//alert(zzz);
}




// address flash movie for external interface in action script
function thisMovie( movieName )
{
    if ( navigator.appName.indexOf("Microsoft") != -1 )
    {
        return window[movieName];
    }
    else
    {
        return document[movieName];
    }
}