/*
tip_balloon.js  v. 1.2

The latest version is available at
http://www.walterzorn.com
or http://www.devira.com
or http://www.walterzorn.de

Initial author: Walter Zorn
Last modified: 13.7.2007

Extension for the tooltip library wz_tooltip.js.
Implements balloon tooltips.
*/

// Here we define new global configuration variable(s) (as members of the
// predefined "config." class).
// From each of these config variables, wz_tooltip.js will automatically derive
// a command which can be passed to Tip() or TagToTip() in order to customize
// tooltips individually. These command names are just the config variable
// name(s) translated to uppercase,
// e.g. from config. Balloon a command BALLOON will automatically be
// created.

if(typeof config == "undefined")
	alert("Error:\nThe core tooltip script file 'wz_tooltip.js' must be included first, before the plugin files!");

//===================  GLOBAL TOOPTIP CONFIGURATION  =========================//
config. Balloon				= true	// true or false - set to true if you want this to be the default behaviour
config. BalloonImgPath		= "/infusions/devira_haber_panel/images/" // Path to images (border, corners, stem), in quotes. Path must be relative to your HTML file.
// Sizes of balloon images
config. BalloonEdgeSize		= 6		// Integer - sidelength of quadratic corner images
config. BalloonStemWidth	= 15	// Integer
config. BalloonStemHeight	= 19	// Integer
config. BalloonStemOffset	= -7	// Integer - horizontal offset of left stem edge from mouse (recommended: -stemwidth/2 to center the stem above the mouse)
//=======  END OF TOOLTIP CONFIG, DO NOT CHANGE ANYTHING BELOW  ==============//


// Create a new tt_Extension object (make sure that the name of that object,
// here balloon, is unique amongst the extensions available for wz_tooltips.js):
var balloon = new tt_Extension();

// Implement extension eventhandlers on which our extension should react

balloon.OnLoadConfig = function()
{
	if(tt_aV[BALLOON])
	{
		// Turn off native style properties which are not appropriate
		balloon.padding = Math.max(tt_aV[PADDING] - tt_aV[BALLOONEDGESIZE], 0);
		balloon.width = tt_aV[WIDTH];
		//if(tt_bBoxOld)
		//	balloon.width += (balloon.padding << 1);
		tt_aV[BORDERWIDTH] = 0;
		tt_aV[WIDTH] = 0;
		tt_aV[PADDING] = 0;
		tt_aV[BGCOLOR] = "";
		tt_aV[BGIMG] = "";
		tt_aV[SHADOW] = false;
		// Append slash to img path if missing
		if(tt_aV[BALLOONIMGPATH].charAt(tt_aV[BALLOONIMGPATH].length - 1) != '/')
			tt_aV[BALLOONIMGPATH] += "/";
		return true;
	}
	return false;
};

balloon.OnCreateContentString = function()
{		
	var aImg, sImgZ, sCssCrn, sVaT, sVaB, sCssImg;
	  tt_sContent = '<table border="0" cellpadding="0" cellspacing="0" style="width:116px" >'
      + '<tr><td colspan=3 align=center valign=top ><span id="balon_ust" style="float:left; display:inline-block; width:116px; height:9px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'/infusions/devira_haber_panel/images/balon_ust.png\', );" ></span></td></tr>'
      + '<tr><td style="width:5px"><span id="balon_sol" style="display:inline-block; width:5px; height:140px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'/infusions/devira_haber_panel/images/balon_sol.png\', );" ></span></td>'
      + '<td style="background-color: #fff; vertical-align:top; width:106px" align=center ><div style="width:98px; text-align:left" >' + tt_sContent + '</div></td>'
      + '<td style="width:5px" ><span id="balon_sag" style="display:inline-block; width:5px; height:140px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'/infusions/devira_haber_panel/images/balon_sag.png\', );" ></span></td></tr>'
      + '<tr><td colspan=3 align=center valign=top ><span id="balon_alt" style="display:inline-block; width:116px; height:18px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'/infusions/devira_haber_panel/images/balon_alt.png\', );" ></span></td></tr></table>'
	return true;
};

function Balloon_CacheImgs(sPath)
{
	var asImg = ["background", "solust", "ust", "sagust", "sag", "sagalt", "alt", "solalt", "sol", "ust_ok", "alt_ok"],
	n = asImg.length,
	aImg = new Array(n),
	img;

	while(n)
	{--n;
		img = aImg[n] = new Image();
		img.src = sPath + asImg[n] + ".png";  //  Change to ".png" if you want to use PNG images
	}
	return aImg;
}


