jQuery(document).ready(function() {
	//When page loads...
	jQuery(".tab_content").hide(); //Hide all content
	jQuery("ul.tabs li:first").addClass("active").show(); //Activate first tab
	jQuery(".tab_content:first").show(); //Show first tab content

	//On Click Event
	jQuery("ul.tabs li").click(function() {

		jQuery("ul.tabs li").removeClass("active"); //Remove any "active" class
		jQuery(this).addClass("active"); //Add "active" class to selected tab
		jQuery(".tab_content").hide(); //Hide all tab content

		var activeTab = jQuery(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		jQuery(activeTab).fadeIn(); //Fade in the active ID content
		
		for( i in maps ){
			var latlng=maps[i].getCenter();
			
			google.maps.event.trigger(maps[i], 'resize');
			
			maps[i].setCenter(latlng);
		}
		
		return false;
	});
	
	//Internal links
	jQuery(".tablink").click(function() {

		jQuery("ul.tabs li").removeClass("active"); //Remove any "active" class
		jQuery(".tab_content").hide(); //Hide all tab content
		
		var activeLink = jQuery(this).attr("id").replace(/ex/, "");
		jQuery("#"+activeLink).addClass("active"); //Add "active" class to selected tab
		var activeTab = jQuery(this).attr("href"); //Find the href attribute value to identify the active tab + content
		jQuery(activeTab).fadeIn(); //Fade in the active ID content
		
		return false;
	});

});


// image fade slideshows
jQuery(document).ready(function() {
   jQuery('#slideshow ul').cycle({
		fx: 'fade',
		timeout: '7000',  // milliseconds between slide transitions (0 to disable auto advance)
		speed: '2000'  // speed of the transition (any valid fx speed value) 
	});
});

//table row zebra striping
jQuery(document).ready(function() {
	jQuery(".genTable tr:even").addClass("alt");
});

//table row zebra striping
jQuery(document).ready(function() {
	jQuery(".me-main tr:even").addClass("alt");
});

//table row zebra striping
jQuery(document).ready(function() {
	jQuery(".formTable tr:even").addClass("alt");
});

//testimonial row zebra striping
jQuery(document).ready(function() {
	jQuery("ul#testimonials li:even").addClass("even");
});

// tooltips
jQuery(document).ready(function() {
	jQuery('.tooltip a[href][title]').qtip({ content: { text: false }, style: 'green', position: {
      corner: {
         target: 'topMiddle',
         tooltip: 'bottomRight'
      }
   } });
});

// initiate fancybox pop-ups
// jQuery(document).ready(function() {
//		jQuery("a.photoBox").fancybox();	
// });

// tutorial accordian
jQuery(document).ready(function(){

	jQuery(".accordion h3:first").addClass("active");
	jQuery(".accordion div").hide();

	jQuery(".accordion h3").click(function(){

	  jQuery(this).next("div").slideToggle("slow")
	  .siblings("div:visible").slideUp("slow");
	  jQuery(this).toggleClass("active");
	  jQuery(this).siblings("h3").removeClass("active");

	});

});
