
function loadNextSlideShow(nNextPage){
	new Effect.Fade('wteaserbox_content');
	window.setTimeout("loadSlideShow("+nNextPage+")",1500);
}

function loadSlideShow(nNextPage){
	new Ajax.Updater('wteaser_content_updateable','/_tools/ajax/getNews.php',
		{ method: 'get', evalScripts:true, parameters: { 'page':nNextPage},
  			onComplete: function () {
  				new Effect.Appear('wteaserbox_content');
  			}
  		});
}


timer_menuclose  = 0;

function switchSubMenu(id,viewmode) {
	strFieldname = 'submenu' + id;
	window.clearInterval(timer_menuclose);
	if (viewmode == '1'){
		if (document.getElementById(strFieldname).style.display != 'block'){
			document.getElementById(strFieldname).style.display = 'block';

			for(i=1;i<=8;i++){
				strFieldname2 = 'submenu' +i;
				if (strFieldname != strFieldname2){
					if (document.getElementById(strFieldname2).style.display == 'block'){
						document.getElementById(strFieldname2).style.display = 'none';
					}
				}// END IF
			}// END FOR
		}// END IF
	}// END IF

	return;
}

function setCloseSubMenu(){
	// Countdown in Sekunden
	window.clearInterval(timer_menuclose);
	timer_menuclose = window.setInterval("CloseSubMenu()",3000);

}

function CloseSubMenu() {

	for(i=1;i<=8;i++){
		strFieldname = 'submenu' + i;
		if (document.getElementById(strFieldname).style.display == 'block' ){
			document.getElementById(strFieldname).style.display = 'none';
		}// END IF
	}// END FOR
	window.clearInterval(timer_menuclose);
	return;
}




/*
	Sonstige Funktionen
*/

function addText(id,text) {

 if(document.layers) { // Netscape 4.x
  document.layers[id].document.open();
  document.layers[id].document.write(text);
  document.layers[id].document.close();
  }
 else if(document.all) { // Internet Explorer 4+
  document.all[id].innerHTML = text;
 }
 else if(document.getElementById) { // W3C konform zB. Opera, Mozilla, Netscape 6+ 
  var DOMobj = document.getElementById(id).firstChild;
  DOMobj.innerHTML = text;
 }
}

function openWindow(url,name){
	window.name='mainpage';
	window.open(url,name,'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=auto,resizable=yes,width=640,height=500');

}

function showHelp(id) {
	if(document.getElementById(id) && document.getElementById(id).style.display == "none") {
		document.getElementById(id).style.display = "block";
		return;
	}else{
		document.getElementById(id).style.display = "none";
	}
}

function switchLayer(id,value) {
	
	if (value == 0) 
		document.getElementById(id).style.display = 'none';
	if (value == 1) 
		document.getElementById(id).style.display = 'block';

	return;
}


function trim(s) {
  while (s.substring(0,1) == ' ') {
    s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') {
    s = s.substring(0,s.length-1);
  }
  return s;
}

function clean_specialcode(strImport){
	strImport = strImport.replace('#t#',' ');
	strImport = strImport.replace('#s#',' ');
	strImport = strImport.replace('#n#',' ');
	return strImport;
}

function ACD(f,v)
{
  if(v.length==0)
    return true;
  isplit=v.indexOf('.');

  if(v.length>=6&&isplit==-1){
    if(v.length==6){
      var y=v.substr(4,2);
      if(Number(y)<50)
        y='20'+y
      else
        y='19'+y
      v=v.substr(0,4)+y
    }

    v=v.substr(0,2)+'.'+v.substr(2,2)+'.'+v.substr(4,4)
    if(f)
      if(f.value)
        f.value=v
    isplit=v.indexOf('.');
  }

  if(isplit==-1||isplit==v.length)
    return false;

  SD=v.substring(0,isplit);
  monthSplit=isplit+1;

  isplit=v.indexOf('.',monthSplit);
  if(isplit==-1 ||(isplit+1)==v.length)
    return false;

  SM=v.substring((SD.length+1),isplit);
  SY=v.substring(isplit+1);

  while(SM.length<2)
    SM='0'+SM

  SM=SM.substring(0,2)

  while(SD.length<2)
    SD='0'+SD

  SD=SD.substring(0,2)

  while(SY.length<2)
    SY='0'+SY

  if(Number(SY)<50)
    SY='20'+SY
  else if(Number(SY)<100)
    SY='19'+SY

  SY=SY.substring(0,4)

  v=SD+'.'+SM+'.'+SY

  if(f)
    if(f.value)
      f.value=v

  if(!ACI(SM))
    return false;
  else if(!ACNR(SM,1,12))
    return false;
  else if(!ACI(SY))
    return false;
  else if(!ACNR(SY,0,null))
    return false;
  else if(!ACI(SD))
    return false;
  else if(!ACDay(SY,SM,SD))
    return false;
  else{
    return true;
  }
}

function ACDay(checkYear,checkMonth,checkDay){
  maxDay=31;
  if(checkMonth==4||checkMonth==6||checkMonth==9||checkMonth==11)
    maxDay=30;
  else if(checkMonth==2){
    if(checkYear%4>0)
      maxDay=28;
    else if(checkYear%100==0&&checkYear%400>0)
      maxDay=28;
    else
      maxDay=29;
  }
  return ACNR(checkDay,1,maxDay);
}

function ACI(v){
  if(v.length==0)
    return true;
  var start_format=".+-0123456789";
  var number_format=".0123456789";
  var check_char;

  check_char=start_format.indexOf(v.charAt(0));
  if(check_char<1)
    return false;
  for(var i=1;i<v.length;i++){
    check_char=number_format.indexOf(v.charAt(i));
    if(check_char<0)
    return false;
  }
  return true;
}

function ACNR(v, min_value, max_value){
  if(v.length==0)
    return true;
  if(min_value!=null){
    if(v<min_value)
      return false;
  }
  if(max_value!=null){
    if(v>max_value)
      return false;
  }
  return true;
}

function ACF(v){
  if(v.length==0)
    return true;
  var start_format=",.+-0123456789";
  var number_format=",.0123456789";
  var check_char;

  check_char=start_format.indexOf(v.charAt(0))
  if(check_char<1)
    return false;

  for(var i=1;i<v.length;i++){
    check_char=number_format.indexOf(v.charAt(i))
    if(check_char<0)
      return false;
  }
  return true
}

 function isEmail(myvalue) {
     if (myvalue.indexOf("@") != "-1" &&
         myvalue.indexOf(".") != "-1") {
         return true;
     }
     else {
         return false;
     }
 }

function isInt(myvalue) {
     var pattern = /[^0-9]/;
     if (pattern.test(myvalue)) {
         return false;
     }
     else {
         return true;
     }
 }

function isURL(myvalue) { return true; }

function O(url,breit,hoch)
{
	F1 = window.open(url,"_blank","resizeable=yes, dependent=yes, scrollbars=no, width="+breit+", height="+hoch);
	return false;
}

function findObj(n, d) { 
  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=findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function boxrow_over(obj)
{
	obj.style.backgroundColor='#F6F6F6';
}

function boxrow_leave(obj)
{
	obj.style.backgroundColor='#FFFFFF';
}

function boxrow_nonbubble()
{
	if (event.stopPropagation) 
	{ 
		event.stopPropagation(); 
	} 
	else 
	{ 
		event.cancelBubble = true; 
	}
}



function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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_nbGroup(event, grpName) { //v6.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } 
}