$(document).ready(function()
{
	/* Динамические стили INPUT элементов*/	
	$(".input_text").click(function(){
		$(".input_text").removeClass('input_text_selected');
		$(this).addClass('input_text_selected');
	});

	/* Меню */
	$(".box[selected='selected']").children('.element').find('a').css({'color':'#fff','background-color':'#353535'});
	
	/* Table styles */
	if($('#module_pages TABLE').length)
	{
		$('#module_pages TABLE').each(function(){
			var $tr = $(this).find('TR').eq(0);
			if($tr.find('TD').length)
			{
				var tr = $tr.html();
				var pos = 0;
			}
			else
			{
				var tr = $(this).find('TR').eq(1).html();
				var pos = 1;
			}
			
			console.log(tr);
			
			if(strpos(tr, 'Наименование'))
			{
				$(this).addClass('datatable');
				$(this).find('TR').eq(pos).addClass('thead');
				$(this).find('TR:even').not('.thead').addClass('even');
			}
		})
	}
});

function strpos( haystack, needle, offset){
	var i = haystack.indexOf( needle, offset ); // returns -1
	return i >= 0 ? i : false;
}
