var gl_browser_height												= 0;
var gl_browser_width												= 0;

//------------------------------------------------------------------
// breite und hoehe des browserfensters bestimmen
//------------------------------------------------------------------
function init_browser_height_width()
  {
  if(ie && navigator.appVersion.indexOf("Linux") < 0)
    {
    gl_browser_width												= document.documentElement.clientWidth;
    gl_browser_height												= document.documentElement.clientHeight;
	//gl_browser_width												= document.body.clientWidth;
    //gl_browser_height												= document.body.clientHeight;
	}
  else
    {
	gl_browser_width												= innerWidth;
    gl_browser_height												= innerHeight;
    }
  
  //fuer linux
  if(navigator.appVersion.indexOf("Linux") >= 0)
    {
    gl_browser_height												= gl_browser_height-8;
    }
  }


//------------------------------------------------------------------
// bitte warten...
//------------------------------------------------------------------
function cx_show_container(str)
  {
  init_browser_height_width();
  cx_show_schleier();
  document.getElementById(str).style.display						= 'block';
  document.getElementById(str).style.top							= (document.body.scrollTop+parseInt(gl_browser_height/2)-parseInt(document.getElementById(str).offsetHeight/2))+'px';
  document.getElementById(str).style.left							= (parseInt(gl_browser_width/2)-parseInt(document.getElementById(str).offsetWidth/2))+'px';
  setTimeout('cx_container_mittig(\''+str+'\')',100);
  }
function cx_show_schleier()
  {
  int_hoehe															= parseInt(document.getElementById('wrap').offsetHeight);
  if(int_hoehe < gl_browser_height)
    {
	int_hoehe														= gl_browser_height;
	}
  document.getElementById('schleier').style.height					= int_hoehe+'px';
  document.getElementById('schleier').style.display					= 'block';
  try{document.getElementById('schleier').focus();}catch(e){}
  }
function cx_hide_schleier()
  {
  document.getElementById('schleier').style.display					= 'none';
  }
function cx_container_mittig(str)
  {
  // nur ausfuehren, wenn sichtbar
  if(document.getElementById(str).style.display == 'block')
    {
	init_browser_height_width();
	document.getElementById(str).style.top				= (document.documentElement.scrollTop+parseInt(gl_browser_height/2)-parseInt(document.getElementById(str).offsetHeight/2))+'px';
    document.getElementById(str).style.left			= (parseInt(gl_browser_width/2)-parseInt(document.getElementById(str).offsetWidth/2))+'px';
    setTimeout('cx_container_mittig(\''+str+'\')',100);
	}
  }
function cx_hide_container(str)
  {
  document.getElementById(str).style.display						= 'none';
  cx_hide_schleier();
  }


function schleier(pfad,breite,hoehe)
  {
  init_browser_height_width();
  obj_iframe														= document.getElementById('schleier_iframe');
  
  merke_str_url_after_login											= '';
  
  if(breite == null || breite == 0)
    {
	breite															= Math.min(gl_browser_width,760);
	}
  if(hoehe == null || hoehe == 0)
    {
	hoehe															= Math.max(gl_browser_height-200,460);
	}
  
  obj_iframe.style.width											= breite+'px';
  obj_iframe.style.height											= hoehe+'px';
  
  if(pfad != '')
    {
    obj_iframe.src													= pfad;
    }
  
  cx_show_container('iframe_container');
  }
function schleier_off(bool_reload)
  {
  cx_hide_container('iframe_container');
  if(bool_reload || parent.merke_zusatz != null)
    {
	if(parent.merke_zusatz != '')
	  {
	  document.location.href										= parent.merke_zusatz;
	  }
	else
	  {
	  document.location.reload(1);
	  }
	}
  }

function formular_verarbeiten(str)
  {
  document.getElementById(str).className							= 'form_verarbeiten';
  
  return true;
  }
  
  
  



