// JavaScript Document


<!-- We only want the thunbnails to display when javascript is disabled -->
document.write("<style type='text/css'>.noscript { display: none; }</style>");


/*    function showHeight(ele, h) {
      $("#size").text("The height for the " + ele + 
                    " is " + h + "px.");
    }*/
	
	jQuery.event.add(window, "load", resizeFrame);
	jQuery.event.add(window, "resize", resizeFrame);

	function resizeFrame() 
{
    //$(document).ready(function () { 
      //showHeight("window", $(window).height()); 
	  var newheight = $(window).height()-380; 
	   scrollpane = newheight+0; 
	  		
	  $("#content-pane").css("height", newheight+'px');
	  
	  $(".scroll-pane").css("height", newheight+'px');

	  $(".jScrollPaneContainer").css("height", newheight+'px');
	  /*$(".jScrollPaneContainer").css("background-color", '#CCC');*/
	  $(".jScrollPaneScrollable").css("height", newheight+'px');
	  $(".jScrollPaneTrack").css("height", scrollpane+'px');
	 /* $(" .jScrollPaneDrag").css("height", '60px');*/
	  
	/*  $("#size").text("The height for the window is "  + $(window).height() + "px. The new container should be " + newheight + "px. The pane container is " + scrollpane);	*/
	  
	  $('#content-pane').jScrollPane(
	  		{
			showArrows: true
			}

	  );	
 
    }/*);
	}*/
	
	

$(document).ready(function()
			{
				// this initialises the scrollpanes on the page.
				//$('#content-pane').jScrollPane(showArrows: true,topCapHeight: 30
				//);
			});

$(document).ready(function() {
	$('.clearField').clearField();
});


$(document).ready(function() {
						
	jQuery.event.add(window, "load", resizeFrame);
	jQuery.event.add(window, "resize", resizeFrame);
	
	function resizeFrame() 
	{
		var h = $(window).height();
		if (h < 690) {
		//$(".content").css('margin-top','-130px');
		$("#phone-number-container").css('margin-top','0px');
		$("#sidebar").css('top','140px');
		$("#sidebar-homepage").css('top','140px');
		$("h1").css('width','350px');
		
		}
		if (h < 720 && h > 690) {
		//$(".content").css('margin-top','-90px');
		$("#sidebar").css('top','163px');
		$("#sidebar-homepage").css('top','163px');
		$("h1").css('width','350px');
		}
		if (h > 720) {
		//$(".content").css('margin-top','0px');
		$("#phone-number-container").css('margin-top','15px');
		$("#sidebar").css('top','233px');
		$("#sidebar-homepage").css('top','230px');
		$("h1").css('width','600px');
		}
		//alert(h);
	}

	/*$(window).live(ready(function () {
		browser_height = $(window).height();
		alert(browser_height);
	});*/
});


$(document).ready(function()
			{
				//Footer navigation highlighting--remove parent background when hovering over child nav list
				$("#nav li ul").hover(function(){
				$(this).parent().removeClass("parent");
				}).mouseleave(function(){
     			 $(this).parent().addClass("parent");
    			});
				
				
			});




jQuery(document).ready(function($) { 
			 
				$("a.single_image").fancybox();
				
				$("a.group_image").fancybox();
				
				$("a.iframe").fancybox({
					'padding'	:	5,
					'margin'	:	5,
					'scrolling'	:	'no',
					'width'		:	650,
					'height'	:	505

				
				
				});

				
				
				// We only want these styles applied when javascript is enabled
				$('div.navigation').css({'width' : '500px', 'float' : 'right'});
				$('div.content').css('display', 'block');
				
				//$('.thumb').css('display', 'none');

				// Initially set opacity on thumbs and add
				// additional styling for hover effect on thumbs
				var onMouseOutOpacity = 0.6;
				$('#thumbs ul.thumbs li, div.navigation a.pageLink').opacityrollover({
					mouseOutOpacity:   onMouseOutOpacity,
					mouseOverOpacity:  1.0,
					fadeSpeed:         'fast',
					exemptionSelector: '.selected'
				});
				
				// Initialize Advanced Galleriffic Gallery
				var gallery = $('#thumbs').galleriffic({
					delay:                     2500,
					numThumbs:                 10,
					preloadAhead:              10,
					enableTopPager:            true,
					enableBottomPager:        false,
					maxPagesToShow:            7,
					imageContainerSel:         '#slideshow',
					controlsContainerSel:      '#controls',
					captionContainerSel:       '#caption',
					loadingContainerSel:       '#loading',
					renderSSControls:          true,
					renderNavControls:         false,
					playLinkText:              '',
					pauseLinkText:             'Pause Slideshow',
					prevLinkText:              '&lsaquo; Prev',
					nextLinkText:              'Next &rsaquo;',
					nextPageLinkText:          'Next &rsaquo;',
					prevPageLinkText:          '&lsaquo; Prev',
					enableHistory:             false,
					autoStart:                 false,
					syncTransitions:           true,
					defaultTransitionDuration: 900,
					onSlideChange:             function(prevIndex, nextIndex) {
						// 'this' refers to the gallery, which is an extension of $('#thumbs')
						this.find('ul.thumbs').children()
							.eq(prevIndex).fadeTo('fast', onMouseOutOpacity).end()
							.eq(nextIndex).fadeTo('fast', 1.0);
					},
					onPageTransitionOut:       function(callback) {
						this.fadeTo('fast', 0.0, callback);
					},
					onPageTransitionIn:        function() {
					
					//var prevPageLink = this.find('a.prev').css('visibility', 'hidden');
						//var nextPageLink = this.find('a.next').css('visibility', 'hidden');
						
						var prevPageLink = this.find('a.prev').css('display', 'none');
						var nextPageLink = this.find('a.next').css('display', 'none');
						
						// Show appropriate next / prev page links
						if (this.displayedPage > 0)
							prevPageLink.css('visibility', 'visible');

						var lastPage = this.getNumPages() - 1;
						if (this.displayedPage < lastPage)
							nextPageLink.css('visibility', 'visible');
							
						this.fadeTo('fast', 1.0);
					}
					
				});
				
				/**************** Event handlers for custom next / prev page links **********************/

				gallery.find('a.prev').click(function(e) {
					gallery.previousPage();
					e.preventDefault();
				});

				gallery.find('a.next').click(function(e) {
					gallery.nextPage();
					e.preventDefault();
				});
				
				/*$('#slide-overlay').click(function(e) {
					//alert('creeper');
					//gallery.nextPage();
					e.preventDefault();
				});*/

				/****************************************************************************************/
			});


jQuery(document).ready(function($) { 
			
				$("a.single_image").fancybox();

				$("a.iframe").fancybox({
					'padding'	:	5,
					'margin'	:	5,
					'scrolling'	:	'no',
					'width'		:	650,
					'height'	:	505

				
				
				});
				
				
			});
