function switchImage(hash, type, count) {
    var myajax = new Ajax.Request('/ajax/product/'+hash, {
      method: 'get',
      onComplete: function(response) {
        var data = response.responseText;
        Object.toJSON(data);
        data = data.evalJSON();
        $('tile_title').update(data.name);
        var dimensions = '';
        if(data.width == '' || data.height == '') {
            dimensions = '';
        } else {
            dimensions = data.width+'" x '+data.height+'"';
        }
        $('tile_dimensions').update(dimensions);
        var large_url = '';
        var image = '/images/products/1_'+hash+'_200x200.'+type;
        $('tile_image').src = image;
        var image_link = '/images/products/1_'+hash+'_500x500.'+type;
        $('large_link').href = image_link;
        if(count == 1) {
            large_url += '<a rel="lightbox" href="/images/products/1_'+hash+'_500x500.'+type+'">view larger image(s)</a>';
        } else {
            for(i=2;i<=count;i++) {
                if(i == 2) {
                    large_url += '<a rel="lightbox[large]" href="/images/products/'+i+'_'+hash+'_500x500.'+type+'">view larger image(s)</a><br />';
                } else {
                    large_url += '<a class="hidden" rel="lightbox[large]" href="/images/products/'+i+'_'+hash+'_500x500.'+type+'"></a><br />';
                }
            }
        }
        $('tile_larger').update(large_url);
      }
    });
}