function OFsquare(num)
{
  return num * num;
}

function OFround(num)
{
	var T = Math.pow(10, 3)
	return Math.round(num*T)/T
}

function expandCollapse() 
{
	for (var i=0; i<expandCollapse.arguments.length; i++)
	{
		var element = document.getElementById(expandCollapse.arguments[i]);
		element.style.display = (element.style.display =='none') ? 'block' : 'none';
	}
}

function wrap_parent (text,icon) {
	return [['<table cellpadding=1 cellspacing=0 border=0 width=100%><tr><td><img height=16 src=', icon !=null ? '/images/menu/' + icon: '/images/menu/pixel.gif width=16', ' hspace=3></td><td width=100%><table cellpadding=1 cellspacing=0 border=0 width=100% height=22><tr><td class=a0  nowrap="nowrap">&nbsp; ', text, '</td></tr></table></td><td><img src=/images/menu/arr.gif width=4 height=7 align="middle" align=absmiddle hspace=3></td></tr></table>'].join(''),
	['<table cellpadding=1 cellspacing=0 border=0 width=100%><tr><td><table cellpadding=1 cellspacing=0 border=0 width=100% height=22 bgcolor=#0099CC><tr><td><img height=16 src=', icon !=null ? '/images/menu/' + icon: '/images/menu/pixel.gif width=16', ' hspace=3></td><td width=100% class=a0 nowrap="nowrap">&nbsp; ', text, '</td><td><img src=/images/menu/arr.gif width=4 height=7 align="middle" align=absmiddle hspace=3></td></tr></table></td></tr></table>'].join(''),
	['<table cellpadding=1 cellspacing=0 border=0 width=100%><tr><td><table cellpadding=1 cellspacing=0 border=0 width=100% height=22 bgcolor=#0099CC><tr><td><img height=16 src=', icon !=null ? '/images/menu/' + icon: '/images/menu/pixel.gif width=16', ' hspace=3></td><td width=100% class=a0 nowrap="nowrap">&nbsp; ', text, '</td><td><img src=/images/menu/arr.gif width=4 height=7 align="middle" align=absmiddle hspace=3></td></tr></table></td></tr></table>'].join('')
	];
}

function wrap_child (text,icon) {
	return [['<table cellpadding=1 cellspacing=0 border=0 width=100%><tr><td><img height=16 src=', icon !=null ? '/images/menu/' + icon: '/images/menu/pixel.gif width=16', ' hspace=3></td><td width=100%><table cellpadding=1 cellspacing=0 border=0 width=100% height=22><tr><td class=a0 nowrap="nowrap">&nbsp; ', text, '</td></tr></table></td></tr></table>'].join(''),
	['<table cellpadding=1 cellspacing=0 border=0 width=100%><tr><td><table cellpadding=1 cellspacing=0 border=0 width=100% height=22 bgcolor=#0099CC><tr><td><img height=16 src=', icon !=null ? '/images/menu/' + icon: '/images/menu/pixel.gif width=16', ' hspace=3></td><td width=99% class=a0 nowrap="nowrap">&nbsp; ', text, '</td></tr></table></td></tr></table>'].join(''),
	['<table cellpadding=1 cellspacing=0 border=0 width=100%><tr><td><table cellpadding=1 cellspacing=0 border=0 width=100% height=22 bgcolor=#0099CC><tr><td><img height=16 src=', icon !=null ? '/images/menu/' + icon: '/images/menu/pixel.gif width=16', ' hspace=3></td><td width=99% class=a0 nowrap="nowrap">&nbsp; ', text, '</td></tr></table></td></tr></table>'].join('')
	];
}

