// Open .pdf, external links, and links with the class _blank into a new window
jQuery(function(){
	jQuery("._blank").click(function(){
		var newwindow = window.open(this.href, '_blank');
		newwindow.focus();
		return false;
	});
});
// Required for Carousel
function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

jQuery(document).ready(function() {
	// PNG Fix
 	jQuery('#container').pngFix();
	// Superfish Drop Downs
	jQuery("ul.sf-menu").superfish(); 
	// Carousel CTA
    jQuery('#mycarousel').jcarousel({
        auto: 8,
		scroll: 1,
        wrap: 'last',
        initCallback: mycarousel_initCallback
    });
	// Site map accordion
	jQuery('#site-map').accordion({
		header: 'div.title',
		active: false,
		alwaysOpen: false,
		animated: false,
		autoheight: false
	});
	// bind to change event of select to control first and seconds accordion
	// similar to tab's plugin triggerTab(), without an extra method
	var accordions = jQuery('#site-map');
		
	jQuery('#switch select').change(function() {
		accordions.accordion("activate", this.selectedIndex-1 );
	});
	jQuery('#close').click(function() {
		accordions.accordion("activate", -1);
	});
	jQuery('#switch2').change(function() {
		accordions.accordion("activate", this.value);
	});
	jQuery('#enable').click(function() {
		accordions.accordion("enable");
	});
	jQuery('#disable').click(function() {
		accordions.accordion("disable");
	});
	jQuery('#remove').click(function() {
		accordions.accordion("destroy");
		wizardButtons.unbind("click");
	});
}); 
 
// Email to a friend
 function mailpage()
{
mail_str = "mailto:?subject=Check out " + document.title;
mail_str += "&body=I thought you might be interested in the " + document.title;
mail_str += ". You can view it at, " + location.href;
location.href = mail_str;
}