var gMenuPath = '';
var gMenuW = 0;
var gMenuH = 0;

function menuBegin(w,h,path) { 

gMenuPath = path;
gMenuW = w;
gMenuH = h;	

document.write('<table class="menutable">');
document.write('<tr>');
document.write('	<td class="m11">&nbsp;</td>');
document.write('	<td class="m21">&nbsp;</td>');
document.write('	<td class="m31">&nbsp;</td>');
document.write('</tr>');
document.write('<tr>');
document.write('	<td class="m12"><img src="'+path+'l.jpg" width="22" height="'+h+'" border="0"/></td>');
document.write('	<td class="m22" style="width:'+w+'px;height:'+h+'px;">');
document.write('<div style="text:-align:left;position:absolute;z-index:2;left:22px;top:1em;width:'+(w-12)+'px">');
	 	
} 

function menuEnd() {

document.write('</div>');
document.write('<div style="position:relative;z-index:1;"><img src="'+gMenuPath+'v.jpg" width="'+gMenuW+'" height="'+gMenuH+'" border="0"/></div>'); 
document.write('</td>');
document.write('	<td class="m32"><img src="'+gMenuPath+'r.jpg" width="22" height="'+gMenuH+'" border="0"/></td>');
document.write('</tr>');                                                           
document.write('<tr>');
document.write('	<td class="m13">&nbsp;</td>');
document.write('	<td class="m23">&nbsp;</td>');
document.write('	<td class="m33">&nbsp;</td>');
document.write('</tr>');
document.write('</table>'); 
} 

//usage $('#something').wrapPanel(path,w,h)
;(function($) {
$.fn.wrapPanel2 = function(path,w,h) { 

var b,a;
b='<table class="menutable">';
b+='<tr>';
b+='	<td class="m11">&nbsp;</td>';
b+='	<td class="m21">&nbsp;</td>';
b+='	<td class="m31">&nbsp;</td>';
b+='</tr>';
b+='<tr>';
b+='	<td class="m12"><img src="'+path+'l.jpg" width="22" height="'+h+'" border="0"/></td>';
b+='	<td class="m22" style="width:'+((w!=0)?w:$(this).width())+'px;height:'+((h!=0)?h:$(this).height())+'px;">';
//b+='<div style="text:-align:left;position:absolute;z-index:2;left:22px;top:1em;width:'+(w-12)+'px">';

 

//a='</div>';
a='<div style="position:relative;z-index:1;"><img src="'+path+'v.jpg" width="'+((w!=0)?w:$(this).width())+'" height="'+((h!=0)?h:$(this).height())+'" border="0"/></div>';
a+='</td>';
a+='	<td class="m32"><img src="'+path+'r.jpg" width="22" height="'+((h!=0)?h:$(this).height())+'" border="0"/></td>';
a+='</tr>';                                                           
a+='<tr>';
a+='	<td class="m13">&nbsp;</td>';
a+='	<td class="m23">&nbsp;</td>';
a+='	<td class="m33">&nbsp;</td>';
a+='</tr>';
a+='</table>';  


 $(this).before(a);
 $(this).after(b);



}

})(jQuery);



var g_idMenuHolder = 0;

//innerWrap
//usage $('#something').wrapPanel(path,w,h)
;(function($) {
$.fn.wrapPanel = function(menuPath,baseUrl,w,h) {

return; 
var w=(w!=0)?w:$(this).width();
var h=(h!=0)?h:$(this).height();

g_idMenuHolder++;
wr='<table class="menutable" id="menu_t'+g_idMenuHolder+'">';
wr+='<tr>';
wr+='	<td class="m2_11">&nbsp;</td>';
wr+='	<td class="m2_21"><img src="'+menuPath+'../clear.gif" width="'+(w+1)+'" height="1"/></td>';
wr+='	<td class="m2_31">&nbsp;</td>';
wr+='</tr>';
wr+='<tr>';
wr+='	<td class="m2_12"><img src="'+menuPath+'2_l.gif" width="22" height="'+h+'" border="0"/></td>';
wr+='	<td id="mc'+g_idMenuHolder+'" class="m2_22" style="width:'+(w+1)+'px;height:'+h+'px;">&nbsp;</td>';
wr+='	<td class="m2_32"><img src="'+menuPath+'2_r.gif" width="22" height="'+h+'" border="0"/></td>';
wr+='</tr>';                                                           
wr+='<tr>';
wr+='	<td class="m2_13">&nbsp;</td>';
wr+='	<td class="m2_23">&nbsp;</td>';
wr+='	<td class="m2_33">&nbsp;</td>';
wr+='</tr>';
wr+='</table>';


var tt = $(this).html();
$(this).html(wr);
//$('#mc'+g_idMenuHolder).css('background','url('+baseUrl+'/site/menubgimg/w/'+w+'/h/'+h+') 0 0 repeat-x');
$('#mc'+g_idMenuHolder).html(tt);
}

})(jQuery);