function wrap_root (text) {
	return [
	'<table border=0 cellpadding=1 cellspacing=0 width=100%><tr><td><table cellpadding=0 cellspacing=0 border=0 width=100% height=21><tr><td width=100% class=a0 align="center" nowrap="nowrap">&nbsp; ' + text + ' &nbsp;</td></tr></table></td></tr></table>',
	'<table border=0 cellpadding=1 cellspacing=0 width=100% background-image:url(../images/j22worlds/buttondown.jpg)><tr><td><table cellpadding=0 cellspacing=0 border=0 width=100% height=27><tr><td width=100% class=a1 align="center" nowrap="nowrap">&nbsp; ' + text + ' &nbsp;</td></tr></table></td></tr></table>',
	'<table border=0 cellpadding=1 cellspacing=0 width=100% background-image:url(../images/j22worlds/buttondown.jpg)><tr><td><table cellpadding=0 cellspacing=0 border=0 width=100% height=27><tr><td width=100% class=a1 align="center" nowrap="nowrap">&nbsp; ' + text + ' &nbsp;</td></tr></table></td></tr></table>'
	];
}
function wrap_j22_child (text,icon) {
	return [['<table cellpadding=1 cellspacing=0 border=0 width=100%><tr><td><img height=16 src=', icon !=null ? '/images/menu/' + icon: '/images/menu/pixel.gif width=16', ' hspace=3></td><td width=100%><table cellpadding=1 cellspacing=0 border=0 width=100% height=22><tr><td class=aj0 nowrap="nowrap">&nbsp; ', text, '</td></tr></table></td></tr></table>'].join(''),
	['<table cellpadding=1 cellspacing=0 border=0 width=100%><tr><td><table cellpadding=1 cellspacing=0 border=0 width=100% height=22 bgcolor=#aae859><tr><td><img height=16 src=', icon !=null ? '/images/menu/' + icon: '/images/menu/pixel.gif width=16', ' hspace=3></td><td width=99% class=aj0 nowrap="nowrap">&nbsp; ', text, '</td></tr></table></td></tr></table>'].join(''),
	['<table cellpadding=1 cellspacing=0 border=0 width=100%><tr><td><table cellpadding=1 cellspacing=0 border=0 width=100% height=22 bgcolor=#aae859><tr><td><img height=16 src=', icon !=null ? '/images/menu/' + icon: '/images/menu/pixel.gif width=16', ' hspace=3></td><td width=99% class=aj0 nowrap="nowrap">&nbsp; ', text, '</td></tr></table></td></tr></table>'].join('')
	];
}

function wrap_j22_root (text) {
	return [
	'<table border=0 cellpadding=1 cellspacing=0 width=100%><tr><td><table cellpadding=0 cellspacing=0 border=0 width=100% height=21><tr><td width=100% class=aj0 align="center" nowrap="nowrap">&nbsp; ' + text + ' &nbsp;</td></tr></table></td></tr></table>',
	'<table border=0 cellpadding=1 cellspacing=0 width=100% background-image:url(../images/j22worlds/j22/nav_btn_over.gif)><tr><td><table cellpadding=0 cellspacing=0 border=0 width=100% height=27><tr><td width=100% class=aj1 align="center" nowrap="nowrap">&nbsp; ' + text + ' &nbsp;</td></tr></table></td></tr></table>',
	'<table border=0 cellpadding=1 cellspacing=0 width=100% background-image:url(../images/j22worlds/j22/nav_btn_over.gif)><tr><td><table cellpadding=0 cellspacing=0 border=0 width=100% height=27><tr><td width=100% class=aj1 align="center" nowrap="nowrap">&nbsp; ' + text + ' &nbsp;</td></tr></table></td></tr></table>'
	];
}
function wrap_j22_admin_child (text,icon) {
	return [['<table cellpadding=1 cellspacing=0 border=0 width=100%><tr><td><img height=16 src=', icon !=null ? '/images/menu/' + icon: '/images/menu/pixel.gif width=16', ' hspace=3></td><td width=100%><table cellpadding=1 cellspacing=0 border=0 width=100% height=22><tr><td class=aja0 nowrap="nowrap">&nbsp; ', text, '</td></tr></table></td></tr></table>'].join(''),
	['<table cellpadding=1 cellspacing=0 border=0 width=100%><tr><td><table cellpadding=1 cellspacing=0 border=0 width=100% height=22 bgcolor=#aae859><tr><td><img height=16 src=', icon !=null ? '/images/menu/' + icon: '/images/menu/pixel.gif width=16', ' hspace=3></td><td width=99% class=aja0 nowrap="nowrap">&nbsp; ', text, '</td></tr></table></td></tr></table>'].join(''),
	['<table cellpadding=1 cellspacing=0 border=0 width=100%><tr><td><table cellpadding=1 cellspacing=0 border=0 width=100% height=22 bgcolor=#aae859><tr><td><img height=16 src=', icon !=null ? '/images/menu/' + icon: '/images/menu/pixel.gif width=16', ' hspace=3></td><td width=99% class=aja0 nowrap="nowrap">&nbsp; ', text, '</td></tr></table></td></tr></table>'].join('')
	];
}

