var ServerConfig = Class.create();

ServerConfig.prototype =
{
	initialize: function(subdomain)
	{
		//alert("APPCODENAME " + navigator.appCodeName + "\nappName " + navigator.appName + " \nuserAgent " + navigator.userAgent);
		//alert(navigator.platform + " " + location.hostname + " " + location.port);
		//this.serverURL = server.protocol + "//"+ server.hostname;//nur serverseitig??
		this.isIE = (navigator.appName == "Microsoft Internet Explorer");


		//alert("is ie " + this.isIE);
		/*if(location.hostname == "localhost" && location.port == "8888")
		{
			this.serverURL = "http://" + url + ":8888/" + subdomain;
		}
		else if(port == "80" || port == "" || port == null)
			this.serverURL = "http://" + url + "/" + subdomain;
		else
			this.serverURL = "http://" + url + ":" + port + "/" + subdomain;*/

		if(location.hostname == "localhost")
		{
			if(location.port != "80")
				this.serverURL = "http://" + location.hostname + ":"+location.port+"/" + subdomain;
			else
				this.serverURL = "http://" + location.hostname + "/" + subdomain;
		}else if(subdomain != "")
			this.serverURL = "http://" + location.hostname + "/" + subdomain;
		else
			this.serverURL = "http://" + location.hostname;
	},

	getURL: function()
	{
		return this.serverURL;
	},

	getTemplBoundary: function()
	{
		return "!*tpl*!";
	},

	checkForIe: function()
	{
		return this.isIE;
	},

	getIconPath: function()
	{
		return this.serverURL + "/images/cat/";
	},

	getImagePath: function()
	{
		return this.serverURL + "/images/";
	}
}

var serverConfig = new ServerConfig(""); /* ohne Backslahes */

/*Führt einen Ajax-Request aus.
*
*/
function doAjaxRequest(params, completeFunction)
{
	//alert("in doajax anfang " + serverConfig.getURL());
	var url = serverConfig.getURL() + params;//params sollte am Anfang /*.php/? enthalten
	//alert("in doajax " + url);
	var req = new Ajax.Request(url,
	{
		method: 'post',
		onComplete: completeFunction
	});
}

function formRequest(params, completeFunction, formObject)
{
	var url = serverConfig.getURL() + params;

	formObject.request(
	{
		method: 'post',
		parameters: {ajaxCmd: 'artPreview'},
		onComplete: completeFunction
	});
}