$(window).load(function() {
	//Image Proportion
	if ($('div.image').length) {
		$('div.image img').each(function() {
			var maxWidth = 112;
			var maxHeight = 82;
			var ratio = 0;
			var width = $(this).outerWidth();
			var height = $(this).outerHeight();
			$(this).css({
				marginTop: '-' + (height / 2) + 'px',
				marginLeft: '-' + (width / 2) + 'px'
			});
			if(width > maxWidth){
				ratio = maxWidth / width;
				$(this).css({
					width: maxWidth + 'px',
					height: (height * ratio) + 'px',
					marginTop: '-' + ((height * ratio) / 2) + 'px',
					marginLeft: '-' + (maxWidth / 2) + 'px'
				});
				height = height * ratio;
			}
			if (height > maxHeight) {
				ratio = maxHeight / height;
				$(this).css({
					width: (width * ratio) + 'px',
					height: maxHeight + 'px',
					marginTop: '-' + (maxHeight / 2) + 'px',
					marginLeft: '-' + ((width * ratio) / 2) + 'px'
				});
				width = width * ratio;
			}
		});
	}
});
$(document).ready(function() { 
	$('ul.sf-menu').superfish({ 
		delay:       1000,                            // one second delay on mouseout 
		animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation 
		speed:       'fast',                          // faster animation speed 
		autoArrows:  false,                           // disable generation of arrow mark-up 
		dropShadows: false                            // disable drop shadows 
	});

	//Breadcrumb Height
	var line_height = $('ul#breadCrumb').height(); 
	if(line_height > 15){
		$('body.interior').addClass('large');
		$('#header').addClass('large');
	}

	//Home Slider
	$('.tab_content').hide(); //Hide all content
	//$('ul.tabs li:first').addClass('active').show(); //Activate first tab
	$('.tab_content:first').show(); //Show first tab content

	//On Click Event
	$('ul.tabs li').click(function() {
		$('ul.tabs li').removeClass('active'); //Remove any "active" class
		$(this).addClass('active'); //Add "active" class to selected tab
		$('.tab_content').hide(); //Hide all tab content
		var activeTab = $(this).find('a').attr('href'); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content
		return false;
	});

	$('#sliderNews').bxSlider({
		mode: 'horizontal',
		auto: true,
		pager: false,
		speed: 1000,
		controls: false,
		pause: 15000
	});

	//Table Style
	$('tr:even td').css('background-color', '#eee');

	//Definition List
	//$('dl dd:last-child').css('margin-bottom', 0);
	/*$('dt').each(function(){
		$(this).after('<div class="clear"></div>');
	})*/
});

