 function change_lang(language){
  alert(language);
 }

 

 
 
function bodyOnClick(){
 try{
  nd();clearContextMenu();nd();
 }catch(e){
 }
} 


 
function clearContextMenu(){


  try {
  dhtml_obj = last_contextmenu_item;
  
  obj_style = dhtml_obj.style;
  
  try{
  obj_style.border="solid white 1px;";
  /////////////////////////////////////////////////////////////////////////////////////
  //  A C H T U N G - Diese funktion sollte unbedingt unter IE noch getestet werden !!!!
  /////////////////////////////////////////////////////////////////////////////////////
  if (!(tmpBackGroundColor == "" || tmpBackGroundColor == undefined )){
   obj_style.backgroundColor = "white";
   //alert (tmpBackGroundColor );
  }else{
   //alert (tmpBackGroundColor )
   obj_style.backgroundColor = tmpBackGroundColor;
  }
  /////////////////////////////////////////////////////////////////////////////////////
  ///   ^ ^ ^ ^                                                                     ///
  /////////////////////////////////////////////////////////////////////////////////////
  // obj_style.backgroundColor="white";
 
  }catch(e){ }
   

  dhtml_obj.onmouseout = tmpMouseOut;
  dhtml_obj.onmouseover = tmpMouseOver;
  
  }catch(e){ }
  

 
}


 
 

function trcol_on(trn,cursor,remote){
 
 try{
 mbgc=trn.style.backgroundColor;
 mc=trn.style.color;
 }catch(e){}
 //if (cursor){
 // trn.style.cursor=cursor;
 //}
 
 /* drmeiser
 trn.style.backgroundColor='#579AD1';
 trn.style.color='#FFFFFF';
 */
 try{
 trn.style.backgroundColor='#E9E9F0';
  }catch(e){}
 /*
 
 if (remote == true ){
  fader('in',trn);
 }else{
  fader('in',trn.id);
 }
 */
}










function trcol_off(trn,remote){
 //trn.style.backgroundColor=mbgc;
 
 try{
 mbgc=trn.style.backgroundColor;
 mc=trn.style.color;
 }catch(e){}
 
 /* drmeiser
 trn.style.backgroundColor='#FFFFFF';
 trn.style.color='#333333';
 */
  try{
 trn.style.backgroundColor='#FFFFFF';
  }catch(e){}
 /*
 if (remote == true ){
  fader('out',trn);
 }else{
  fader('out',trn.id);
 }
 */
 
}





function trcol_go(url,target){
 if (url!=''){
  if (target == '_self'){
   document.location.href = url;
  }else{
   openWindow(url);
  }
 }else{
  
 }
}




function openWindow(url, width, height){
	var dimensions = "";
	if (width)	{
		dimensions += ",width=" + width;
	}
	if (height)	{
		dimensions += ",height=" + height;
	}
	window.open(url, "_blank", "location=yes,status=yes,menubar=yes,toolbar=yes,scrollbars=yes,resizable=yes" + dimensions);
	return false;
}







////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////

var timer=new Array();
var action=new Array();
var obj=new Array();
var colors=new Array();
var whisper=new Array();



function rgb(rrr, ggg, bbb){
 rrr=parseInt(rrr);
 ggg=parseInt(ggg);
 bbb=parseInt(bbb);
 rrrHex=rrr.toString(16).toUpperCase();
 gggHex=ggg.toString(16).toUpperCase();
 bbbHex=bbb.toString(16).toUpperCase();
 if (rrrHex.length == 1) rrrHex='0'+rrrHex;
 if (gggHex.length == 1) gggHex='0'+gggHex;
 if (bbbHex.length == 1) bbbHex='0'+bbbHex;
 rgbVal=new Array(rrrHex,gggHex,bbbHex);
 return rgbVal;
}





function fader(mode,id){
 if (!document.getElementById) return;
 
 
  
  
 
  
 if(mode=='in'){
  
  // automatisches ausblenden aufheben
  //window.clearTimeout(timer['u_whisperoff'+'r_'+id]);
  
  // window.clearTimeout(timer[mode+'r_'+id]);
  obj[id] = document.getElementById(id).style;
  if ((obj[id])){
  
  if (mode == "in" && action['r_'+id] == "out" ){
  window.clearTimeout(timer["out"+id]);
  delete timer["out"+id];
 }
  
  
  
  actcolor = obj[id].backgroundColor;
  if(actcolor){
   if (actcolor.indexOf('#')!=-1){
    actcolor=new Array(actcolor.substring(1,3).toUpperCase(),actcolor.substring(3,5).toUpperCase(),actcolor.substring(5,7).toUpperCase());
   }else if(actcolor.indexOf('rgb')!=-1){
    tmp=actcolor.substring((actcolor.indexOf('rgb(')+4),(actcolor.length)-1);
    actcolor=tmp.split(',');
    actcolor=rgb(actcolor[0],actcolor[1],actcolor[2]);
   }
  }else{   
   actcolor=new Array('ff','ff','ff');
  }
  colors[id]=new Array('0x'+actcolor[0],'0x'+actcolor[1],'0x'+actcolor[2],'0x57','0x9A','0xD1');
  timer[mode+id] = window.setTimeout("fade('"+id+"','"+mode+"')",10);
  
  // automatisches ausfaden:
  // whisper['w_'+id]=window.setTimeout("fader('u_whisperoff','"+id+"')",60000);
 }
 }
 
 if(mode=='out'){
  obj[id] = document.getElementById(id).style;
  
   if ((obj[id])){
  if (mode == "out" && action['r_'+id] == "in" ){
  window.clearTimeout(timer["in"+id]);
  delete timer["in"+id];
  
 }
 
 
 
 actcolor = obj[id].backgroundColor;
  if(actcolor){
   
   if (actcolor.indexOf('#')!=-1){
    actcolor=new Array(actcolor.substring(1,3).toUpperCase(),actcolor.substring(3,5).toUpperCase(),actcolor.substring(5,7).toUpperCase());
   }else if(actcolor.indexOf('rgb')!=-1){
    tmp=actcolor.substring((actcolor.indexOf('rgb(')+4),(actcolor.length)-1);
    
    actcolor=tmp.split(',');
    //alert (actcolor[0])
    actcolor=rgb(actcolor[0],actcolor[1],actcolor[2]);
    
   }
  }else{   
   actcolor=new Array('57','9A','D1');
  }
  
  //actcolor=new Array('57','9A','D1');
  eval ("colors[id]=new Array(0x"+actcolor[0]+",0x"+actcolor[1]+",0x"+actcolor[2]+",'0xff','0xff','0xff')");
  //colors[id]=new Array(0x57,0x9A,0xD1, 0xff,0xff,0xff);
  timer[mode+id] = window.setTimeout("fade('"+id+"','"+mode+"')",10);
 
  //obj[mode+'_'+id].backgroundColor = "#ff0000";
  
  //timer[mode+id] = window.setTimeout("fade('"+id+"','"+mode+"')",10);
  
  }
 }
 
 
}

