// JavaScript Document
$j=jQuery.noConflict();

$j(document).ready(function($) {
$('.round_corner').corner();

$('#header').css('height',$('#logo').height()+'px');

if($('#content').height() < $('#rightcol').height()){
	$('#main').css('height',$('#rightcol').height()+'px');
} else if(($('#ssDiv').height() > 0) && $('#rightcol').height() > 525){
	$('#main').css('height',$('#rightcol').height()+'px');
}
	

$("#ssDiv").carousel( {
	effect: "fade",
	direction: "vertical",
	loop: true,
	nextBtn: false,
	prevBtn: false,
	pagination: true,
	autoSlide: true,
    autoSlideInterval: 6000
	} );

$(".box_a").hover(function() { $(this).parent().find(".box_label").toggleClass("box_label_over") });
$(".message").corner("4px");
$(".gobox a").corner("4px");

$("#accent").parents("#main").css("margin","0 -60px");

changeColor = function(p,pc){
	$('#lrg_color h2').css('display','none');
	$('#color').attr("src",p+"_large.jpg");
	$('#color_link').attr("href",p+"_10.jpg");
	$("#color_button").css("display","block").html($("#color_button_label").text(pc));
}

$('.clink').click(function(){ 
	$('html, body').animate({ scrollTop: $('#lrg_color').offset().top }, 500);
	$('.zoom').css('display','none');
	$('.zoom', this).toggle();
	});

$('.slink').click(function(){ 
	$('.zoom').css('display','none');
	$('.zoom', this).toggle();
	});


var $floatingbox = $('.join');

if ($('#content').length > 0) {

	var bodyY = parseInt($('#content').offset().top) - 20;
	var originalX = parseInt($('#content').offset().left);
	
	  $(window).scroll(function () { 
	  
		var scrollY = $(window).scrollTop();
		var isfixed = $floatingbox.css('position') == 'fixed';
		
		if ($floatingbox.length > 0) {
		
		  if ( scrollY > bodyY && !isfixed ) {
			$floatingbox.stop().css({
			position: 'fixed',
			right:originalX,
			top: 10
			});
			} else if ( scrollY < bodyY && isfixed ) {
			$floatingbox.css({
			position: 'absolute',
			right: 0,
			top: 0
			});
		  }		
		}
	  });
}

});//ready

catoggle = function(w){
	if(document.getElementById(w)){
		document.getElementById('tab_c').className = '';
		document.getElementById('tab_a').className = '';
		document.getElementById(w).className = 'current';
		document.getElementById('tab_c_content').style.display = 'none';
		document.getElementById('tab_a_content').style.display = 'none';
		document.getElementById(w+'_content').style.display = 'block';
	}
}

