
var projectpath = "";
var temptime = false;
var _userinfo = new Array;

// Wichtige Objekte laden
_sosSystem = new sosSystem({

	host : 'http://' + window.location.host + '/'+projectpath+'/',
	ajax : 'ajax.php',
	sTK  : 'http://' + window.location.host + '/'+projectpath+'/sTK/'
});




// Template bekommen
function gettpl(tpl)
{
	var _ajax_tpl = new sosAjax({
	'host' : _sosSystem.settings.host,
	'name' : 'ajax_tpl',
	'request_url' : _sosSystem.settings.ajax
	});

	var params = new Array();
	params['tpl'] 	= tpl;
	return '<div>'+ _ajax_tpl.request('ajax_getTemplate', '', params) + '</div>';
}

function getUserInfo(userid)
{
	var _ajax_uinfo = new sosAjax({
	'host' : _sosSystem.settings.host,
	'name' : 'ajax_uinfo',
	'request_url' : _sosSystem.settings.ajax
	});

	var params = new Array();
	params['userid'] 	= userid;

	return _ajax_uinfo.request('ajax_getUserInfo', '', params);
}


function getTopic(topicid)
{
	var _ajax_topic = new sosAjax({
	'host' : _sosSystem.settings.host,
	'name' : 'ajax_topic',
	'request_url' : "forum/index.php"
	});

	var params = new Array();
	params['t'] 	= topicid;
	params['act'] 	= 'st';
	params['view'] 	= 'getpost';
	params['__'] 	= Math.random();

	return _ajax_topic.request('s', '', params);
}


function show_bfwerbung()
{
	var _agb = new sosWindow({
		title : 'Werbung bei Bauforum24',
		name : '_agb',
		body : gettpl('bfwerbung'),
		height : 440,
		width:  650

	});

	_agb.create();
}

function load_userinfo(userid,typ){

	if(typ =="open"){

		if(temptime == true) {
			return true;
		}

		var msg = getUserInfo(userid);



		_userinfo[userid] = new sosInfo({text : msg,selfclose : false, styleType: 2,title: 'Bauforum24 Info Box' });
		_userinfo[userid].create();

	}
	else{

		if(typeof _userinfo[userid] != 'undefined')
		{
			_userinfo[userid].close();
		}

		window.clearTimeout(_user_info);
		_user_info = null;
		temptime = false;

	}




}

function load_topic(topicid,typ){

	if(typ =="open"){

		if(temptime == true) {
			return true;
		}
		var img_src = _sosSystem.settings.sTK + 'info/images/info2.png';

		document.getElementById('topicinfo_'+topicid).innerHTML = '<div class="sosInfo3"><img src="' + img_src + '" align="left" hspace="10" />' + getTopic(topicid)+ '</div>';
		document.getElementById('topicinfo_'+topicid).style.display ="block";
		document.getElementById('topicinfo_'+topicid).style.height ="auto";

	}
	else{

		document.getElementById('topicinfo_'+topicid).innerHTML = "";
		document.getElementById('topicinfo_'+topicid).style.display ="none";
		document.getElementById('topicinfo_'+topicid).style.height ="1px";
		window.clearTimeout(_tipic);
		temptime = false;

	}




}