function setChkbox(obj,id_db)	
{
	if (obj.checked==true) 
	{
		document.getElementById(id_db).value=1;
	}	
	else	
	{
		document.getElementById(id_db).value=0;
	}
}

var bool=0;

function setActiveStatus(id,base_url)	{
	if (document.getElementById(id).checked===true)	{
		bool=1;
	}
	document.location.href=base_url+'&ref_id='+id+'&active='+bool;
}

function returnMainMenue()
{
	check = confirm("Wollen Sie ins Hauptmenü zurückkehren? (alle noch nicht gespeicherten Änderungen gehen verloren)");
	if (check === true)
	{
		document.location.href = "member_logged_in.php";
	}
	else
	{
		return false;
	}
}

function confirmRedirect(confirm_text,redirect_link)
{
	check = confirm(confirm_text);
	if (check === true)
	{
		document.location.href = redirect_link;
	}
	else
	{
		return false;
	}
}

function returnWithoutSave(link)
{
	check = confirm("Wollen Sie wirklich zurück ? (alle noch nicht gespeicherten Änderungen gehen verloren)");
	if (check === true)
	{
		document.location.href = link;
	}
	else
	{
		return false;
	}
}

function deleteEntry(confirm_text,redirect_link)
{
	check = confirm(confirm_text);
	if (check === true)
	{
		document.location.href = redirect_link;
	}
	else
	{
		return false;
	}
}



function jsWindow(url, ref, x, y, w, h, openAtStartup, scroll, hideMenue, resizable, noPopupErrorMsg, noPopupLocation, BrowserCrashedErrorMsg) 
{
	var foo_w = w;
	
	var foo_h = h;
	//alert(noPopupErrorMsg+"\n"+noPopupLocation+"\n"+BrowserCrashedErrorMsg);
	if (window.screen) 
	{
		var screen_height = ((screen.height - 50) > screen.availHeight ) ? screen.height - 50 : screen.availHeight;
		
		screen_height = screen_height - 40;
		
		var screen_width = screen.availWidth-10;
		
		w = Math.min(screen_width, w);
		
		h = Math.min(screen_height, h);
		
		if(x == -1) x = Math.round((screen_width - w) / 2);
		
		if(y == -1) y = Math.round((screen_height - h) / 2);
	}

	this.name = "jsWindow" + (jsWindow_count++);
	
	this.url = url;
	
	this.ref = ref;
	
	this.x = x;
	
	this.y = y;
	
	this.w = w;
	
	this.h = h;
	
	this.scroll = (foo_w != w || foo_h != h) ? true : scroll;
	
	this.hideMenue = hideMenue;
	
	this.resizable = resizable;
	
	this.wind = null;
	
	this.open = jsWindowOpen;
	
	this.close = jsWindowClose;
	
	this.obj = this.name + "Object";
	
	eval(this.obj + "=this");
	
	if (openAtStartup) 
	{
		this.open(noPopupErrorMsg, noPopupLocation);
	}
}

function  jsWindowOpen(noPopupErrorMsg, noPopupLocation) 
{
	//alert(noPopupErrorMsg+"\n"+noPopupLocation);
	var properties = (this.hideMenue ? "menubar=no," : "menubar=yes,")+(this.resizable ? "resizable=yes," : "resizable=no,")+((this.scroll) ? "scrollbars=yes," : "scrollbars=no,")+"width="+this.w+",height="+this.h;
	
	properties += ",left="+this.x+",top="+this.y;
	
	//alert(properties);
	
	try
	{
		//alert(this.url+"\n"+this.ref+"\n"+properties);
		this.wind=window.open(this.url, this.ref, properties);
		//alert(this.wind);
		this.wind.moveTo(this.x,this.y);
	}
	catch(e) 
	{
	 	//alert(e);
		if (noPopupErrorMsg != undefined &&  noPopupErrorMsg.length) 
	 	{
			if (!this.wind) 
			{
				alert(noPopupErrorMsg);
				if(noPopupLocation != "none")
				{
					document.location.href = noPopupLocation;
				}
			}
		}
	}

}

function  jsWindowClose()
{
	if(!this.wind.closed) this.wind.close();
}

jsWindow_count = 0;