function wrap_j22_admin_root (text) {
	return [
	'<table border=0 cellpadding=1 cellspacing=0 width=100%><tr><td><table cellpadding=0 cellspacing=0 border=0 width=100% height=21><tr><td width=100% class=aja0 align="center" nowrap="nowrap">&nbsp; ' + text + ' &nbsp;</td></tr></table></td></tr></table>',
	'<table border=0 cellpadding=1 cellspacing=0 width=100% background-image:url(../images/j22worlds/j22/nav_btn_over.gif)><tr><td><table cellpadding=0 cellspacing=0 border=0 width=100% height=27><tr><td width=100% class=aja1 align="center" nowrap="nowrap">&nbsp; ' + text + ' &nbsp;</td></tr></table></td></tr></table>',
	'<table border=0 cellpadding=1 cellspacing=0 width=100% background-image:url(../images/j22worlds/j22/nav_btn_over.gif)><tr><td><table cellpadding=0 cellspacing=0 border=0 width=100% height=27><tr><td width=100% class=aja1 align="center" nowrap="nowrap">&nbsp; ' + text + ' &nbsp;</td></tr></table></td></tr></table>'
	];
}
/* Tigra Menu template structure */
var MENU_TPL = [
	{
		'width': 160,
		'height': 29,
		'hide_delay': 1000,
		'expd_delay': 200,
		'vertical': true,
		'table': [0,1,0],
		'css': {
			'table': 'TM0t0',
			'outer': ['TM0o0','TM0o1'],
			'inner': 'TM0i0'
		}
	}
];
var MENU_POS_XP =[
// Level 0 block configuration
{
	// Item's height in pixels
	'height'     : 29,
	// Item's width in pixels
	'width'      : 60,
	// if Block Orientation is vertical
	'vertical'   : false,
	// Time Delay in milliseconds before subling block expands
	// after mouse pointer overs an item
	'expd_delay' : 300,
	// Style class names for the level
	'css': {
		// Block outing table class
		'table' : '',
		// Item outer tag style class for all item states or
		// classes for [<default state>, <hovered state>, <clicked state>]
		'outer' : ['mXPmouto','',''],
		// Item inner tag style class for all item states or
		// classes for [<default state>, <hovered state>, <clicked state>]
		'inner' : ''
	}
},
// Level 1 block configuration
{
	'width'      : 160,
	'height'     : 29,
	// Vertical Offset between adjacent levels in pixels
	'block_top'  : 22,
	// Horizontal Offset between adjacent levels in pixels
	'block_left' : 0,
	// block behaviour if single frame:	
	// 1 - shift to the edge, 2 - flip relatively to left upper corner
	'wise_pos'   : 2,
	'vertical'   : true,
	// transition effects for the block 
	// [index on expand, duration on expand, index on collapse, duration on collapse]
	'transition' : [0, 0.3, 0, 0.3],
	// Time Delay in milliseconds before menu collapses after mouse
	// pointer leafs all items
	'hide_delay' : 1000,
	'css' : {
		'table' : 'mXPtable',
		'outer' : '',
		'inner' : ''
	}
},
// Level 2 block configuration
{
	'block_top'  : 0,
	'block_left' : 160
}
	//Subling level configurations are inherited from level 2
]


var MENU_POS_XP_J22 =[
// Level 0 block configuration
{
	// Item's height in pixels
	'height'     : 29,
	// Item's width in pixels
	'width'      : 60,
	// if Block Orientation is vertical
	'vertical'   : false,
	// Time Delay in milliseconds before subling block expands
	// after mouse pointer overs an item
	'expd_delay' : 300,
	// Style class names for the level
	'css': {
		// Block outing table class
		'table' : '',
		// Item outer tag style class for all item states or
		// classes for [<default state>, <hovered state>, <clicked state>]
		'outer' : ['mXPJ22mouto','',''],
		// Item inner tag style class for all item states or
		// classes for [<default state>, <hovered state>, <clicked state>]
		'inner' : ''
	}
},
// Level 1 block configuration
{
	'width'      : 160,
	'height'     : 29,
	// Vertical Offset between adjacent levels in pixels
	'block_top'  : 22,
	// Horizontal Offset between adjacent levels in pixels
	'block_left' : 0,
	// block behaviour if single frame:	
	// 1 - shift to the edge, 2 - flip relatively to left upper corner
	'wise_pos'   : 2,
	'vertical'   : true,
	// transition effects for the block 
	// [index on expand, duration on expand, index on collapse, duration on collapse]
	'transition' : [0, 0.3, 0, 0.3],
	// Time Delay in milliseconds before menu collapses after mouse
	// pointer leafs all items
	'hide_delay' : 1000,
	'css' : {
		'table' : 'mXPJ22table',
		'outer' : '',
		'inner' : ''
	}
},
// Level 2 block configuration
{
	'block_top'  : 0,
	'block_left' : 160
}
	//Subling level configurations are inherited from level 2
]

