function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function getCurrentDate() {
	var mydate=new Date()
	var year=mydate.getYear()
	if (year < 1000) year+=1900
	var day=mydate.getDay()
	var month=mydate.getMonth()
	var daym=mydate.getDate()
	if (daym<10) daym="0"+daym
	var dayarray=new Array("Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag")
	var montharray=new Array("Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember")
	var suf="th";
	if(daym===1) s='st';
	if(daym===2) s='nd';
	if(daym===3) s='rd';
	document.write(dayarray[day]+", "+daym+". "+montharray[month]+" "+year)
}


function showBreaks(){
    var n = parseInt(document.forms['login'].formField_NumberOfBreaks.value);
    var div1 = document.getElementById('break1div');
    var div2 = document.getElementById('break2div');
    var div3 = document.getElementById('break3div');
    var div4 = document.getElementById('break4div');

    if( n>= 1){
        div1.style.display = '';
    }else{
        div1.style.display = 'none';
    }

    if( n>= 2){
        div2.style.display = '';
    }else{
        div2.style.display = 'none';
    }

    if( n>= 3){
        div3.style.display = '';
    }else{
        div3.style.display = 'none';
    }

    if( n>= 4){
        div4.style.display = '';
    }else{
        div4.style.display = 'none';
    }
}

function isValidDate(year, month, day){
    var dayobj = new Date(year, month-1, day);
    if ((dayobj.getMonth()+1!=month)||(dayobj.getDate()!=day)||(dayobj.getFullYear()!=year)){
        return false;
    }else{
        return true;
    }
}


//use this to reload form security image - securityCodeDiv is div id
var cakeGlobalSecurityImageSeq = Math.floor(Math.random()*50000);
function reloadSecurityCode(style) {
    var obj = document.getElementById('securityCodeDiv');
    var txt = '<img src="/getImage/formCode/180/35/' + cakeGlobalSecurityImageSeq;
        txt+= '/code.gif" title="please type text from this image to field below" alt="" style="'+style+'">';
    obj.innerHTML = txt;
    cakeGlobalSecurityImageSeq++;
}

function floating(iX,iY,id){
    var L=dD.getElementById?dD.getElementById(id):dD.all?dD.all[id]:dD.layers[id];              
    this[id+'O']=L;if(dD.layers)L.style=L;L.nX=L.iX=iX;L.nY=L.iY=iY;
    L.P=function(x,y){this.style.left=x+px;this.style.top=y+px;};L.Fm=function(){var pX, pY;    
    pX=(this.iX >=0)?0:nn?innerWidth:nn&&dH.clientWidth?dH.clientWidth:dB.clientWidth;  
    pY=nn?pageYOffset:nn&&dH.scrollTop?dH.scrollTop:dB.scrollTop;       
    if(this.iY<0)pY+=nn?innerHeight:nn&&dH.clientHeight?dH.clientHeight:dB.clientHeight;        
    this.nX+=.1*(pX+this.iX-this.nX);this.nY+=.1*(pY+this.iY-this.nY);this.P(this.nX,this.nY);
    setTimeout(this.id+'O.Fm()',63);};
    return L;
}

function closefl(o){
        var o = document.getElementById(o);
        o.style.display = 'none';
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function show_image(what, w, h){
    w=window.open(what,"Image","width=" + w + ",height=" + h + ",scrollbars=NO,resizeable=YES",1);
}

//here you place the ids of every element you want.
var ids=new Array('submenu0', 'submenu1', 'submenu2','submenu3');

function switchid(id){	
	hideallids();
	showdiv(id);
}

function hideallids(){
	//loop through the array and hide each element by id
	for (var i=0;i<ids.length;i++){
		hidediv(ids[i]);
	} 
}

function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}