//innerWrap
//usage $('#something').wrapPanel(path,w,h)
;(function($) {
$.fn.wrapMenu = function(menuPath,baseUrl,w,h) {

var w=(w!=0)?w:$(this).width();
var h=(h!=0)?h:$(this).height();

g_idMenuHolder++;
wr='<table class="menutable" id="menu_t'+g_idMenuHolder+'">';
wr+='<tr>';
wr+='	<td class="m11">&nbsp;</td>';
wr+='	<td class="m21"><img src="'+menuPath+'../clear.gif" width="'+(w+1)+'" height="1"/></td>';
wr+='	<td class="m31">&nbsp;</td>';
wr+='</tr>';
wr+='<tr>';
wr+='	<td class="m12"><img src="'+menuPath+'bg.gif" width="20" height="'+h+'" border="0"/></td>';
wr+='	<td id="mc'+g_idMenuHolder+'" class="m22" style="width:'+(w+1)+'px;height:'+h+'px;">&nbsp;</td>';
wr+='	<td class="m32"><img src="'+menuPath+'bg.gif" width="20" height="'+h+'" border="0"/></td>';
wr+='</tr>';
wr+='<tr>';
wr+='	<td class="m13">&nbsp;</td>';
wr+='	<td class="m23">&nbsp;</td>';
wr+='	<td class="m33">&nbsp;</td>';
wr+='</tr>';
wr+='</table>';


var tt = $(this).html();
$(this).html(wr);
//$('#mc'+g_idMenuHolder).css('background','url('+baseUrl+'/site/menubgimg/w/'+w+'/h/'+h+') 0 0 repeat-x');
$('#mc'+g_idMenuHolder).html(tt);
}

})(jQuery);


jQuery.fn.outerHTML = function() {
    return $('<div>').append( this.eq(0).clone() ).html();
};

//var g_idMenuHolder = 0;

//innerWrap
//usage $('#something').wrapPanel(path,w,h)
;(function($) {
$.fn.wrapPanel_grad = function(menuPath,baseUrl,w,h) { 
 
var w=(w!=0)?w:$(this).width();
var h=(h!=0)?h:$(this).height()+14;

g_idMenuHolder++;
wr='<table class="menutable" id="menu_t'+g_idMenuHolder+'">';
wr+='<tr>';
wr+='	<td class="m11">&nbsp;</td>';
wr+='	<td class="m21"><img src="'+menuPath+'../clear.gif" width="'+(w+1)+'" height="1"/></td>';
wr+='	<td class="m31">&nbsp;</td>';
wr+='</tr>';
wr+='<tr>';
wr+='	<td class="m12"><img src="'+menuPath+'l.jpg" width="22" height="'+h+'" border="0"/></td>';
wr+='	<td id="mc'+g_idMenuHolder+'" class="m22" style="width:'+(w+1)+'px;height:'+h+'px;">&nbsp;</td>';
wr+='	<td class="m32"><img src="'+menuPath+'r.jpg" width="22" height="'+h+'" border="0"/></td>';
wr+='</tr>';                                                           
wr+='<tr>';
wr+='	<td class="m13">&nbsp;</td>';
wr+='	<td class="m23">&nbsp;</td>';
wr+='	<td class="m33">&nbsp;</td>';
wr+='</tr>';
wr+='</table>';  


var tt = $(this).html();
$(this).html(wr);
$('#mc'+g_idMenuHolder).css('background','url('+baseUrl+'/site/menubgimg/w/'+w+'/h/'+h+') 0 0 repeat-x');
$('#mc'+g_idMenuHolder).html(tt);
}

})(jQuery); 

//outerWrap
//usage $('#something').outerWrapPanel(path,w,h)
;(function($) {
$.fn.outerWrapPanel = function(menuPath,baseUrl,w,h) { 
 
var w=(w!=0)?w:$(this).width();
var h=(h!=0)?h:$(this).height()+14;

g_idMenuHolder++;
wr='<table class="menutable" id="menu_t'+g_idMenuHolder+'">';
wr+='<tr>';
wr+='	<td class="m11">&nbsp;</td>';
wr+='	<td class="m21"><img src="'+menuPath+'../clear.gif" width="'+(w+1)+'" height="1"/></td>';
wr+='	<td class="m31">&nbsp;</td>';
wr+='</tr>';
wr+='<tr>';
wr+='	<td class="m12"><img src="'+menuPath+'l.jpg" width="22" height="'+h+'" border="0"/></td>';
wr+='	<td id="mc'+g_idMenuHolder+'" class="m22" style="width:'+(w+1)+'px;height:'+h+'px;">&nbsp;</td>';
wr+='	<td class="m32"><img src="'+menuPath+'r.jpg" width="22" height="'+h+'" border="0"/></td>';
wr+='</tr>';                                                           
wr+='<tr>';
wr+='	<td class="m13">&nbsp;</td>';
wr+='	<td class="m23">&nbsp;</td>';
wr+='	<td class="m33">&nbsp;</td>';
wr+='</tr>';
wr+='</table>';  


var tt = $(this).outerHTML();
$(this).after(wr).remove();
$('#mc'+g_idMenuHolder).css('background','url('+baseUrl+'/site/menubgimg/w/'+w+'/h/'+h+') 0 0 repeat-x');
$('#mc'+g_idMenuHolder).html(tt);
}

})(jQuery); 

