jQuery(document).ready(function($){
    $('.lightbox-link').fancybox();
	$('.fancybox').fancybox();
    $('#contactus-form').validate();
    
    $('#storeSelection').change(function(){
        var num = $(this).val();
        if (num != '') {
            window.location = '/index.php?task=store_locations&num='+num;
        }
    });
    $('#readMoreBtn').click(function(){
        if ($(this).find('img').attr('id') == 'readMore') {
            $(this).html('<img src="/images/btn_readless.gif" id="readLess" />');
            $('#introContent').hide();
            $('#fullContent').show();
        } else {
            $(this).html('<img src="/images/bg-read-more.gif" id="readMore" />');
            $('#fullContent').hide();
            $('#introContent').show();
        }
    });
    $('.video-holder').find('iframe').attr( {width: '355', height: '230'})
    $('.add').click(function() {
        var container = $(this);
        $.post($(this).attr('href'), function(data){
            //replace with style
            $(container).removeClass('add');
            $(container).removeClass('tTip');
            $(container).unbind('mouseenter').unbind('mouseleave');
            $(container).addClass('inWishlist');
            $('.tinyTip').hide();
            $('#wishlist-quantity').html(" - "+data+" items");
            Cufon.replace('.header-bar dl', { fontFamily: 'Eurostile Bold', hover: true });
        });
        return false;
    });
    $('a.tTip').tinyTips('Keep a list of your products of interest. You can email with your enquiry to a showroom later.');
    $('.removeWishlist').click(function(){
        $(this).parent().parent().fadeOut('slow');
        $.post($(this).attr('href'), function(data){
            $('#wishlist-quantity').html(" - "+data+" items");
            Cufon.replace('.header-bar dl', { fontFamily: 'Eurostile Bold', hover: true });
        });
        return false;
    });
});