//------------------------------------------------------------------
// AJAX-Framework
//------------------------------------------------------------------
var cx_arr_http_request 											= new Array();

function cx_make_request(str_index,str_url,str_method,cx_parameter,cx_response_function)
  {
  cx_arr_http_request[str_index][0]									= false;
  
  if(window.XMLHttpRequest)
    {// Mozilla, Safari,...
    cx_arr_http_request[str_index][0]									= new XMLHttpRequest();
	if(cx_arr_http_request[str_index][0].overrideMimeType)
	  {
      cx_arr_http_request[str_index][0].overrideMimeType('text/xml');
      }
    }
  else if(window.ActiveXObject)
    {// IE
	try
	  {
      cx_arr_http_request[str_index][0]								= new ActiveXObject("Msxml2.XMLHTTP");
      }
	catch(e)
	  {
	  try
	    {
        cx_arr_http_request[str_index][0]							= new ActiveXObject("Microsoft.XMLHTTP");
        }
	  catch(e)
	    {}
	  }
	}
  
  if(!cx_arr_http_request[str_index][0])
    {
    alert('Giving up :( Cannot create an XMLHTTP instance');
    return false;
    }
  
  //----------------------------------------------------------------
  // response funktion
  //----------------------------------------------------------------
  if(cx_response_function == '')
    {
	cx_arr_http_request[str_index][0].onreadystatechange 			= function()
	  {
	  if(cx_arr_http_request[str_index][0].readyState == 4)
		{
	    if(cx_arr_http_request[str_index][0].status == 200)
		  {
	  	  cx_response_default(str_index);
	  	  }
		}
	  };
    }
  else
    {
	cx_arr_http_request[str_index][0].onreadystatechange 			= eval(cx_response_function);
    }
  
  cx_arr_http_request[str_index][0].open(str_method, str_url, true);
  if(str_method == 'POST')
    {
    cx_arr_http_request[str_index][0].setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    cx_arr_http_request[str_index][0].setRequestHeader("Content-length", cx_parameter.length);
    cx_arr_http_request[str_index][0].setRequestHeader("Connection", "close");
    cx_arr_http_request[str_index][0].send(cx_parameter);
	}
  else
    {
    cx_arr_http_request[str_index][0].send(null);
    }
  }
  
  
//------------------------------------------------------------------
// default response funktion
//------------------------------------------------------------------
function cx_response_default(str_index)
  {
  // 1 ein Objekt?
  if(cx_arr_http_request[str_index][1] != '')
    {
    cx_arr_http_request[str_index][1].innerHTML						= cx_arr_http_request[str_index][0].responseText;
    cx_arr_http_request[str_index][1].style.display					= 'block';
	}
  else
    {
	//alert(cx_arr_http_request[str_index][0].responseText);
	}
  // 2 weitere funktion vorhanden?
  if(cx_arr_http_request[str_index][2] != '')
    {
	eval(cx_arr_http_request[str_index][2]);
	}
  else
    {
	cx_hide_ladevorgang();
	}
  }


//------------------------------------------------------------------
// downloads
//------------------------------------------------------------------
function zeige_downloads(id_folder,anz_slashes,vorgaenger)
  {
  if($('.downloads'+id_folder).length)
    {
	$('.nachoben').show();
	$('#download_container').hide();
	$('.downloads'+id_folder).show();
	$('#download_bezy').html($('#pv'+id_folder).html());
	$('#download_bezy').show();
	}
  else
    {
	$('.subdownloads'+id_folder).toggle();
	}
  }

function zeige_downloads_zurueck()
  {
  $('.nachoben').hide();
  $('#download_container').show();
  $('.download_liste').hide();
  $('#download_bezy').html('');
  $('#download_bezy').hide();
  }

$(document).ready(function(){
  $('.downloadies,.download_liste').hide();
  $('.ebene1').show();
  $('.download_liste_visible').show();
  });