$(document).ready(function() {
    $('textarea.expanding').autogrow();
    $('a.enlarge').lightBox();
    $('.slide-specials .slide').removeClass('hide');
    $('.slide-specials').before('<div id="slide-nav" class="slide-nav">').cycle({
        fx:     'fade',
        speed:   1000,
        timeout: 3000,
        pager:  '#slide-nav'
    });
    _equal_height($('.content-side, .content-main'));

    $('.password-clear').show();
    $('.password-password').hide();
    $('.password-clear').focus(function() {

        var target_id = $(this).attr('rel');

        $(this).hide();
        $('#'+target_id+'.password-password').show();
        $('#'+target_id+'.password-password').focus();
    });

    $('.password-password').blur(function() {

        var target_id = $(this).attr('id');

        if ($(this).val() == '') {

            $('input[rel='+target_id+']').show();
            $(this).hide();
        }
    });

    $('.product-details .tabs a').click(function(e){
        e.preventDefault();

        var target_tab = $(this).attr('rel');
        var this_tab   = ( target_tab == 'this_gender' ) ? 'other_gender' : 'this_gender';

        $('#'+this_tab).hide();
        $('#'+target_tab).show();

        _equal_height($('.content-side, .content-main'));
    })
});

function _equal_height(el) {

    var max_height = 0;

    el.each(function() {

		var this_height = $(this).height();

		if( this_height > max_height) {

		    max_height = this_height;
		}
	});

	el.height(max_height);
}
