// JavaScript Document

var J = jQuery.noConflict();

    J(document).ready(function(){ 
						
		//J(".sf-menu li:first-child a").addClass("imgreplace");				
							   
        J(".sf-menu").supersubs({ 
            minWidth:    13,  
            maxWidth:    27,   
            extraWidth:  2   
                               
        }).superfish({
			autoArrows:    false, 
			dropShadows:   false
		}); 
		
		

			 
    }); 

// FancyBox

	J(function(){

				J.fn.getTitle = function() {
			var arr = J("a.fancybox");
			J.each(arr, function() {
				var title = J(this).children("img").attr("title");
				if (title == "") {title = J(this).attr("title")};
				J(this).attr('title',title);
			})
		}

		// Supported file extensions
		var thumbnails = 'a:has(img)[href$=".bmp"],a:has(img)[href$=".gif"],a:has(img)[href$=".jpg"],a:has(img)[href$=".jpeg"],a:has(img)[href$=".png"],a:has(img)[href$=".BMP"],a:has(img)[href$=".GIF"],a:has(img)[href$=".JPG"],a:has(img)[href$=".JPEG"],a:has(img)[href$=".PNG"]';

	
		J(thumbnails).addClass("fancybox").attr("rel","fancybox").getTitle();

		//J(thumbnails).addClass("fancybox").attr("rel","fancybox");

			J("a.fancybox").fancybox({
			'imageScale': true,
			'padding': 10,
			'zoomOpacity': true,
			'zoomSpeedIn': 500,
			'zoomSpeedOut': 500,
			'zoomSpeedChange': 300,
			'overlayShow': true,
			'overlayColor': "#666666",
			'overlayOpacity': 0.3,
			'enableEscapeButton': true,
			'showCloseButton': true,
			'hideOnOverlayClick': true,
			'hideOnContentClick': false,
			'frameWidth':  560,
			'frameHeight':  340,
			'callbackOnStart': null,
			'callbackOnShow': null,
			'callbackOnClose': null,
			'centerOnScroll': false,
			'title'			: this.title,
			'titlePosition'	:	'over'


		});
			
			
		J("a.more_info").fancybox({						   
				'hideOnContentClick': false,
				'autoDimensions' : true,
				'padding': 20
		});
		
		J("a.iframe").fancybox({
		'hideOnContentClick': false,
		'width'				: 660,
		'height'			: '75%',
        'autoScale'     	: false,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});
		
				J("li.iframe a").fancybox({
		'hideOnContentClick': false,
		'width'				: 660,
		'height'			: '75%',
        'autoScale'     	: false,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});
		

		//accordian
		
		J('div.accordionButton').click(function() {
		J('div.accordionContent').slideUp('normal');	
		J(this).next().slideDown('normal');
	});
		
		J("div.accordionContent").hide();
		
		J("#open").trigger('click');

		J('#event_details').load('/wp-content/themes/makeitmissoula/includes/event_details.php');
		J('#weather').load('/wp-content/themes/makeitmissoula/includes/weather_header.php');
		J('#weatherpage').load('/wp-content/themes/makeitmissoula/includes/weather_page.php');
		
		J('#more_info_content p:first').addClass('heading');
		
}); // end document ready
	

	 

