$(document).ready(function() {
		$('ul.sf-menu').superfish({
			delay:       800,                            // 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
		});
		
		
		// TOGGLE SCRIPT
		$(".hide").hide();
		
		$("a.read_more").click(function(event){
		//slideup or hide all the hide items
		$('.summary ul').slideUp(600);

		// expand the article
		$(this).parents(".summary").find(".hide").slideDown(600);
		// Stop the link click from doing its normal thing
		return false;
		}); // END TOGGLE


		// List hidden for 2009 ASX
		$(".hiddenlist09").hide();
		
		$("a.reveal09").click(function(event){
		//reveal
		$('.hiddenlist09').slideDown(600);

		// Stop the link click from doing its normal thing
		return false;
		}); // END TOGGLE
		
		
		$("a#vid_opener").fancybox({
		width: 340,
		height: 260,
		overlayOpacity: 0.7,
		overlayColor: '#000'
		});
		
		// full article toggle on residential homes
		$(".full-article").hide();
		
		$("a.revealFA").click(function(event){
		//reveal
		$('.full-article').slideDown(600);
		// hide itself
		$(".revealFA").hide();
		// Stop the link click from doing its normal thing
		return false;
		}); // END TOGGLE
		
		$("a.hideFA").click(function(event){
		//reveal
		$('.full-article').slideToggle(600);
		// show read more link
		$(".revealFA").show();
		// Stop the link click from doing its normal thing
		return false;
		}); // END TOGGLE
		
		
		$("#galleryThumbs a").fancybox({
						overlayOpacity: 0.7,
						overlayColor: '#000'
					});

		// slideshow functions
		
		$('.slideshow').cycle({
						timeout:       5000,
						pager:      '#pager_links',
						pagerClick: stopSlideshow
					});
		
		function stopSlideshow(){
		$('.slideshow').cycle('pause');
		}
		
		// hide preloaders
		$(".design_loader").hide();
		$(".cat_loader").hide();
		// global function
			
			function initAjaxLoaders() {
			
			
			
			// slide loader
			
			$('#thumb_nav li a').click(function(){
								  
				var toLoad = $(this).attr('href')+' #slide';
				$('#slide').fadeOut('fast',loadContent);
				$('.cat_loader').fadeIn('normal');
		
				function loadContent() {
					
					$('#slide').load(toLoad,'',showNewContent)
				}
				
				function showNewContent() {
					$('#slide').fadeIn('normal',hideLoader);
				}
				
				function hideLoader() {
					$('.cat_loader').fadeOut('fast');
					//
					initAjaxLoaders();
				}
				
				return false;
		
			});
			// end slide loader
			
			
			
			// old house loader
			/*
			$('.houseLoader a').click(function(){
				
				$('.slideshow').cycle('destroy');
							  
				var toLoad = $(this).attr('href')+' #house_slide';
				// scroll to top
				window.scrollTo(0, 0);
				//
				$('#house_slide').fadeOut('fast',loadContent);
				$('.design_loader').fadeIn('normal');
				
				function loadContent() {
					
					$('#house_slide').load(toLoad,'',showNewContent)
				}
				
				function showNewContent() {
					$('#house_slide').fadeIn('normal',hideLoader);
				}
				
				function hideLoader() {
					

					$('.design_loader').fadeOut('fast');
					//
					$('.slideshow').cycle({
						timeout:       5000,
						pager:      '#pager_links',
						pagerClick: stopSlideshow
					});
					
					// assign fancybox
					$("#galleryThumbs a").fancybox({
						overlayOpacity: 0.7,
						overlayColor: '#000'
					});
					
					//
					//initAjaxLoaders();
				}
				
				return false;
		
			});
			// end house loader
			*/
			
			
}
// end global function

// call global function to initilize the jquery/ajax slide loaders
initAjaxLoaders();

			
}); // end doc init