function fade(id,mode){
        tf_in=20;
        tf_out=4;
        fadedir = '';
        deny = false;
        
       
        
        if (mode == "out"){
         window.clearTimeout(timer['in'+id]);
         delete timer['in'+id];
         if (action['r_'+id] == "fin_out" ){
          deny = true;
          }
         //alert ("out -> "+action['r_'+id]);
        }
        
        if (mode == "in"){
         window.clearTimeout(timer['out'+id]);
         delete timer['out'+id];
         if (action['r_'+id] == "fin_in" ){
          deny = true;
          
         }
         //alert ("in -> "+action['r_'+id]);
         //if (action[mode+'r_'+id] == "in" ) deny = true;
        }
        
        
        if ((colors[id][0] == colors[id][3]) && (colors[id][1] == colors[id][4]) && (colors[id][2] == colors[id][5])){
         deny = true;
        }
        
        if ((obj[id]) && !(deny)){
        
        obj[id].backgroundColor = "#" + fmToHex(colors[id][0]) + fmToHex(colors[id][1]) + fmToHex(colors[id][2]);
        
        
        for (i=0;i<3;i++){
         if (colors[id]   [i] !=colors[id][i+3]){
         if (  colors[id][i+3] > colors[id][i]){
          if (abs((colors[id][i+3] - colors[id][i]))<=tf_out){
           colors[id]    [i] = colors[id][i+3];
          }else{
           colors[id]    [i] +=tf_out;
          }
          fadedir = 'out';
         }else{
          fadedir = 'in';
          if (abs((colors[id][i] - colors[id][i+3]))<=tf_in){
           colors    [id][i] = colors[id][i+3];
          }else{
           colors[id]    [i] -=tf_in;
          }
         }
        }
        }
      
        if ((colors[id][0] == colors[id][3]) && (colors[id][1] == colors[id][4]) && (colors[id][2] == colors[id][5])){
         window.clearTimeout(timer[mode+id]);
         delete timer[mode+id];
         
         if(mode=='out'){
          obj[id].backgroundColor= "#ffffff";
         }
         delete obj[mode+'_'+id];
         action['r_'+id] = "fin_"+fadedir;
        // alert ("fertig");
        }else{   
         action['r_'+id] = fadedir;
         timer[mode+id] = window.setTimeout("fade('"+id+"','"+mode+"')",10);
         
        }
        }
  }



  


function abs(val){
 if (val >= 0) return val;
 if (val < 0) return -(val);
}

function usr_fadeIn(id){
if (!document.getElementById) return;
fmb1=0x19; fmb2=0x19; fmb3=0x70;
fmb4=0xff; fmb5=0xff; fmb6=0xff;
usr_Fade(id);
}

function usr_fadeOut(id){
if (!document.getElementById) return;
fmb1=0xff; fmb2=0xff; fmb3=0xff;
fmb4=0x19; fmb5=0x19; fmb6=0x70;
usr_Fade(id);
}

function room_fadeOut(id){
if (!document.getElementById) return;
fmb1=0x19; fmb2=0x19; fmb3=0x70;
fmb4=0xff; fmb5=0xff; fmb6=0xff;
room_Fade(id);
}

function room_fadeIn(id){
if (!document.getElementById) return;
obj = document.getElementById(id).style;
obj.backgroundColor = "#ff0000";
fmb1=0xff; fmb2=0x00; fmb3=0x00;
fmb4=0x19; fmb5=0x19; fmb6=0x70;

roomTimer = window.setTimeout("room_Fade('"+id+"')",1000);
}



function fmToHex(n){
var hexChars = "0123456789ABCDEF";
if (n == 0) return "00";
var j, n;
var temp = "";
while (n != 0){
j = n % 16;
n = (n - j)/16;
temp = hexChars.charAt(j) + temp;
}
if (temp.length < 2){
temp = "0" + temp;
}
return temp;
}

