 
						function slideSwitch() {
						var $active = $('.slideshow img.active');
						if ( $active.length == 0 ) $active = $('.slideshow img:last');
						var $next =  $active.next().length ? $active.next()
							: $('.slideshow img:first');
						$active.addClass('last-active');
					
						$next.css({opacity: 0.0})
							.addClass('active')
							.animate({opacity: 1.0}, 1000, function() {
								$active.removeClass('active last-active');
							});
												}	 //end of function slideswitch
	 	 
			$(function() {
			
				
					$('img.image1').data('ad-desc', '');
					$('img.image1').data('ad-title', '');
					$('img.image4').data('ad-desc', '');
					$('img.image5').data('ad-desc', 'n');
					var galleries = $('.ad-gallery').adGallery({
							slideshow: {
							enable: true,
							autostart: true,
							speed: 5000
							}}
					);
					$('#switch-effect').change(
					  function() {
						galleries[0].settings.effect = $(this).val();
						return false;
					  }
					);
					$('#toggle-slideshow').click(
					  function() {
						galleries[0].slideshow.toggle();
						return false;
					  }
					);
					$('#toggle-description').click(
					  function() {
						if(!galleries[0].settings.description_wrapper) {
						  galleries[0].settings.description_wrapper = $('#descriptions');
						} else {
						  galleries[0].settings.description_wrapper = false;
						}
						return false;
					}); //end of ad gallery
					 
					$(".smoothscroll").click(function(event){
						//prevent the default action for the click event
						event.preventDefault();
				
						//get the full url - like mysitecom/index.htm#home
						var full_url = this.href;
				
						//split the url by # and get the anchor target name - home in mysitecom/index.htm#home
						var parts = full_url.split("#");
						var trgt = parts[1];
				
						//get the top offset of the target anchor
						var target_offset = $("#"+trgt).offset();
						var target_top = target_offset.top;
				
						//goto that anchor by setting the body scroll top to anchor top
						$('html, body').animate({scrollTop:target_top}, 500);
					 }); // end of smooth scroll
						
					$('.processtip').hover(function(){
							var hit = $(this).find('.process-caption').height();
							hit += 25;
							$(this).find('.process-caption').fadeIn();
							$(this).find('.process-caption').stop(true, true).animate({top: "-"+hit});
									},function(){
									 $(this).find('.process-caption').fadeOut();
									 $(this).find('.process-caption').css({'top':'-250px'});
					 }); // end of processtip
					 					
					 $('#slider').nivoSlider({
								 effect:'fade'
						});
					
					 $( "#date" ).datepicker();
					 	
					setInterval( "slideSwitch()", 3500 ); // looping of slidew switch  		
					
					 $("#faq-content").jPaginate({items: 5, cookies: false});   // pagination for the FAQ 
					 
					 $("a[rel=gallery]").fancybox({
								'transitionIn'		: 'fade',
								'transitionOut'		: 'fade',
								'titlePosition' 	: 'over',
								'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
														return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
																												}
													});		   
			}); //end the main function here
	 

