	/* IFRAME Transparenz:
		im Aufrufer:
			iframe.frameborder='0';
			iframe.allowTransparency='true';
		im Aufgerufenen:
			<body style="border:none; background:transparent; ">
	*/

	/** 
	  * Position object
	  */
  function jsframe_setposition(obj, border)
  {
	obj.style.border = "0";
	obj.style.position = 'absolute';
	obj.style.top = border + '%';
	obj.style.left = border + '%';
	obj.style.width = (100-2*border) + '%';
	obj.style.height = (100-2*border) + '%';
  }

	/** 
	  * Set opacity / transparency of an object
	  */
  function jsframe_setopacity(obj, percentvalue)
  {
    obj.style.MozOpacity = percentvalue / 100.0;
    obj.style.opacity = percentvalue / 100.0;
    obj.style.filter = "alpha(opacity:" + percentvalue + ")";
  }
    
	/** 
	  * Create border-div and iframe
	  */
  function jsframe_create(url)
  {
	// Div holen oder ggf. anlegen
	var div = document.getElementById('jsframe');
	if (div == null)
	{
		var o = document.getElementsByTagName('body')[0];

		div = document.createElement('div');
		div.id = 'jsframe';
		div.style.background="#FFFFFF";
		jsframe_setopacity(div, 0);
		jsframe_setposition(div, 3);
		
		link = document.createElement('div');
		link.align='right';
		link.style.margin='3px';
		link.innerHTML = '<a href="#" onclick="jsframe_quit(); return false;" style="text-decoration:none; color:black; font-size:11; font-weight:bold;">(schlie&szlig;en)</a>';
		div.appendChild(link);

		o.appendChild(div);
		
		var iframe = document.createElement('iframe');
		iframe.src = url;
		iframe.id = 'jsiframe';
		iframe.frameborder = '0';
		iframe.allowTransparency='true';
		jsframe_setopacity(iframe, 0);
		jsframe_setposition(iframe, 7);
		
		o.appendChild(iframe);

	}
  }
  
	/** 
	  * Remove border-div and iframe
	  */
  function jsframe_drop()
  {
	var body = document.getElementsByTagName('body')[0];
	var div = document.getElementById('jsframe');
	var iframe = document.getElementById('jsiframe');
	
	if (iframe != null) body.removeChild(iframe);
	if (div != null) body.removeChild(div);
  }


	/** 
	  * fade in object
	  */
  function jsframe_fadein(value, step)
  {
	var div = document.getElementById('jsframe');
	var iframe = document.getElementById('jsiframe');

	jsframe_setopacity(div, (value > 93) ? 93 : value);
	jsframe_setopacity(iframe, (value > 100) ? 100 : value);
	
	// Weitermachen falls notwendig
	if (value < 100)
	{
		value += step;
		if (value > 100) value = 100;
		window.setTimeout( function() { jsframe_fadein(value,step); }, 25);
	}
  }

	/** 
	  * fade out object
	  */
  function jsframe_fadeout(value, step)
  {
	var div = document.getElementById('jsframe');
	var iframe = document.getElementById('jsiframe');

	if (value <= 0) 
	{
		jsframe_drop();

	} else
	{
		jsframe_setopacity(div, (value > 93) ? 93 : value);
		jsframe_setopacity(iframe, (value > 100) ? 100 : value);

		value -= step;
		if (value < 0) value = 0;
		window.setTimeout( function () {  jsframe_fadeout(value, step) }, 25);
	}
  }
	  
	/** 
	  * open url in an iframe and fade in
	  */
  function jsframe_go(url)
  {
	jsframe_drop();
	jsframe_create(url);
	window.setTimeout( function () { jsframe_fadein(5,5) }, 300);
  }
	
	/** 
	  * fade out and close iframe
	  */
  function jsframe_quit()
  {
	window.setTimeout( function () { jsframe_fadeout(100,5) }, 25);
  }

