
/**
* sosInfo Klasse
* @author mor_dark
*/
var all_sos_infos = new Array();

// settings.text
// settings.selfclose
function sosInfo(settings)
{


	this.settings = settings;
	this.oDiv = null;
	this.action = false;
	this.oImgL = null;
	this.oImgR = null;
	this.oDiv  = null;
	this.Title = null;

	if(this.settings.selfclose == undefined){
		this.settings.selfclose = true;
	}
	if(this.settings.styleType == undefined){
		this.settings.styleType = 1;
	}
}

/**
* Erstellt eine Info Nachricht
*/
sosInfo.prototype.create = function()
{
	if(all_sos_infos[this.settings.name])
	{
		all_sos_infos[this.settings.name].hide();
	}

	if(this.settings.styleType ==1){

		this.oDiv = document.createElement('div');
		this.oImgL = document.createElement('img');
		this.oImgR = document.createElement('img');

		this.oDiv.className = 'sosInfo';
		this.oDiv.style.width = '80%';
		this.oDiv.style.height = '60px';
		this.oDiv.style.position = 'absolute';
		this.oDiv.style.top = (_sosSystem.getScrollXY()[1] + 10) + 'px';
		this.oDiv.style.visibility = 'hidden';
		this.oDiv.style.backgroundImage = 'url("' + _sosSystem.settings.sTK + 'info/images/bg.png")';
		this.oDiv.style.backgroundRepeat = 'repeat-x';

		if(this.settings.image)
		{
			var img_src = this.settings.image;
		} else
		{
			var img_src = _sosSystem.settings.sTK + 'info/images/info.png';
		}

		this.oDiv.innerHTML = '<img src="' + img_src + '" align="left" hspace="10" />' + this.settings.text;

		this.oImgL.src = _sosSystem.settings.sTK + 'info/images/left.png';
		this.oImgL.style.position = 'absolute';
		this.oImgL.style.top = '0px';
		this.oImgL.style.left = '-15px';

		this.oImgR.src = _sosSystem.settings.sTK + 'info/images/right.png';
		this.oImgR.style.position = 'absolute';
		this.oImgR.style.right = '-14px';
		this.oImgR.style.top = '0px';

		this.oDiv.appendChild(this.oImgR);
		this.oDiv.appendChild(this.oImgL);

		document.body.appendChild(this.oDiv);

		if (window.innerHeight)
		{
			var maxHeight = window.innerHeight;
			var maxWidth = window.innerWidth;
		} else
		{
			var maxHeight = document.body.clientHeight;
			var maxWidth = document.body.clientWidth;
		}

		this.oDiv.style.left = (maxWidth - this.oDiv.offsetWidth) / 2 + "px";
		this.oDiv.style.visibility = 'visible';
	}

	if(this.settings.styleType ==2){

		this.oDiv = document.createElement('div');
		this.oImg = document.createElement('img');
		this.oDivShadow = this.oDiv.cloneNode(true);
		this.oDivTitle = this.oDiv.cloneNode(true);
		this.oDivBody = this.oDiv.cloneNode(true);


		var oDivShadow_rd = this.oDiv.cloneNode(true);
		var oDivShadow_lt = this.oDiv.cloneNode(true);
		var oDivShadow_bl = this.oDiv.cloneNode(true);
		var oDivShadow_rt = this.oDiv.cloneNode(true);

		this.oDiv.className = 'sosInfo2';
		this.oDiv.style.position = 'absolute';
		this.oDiv.style.visibility = 'hidden';
		this.oDiv.style.zIndex 	= 10000;



		var maxHeight = document.body.clientHeight;
		var maxWidth = document.body.clientWidth;

		this.oDivTitle.className = 'sosInfo2Title';
		this.oDivTitle.innerHTML = '<span>'+this.settings.title+'</span>';
		this.oDivTitle.style.height = '20px';
		this.oDivTitle.style.width = this.oDiv.style.width;

		this.oDivBody.className = 'sosInfo2Body';

		if(this.settings.image)
		{
			var img_src = this.settings.image;
		} else
		{
			var img_src = _sosSystem.settings.sTK + 'info/images/info2.png';
		}




		this.setBody('<img src="' + img_src + '" align="left" hspace="10" />' + this.settings.text);
		this.oDiv.appendChild(this.oDivTitle);
		this.oDiv.appendChild(this.oDivBody);

		this.oImg.src = _sosSystem.settings.sTK + 'info/images/point_l.png';
		this.oImg.style.position = 'absolute';
		this.oImg.style.left = '-42px';
		this.oImg.style.top = '-13px';

		this.oDiv.appendChild(this.oImg);



		// ins body einbinden
		document.body.appendChild(this.oDiv);

		// POS
		this.y = _sosSystem.getScrollXY()[1]+250;
		this.x = ((maxWidth-this.oDiv.offsetWidth) / 2)-80;

		this.oDiv.style.top = this.y + 'px';
		this.oDiv.style.left = this.x + 'px';

		// Schatten
		this.oDivShadow.style.position = 'absolute';
		this.oDivShadow.style.visibility = 'hidden';
		this.oDivShadow.style.zIndex = 9999;
		this.oDivShadow.style.width = this.oDiv.offsetWidth + 14 + "px";
		this.oDivShadow.style.height = this.oDiv.offsetHeight + 14 + "px";
		this.oDivShadow.style.top = this.y-7 + 'px';
		this.oDivShadow.style.left = this.x-7 + 'px';

		oDivShadow_rd.style.backgroundImage = "url('" + _sosSystem.settings.sTK + "window/images/shadow.png')";
		oDivShadow_rd.style.backgroundRepeat = "no-repeat";
		oDivShadow_rd.style.backgroundPosition = "bottom right";
		oDivShadow_rd.style.position = "absolute";
		oDivShadow_rd.style.right = "0px";
		oDivShadow_rd.style.bottom = "0px";
		oDivShadow_rd.style.width = this.oDiv.offsetWidth+7 +"px";
		oDivShadow_rd.style.height = this.oDiv.offsetHeight+7 +"px";
		oDivShadow_rd.innerHTML = "&nbsp;"

		oDivShadow_lt.style.backgroundImage = "url('" + _sosSystem.settings.sTK + "window/images/shadow_l.png')";
		oDivShadow_lt.style.backgroundRepeat = "no-repeat";
		oDivShadow_lt.style.backgroundPosition = "top left";
		oDivShadow_lt.style.position = "absolute";
		oDivShadow_lt.style.left = "0px";
		oDivShadow_lt.style.top = "0px";
		oDivShadow_lt.style.width = this.oDiv.offsetWidth+7 +"px";
		oDivShadow_lt.style.height = this.oDiv.offsetHeight+7 +"px";
		oDivShadow_lt.innerHTML = "&nbsp;"

		oDivShadow_bl.style.backgroundImage = "url('" + _sosSystem.settings.sTK + "window/images/shadow_bl.png')";
		oDivShadow_bl.style.backgroundRepeat = "no-repeat";
		oDivShadow_bl.style.backgroundPosition = "bottom left";
		oDivShadow_bl.style.position = "absolute";
		oDivShadow_bl.style.left = "0px";
		oDivShadow_bl.style.bottom = "0px";
		oDivShadow_bl.style.width = "8px";
		oDivShadow_bl.style.zIndex = 101;
		oDivShadow_bl.style.height = "8px";
		oDivShadow_bl.innerHTML = "&nbsp;"

		oDivShadow_rt.style.backgroundImage = "url('" + _sosSystem.settings.sTK + "window/images/shadow_rt.png')";
		oDivShadow_rt.style.backgroundRepeat = "no-repeat";
		oDivShadow_rt.style.backgroundPosition = "top right";
		oDivShadow_rt.style.position = "absolute";
		oDivShadow_rt.style.right = "0px";
		oDivShadow_rt.style.top = "0px";
		oDivShadow_rt.style.width = "8px";
		oDivShadow_rt.style.height = "8px";
		oDivShadow_rt.innerHTML = "&nbsp;"






		this.oDivShadow.appendChild(oDivShadow_lt);
		this.oDivShadow.appendChild(oDivShadow_bl);
		this.oDivShadow.appendChild(oDivShadow_rd);
		this.oDivShadow.appendChild(oDivShadow_rt);

		document.body.appendChild(this.oDivShadow);


		if(this.settings.image)
		{
			var img_src = this.settings.image;
		} else
		{
			var img_src = _sosSystem.settings.sTK + 'info/images/info.png';
		}






		if (window.innerHeight)
		{
			var maxHeight = window.innerHeight;
			var maxWidth = window.innerWidth;
		} else
		{
			var maxHeight = document.body.clientHeight;
			var maxWidth = document.body.clientWidth;
		}





		this.oDiv.style.visibility = 'visible';
		this.oDivShadow.style.visibility = 'visible';

	}



	var self = this;
	if(this.settings.selfclose == true){
		document.body.onmousemove = function()
		{
			window.setTimeout("all_sos_infos['" + self.settings.name + "'].hide()", 3000);
		}

		document.body.onkeydown = function()
		{
			window.setTimeout("all_sos_infos['" + self.settings.name + "'].hide()", 1000);
		}

		this.action = true;
	all_sos_infos[this.settings.name] = this;
	}



}

/**
* Info Box verschwinden lassen
*/
sosInfo.prototype.hide = function()
{
	if(this.action == true)
	{
		this.oDiv.parentNode.removeChild(this.oDiv);
		document.body.onmousemove = function() { }
	}

	this.action = false;
}

/**
* Schließt das Fenster
*/
sosInfo.prototype.close = function()
{

this.oDiv.parentNode.removeChild(this.oDiv);
if(this.settings.styleType ==2){

	this.oDivShadow.parentNode.removeChild(this.oDivShadow);
}
	all_sos_infos[this.settings.name] = null;
}


/**
* Setzt den Info Body
*/
sosInfo.prototype.setBody = function(html)
{
	this.oDivBody.innerHTML = html;
}