// Disable Enter Button
// ===================================================================
function noenter()
{
	return !(window.event && window.event.keyCode == 13);
}
// ===================================================================

// Parametrisierbares Fenster
// ===================================================================
function popUp(purl,imgurl,scroll)
{
	foto1= new Image();
 	foto1.src=(imgurl);
 	controlImg(purl,imgurl,scroll);
}
// ===================================================================

//Call function with timeout, if sizes of image not available that fast
function controlImg(purl,imgurl,scroll){
  if((foto1.width!=0)&&(foto1.height!=0)){
 	viewFoto(purl,imgurl,scroll);
  }
  else{
 	imgFunction="controlImg('"+purl+"','"+imgurl+"','"+scroll+"')";  
 	setTimeout(imgFunction,20);
  }
}

//Function to open picture in new windows
function viewFoto(purl,imgurl,scroll)
{
	var scr = 0;
	
	if(scroll == 1)
		scr = 1;
		
	foto1 = new Image();
 	foto1.src = (imgurl);
 	
 	if (foto1.width < 1185)
 		{
 		resizewidth=1185;	
 		} 
 		else{
 		resizewidth=foto1.width+185;	
 		}
 		
 	resizedheight=foto1.height+240;
 	
	var popupwin;
	Posleft = 0;
	Postop = 0;
	day = new Date();
	id = day.getTime();
	popupwin = window.open(purl,id,'left='+Posleft+',top='+Postop+',height='+resizedheight+',width='+resizewidth+',toolbar=0,scrollbars='+scr+',location=0,statusbar=0,menubar=0,resizable=1');
	popupwin.moveTo(Posleft,Postop);
	popupwin.focus();
}


// Div Anzeigen/Verstecken
// ===================================================================
var curDiv = '';
function ShowContent(show)
{
	if(curDiv != '')
	{
		HideContent(curDiv);
		curDiv = '';
	}
	else
	{
		document.getElementById(show).style.visibility = "visible";
		curDiv = show;
	}
}
function HideContent(hide)
{
	document.getElementById(hide).style.visibility = "hidden";
}
// ===================================================================


// Image Fading
// ===================================================================
FadeItObjects 	= new Object();
FadeItTimers 	= new Object();


function FadeIt(object, destOp, rate, delta)
{
	if (!document.getElementById)
	return
	
	if (object != "[object]")
	{
		setTimeout("FadeIt("+object+","+destOp+","+rate+","+delta+")",0);
		return;
	}
	
	clearTimeout(FadeItTimers[object.sourceIndex]);
	
	diff = destOp-object.filters.alpha.opacity;
	direction = 1;
	
	if (object.filters.alpha.opacity > destOp)
	{
		direction = -1;
	}
	
	delta=Math.min(direction*diff,delta);
	object.filters.alpha.opacity+=direction*delta;
	
	if (object.filters.alpha.opacity != destOp)
	{
		FadeItObjects[object.sourceIndex]=object;
		FadeItTimers[object.sourceIndex]=setTimeout("FadeIt(FadeItObjects["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate);
	}
}
/***********************************************
* Switch Content script- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use. Last updated April 2nd, 2005.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var enablepersist="off" //Enable saving state of content structure using session cookies? (on/off)
var collapseprevious="no" //Collapse previously open content when opening present? (yes/no)

var contractsymbol='[-]' //HTML for contract symbol. For image, use: <img src="whatever.gif">
var expandsymbol='[+]' //HTML for expand symbol.


if (document.getElementById){
document.write('<style type="text/css">')
document.write('.switchcontent{display:none;}')
document.write('</style>')
}

function getElementbyClass(rootobj, classname){
var temparray=new Array()
var inc=0
var rootlength=rootobj.length
for (i=0; i<rootlength; i++){
if (rootobj[i].className==classname)
temparray[inc++]=rootobj[i]
}
return temparray
}

function contractcontent(omit){
var inc=0
while (ccollect[inc]){
if (ccollect[inc].id!=omit)
ccollect[inc].style.display="none"
inc++
}
}

function expandcontent(curobj, cid){
var spantags=curobj.getElementsByTagName("SPAN")
var showstateobj=getElementbyClass(spantags, "showstate")
if (ccollect.length>0){
if (collapseprevious=="yes")
contractcontent(cid)
document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="inline")? "inline" : "none"
if (showstateobj.length>0){ //if "showstate" span exists in header
if (collapseprevious=="no")
showstateobj[0].innerHTML=(document.getElementById(cid).style.display=="inline")? contractsymbol : expandsymbol
else
revivestatus()
}
}
}

function revivecontent(){
contractcontent("omitnothing")
selectedItem=getselectedItem()
selectedComponents=selectedItem.split("|")
for (i=0; i<selectedComponents.length-1; i++)
document.getElementById(selectedComponents[i]).style.display="inline"
}

function revivestatus(){
var inc=0
while (statecollect[inc]){
if (ccollect[inc].style.display=="inline")
statecollect[inc].innerHTML=contractsymbol
else
statecollect[inc].innerHTML=expandsymbol
inc++
}
}

function get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { 
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function getselectedItem(){
if (get_cookie(window.location.pathname) != ""){
selectedItem=get_cookie(window.location.pathname)
return selectedItem
}
else
return ""
}

function saveswitchstate(){
var inc=0, selectedItem=""
while (ccollect[inc]){
if (ccollect[inc].style.display=="inline")
selectedItem+=ccollect[inc].id+"|"
inc++
}

document.cookie=window.location.pathname+"="+selectedItem
}

function do_onload(){
uniqueidn=window.location.pathname+"firsttimeload"
var alltags=document.all? document.all : document.getElementsByTagName("*")
ccollect=getElementbyClass(alltags, "switchcontent")
statecollect=getElementbyClass(alltags, "showstate")
if (enablepersist=="on" && ccollect.length>0){
document.cookie=(get_cookie(uniqueidn)=="")? uniqueidn+"=1" : uniqueidn+"=0" 
firsttimeload=(get_cookie(uniqueidn)==1)? 1 : 0 //check if this is 1st page load
if (!firsttimeload)
revivecontent()
}
if (ccollect.length>0 && statecollect.length>0)
revivestatus()
}

if (window.addEventListener)
window.addEventListener("load", do_onload, false)
else if (window.attachEvent)
window.attachEvent("onload", do_onload)
else if (document.getElementById)
window.onload=do_onload

if (enablepersist=="on" && document.getElementById)
window.onunload=saveswitchstate

// ===================================================================
	function jtf()
	{
		var jtf
		jtf= window.open('http://www.am-krisenherd.de', 'NewWindow1','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=780,height=585');
		jtf.focus();

}

function clickclear(thisfield, defaulttext) {
    if (thisfield.value == defaulttext) {
        thisfield.value = "";
    }
}

function clickrecall(thisfield, defaulttext) {
    if (thisfield.value == "") {
        thisfield.value = defaulttext;
    }
}
