$PAGE = window.location.href.replace(/^.*\//, '').replace(/\.(php|hmtl|xml|js|css).*$/, '');



if ($PAGE == '') {

    $PAGE = 'index';

}



$.require($PAGE + '.js', {

    reload: true

});



$.require('JPlugins/jquery.livequery.js');

$.require('JPlugins/jquery.function.js');

$.require('JPlugins/jquery.dimensions.js');



$('<img />').attr('src', '../app/app_2/img/loading.gif').css('display', 'none').prependTo($('body'));



var viewimg = function( selectors ){

    $(selectors).each(function(){

        $(this).hide();

                               

        $(this).parent().parent().css({

            backgroundImage: 'url("../app/app_2/img/loading.gif")',

			backgroundPosition : '50% 50%',

			backgroundRepeat : 'no-repeat',

			height : 50

        });

        

        $(this).load(function(){

            $(this).parent().parent().css({

                backgroundImage: 'none',

            	height: $(this).height() + 'px'

            });

			$(this).fadeIn();

        }).attr('src', $(this).attr('src'));

    });

};



$(function(){

	

	$('#col_esq ul li a').livequery(function(){		

				

		$(this).mouseover(function(){			

			fontSize = parseFloat($(this).css('font-size'));

			

			if( ! $(this).attr('fontSize') ) $(this).attr('fontSize',fontSize);		

			

			$(this).animate({

				fontSize : (fontSize + (fontSize*20/100))  + 'px'

			} , 50);			

		});

		

		$(this).mouseout(function(){

						

			$(this).animate({

				fontSize : $(this).attr('fontSize')  + 'px'				

			} , 50);	

				

		});

	});

			

	$('#form_busca').livequery('submit',function(){

		if($.trim($('#busca').val()).length == 0){			

			return false;

		}

	});

	

	viewimg( 'table img'  );

	

	var $a = $('<a />').attr('href','javascript:history.go(-1)').html('&laquo; Voltar').css({

		'display': 'block',

		'text-align' : 'left',

		'padding-left' : '20px',

		'color' : '#8C2624',

		'text-decoration' : 'none',

		'clear' : 'both'

	});

	

	$('#col_dir_bottom_bar').append($a);

});



window.onload = function(){	

	$('#col_dir_bottom_bar').livequery(function(){		

		if($(this).height() < $('#col_esq').height()){

			$(this).height($('#col_esq').height());

		}

	});

};




