document.title = sTitle;

function Init()
{
	//google.load("jquery", "1.2.6");
	//google.load("jqueryui", "1.5.2");
	//var clientLocation = google.loader.ClientLocation.address.city + ", " + google.loader.ClientLocation.address.region;
	//alert (google.loader.ClientLocation.address.city)
	if (document.getElementById("ActiveUsers")) {
		var city = new String();
		try {
			city = google.loader.ClientLocation.address.city;
			if (city.length > 0) {
				document.getElementById("ActiveUsers").innerHTML += "<br/>Und schönen Gruss an Dich nach " + city + ".";
			}
		}
		catch(e) {}
	}
}

/*
 * -----------------------   private Parts --------------------------
 */

function trimWord(word)
{
	var sWord = new String(word);
	var sReturn = new String();
	
	for (var i=0; i<sWord.length; i++)
	{
		if (sWord.substr(i, 1) != " ")
		{
			sReturn += sWord.substr(i, 1);
		}
	} // for (var i=0; i<sWord.length; i++)

	return sReturn;
}

function isNotEmpty(sString)
{
	var arrString = new Array();
	arrString = sString.split(' ');
	var sNewString = new String();
				
	for(var i=0; i<arrString.length; i++)
	{
		if(!arrString[i] == '')
		{
			sNewString = sNewString + arrString[i] + ' ';
		}
	}
		
	if(sNewString.length == 0)
	{
	    return(false);
	}
	else
	{
	    return sNewString;
	}
	
} // isEmpty(sString)

function checkMail(sFieldId, bClearField, bCheckSpaces)
{
	/*
		mal ne E-Mail checken
		IN:		- id of mail field
		        - clear the form field "email", true for YES (bool)
				- check spaces and set new value in the form field, true for YES (bool)
		OUT:	bool (true for OK)
	*/

	var sMail = new String(document.getElementById(sFieldId).value);
	var sMatchRegExp1 = new String('^.{6,100}$');
	var sMatchRegExp2 = new String('^([a-zA-Z0-9\\-\\.\\*\\_])+@(([a-zA-Z0-9\\-]+\\.)+[a-zA-Z]{2,6})$');
	
	// --- begin check for spaces
	if (bCheckSpaces)
	{
		var sNewMaiString = new String();
		for(var i=0; i < sMail.length; i++)
		{
			var sTemp = sMail.substr(i, 1);
			if (sTemp != ' ')
			{
				sNewMaiString += sTemp;
			}
		}
		document.getElementById(sFieldId).value = sNewMaiString;
	}
	// --- end check for spaces

	// --- begin check of regExp
	if (!sMail.match(sMatchRegExp1) || !sMail.match(sMatchRegExp2))
	{
		if(bClearField)
		{
			document.getElementById(sFieldId).value = '';
		}
		return false;
	}
	// --- end check of regExp
	
	return true;

}	// --- checkMail()

function showMessage(sTitle, sMessage)
{
	document.getElementById("divMessageOverAll").style.display = "block";
	document.getElementById("divMessage").style.display = "block";
	document.getElementById("divMessageTitle").innerHTML = sTitle;
	document.getElementById("divMessageText").innerHTML = sMessage;
} // showMessage(sTitle, sMessage)
function hideMessage()
{
    document.getElementById("divMessageOverAll").style.display = "none";
    document.getElementById("divMessage").style.display = "none";
} // hideMessage()
