var eben= 6;
var xtel= 2;
var tm =new Array();
var schl= 20;
var apos=-1;
z=1;
var pos=-1;

	for (var a=0; a<= schl; a++){
	    tm[a]=0
	}
	i=1;
	for (var b=0; b< eben; b++) {
	    for (var a=0; a <= schl ; a=a+Math.max(i,1)) {
	        tm[a]=(tm[a]+1);
	    }
	    i=(i+i)*((xtel/2));
	}
	var tmd=new Array;
	b= tm[0];
	tmd[0]=b;
	for (var a=0; a< tm.length ; a++) {
	    b2= tm[a];
	    while (b2 != b ) {
	        z++;
	        if (b> b2){ b--} else{ b++}
	        tmd[z]=b*2;  
	    }
	}

	
function strin(s) {if (s.length<= 1 ) {s="0"+s;} ;return s}



function farbe(){ 
	   pos=pos+1;
	    apos=apos+1;
	    tw=0;
	    if (apos>tm.length-1){
	        tm=tm.reverse();
	        apos=0;ind++;}    
	    if (pos>tmd.length-1){
	        pos=0;ind--;}
	    tma=(tm[apos]);
	    tmt=(tmd[pos]);
	    if (z%(x/schl)==0 && z> 1) {subm++;tw=tm[apos]-za ;za = tw}
	    r =Math.ceil(40+tmt);
	    g =Math.ceil(40+tw+tma);
	    b =ind;
	    r = strin(Number(r).toString(16));
	    g = strin (Number(g).toString(16));
	    b = strin (Number(b).toString(16));
		rgb=("#"+r+g+b);
		return ("#"+r+g+b);
}



function cf(cc){
	    r=cc.substring(2,4);
	    g=cc.substring(4,6);
	    b= cc.substring(5,7);
	    r=parseInt(r,16)*.5;
	    g=parseInt(g,16)*.4;
	    b=(parseInt(b,16)+22);
	    r = strin( Number(r).toString(16));
	    g = strin (Number(g).toString(16));
	    b = strin (Number(b).toString(16));
	    sz="#"+r+g+b;
	   return ("#"+r+g+b);
 }
 
 
 
function farbe2(sf) {
    co= document.getElementById(sf).style.backgroundColor;
	//co=$(sf).css('backgroundColor');
	window.status = co;
    return(co);
}

