//Umschalten auf dynamisches Nachladen
var usePartitialLoad = false;
var globalsandglassimg;
  globalsandglassimg=new Image();
  globalsandglassimg.src="/jportal/images/arrow.gif";
  globalsandglassimg.title = "sanduhr";
  globalsandglassimg.height = "21";
  globalsandglassimg.width = "19";

/* Hilfe in Login Bereich*/
function openHelpWindow(helpUrl){
	var helpWindow = window.open(helpUrl, "Hilfe", "width=700,height=768,resizable=yes,scrollbars=yes");
	helpWindow.focus();
}

/* Box in Suchmaske mitAendern */
function toggleCheckbox(boxId)
{
   var elem = document.getElementById(boxId);
   if (elem !=  null)
   {
      elem.checked =  !elem.checked;
   }
}

function setFastSearch(newvalue)
{
  if (document.getElementById("fastsearchquery") != null) 
  {
  	 newvalue = newvalue.replace(/&lt;/g, "<");
   	 newvalue = newvalue.replace(/&gt;/g, ">");
   	 newvalue = newvalue.replace(/&quot;/g, "\"");
     document.getElementById("fastsearchquery").value=document.getElementById("fastsearchquery").value + " " + newvalue;
  }
}

function showsandglass(srcOfImage)
{
  globalsandglassimg.src=srcOfImage;
 
  var sandglass = document.getElementById("sandglass");
  eval("sandglass.src=globalsandglassimg.src");
  eval("sandglass.title=globalsandglassimg.title");
  eval("sandglass.height=globalsandglassimg.height");
  eval("sandglass.width=globalsandglassimg.width");
 
	return true;
}

function formhaschanged()
{
    if (document.forms['searchForm'] != null)
    {
	  if(document.forms['searchForm'].formhaschangedvalue)
	  {
		  document.forms['searchForm'].formhaschangedvalue.value="yes";
	  }
    }
    if (document.forms['searchFormDokstelle'] != null)
    {
	  if(document.forms['searchFormDokstelle'].formhaschangedvalue)
	  {
		  document.forms['searchFormDokstelle'].formhaschangedvalue.value="yes";
	  }
	}
}

function TakeOverValue()
{
    if (document.getElementById('standFrom') != null)
    {
		if (document.getElementById('standFrom').value != '')
		{
			if (document.getElementById('standTo') != null)
			{
				if (document.getElementById('standTo').value == '')
				{
					document.getElementById('standTo').value = document.getElementById('standFrom').value;
				}
			}
		}
	}
	if (document.getElementById('erlassdateFrom') != null)
	{
		if (document.getElementById('erlassdateFrom').value != '')
		{
			if (document.getElementById('erlassdateTo') == null)
			{
				if (document.getElementById('erlassdateTo').value == '')
				{
					document.getElementById('erlassdateTo').value = document.getElementById('erlassdateFrom').value;
				}
			}
		}
	}
   if (document.getElementById('dateFrom') != null)
    {
		if (document.getElementById('dateFrom').value != '')
		{
			if (document.getElementById('dateTo') != null)
			{
				if (document.getElementById('dateTo').value == '')
				{
					document.getElementById('dateTo').value = document.getElementById('dateFrom').value;
				}
			}
		}
	}
}

/* 
  Neue Version von TakeOverValue, um das Ausufern der FÃ¤lle einzudaemmen...
  Uebertraegt den Wert vom Feld mit der id1 in das Feld mit der id2, falls dieses leer ist  
*/
function TakeOverValueNew(id1, id2)
{
    if (document.getElementById(id1) != null)
    {
		if (document.getElementById(id1).value != '')
		{
			if (document.getElementById(id2) != null)
			{
				if (document.getElementById(id2).value == '')
				{
				    if (!document.getElementById(id2).readonly)
				    {
					   document.getElementById(id2).value = document.getElementById(id1).value;
					}
				}
			}
		}
	}
}

// Diese Methode sorgt dafuer, dass die Icons in der Dokumentdarstellung 
// zum Speichern, Drucken, etc. aus- und einblendbar sind.
function showOrHideIcons()
{
	var showHideIconsButton = document.getElementById("showHideIconsButton");
	if(document.getElementById("iconsToHide").style.visibility!="visible")
	{
	document.getElementById("iconsToHide").style.visibility="visible";
	document.getElementById("iconsToHide").style.display="inline";
	}
	else
	{
	document.getElementById("iconsToHide").style.visibility="hidden";
	document.getElementById("iconsToHide").style.display="none";
	}
}

$(document).ready(function() {
	//Fancybox
	$("a.fancybox").fancybox();
});
	
