var actualTab;


function tab(obj, context, width, height, elementInfo)
{
var l = {
			x :0, 
			y : 0, 
			height : height, 
			width : width, 
			offsetLeft : 0, 
			offsetRight : 0, 
			radiusLeft : 10, 
			radiusRight : 10, 
			border : 0
		}; 
		context.fillStyle = "#999999"; 
		$.canvasPaint.roundTab(context, l); 
		l.border = 1; 
		
		
	//	if(typeof actualTab == "undefined")
		//{
			if( obj.hasClass("ui-tabs-selected") )
			{
				context.fillStyle = "#FFF"; 
			}
			else
			{
				context.fillStyle = "#999999"; 
			}
	/*	}
		else
		{
			//alert(actualTab.index);
			var href1= actualTab.tab.attributes[0].value;
			var href2 = obj.children('.jbgContentDiv').children('a').attr("href");
			if(href1==href2)
			{
				context.fillStyle = "#FFF"; 

			}
			else
			{
				context.fillStyle = "#CCC";
				//obj.css("margin-bottom:","0"); 
				//obj.css("padding-bottom:", "1px");				
			}
			//alert( href1 + " "+  href2 );
		
		}
*/
		
		$.canvasPaint.roundTab(context, l);
} 
function DrawBackgroundChange(ui)
{
	actualTab = ui;
	var href1= actualTab.tab.attributes[0].value;
	var href2search = "a[href*=" + href1 + "]";
	//var obj = $(".tx-rgtabs-pi1").children('ul').children('li').children('.jbgContentDiv');
	var obj = $(".jbgContentDiv").children(href2search);
	//.children(href2search);
	var href2 = obj.attr("href");
/*	obj.parent().parent().parent().css("background-color", "#FFFF66");	
	obj.parent().parent().parent().css("margin-bottom","0"); 
	obj.css("padding-bottom", "0px"); 
	obj.css("margin-bottom", "0px"); */
/*	$(".ui-tabs .ui-tabs-nav li.ui-tabs-selected").removeClass("ui-tabs-selected");
	obj.parent().parent().addClass("ui-tabs-selected"); */
	
	DrawBackground();
}

function TestBackgroundPaintFkt(context, width, height, elementInfo)
{
	var options = {x:0, height: height, width: width,radius:15, border: 0 };
	context.fillStyle = "#FFFF66";
	$.canvasPaint.roundedRect(context,options);

	var options = {x:0, height: height, width: width,radius:15, border: 1 };
	context.fillStyle = "#FFF";
	$.canvasPaint.roundedRect(context,options);
}


