function getRecArray() { var recArray=new Array(); recArray[0]= new recItem(20206709,20468838,'Beautiful Bridal Jewelry','http://img2.timeinc.net/instyle/images/2008/weddings/061008_jew5_sp08_75x75.jpg','Summer Weddings - Jewelry'); recArray[1]= new recItem(20204423,20468755,'Summer Accessories','http://img2.timeinc.net/instyle/images/2008/weddings/061008_acc11_sp08_75x75.jpg','Summer Weddings - Accessories'); recArray[2]= new recItem(20179080,20410966,'Veil Call','http://img2.timeinc.net/instyle/images/2008/weddings/022608_veil18_75x75.jpg','tai mazza veil'); recArray[3]= new recItem(20164631,20378228,'Hot Shoes','http://img2.timeinc.net/instyle/images/2007/wedding/fall06/shoes/fall06_shoes_75x75.jpg','glittery sandals'); recArray[4]= new recItem(20166517,20382005,'Simple, Chic Shoes','http://img2.timeinc.net/instyle/images/2007/wedding/fall05/shoes/fall05_shoes_75x75.jpg','silk slingbacks'); recArray[5]= new recItem(20166605,20382167,'Pastel Bridal Shoes','http://img2.timeinc.net/instyle/images/2008/weddings/touts/011108_pastelshoes_75x75.jpg','silk satin sandals'); recArray[6]= new recItem(20166618,20382170,'Soles to Suit Every Bride','http://img2.timeinc.net/instyle/images/2008/weddings/touts/011108_solestosuit_75x75.jpg','lace-and-mesh pumps'); recArray[7]= new recItem(20166619,20382154,'Bridal Shoes with Bows','http://img2.timeinc.net/instyle/images/2008/weddings/touts/011108_withbows_75x75.jpg','satin pumps with kitten heel'); recArray[8]= new recItem(20166620,20382166,'Dazzling Dream Day Shoes','http://img2.timeinc.net/instyle/images/2008/weddings/touts/011108_dazzlingdream_75x75.jpg','silk slides with crystals'); recArray[9]= new recItem(20166622,20382152,'Pretty Pink Bridal Shoes','http://img2.timeinc.net/instyle/images/2008/weddings/touts/011108_prettypink_75x75.jpg','silk satin slingbacks'); recArray[10]= new recItem(20165310,20379492,'Pearl Accessories','http://img2.timeinc.net/instyle/images/2007/wedding/fall06/jewelry/fall06_pearls_75x75.jpg','white cultured South Sea pearl earrings'); recArray[11]= new recItem(20165499,20379841,'The Perfect Purse','http://img2.timeinc.net/instyle/images/2007/wedding/winter06/accessories/winter06_acc3_75x75.jpg','beaded clutch'); return recArray; } function recItem (id,lastSlideID,title,image_src,alt) { this.id = id; this.lastSlideID = lastSlideID; this.title = title; this.image_src = image_src; this.alt = alt; this.getLink = function() { var str = '/weddings/gallery/1,,' + this.id + ',00.html' return str; } this.getLastSlideLink = function() { var str = '/weddings/gallery/1,,' + this.id + '_' + this.lastSlideID + ',00.html' return str; } this.renderDisplay = function(classtxt) { var disp = ''; if (classtxt.indexOf('current') == -1) { disp = '

' + this.title + '

' } else { disp = '

' + this.title + '

' } return disp } } function recComponent () { var _arr = new Array(); var _currentID = '-1'; var _nextObj = ""; var _prevObj = ""; var _filteredArray = new Array(); var iswStaticPath = "http://img2.timeinc.net/weddings/static/2008"; this.setOverride = function(oarr) { _arr = oarr; } this.setCurrentID = function(cid) { _currentID = cid; } this.initialize = function () { try { // remove duplicates from array var tmpArray = _arr.concat(getRecArray()); var usedIDs = ""; var counter = 0; for (i=0; i < tmpArray.length; i++) { var itemObj = tmpArray[i]; var id = itemObj.id; if (usedIDs.indexOf('-'+id+'-') == -1) { _filteredArray[counter] = itemObj; counter++; } usedIDs = usedIDs + id + '-'; } if (typeof(_filteredArray[0]) != 'undefined') { _nextObj = _filteredArray[0]; _prevObj = _filteredArray[_filteredArray.length -1]; } for (i=0; i < _filteredArray.length; i++) { var itemObj = _filteredArray[i]; var id = itemObj.id; if (id == _currentID) { if (i > 0) { _prevObj = _filteredArray[i-1]; } if (i < _filteredArray.length -1) { _nextObj = _filteredArray[i+1]; } break; } } } catch (err) { alert('Problem with initializing more gallery: ' + err.description); } } this.drawPreviousLink = function () { try { if (_prevObj != "") { var str = 'Previous Photo'; document.write(str); } } catch(err) { alert('Problem with drawPreviousLink: ' + err.description); } } this.drawNextLinkTitle = function () { try { if (_nextObj != "") { var str = ''; document.write(str); } } catch(err) { alert('Problem with drawNextLinkTitle: ' + err.description); } } this.drawNextLink = function () { try { if (_nextObj != "") { var str = 'Next Gallery ' document.write(str); } } catch(err) { alert('Problem with drawNextLink: ' + err.description); } } this.renderDisplay = function() { var max = 12; var display = ''; var tmpdisplay = ''; try { for (i=0; i < _filteredArray.length; i++) { var itemObj = _filteredArray[i]; var id = itemObj.id; var counter = i + 1; var txt = ''; if (_currentID == id) { txt = 'current '; } if (counter % 6 == 0) { txt = txt + 'last'; } if (txt != "") { txt = ' class="' + txt.replace(/^s*/, "").replace(/s*$/, "") + '"'; } tmpdisplay = tmpdisplay + itemObj.renderDisplay(txt); if (counter % 6 == 0 || max == counter || counter == _filteredArray.length) { display = display + '' tmpdisplay = ""; } if (max == counter) { break; } } } catch(err) { alert('Problem with rendering more gallery: ' + err.description); } return display } this.draw = function () { document.write(this.renderDisplay()); } }