/* Call on Document load */

$.noConflict();
jQuery(document).ready(function($) {
    effects();
    item_slider();
    slideshow();
    tabbing();
    lightbox();
    christmas();
});

/* Effect Functions */

function effects() {
    jQuery(".more_info").hide();
    jQuery(".more_link a").click(function() {
	jQuery(".more_info").toggle("slow");
    });
    jQuery('#topmenu ul li:last-child').css('border-right', 'none');
}

function item_slider() {
    jQuery("#news_slider").carouFredSel({
	items: 1,
	scroll: {
	    duration: 600
	},
	auto : true,
	prev : {	
	    button	: "#prev",
	    key		: "left"
	},
	next : { 
	    button	: "#next",
	    key		: "right"
	}
    });
}

function slideshow() {
jQuery('#slideshow').cycle({ 
    fx: 'fade', 
    speed:  2500, 
    timeout: 5000, 
    pager:  null
 });	
}

function tabbing() {
    //When page loads...
	jQuery(".tab_content").hide(); //Hide all content
	jQuery("ul.tabs li:nth-child(2)").addClass("active").show(); //Activate first tab
	jQuery(".tab_content:nth-child(2)").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
		return false;
    });
}

function lightbox() {
jQuery("a[rel^='prettyPhoto']").prettyPhoto({theme:'light_rounded'});
}

function christmas() {
	
	if(jQuery(".christmas_overlay").length > 0) {
		
		jQuery(".christmas_overlay").bPopup();
    
	}
	
}
