// wrapfunctions.js - Javascript Wrapper Functions
// - V1 for Tigra Menu GOLD v2.2 - initial release - Apr 2003 - L Connor
// - V2 for Tigra Menu GOLD v2.4 - modified to handle menu item wrapping correctly - June 2004 - L Connor
var states = ['mout', 'mover', 'mdown'];

// 	wrap_cap: Wraps Caption with Styles to handle each of the 3 States (mouse-out, mouse-over and mouse-down) - Tested
//				accepts: Menu Short Name, Menu Level and Caption Text
function wrap_cap (shortName, level, caption) {
	var res=[]; for (var i=0; i<states.length; i++)
		res[i]=	'<table cellpadding=0 cellspacing=0 border=0 width=100%>' +
								'<tr>' +
									'<td width=100% class=' + shortName + 'L' + level + states[i] + 'i>' + caption + '</td>' +
								'</tr>' +
							'</table>';
	return res;
}

// 	wrap_cap_arrow: Wraps Caption with Styles to handle each of the 3 States (mouse-out, mouse-over and mouse-down),
//  							  Plus an Arrow GIF (Name is dependent on ArrowSuffix in ..._Menu_Items.js and Arrow wrap_gif_cap_arrowition passed in - Tested
//				 accepts: Menu Short Name, Menu Level, Caption Text, Image Path and Arow Suffix (e.g. "ArrowWhite" and wrap_gif_cap_arrowition ("R"=right, "D"=down) 
function wrap_cap_arrow (shortName, level, caption, path, arrow) {
	var res=[];
	 for (var i=0; i<states.length; i++)
		res[i]=	'<table cellpadding=0 cellspacing=0 border=0 width=100%>' +
								'<tr>' +
									'<td width=100% class=' + shortName + 'L' + level + states[i] + 'i>' + caption + '</td>' +
									(arrow?'<td valign=top><img src=' + path + arrow[i] + states[i] + '.gif width=12 height=12 align=absmiddle valign=bottom>&nbsp;</td>':'') +
								'</tr>' +
							'</table>';
	return res;
}

// wrap_gif_cap: Displays GIF then Wraps Caption with Styles to handle each of the 3 States (mouse-out, mouse-over and mouse-down) - Tested
//			accepts: Menu Short Name, Menu Level, Caption Text, Image Path and GIF Name (15 pixel empty GIF if none passed in) 
function wrap_gif_cap (shortName, level, caption, path, icon) {
	var res=[]; for (var i=0; i<states.length; i++)
		res[i]=	'<table cellpadding=0 cellspacing=0 border=0 width=100%>' +
								'<tr>' +
									'<td valign=top><img height=16 src=' +  path + (icon != null ? icon + ' height=16': 'pixel.gif width=15') + '>' +
									'<td width=100% class=' + shortName + 'L' + level + states[i] + 'i>' + caption + '</td>' +
								'</tr>' +
							'</table>';
	return res;
}

// 	wrap_gif_cap_arrow: Wrap GIF (15 pixel empty GIF if none passed in), Caption (applies the correct inner formatting class),
//  							  Plus an Arrow GIF (Name is dependent on ArrowSuffix in ..._Menu_Items.js and Arrow wrap_gif_cap_arrowition passed in - Tested
//				 accepts: Menu Short Name, Menu Level, Caption Text, Image Path, GIF and Arow wrap_gif_cap_arrowition ("R"=right, "D"=down) 
function wrap_gif_cap_arrow (shortName, level, caption, path, icon, arrow) {
	var res=[];
	for (var i=0; i<states.length; i++)
		res[i]=	'<table cellpadding=0 cellspacing=0 border=0 width=100%>' +
								'<tr>' +
									'<td valign=top><img height=16 src=' + path + (icon != null ? icon + ' height=16': 'pixel.gif width=15') + '>' +
									'<td width=100% class=' + shortName + 'L' + level + states[i] + 'i>' + caption + '</td>' +
									(arrow?'<td valign=top><img src=' + path + arrow[i] + states[i] + '.gif width=12 height=12 align=absmiddle valign=bottom>&nbsp;</td>':'') +
								'</tr>' +
							'</table>';
	return res;
}
