(function(window,$,undefined){
	var mwd = {
		initVisualArts:function(){
			var vis = $('.visualarts');
			$('ul.tab a',vis).click(function(){
				$('ul.tab li.active').removeClass('active');
				$(this).parent().addClass('active');
				$('div.active',vis).removeClass('active');
				$($(this).attr("href")).addClass('active');
				return false;
			})
		},
		initIconTooltip:function() {
			var t = $('<div id="icon-tooltip"/>');
			t.appendTo($('body'));
			$('table.icons img').hover(mwd.showIconTooltip,mwd.hideIconTooltip);
		},
		showIconTooltip:function() {
			var t = $('#icon-tooltip');
			var img = $(this);
			var offset = $(img).offset();
			var i = img.attr('rel');
			$.get('/includes/box/icon.cfm',{id:i},function(result){
				result = $.trim(result);
				if ( result.length > 0 ) {
					t.html(result);
					t.show();
					t.css({
						top: offset.top - t.height(),
						left: offset.left - (t.width()/2)
					});
				}
			});
			setTimeout(hideIconTooltip,2000);
		},
		initHomeSlider:function() {
			var slider = $(".showgallery .thumbs");
			var ul = $("ul",slider);
			var thumbs = $("li",slider);
			var pos = 0, max = 0;
			$(ul).css("width",(thumbs.length*170));
			max = ( $(slider).width() - $(ul).width() );
			if ( max < 0 ) {
				setInterval(function(){
					if ( pos > max ) {
						pos -= 170;
					} else {
						pos = 0;
					}
					$(ul).animate({ left: pos },500);
				},3000);
			}
		},
		hideIconTooltip:function(){
			var t = $('#icon-tooltip');
			t.hide();		
		}
	};
	window.mwd = mwd;
})(window,jQuery);
