//Cleartype


//Toggle

$(document).ready(function(){

	$(".toggle_container").hide();

	$("h1.trigger").toggle(function(){
		$(this).addClass("active"); 
		}, function () {
		$(this).removeClass("active");
	});
	
	$("h1.trigger").click(function(){
		$(this).next(".toggle_container").slideToggle("normal");
	});
	
//Tabs

	$(".tab_content").hide();
	$("ul.tabs li:first").addClass("active").show();
	$(".tab_content:first").fadeIn("slow");
	$("ul.tabs li").click(function() {
		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn("slow"); 
        return false;

});

	$(".tab_content2").hide(); //Hide all content
	$("ul.tabs2 li:first").addClass("active").show(); //Activate first tab
	$(".tab_content2:first").fadeIn("slow");
	$("ul.tabs2 li").click(function() {
		$("ul.tabs2 li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content2").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn("slow"); //Fade in the active content
		return false;
	});
	
});  

//Slideshow

$(document).ready(function() {

$('#s1').cycle({ 
    fx:     'fade', 
    speed:  'slow', 
    timeout: 0, 
    next:   '#next1', 
    prev:   '#prev1', 
    timeout: 4000,
	delay: 0
});

$('#s2').cycle({ 
    fx:     'fade', 
    speed:  'slow', 
    timeout: 0, 
    next:   '#next2', 
    prev:   '#prev2', 
    timeout: 4000,
	delay: 2000
});

$('#s3').cycle({ 
    fx:     'fade', 
    speed:  'slow', 
    timeout: 0, 
    next:   '#next3', 
    prev:   '#prev3', 
    timeout: 4000,
	delay: 4000
});

});

// Grayscale Hover

$(document).ready(function() {

	$(".pics a").hover(function() { //On hover...

		var thumbOver = $(this).find("img").attr("src"); //Get image url and assign it to 'thumbOver'

		//Set a background image(thumbOver) on the <a> tag - Set position to bottom
		$(this).addClass(".thumb").css({'background' : 'url(' + thumbOver + ') no-repeat center bottom'});

		//Animate the image to 0 opacity (fade it out)
		$(this).find("span").stop().fadeTo('normal', 0 , function() {
			$(this).hide() //Hide the image after fade
		});
	} , function() { //on hover out...
		//Fade the image to full opacity 
		$(this).find("span").stop().fadeTo('normal', 1).show();
	});

});

// Colorbox

$(document).ready(function(){
	$("a[rel='cb1']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb2']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb3']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb4']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb5']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb6']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb7']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb8']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb9']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb10']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb11']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb12']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb13']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb14']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb15']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb16']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb17']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb18']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb19']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb20']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb21']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb22']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb23']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb24']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb25']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb26']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb27']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb28']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb29']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb30']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb31']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb32']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb33']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb34']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb35']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
	$("a[rel='cb36']").colorbox({transition:"fade", speed: "normal", opacity: 0.50 });
});

// Scroll

	$(document).ready(function(){
	    $(".scroll").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}, 800);
	    });
	});
	

