function fade(id,param){ /* parameter: in - out */
  if(param=="in"){
    document.getElementById(id).style.filter='Alpha(opacity=60)';
    document.getElementById(id).style.MozOpacity='0.60';
  }else if(param=="out"){
    /*item_id.style.filter='Alpha(opacity=50)';*/
    document.getElementById(id).style.filter='none';
    document.getElementById(id).style.MozOpacity='1';
  }
}

function carSel(id,param){
  if(param=="in"){
    document.getElementById(id).style.backgroundColor='gainsboro';
  }else if(param=="out"){
    document.getElementById(id).style.backgroundColor='#706f6e';
  }
}

function carSelDark(id,param){
  if(param=="in"){
    document.getElementById(id).style.backgroundColor='gainsboro';
  }else if(param=="out"){
    document.getElementById(id).style.backgroundColor='black';
  }
}
    
function borderCol(id,color){ /* parameter: in - out */
  document.getElementById(id).style.borderColor=color;
}

function openWind(WindUrl,WindTitle,width,height){
  Wind1=window.open(WindUrl, WindTitle, "width="+width+",height="+height+",resizable=yes, scrollbars=yes, menubar=yes, toolbar=yes");
  Wind1.focus();
}

var showTimes=0;
var hideTimes=0;
var timeOuts=new Array();

function show(id,time){
  showTimes++;
  if(document.getElementById(id).style.visibility!="visible"){
    var foo='document.getElementById(\"'+id+'\").style.visibility=\"visible\";'
           +'document.getElementById(\"'+id+'\").style.display=\"block\";';
    timeOuts[showTimes]=setTimeout(foo,time);
  }
}

function hide(id,time){
  hideTimes++;
  if(document.getElementById(id).style.visibility!="hidden"){
    var foo='document.getElementById(\"'+id+'\").style.visibility=\"hidden\";'
           +'document.getElementById(\"'+id+'\").style.display=\"none\";';
    timeOuts[hideTimes]=setTimeout(foo,time);
  }
}

function clearAllTimeouts(){
  for(key in timeOuts ){
    clearTimeout(timeOuts[key]);
  }
}

function insert(aTag, eTag, form_name, input_name) {
  var input = document.forms[form_name].elements[input_name];
  input.focus();
  /* für Internet Explorer */
  if(typeof document.selection != 'undefined') {
    /* Einfügen des Formatierungscodes */
    var range = document.selection.createRange();
    var insText = range.text;
    range.text = aTag + insText + eTag;
    /* Anpassen der Cursorposition */
    range = document.selection.createRange();
    if (insText.length == 0) {
      range.move('character', -eTag.length);
    } else {
      range.moveStart('character', aTag.length + insText.length + eTag.length);      
    }
    range.select();
  }
  /* für neuere auf Gecko basierende Browser */
  else if(typeof input.selectionStart != 'undefined')
  {
    /* Einfügen des Formatierungscodes */
    var start = input.selectionStart;
    var end = input.selectionEnd;
    var insText = input.value.substring(start, end);
    input.value = input.value.substr(0, start) + aTag + insText + eTag + input.value.substr(end);
    /* Anpassen der Cursorposition */
    var pos;
    if (insText.length == 0) {
      pos = start + aTag.length;
    } else {
      pos = start + aTag.length + insText.length + eTag.length;
    }
    input.selectionStart = pos;
    input.selectionEnd = pos;
  }
}

