$(document).ready(function() {
    $(this).run();
});

jQuery.fn.run = function() {

    var context = this;
    
    if ($.browser.msie/* && $.browser.version <= 6*/) {
        $('.text-shadow').textShadow();
    }
    
    $.ifixpng('/img/blank.gif');
    $('*', this).ifixpng();
    
    $('.focus-blur', context).each(function() {
        var t = $(this).val();
        $(this).bind('focus', function() {
            if ($(this).val() == t) {
                $(this).val('');
            }
        });
        $(this).bind('blur', function() {
            if ($(this).val() == '') {
                $(this).val(t);
            }
        });
    });
    
    $('.form-submit', context).click(function() {
        $(this).parents('form').submit();
        return false;
    });
    
    $('a[href$=.jpg],a[href$=.png],a[href$=.gif]', context).has('img').each(function() {
        //if (!$(this).attr('title')) {
        //    $(this).attr('title', $(this).attr('href').split('/').pop());
        //}
        $(this).fancybox({'titlePosition':'inside','overlayShow':true,'centerOnScroll':true});
    });
    
    if (LANG == 'ch') {
        Cufon.replace('.cufon');
    }
    else {
        Cufon.replace('.cufon, .h1, h1');
    }
    
    $('#price .scrollable', context).each(function() {
        var size = Math.floor($(this).outerHeight(true) / $('> ul > li', this).outerHeight(true));
        var speed = 500;
        $(this).scrollable({'size':size,'items':'ul','speed':speed,'clickable':false,'vertical':true,'hoverClass':'hover','activeClass':'active'});
        if ($('> ul > li', this).size() > 1) {
            $(this).circular();
            $(this).autoscroll();
        }
    });

    return this;


};

