$(document).ready(
	function()
	{	  
		var background = new Array(0, '1f90ba', 'd00c18', 'd36a01');
		
		$("#tamplate_table table").attr('style', '');
		$("#tamplate_table table").css('padding-bottom', '10px');
		$("#tamplate_table table").width('100%');
		$("#tamplate_table table").attr('border', '0');
		$("#tamplate_table tr").css('background','#f0f0e3');
		$("#tamplate_table table tr:first-child").css('background','#e4e4d8');
		$("#tamplate_table tr:first").css('font-weight','bold');
		$("#tamplate_table td").css('padding-left','5px');
		$("#tamplate_table td").css('padding-right','5px');
		$("#tamplate_table td").css('padding-top','3px');
		$("#tamplate_table td").css('padding-bottom','3px');
		
		$(".next_td, .th_background_1, .th_background_2, .th_background_3").mousemove(function(){
								
			var counter = 0;					
			var id = $(this).attr("id");
			var table_id = id.split('-')[0];

			$("th[id='"+id+"']").css({'background':'url(images/element_'+table_id+'_3_actual.jpg) no-repeat', 'color':'#000'});
			$("td[id='"+id+"']").css({'background':'url(images/background_3_actual.jpg) repeat-y'});
			
			$($("td[id='"+id+"']").find("img")).each(function(){
				counter++;
				if ($(this).attr('src') == 'images/element_1.jpg')
				{
					$(this).attr('src', 'images/element_1b.jpg');
					$("#first_td_"+table_id+"_"+counter+", #third_td_"+table_id+"_"+counter).css("background", "url(images/background_"+table_id+"_4a.jpg) repeat-x 0px 5px");
					$("#table_content_"+table_id+"_"+counter).css({"background":"#"+background[table_id], "color":"#000"});
				}
			});
		});
		
		$(".next_td, .th_background_1, .th_background_2, .th_background_3").mouseleave(function(){	
																								
			var counter = 0;																					
			var id = $(this).attr("id");
			var table_id = id.split('-')[0];
			
			$("th[id='"+id+"']").css({'background':'url(images/element_'+table_id+'_3.jpg) no-repeat', 'color':'#fff'});
			$("td[id='"+id+"']").css('background','url(images/background_3.jpg) repeat-y');
			
			$($("td[id='"+id+"']").find("img")).each(function(){
				counter++;
				if ($(this).attr('src') == 'images/element_1b.jpg')
				{
					$(this).attr('src', 'images/element_1.jpg');
					$("#first_td_"+table_id+"_"+counter+", #third_td_"+table_id+"_"+counter).css("background", "url(images/background_"+table_id+"_4.jpg) repeat-x 0px 5px");
					$("#table_content_"+table_id+"_"+counter).attr("style", "");
				}
			});
		});
	}
);


