$(document).ready(function(){

	$('.genderSelect a, .ageSelect a').click(function() {
		var selector = $(this).attr('href').substr($(this).attr('href').indexOf('#')+1);

		$('.beforeafter_gallery').find('div.beforeafter_item').show();
		$('.genderSelect a, .ageSelect a').css('fontWeight', 'normal');
		
		if (selector.indexOf('All') < 0) {
			$('.beforeafter_gallery > div:not(.'+selector+')').hide();
			$(this).css('fontWeight', 'bold');
		}		
		
	});
	$('a.gsc-go').click(function() {$('#cse-search-box').submit(); return false;});
	
	try {
		$('input.gsc-input').inputclear();
	} catch(e) {}
	
	try {
		$('select[name*=CreditCardType] option[value*=Amex]').remove();
	} catch(e) {}

	$('li:has(a[href*=events]) ul').hide();
	$('#header_logo').click(function() {
		window.location = '/';
	});
	$('a[href*=fiber-calculator]').click(function() {
		window.open(this.href, 'FiberCalculator', 'menubar=0,width=900,height=700,status=0,toolbar=0,scrollbars=0,resizable=0');
		return false;
	});
	
	try {
		$('#products_home .learn_more').attr('href', $('#products_home .product_wrapper .carousel a:first').attr('href'));
		$('#products_home .product_wrapper .carousel').jCarouselLite({
			vertical: true,
			visible: 1,
			auto: 2500,
			speed: 1000,
			easing: "easeInOutBack",
			afterEnd: function(a) {
				$('#products_home .learn_more').attr('href', a.find('a').attr('href'));
			}
		});
	} catch(e) {}
	
});
