
	var search_string = 'Search Site';
	var slideShowOn = true;
	var slideShowAutoStop = true;
	var slideShowSpeed = 1000;
	var slideShowDelay = 5000;
	var allImages = 0;
	  
	function nextSlide(){
		var slideIn = 2; 
		var slideOut = 1;
		
		if($('#nav .active').length > 0){
			slideOut = slideIn = $('#nav .active').attr('rel'); 
			slideIn++;
			if(slideIn > allImages){
				slideIn = 1;
			}
		}
		$('#slide-' + slideIn).fadeIn(slideShowSpeed);
		$('#slide-' + slideOut).fadeOut(slideShowSpeed);
		$('#image-nav-' + slideIn).addClass('active');
		$('#image-nav-' + slideOut).removeClass('active');
	}
	
	function prevSlide(){
		var slideIn = allImages;
		var slideOut = 1;
		
		if($('#nav .active').length > 0){
			slideOut = slideIn = $('#nav .active').attr('rel'); 
			slideIn--;
			if(slideIn < 1){
				slideIn = allImages;
			}
		}
		$('#slide-' + slideIn).fadeIn(slideShowSpeed);
		$('#slide-' + slideOut).fadeOut(slideShowSpeed);
		$('#image-nav-' + slideIn).addClass('active');
		$('#image-nav-' + slideOut).removeClass('active');
	}
	  
	function slideShowPlay(){
		if(slideShowOn){
			nextSlide();
			setTimeout(slideShowPlay, slideShowDelay);
		}
	}
	  
	$(document).ready(function() {
		
		//quick links start
		$('#header .right h2').mouseover(function(){
			$('#header .right ul.menu').css('display','block');
		});
		
		$('#header .right h2').mouseout(function(){
			$('#header .right ul.menu').css('display','none');
		});
		
		$('#header .right ul.menu').mouseover(function(){
			$(this).css('display','block');
		});
			  
		$('#header .right ul.menu').mouseout(function(){
			$(this).css('display','none');
		});
		//quick links end
		
		//search box start
	  	$('#edit-search-block-form-1').val(search_string);
		$('#edit-search-block-form-1').click(function(){
			if($(this).val() == search_string){
				$(this).val('');
			}
		});
		
		$('#edit-search-block-form-1').blur(function(){
			if($(this).val().replace(/\s+/g,'').length == 0){
				$(this).val(search_string);
			}
		});
		//seach box end
		
		//main nav start
		$('#block-nice_menus-1 li a').mouseover(function(){
			$(this).css('color', '#6dc068');
		});
		
		$('#block-nice_menus-1 li a').mouseout(function(){
			$(this).css('color', '#ffffff');
		});
		
		$('#block-nice_menus-1 li.menuparent ul li a').mouseover(function(){
			$(this).css('color', '#00346f');
		});
		
		$('#block-nice_menus-1 li.menuparent ul li a').mouseout(function(){
			$(this).css('color', '#ffffff');
		});

	  	$('#block-nice_menus-1 li.menuparent ul').each(function(){
			$(this).css('position','absolute');
			$(this).css('top','43px');
		});

                $('#block-nice_menus-1 li.menuparent ul li.menuparent ul li').css('background-color','#59b356');

                $('#block-nice_menus-1 li.menuparent ul li.menuparent ul').hover(
			function(){
				$(this).parent().children('a').css('color', '#00346f');
			},
			function(){
                                $(this).parent().children('a').css('color', '#ffffff');
			}
		);


                $('#block-nice_menus-1 > li.menuparent > ul').each(function(){
			$(this).mouseover(function(){
				$(this).parent().children('a').css('color', '#6dc068');
			});

			$(this).mouseout(function(){
				$(this).parent().children('a').css('color', '#ffffff');
			});
		});
		//main nav end
		
		//images slide show start
		allImages = $('span.image-slide img').size();//count all slides
		
		var navLabel = 1;
		var html = '';
		var linkClass = '';
		var linkURL = '';
		
		if(allImages > 1){
			//create nav numbers start
			$('span.image-slide').each(function(){
				if(linkURL != ''){
					$(this).attr('id', 'slide-' + navLabel);
					if(navLabel == 1){
						linkClass = ' first';
					}
					else if(navLabel == allImages){
						linkClass = ' last';
					}
					else{
						linkClass = '';
					}
					html += '<a href="" onclick="return false;" class="nav' + linkClass +'" id="image-nav-' + navLabel + '" rel="' + navLabel + '">' + navLabel + '</a>';
					
					//$(this).children('img').bind('onclick','alert(1); window.location = \''+linkURL+'\'');
					
					$(this).children('img').attr('rel',linkURL);
					$(this).children('img').css('cursor','pointer');
					$(this).children('img').click(function(){
						window.location = $(this).attr('rel');
					});
					
					++navLabel;
					linkURL = '';
				}
				else{
					linkURL = $(this).children('div.callout-link').html();
				}
			});
			
			$('#nav').html(html);
			//create nav numbers end
			
			$('#slide-1').fadeIn('slow');	//show first slide
			$('#image-nav-1').addClass('active');	//make first nav number active
		
			//nav numbers handling start
			$('a.nav').click(function(){
				$('a.nav').each(function(){
					$(this).removeClass('active');
				});
				$(this).addClass('active');
				$('#callouts .body div .content span').each(function(){
					$(this).fadeOut('slow');
				});
				$('#slide-' + $(this).attr("rel")).fadeIn('slow');
				if(slideShowAutoStop){
					slideShowOn = false
				}
			});
			//nav numbers handling end
			
			//nav next handling start
			$('#next').click(function(){
				nextSlide();
				if(slideShowAutoStop){
					slideShowOn = false
				}
			});
			//nav next handling end
			
			//nav prev handling start
			$('#prev').click(function(){
				prevSlide();
				if(slideShowAutoStop){
					slideShowOn = false
				}
			});
			//nav prev handling end
			
			setTimeout(slideShowPlay, slideShowDelay);//start lide show
		}
		else if(allImages == 1){
			$('span.image-slide').fadeIn('slow');	//show first slide
		}
		//images slide show end
      }); 

