jQuery.preloadImages = function()
{
    for(var i = 0; i<arguments.length; i++)
    {
        jQuery("<img>").attr("src", arguments[i]);
    }
}
function slideSwitch() {
    var $active = $('#product-images IMG.active');

    if ( $active.length == 0 ) $active = $('#product-images IMG:last');

    var $next =  $active.next().length ? $active.next()
        : $('#product-images IMG:first');

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(document).ready(function(){
    // set all input.text default value according to alt attribute
    // $("input.text").each(function(){
    //         $(this).val($(this).attr("alt"));
    //     });
    
    $("#tlhho-tlhho").val($(this).attr("alt"));
    
    // clear input.text on focus, if still in default
    $("#tlhho-tlhho").focus(function() {
        if($(this).val()==$(this).attr("alt")) {
            $(this).val("");
        }
    });

    // if field is empty afterward, add text again
    $("#tlhho-tlhho").blur(function() {
        if($(this).val()=="") {
            $(this).val($(this).attr("alt"));
        }
    });
    
    $("#lookup_search").val($(this).attr("alt"));
    
    // clear input.text on focus, if still in default
    $("#lookup_search").focus(function() {
        if($(this).val()==$(this).attr("alt")) {
            $(this).val("");
        }
    });

});

