// Escaping js problems, activate only after launch
//function oe() {return true;}
//window.onerror = oe;

// Visual-Show
function gallery() {
 var i = 1;

 this.swap = function() {

   if ( i<6 )
    i++;
   else
    i = 1;

    document.getElementById("gallery").src = 'pix/animation'+i+'.jpg';
 }

 setInterval( function(){self.swap()}, 2000 )
}

// flash-include-workaround ie7 active-x-sperre
function flashInclude( swf, height, width ) {
// JS-Initialising and Activating
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+width+'" height="'+height+'" id="tvl" align="middle"><param name="allowScriptAccess" value="sameDomain"><param name="movie" value="pix/'+swf+'"><param name="quality" value="high"><param name="bgcolor" value="#ffffff"><embed src="pix/'+swf+'" quality="high" bgcolor="#ffffff" width="'+width+'" height="'+height+'" name="tvl" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></object>');
}

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;
}


function checkReqFields( fields ) {
 fields = explodeArray(fields,",");

 var m,ok,obj,mfocus,frm;
 ok=true;

 frm=document.forms[0];

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

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

      //wenn radio box dann dyn. durchklappern
      if ( obj.type != "text"  && obj.type != "password" && obj.type != "file" && obj.type != "textarea" && obj.type != "select-one" && obj.type != "checkbox" )

      {
        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='#73AA1B';
            }
          } else {
            for (k=0;k<obj.length;k++) {
              obj[k].style.backgroundColor='#0866b0';
            }
          }
        }
      }
      else if ( obj.type == "select-one" )
      {
        //alert(obj.value);
        if ( obj.value == "" ) {ok=false; obj.style.backgroundColor='#626832';} else  { obj.style.backgroundColor='#cccdbe'; }
		    }  

      else if ( obj.type == "checkbox" )
      {
        if ( obj.checked == false ) {ok=false; obj.style.backgroundColor='#626832'; } else  { obj.style.backgroundColor='#cccdbe'; }
		    }     
      else
      {
        if (!obj.value) {ok=false; obj.style.backgroundColor='#626832';} else  { obj.style.backgroundColor='#cccdbe'; }
		  }	
    }		

		if ( !ok )
    {
			alert("Markierte Felder (*) sind pflicht.");

			return false;
		}
    else return true;
	}
} //end of function checkReqFields()

