 | | Color: | | // this initial block stores the images in a global var called swatchUrls so// that we will have them as we do rolloversvar queryString;var SelectedDefaultSwatchImgId;var SelectedDefaultSwatchColorName;var thumbnailPerspective = "default";var swatchUrls = new Array();var originalImageUrls = new Array();setDefaultSwatch( 'imageColor_1','White');swatchUrls['imageColor_1'] = new Array(); //for default, front and backswatchUrls['imageColor_1'][0] = new Image;swatchUrls['imageColor_1'][0].src = 'http://images2.cafepress.com/product/20818942v3_350x350_Front_Color-White.jpg';swatchUrls['imageColor_1'][1] = new Image;swatchUrls['imageColor_1'][1].src = 'http://images2.cafepress.com/product/20818942v3_350x350_Front_Color-White.jpg';swatchUrls['imageColor_1'][2] = new Image;swatchUrls['imageColor_1'][2].src = 'http://images2.cafepress.com/product/20818942v3_350x350_Back_Color-White.jpg';var lastIndex = (swatchUrls['imageColor_1']).length;swatchUrls['imageColor_1'][lastIndex] = new Image;swatchUrls['imageColor_1'][lastIndex].src = 'http://content.cafepress.com/products/additional_photos/5_c1_1.jpg';swatchUrls['imageColor_23'] = new Array(); //for default, front and backswatchUrls['imageColor_23'][0] = new Image;swatchUrls['imageColor_23'][0].src = 'http://images2.cafepress.com/product/20818942v3_350x350_Front_Color-AshGrey.jpg';swatchUrls['imageColor_23'][1] = new Image;swatchUrls['imageColor_23'][1].src = 'http://images2.cafepress.com/product/20818942v3_350x350_Front_Color-AshGrey.jpg';swatchUrls['imageColor_23'][2] = new Image;swatchUrls['imageColor_23'][2].src = 'http://images2.cafepress.com/product/20818942v3_350x350_Back_Color-AshGrey.jpg';var lastIndex = (swatchUrls['imageColor_23']).length;swatchUrls['imageColor_23'][lastIndex] = new Image;swatchUrls['imageColor_23'][lastIndex].src = 'http://content.cafepress.com/products/additional_photos/5_c23_1.jpg';function setDefaultSwatch(colorId,colorName){SelectedDefaultSwatchImgId = colorId;SelectedDefaultSwatchColorName = colorName;}/**** refreshImages - replaces the image link with a** new random number so that the image is not cached**/function refreshImages(){var regexp = /\?r=*/;var randNum = "?r=" + (new Date()).getTime();for(var j in swatchUrls) {for(var i in swatchUrls[j]) {var myUrl = swatchUrls[j][i].src;if (myUrl.match(regexp)) {swatchUrls[j][i].src = myUrl.replace(regexp, randNum);} else {swatchUrls[j][i].src = myUrl + randNum;}}}//refresh originalsfor(var k in originalImageUrls) {var myUrl = originalImageUrls[k];if (myUrl.match(regexp)) {originalImageUrls[k] = myUrl.replace(regexp, randNum);} else {originalImageUrls[k] = myUrl + randNum;}}}//convenience methodfunction convertImageArrayToUrlArray(newImageArray) {//get source and put into arrayvar urlArray = new Array(newImageArray.length);for(i=0; i < newImageArray.length; i++) {if (newImageArray[i] != null && newImageArray[i] != undefined) {urlArray[i] = newImageArray[i].src;}}//fix for if you clicked backif (thumbnailPerspective.toLowerCase() == 'back') {urlArray[0] = newImageArray[2].src;} else if (thumbnailPerspective.toLowerCase() == 'front') {urlArray[0] = newImageArray[1].src;}return urlArray;}/**** doSwatchClick - action performed when swatch is clicked, which could be:** 1. change default color text if in edit page, also change view larger link to send in the new color** 2. change default color chosen in drop down if a drop down exists** 3. swap main image + 2 small front/back images with the chosen color** 4. refreshes size drop down if upon choosing this color, there are sizes that are out of stock** 5. if in edit page, draws a border around the clicked swatch**/function doSwatchClick(newImageArray, dropDownId, newSelectValue, sizeDropDownId, imgIdToHighlight, colorText) {//get source and put into arrayvar urlArray = convertImageArrayToUrlArray(newImageArray);setDefaultSwatch(imgIdToHighlight, colorText);if (imgIdToHighlight != undefined && imgIdToHighlight != '') {toggleImgBorder(imgIdToHighlight,1,1);}if (changeDefaultColor != undefined) {changeDefaultColor(colorText);}swapImgsWithUrls(['mainimg', 'img1', 'img2', 'imgproductinfo1'], urlArray);changeDropDownValueSelected(dropDownId, newSelectValue);if (sizeDropDownId != '') {if (refreshSizeDropDown != undefined) {refreshSizeDropDown(sizeDropDownId, dropDownId);}}//overwrite originalImageUrls - call save again since your new values have changedsaveOriginalImageUrls();//refresh availability message, if it existsif (refreshAvailabilityMessage != undefined) {refreshAvailabilityMessage();}}/**** saveOriginalImageUrls() -- saves the pre rollover images in a global** var named originalImageUrls so that we can retrieve them 'onmouseout'**/function saveOriginalImageUrls() {if (document.images['mainimg'] != undefined) {originalImageUrls[0] = document.images['mainimg'].src}var lastIndex = 2;if (document.images['img1'] != undefined) {originalImageUrls[1] = document.images['img1'].src}if (document.images['img2'] != undefined) {originalImageUrls[2] = document.images['img2'].srclastIndex=3;}if (document.images['imgproductinfo1'] != undefined){originalImageUrls[lastIndex] = document.images['imgproductinfo1'].src}}/**** restoreOriginalImageUrls() -- onmouseout, we restore whatever the original** images were pre-rollover**/function restoreOriginalImageUrls() {swapImgsWithUrls(['mainimg', 'img1', 'img2', 'imgproductinfo1'], originalImageUrls);}/**** changeImgBorder -- changes image border to a new value**/function changeImgBorder(id, border,colorno) {myImg = document.getElementById(id);if (myImg != undefined) {myImg.style.border=border;}}/**** toggleImgBorder**/function toggleImgBorder(idToHighlight,SelectedAsDefault,MouseOver) {var divId = 'imageColor_1';if (divId == idToHighlight && MouseOver==1) {if(SelectedAsDefault){changeImgBorder(divId, "1px solid black",1);}else{if(divId != SelectedDefaultSwatchImgId)changeImgBorder(divId, "1px solid gray",1);changeDefaultColor('White');}} else {if (SelectedDefaultSwatchImgId != undefined && SelectedDefaultSwatchImgId != ''){if (!MouseOver){changeDefaultColor(SelectedDefaultSwatchColorName);}if(divId != SelectedDefaultSwatchImgId){//original borderchangeImgBorder(divId, "0px solid",1);}}}var divId = 'imageColor_23';if (divId == idToHighlight && MouseOver==1) {if(SelectedAsDefault){changeImgBorder(divId, "1px solid black",23);}else{if(divId != SelectedDefaultSwatchImgId)changeImgBorder(divId, "1px solid gray",23);changeDefaultColor('Ash Grey');}} else {if (SelectedDefaultSwatchImgId != undefined && SelectedDefaultSwatchImgId != ''){if (!MouseOver){changeDefaultColor(SelectedDefaultSwatchColorName);}if(divId != SelectedDefaultSwatchImgId){//original borderchangeImgBorder(divId, "0px solid",23);}}}}//end if in edit page |
| Have you seen my stapler? Long Sleeve T-Shirt I could see the squirrels, and they were married, but then, they switched from the Swingline to the Boston stapler, but I kept my Swingline stapler because it didn't bind up as much... Product InformationNot too tight, not too loose. Fabric Thickness: The most comfortable t-shirt ever! Our 100% cotton, Hanes Beefy-T is preshrunk, durable and guaranteed. - 6.1 oz. 100% luxuriously soft ring spun cotton
- Standard fit
- Ribbed sleeve cuffs
|