/****************************************************************************************************
* Description:
* This file includes the modules javascript functions for the website.
*
* Notice:
* - There are no Umlaute and special characters allowed.
* - Use the given Prefixs for naming the variables (str, arr, flag, int etc.)
* - If possible do layout without using padding (IE box modell error)
* - German names for css-classes etc. are used in respect to English key words, which are reservated
*
* Versions:
* Initial 0.1			08. Oktober 2008		Beat Schilbach (Steckborn)
* Update Version 3.2	November 2009			Beat Schilbach
****************************************************************************************************/


/****************************************************************************************************
* changeBackground()
*
* change background color of a row in a table
****************************************************************************************************/
function changeBackground(theObj,theColor) {
	theObj.style.backgroundColor = theColor;
}

/****************************************************************************************************
* cloadWebsite()
*
* load the website
****************************************************************************************************/
function loadWebsite(theID,theUrl,theForm) {
	// load agenda page
	if(theID >= 0 && theUrl == "none")
	{
		document.forms[theForm].sCatID.value = theID;
		document.forms[theForm].submit();
	}
	else if(theID < 0 && theUrl != "none")
	{
		openNewWindow(theUrl,theUrl,'toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=1000,height=750');
	}
}

/****************************************************************************************************
* sendForumData()
*
* load the website
****************************************************************************************************/
function sendForumData(button,id)
{
	if(button == "abschicken")
	{		// allgemein
		document.forumForm.enterNow.value = id;
	}
	else if(button == "newThema")
	{	// Forum
		document.forumForm.newThema.value = id;
	}
	document.forumForm.submit();
}


/****************************************************************************************************
* sendUserCtlData()
*
* load the website
****************************************************************************************************/
function sendUserCtlData(theFlag)
{
	document.usCtlForm.showFlag.value = theFlag;
	document.usCtlForm.submit();
}

/****************************************************************************************************
* changeUserDirectory()
*
* load the website
****************************************************************************************************/
function changeUserDirectory(theTypeRef)
{
	var chosenType = theTypeRef.options[theTypeRef.selectedIndex].value;
	document.usCtlForm.showFlag.value = "adrChange";
	document.usCtlForm.workType.value = chosenType;
	document.usCtlForm.submit();
}


/****************************************************************************************************
* ToggleCheckAll()
* 
* toggle all checkboxes
****************************************************************************************************/
function ToggleCheckAll(button,start,length,theForm)
{
	var sa=true;
	var tmp = start + length;
	if(button.checked) sa=false;
	for (var i=start;i<tmp;i++)
	{
		var e = document.forms[theForm].elements[i];
		if(sa)
			e.checked=false;
		else
			e.checked=true;
	}
	if(sa)
		button.checked=false;
	else 
		button.checked=true;
}

