function navigate(choice) {
    var url = choice.options[choice.selectedIndex].value;
    if (url) {
        location.href = url;
    }
}
$.fn.delay = function(time, callback){
    // Empty function:
    jQuery.fx.step.delay = function(){};
    // Return meaningless animation, (will be added to queue)
    return this.animate({delay:1}, time, callback);
}
$(function() {
    $('td pre code').each(function() {
        eval($(this).text());
    });
});
function onAfter(curr, next, opts) {
    var index = opts.currSlide;
    $('#prev')[index == 0 ? 'hide' : 'show']();
    $('#next')[index == opts.slideCount - 1 ? 'hide' : 'show']();
}
function imgSwap(imgIndex, newText, bigImgLink) {
	document.getElementById("bigImg").src = imgIndex;
	document.getElementById("image-color").innerHTML = newText;
	document.getElementById("bigImg-link").href = bigImgLink;
	return false;
}

$(document).ready(function() {
	$('#zoom-btn').hover(function() {
		$('#zoom-img').fadeIn();
	}, function() {
		$('#zoom-img').fadeOut();
	});
	$('#cust-serv ul ul').css({display: "none"});
	$("#cust-serv li a").click(function () {
		$(this).siblings('ul').slideToggle("slow");
		return false;
	});
	$('#show').hide();
	$('#hide').click(function () {		
		$('h1#logo').animate({'opacity':'0'}, 200);
		$('#nav').delay(200).animate({'opacity':'0'}, 200);
		$('#main, #features, #content').delay(400).animate({'opacity':'0'}, 200);
		$(this).hide();
		$('#show').show();
		$('#features img').delay(600).hide();
	});
	$('#show').click(function () {
		$('h1#logo').animate({'opacity':'1'}, 200);
		$('#nav').delay(200).animate({'opacity':'1'}, 200);
		$('#main, #features, #content').delay(400).animate({'opacity':'1'}, 200);
		$(this).hide();
		$('#hide').show();
		$('#features img').delay(600).show();
	});
	
	$('#add_to_bag_btn').hide();
	$('#option-picker').change(function(){
	    if ($(this).val()) {
	        $('#add_to_bag_btn').attr('disabled', '');
			$('#add_to_bag_btn').show();
	    } else {
	        $('#add_to_bag_btn').attr('disabled', 'disabled');
			$('#add_to_bag_btn').hide();
	    }
	}).change();
});
