var gSubmitted = false;

function GoBack()
{
  if (gSubmitted == true)
	{
	  return;
	}

  history.back();
}

function DoSubmit(pShowLoadingTop)
{
  if (gSubmitted == true)
	{
	  return false;
	}

  gSubmitted = true;
  

	if (pShowLoadingTop)
	{
  		OpenWindow("/allgemein/allgemein/loading.htm", "loading", 300, 120, '', 'no', true) 
	}    
	else
	{
  		OpenWindow("/allgemein/allgemein/loading.htm", "loading", 300, 120) 
	}    
  
  return true;
}

function Trim(s)
{
  while (s.substring(0,1) == ' ') {
    s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') {
    s = s.substring(0,s.length-1);
  }
  return s;
}

function OpenWindow(pURL, pTitle, pWidth, pHeight, pParameters, pScrollbars, pShowTop, pLocation)
{
  var vURL;
  var vX;
  
  if (pLocation)
  {
    pLocation = 'yes';
  }
  else
  {
    pLocation = 'no';
  }
  
  if (pScrollbars)
  {
    pScrollbars = 'yes';
  }
  else
  {
    pScrollbars = 'no';
  }
  
  vURL = pURL + '?_sys_sid=-1&' + pParameters;

  newWin = window.open(vURL,pTitle,
          'width=' + pWidth + 
          ',height=' + pHeight +
          ',dependent=yes' +
          ',location=' + pLocation +
          ',menubar=no' +
          ',resizeable=' + pScrollbars +
          ',scrollbars=' + pScrollbars +
          ',status=no' +
          ',toolbars=no');
          
  if (pShowTop)
  {
    vX = 50;
  }
  else
  {
    vX = (screen.height-pHeight) / 2;  
  }

  newWin.moveTo((screen.width-pWidth) / 2, vX);
  
  newWin.focus();
}

function CC_Trim(s) {
  while (s.substring(0,1) == ' ') {
    s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') {
    s = s.substring(0,s.length-1);
  }
  return s;
}

function CC_OpenSearch()
{
  newWin = window.open('../suche/start.php','_dah_search',
          'width=' + 400 + 
          ',height=' + 600 +
          ',dependent=yes' +
          ',location=no' +
          ',menubar=no' +
          ',resizeable=yes' + 
          ',scrollbars=yes' + 
          ',status=no' +
          ',toolbars=no');

  newWin.moveTo((screen.width-400) / 2, (screen.height-600) / 2);
  
  newWin.focus();
}

function CC_StartSearch()
{
  document._frm_search_cc._search_cc.value = CC_Trim(document._frm_search_cc._search_cc.value);
  
  if (document._frm_search_cc._search_cc.value.length < 1)
  {
    alert('Bitte geben Sie einen Suchbegriff ein.');
    return false;
  }
  
  CC_OpenSearch()
  
  return true;
}

function Call(pURL)
{
  opener.location.href = pURL;
  opener.focus();
}
