var azs04 = { params: params, coreimg: 'images/azscroll04/', xmlsrc: 'azscroll04_loader.php', loading1: 'images/azscroll04/ajax_loader.gif', imgpath: null, noimage: 'noimage.gif', view: 0, // 0:new_products, 1:specials, 2:featured dimension: ['',120], // width | height dimension2: new Array(), // temp var (just leave unset) scaleby: 20, sortby: 'latest', sort_order: 'desc', limitstart: 0, limit: 5, total: 0 }; var azs04_desc = false; var azs04_data = new Array(); function azs04_loadItem(gallery, state) { azs04.limitstart = gallery.first-1; var data_params = azs04.params+"&task=showproducts&view="+azs04.view+"&sort="+azs04.sortby+"&sortorder="+azs04.sort_order+"&limitstart="+azs04.limitstart+"&limit="+azs04.limit; // Check if the requested items already exist if (gallery.has(gallery.first, gallery.last)) { return; } jQuery.ajax({ url: azs04.xmlsrc, type: "get", dataType: "xml", data: data_params, error: function(){ $(".azscroll04-container").prepend($azs04_label['ERROR1']); }, success: function(xml){ azs04_addItem(gallery, gallery.first, gallery.last, xml); } }); }; function azs04_addItem(gallery, first, last, xml) { var gal = $(xml).find("gallery"); azs04_data = new Array(); azs04.limitstart = gal.attr("limitstart"); azs04.total = gal.attr("total"); azs04.imgpath = gal.attr("path"); gallery.size(parseInt(azs04.total)); $("product", xml).each(function(i){ azs04_data[i] = new Array(); azs04_data[i]['id'] = $("id", this).text() ? $("id", this).text() : 0; azs04_data[i]['title'] = $("title", this).text() ? $("title", this).text() : null; azs04_data[i]['image'] = $("image", this).text() ? $("image", this).text() : azs04.noimage; azs04_data[i]['price'] = $("price", this).text() ? $("price", this).text() : 0; azs04_data[i]['sprice'] = $("sprice", this).text() ? $("sprice", this).text() : 0; gallery.add(first + i, azs04_getItemHTML(azs04_data[i], i)); }); jQuery('div.azs04_pbox').hover( function () { $(this).addClass('selected') $('.azs04_button2',this).css({'display':'inline'}) $('.azs04_button',this).css({'display':'none'}) if(azs04.dimension[0]){ $('img', this).width(parseInt(azs04.dimension[0]+azs04.scaleby)+'px').height('auto') }else{ $('img', this).width('auto').height(parseInt(azs04.dimension[1]+azs04.scaleby)+'px') } }, function () { $(this).removeClass('selected') $('.azs04_button',this).css({'display':'inline'}) $('.azs04_button2',this).css({'display':'none'}) if(azs04.dimension[0]){ $('img', this).width(azs04.dimension[0]+'px').height('auto') }else{ $('img', this).width('auto').height(azs04.dimension[1]+'px') } } ); if(azs04.total < azs04.limit){ $('.azscroll04-item-temp').css({'background' : 'none'}) } }; function azs04_getItemHTML(data, id) { var imgpath = data['image']; imgDimension = azs04_desc ? (azs04.dimension[0] ? 'width="'+parseInt(azs04.dimension[0]+azs04.scaleby)+'" ' : '') + (azs04.dimension[1] ? 'height="'+parseInt(azs04.dimension[1]+azs04.scaleby)+'" ' : '') : (azs04.dimension[0] ? 'width="'+azs04.dimension[0]+'" ' : '') + (azs04.dimension[1] ? 'height="'+azs04.dimension[1]+'" ' : ''); ptitle = data['title'].length > 10 ? data['title'].substr(0,9)+'...' : data['title']; buttonText = azs04_desc ? $azs04_label['BACK'] : $azs04_label['MORE'] ; var html = '
'; return html; }; function azs04_getDescriptionHTML(id) { var html = '