var App = {
	init: function() {
		var postfix = '-on';
		App.external_link();
		App.set_gnav_current(postfix);
		App.swap_image(postfix);
	},
	external_link: function() {
		$('a[rel=external]').click(function (){
			window.open(this.href,'');
			return false;
		})
	},
	set_gnav_current: function(postfix) {
		var src = $('#beta-inner ul li a.here img').attr('src');
		var src_here = src.substr(0, src.lastIndexOf('.'))+'-here'+src.substring(src.lastIndexOf('.'));
		$('#beta-inner ul li a.here img').attr('src',src_here);
	},
	swap_image: function(postfix) {
		$('#beta-inner ul li a:not(".here") img, #content-inner .nav ul li:not(".here") a img').hover(function(){
			var src = $(this).attr('src');
			var src_on = src.substr(0, src.lastIndexOf('.'))+postfix+src.substring(src.lastIndexOf('.'));
			$(this).attr('src',src_on);
		}, function() {
			var src = $(this).attr('src');
			var src_off = $(this).attr('src').replace(postfix,'');
			$(this).attr('src',src_off);
		});
	}
};

$().ready(function() {
	App.init();
//	$('.lb a, a.lb').lightBox({
//		imageLoading: '/skin/src/lightbox/lightbox-ico-loading.gif',
//		imageBtnClose: '/skin/src/lightbox/lightbox-btn-close.gif',
//		imageBtnPrev: '/skin/src/lightbox/lightbox-btn-prev.gif',
//		imageBtnNext: '/skin/src/lightbox/lightbox-btn-next.gif',
//		imageBlank: '/skin/src/lightbox/lightbox-blank.gif',
//		overlayBgColor: '#663300',
//		overlayOpacity: '0.5'
//	});
});

