
function setOpacity(obj, opacity) {

  if ( obj ) {

  	opacity = (opacity == 100)?99.999:opacity;
  
  	// IE/Win
  	obj.style.filter = "Alpha(opacity="+opacity+")";
  
  	// Safari<1.2, Konqueror
  	obj.style.KHTMLOpacity = opacity/100;
  
  	// Older Mozilla and Firefox
  	obj.style.MozOpacity = opacity/100;
  
  	// Safari 1.2, newer Firefox and Mozilla, CSS3
  	obj.style.opacity = opacity/100;
  }
}

function fadeIn(objId,opacity,stop_opacity,step,interval, end_fkt) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity <= stop_opacity) {
      setOpacity(obj, opacity);
      opacity += step;
      window.setTimeout("fadeIn('"+objId+"',"+opacity+","+stop_opacity+","+step+","+interval+","+end_fkt+")", interval);
    }
    else  {
      if ( end_fkt ) end_fkt ();
    }
  }
}

function fadeOut(objId,opacity,stop_opacity,step, interval, end_fkt ) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity >= stop_opacity) {
      setOpacity(obj, opacity);
      opacity -= step;
      window.setTimeout("fadeOut('"+objId+"',"+opacity+","+stop_opacity+","+step+","+interval+","+end_fkt+")", interval);
    }
    else {
      if ( end_fkt ) end_fkt ();
    }
  }
}

function resize_and_move_Element ( objId, left, top, width, stop_left, stop_top, stop_width, step_left, step_top, step_width, interval ) {
	var obj = document.getElementById( objId );

	if ( obj ) {
		if ( left  == -1 )  left  = eliminatePX(obj.style.left);
		if ( top   == -1 )  top   = eliminatePX(obj.style.top);
		if ( width == -1 )  width = eliminatePX(obj.style.width);
		if ( width < 0 ) return;

		ratio_width  = obj.width;
		ratio_height = obj.height;
		if ( !ratio_height && obj.clientHeight ) ratio_height = obj.clientHeight;
		if ( !ratio_width && obj.clientWidth )   ratio_width  = obj.clientWidth;
		if ( !ratio_height && obj.offsetHeight ) ratio_height = obj.offestHeight;
		if ( !ratio_width && obj.offestWidth )   ratio_width  = obj.offsetWidth;
		ratio = ratio_height / ratio_width;

		if ( step_left < 0 && left > stop_left ) left  = (left + step_left);
		if ( step_left > 0 && left < stop_left ) left  = (left + step_left);

		if ( step_top < 0 && top > stop_top ) top  = (top + step_top);
		if ( step_top > 0 && top < stop_top ) top  = (top + step_top);

		width = (width + step_width);
		var height = ratio * width;

		obj.style.width  = width  + "px";
		obj.style.height = Math.ceil(height) + "px";
		obj.style.left	 = left + "px";
		obj.style.top	 = top + "px";

		if ( step_width < 0 ) {
			if ( width > stop_width ) {
				window.setTimeout("resize_and_move_Element('"+objId+"',"+left+","+top+","+width+","+stop_left+","+stop_top+","+stop_width+","+step_left+","+step_top+","+step_width+","+interval+")", interval);
			}			
		}
		else {
			if ( width < stop_width ) {
				window.setTimeout("resize_and_move_Element('"+objId+"',"+left+","+top+","+width+","+stop_left+","+stop_top+","+stop_width+","+step_left+","+step_top+","+step_width+","+interval+")", interval);
			}
		}
	}
}


function eliminatePX ( str ) {
	return ( Math.ceil(str.substr(0, str.length-2)) );
}

function hide ( objId, left, top ) {
	var obj = document.getElementById ( objId );

	if ( obj && obj.style.visibility ) obj.style.visibility = "hidden";
	if ( obj && obj.style.left ) obj.style.left = left;
	if ( obj && obj.style.top ) obj.style.top = top;
}

function show ( objId, left, top ) {
	var obj = document.getElementById ( objId );

	if ( obj && obj.style.left ) obj.style.left = left;
	if ( obj && obj.style.top ) obj.style.top = top;
	if ( obj && obj.style.visibility ) obj.style.visibility = "visible";
}

function resetElement ( objId, left, top, width, height ) {
	var obj = document.getElementById ( objId );

	if ( obj && obj.style.left )   obj.style.left   = left + "px";
	if ( obj && obj.style.top )    obj.style.top    = top + "px";
	if ( obj && obj.style.width )  obj.style.width  = width + "px";
	if ( obj && obj.style.height ) obj.style.height = height + "px";

	if ( obj && obj.width )  obj.width  = width;
	if ( obj && obj.height ) obj.height = height;

}

