function gotoRepository(){ if (checkMarkets() == true) { document.forms[1].SelImages.value = "R"; // Repository document.forms[1].submit(); } } function gotoUpload(){ if (checkMarkets() == true) { document.forms[1].SelImages.value = "U"; // Upload document.forms[1].submit(); } } function doUploadFinish(win, popup, maxImages){ var count = 0; if (img_urls.length){ for(var i=0; i < maxImages; i++){ if(img_urls[i].value){ count++; } } } if(popup.document.confirmForm.image_url) { img_urls[count].value = popup.document.confirmForm.image_url.value; img_alias[count].value = popup.document.confirmForm.OrigAlias.value; img_tnails[count].value = popup.document.confirmForm.image_tnurl.value; if (img_holders[count]) img_uholders[count].src = popup.document.confirmForm.image_tnurl.value; else if (imgNameDD) imgNameDD.options[count] = new Option(popup.document.confirmForm.OrigAlias.value, popup.document.confirmForm.OrigAlias.value); for(var i=0; i < popup.document.confirmForm.image_url.length; i++){ img_urls[count].value = popup.document.confirmForm.image_url[i].value; img_alias[count].value = popup.document.confirmForm.OrigAlias[i].value; img_tnails[count].value = popup.document.confirmForm.image_tnurl[i].value; if (img_holders[count]) img_uholders[count].src = popup.document.confirmForm.image_tnurl[i].value; else if (imgNameDD) imgNameDD.options[count] = new Option(popup.document.confirmForm.OrigAlias[i].value, popup.document.confirmForm.OrigAlias[i].value); count++; } //if (imgNameDD) // imgNameDD.options[0].selected = true; //setPreImg(0); } } function doUploadFinishAX(imageUrls){ var imgcount = 0; imageUrls = imageUrls.substr(0, imageUrls.indexOf("*")); for(var i=0; i < numImages; i++){ if(img_urls[i].value){ imgcount++; } } var arrImageUrls = imageUrls.split(","); for(var i=0; i < arrImageUrls.length; i++){ if (arrImageUrls[i] != ""){ if (img_urls[imgcount]){ img_urls[imgcount].value = arrImageUrls[i]; imgcount++; } } } } function doUploadFinishAlias(alias){ var imgcount = 0; alias = alias.substr(0, alias.indexOf("*")); for(var i=0; i < numImages; i++){ if(img_alias[i].value){ imgcount++; } } var arrAlias = alias.split(","); for(var i=0; i < arrAlias.length; i++){ if (arrAlias[i] != ""){ img_alias[imgcount].value = arrAlias[i]; if (maxImgOnPage > 8) imgNameDD.options[imgcount] = new Option(arrAlias[i], arrAlias[i]); imgcount++; } } } function doUploadFinishTNAX(imageTNUrls){ var imgcount = 0; imageTNUrls = imageTNUrls.substr(0, imageTNUrls.indexOf("*")); for(var i=0; i < numImages; i++){ if(img_tnails[i].value){ imgcount++; } } var arrImageTNUrls = imageTNUrls.split(","); for(var i=0; i < arrImageTNUrls.length; i++){ if (arrImageTNUrls[i] != ""){ if (img_tnails[imgcount]){ img_tnails[imgcount].value = arrImageTNUrls[i]; if(img_uholders[imgcount]) img_uholders[imgcount].src = arrImageTNUrls[i]; imgcount++; } } } } /** * doFinish * Extract the selected images from the popup window * and populate the hidden fields and images. * @param NumImages represents the max. no of images that can * be transferred to the parent window. */ function doFinish(win, popup, numImages){ var count = 0; var startindex = 0; if(typeof img_urls == 'undefined'){ img_urls = parent.window.frames['customSectionFrame'].img_urls; } if(typeof img_alias == 'undefined'){ img_alias = parent.window.frames['customSectionFrame'].img_alias; } if(typeof img_tnails == 'undefined'){ img_tnails = parent.window.frames['customSectionFrame'].img_tnails; } if(typeof img_holders == 'undefined'){ img_holders = parent.window.frames['customSectionFrame'].img_holders; } if (img_urls.length){ for(var i=0; i 8) imgNameDD.options[startindex] = new Option(popup.document.ImgReposit.alias[i].value, popup.document.ImgReposit.alias[i].value); startindex++; } } } else { if(popup.document.ImgReposit.imgselect.checked){ img_urls[startindex].value = popup.document.ImgReposit.url.value; img_alias[startindex].value = popup.document.ImgReposit.alias.value; img_tnails[startindex].value = popup.document.ImgReposit.tnurl.value; if (img_holders[startindex]) img_holders[startindex].src = popup.document.ImgReposit.tnurl.value; else if (imgNameDD) imgNameDD.options[startindex] = new Option(popup.document.ImgReposit.alias.value, popup.document.ImgReposit.alias.value); startindex++; } if (imgNameDD) imgNameDD.options[0].selected = true; setPreImg(0); } } function doSectionFinish(win, popup, numImages, secNum){ var count = 0; var startindex = 0; if (img_sec_urls.length){ for(var i=0; i 8) imgNameDD.options[secNum] = new Option(popup.document.ImgReposit.alias[i].value, popup.document.ImgReposit.alias[i].value); startindex++; } } } else { if(popup.document.ImgReposit.imgselect.checked){ img_sec_urls[secNum].value = popup.document.ImgReposit.url.value; img_sec_alias[secNum].value = popup.document.ImgReposit.alias.value; img_sec_tnails[secNum].value = popup.document.ImgReposit.tnurl.value; if (img_sec_holders[secNum]) img_sec_holders[secNum].src = popup.document.ImgReposit.tnurl.value; else if (imgNameDD) imgNameDD.options[secNum] = new Option(popup.document.ImgReposit.alias.value, popup.document.ImgReposit.alias.value); startindex++; } } } function doSectionUploadFinish(win, popup, numImages, secNum){ if(popup.document.confirmForm.image_url) { img_sec_urls[secNum].value = popup.document.confirmForm.image_url.value; img_sec_alias[secNum].value = popup.document.confirmForm.OrigAlias.value; img_sec_tnails[secNum].value = popup.document.confirmForm.image_tnurl.value; img_sec_holders[secNum].src = popup.document.confirmForm.image_tnurl.value; } } /** * refreshImages * Make sure the thumbnails show the correct images when the page loads. * Otherwise going back and forth causes the thumbs to disappear */ function refreshImages() { // Reset the next page to null document.forms[1].SelImages.value = ""; for(var i=0; i < img_tnails.length; i++) { if(img_tnails[i].value.length > 1){ img_holders[i].src = img_tnails[i].value; } } } /** * doSelectPopup * Create the image selection popup window * @param NumImages represents the max. no of images that can * be transferred to the parent window. */ function doSelectPopup(numImages, caller) { var fold = ""; if (document.forms[myform]) { if (document.forms[myform].selfolder) { var ind = document.forms[myform].selfolder.selectedIndex; fold = document.forms[myform].selfolder.options[ind].value; } else { fold = document.forms[myform].sfFolder.value; } } // Encode the foldername so that NN doesnt choke - // replace spaces with pluses fold = fold.replace(/\s/g, "+"); var numLeft = numImages; for(i=0; i 1 ) numLeft--; } if (numLeft > 0) { if (navigator.appVersion.indexOf("WebTV") != -1) { window.status="WebTV does not support this feature."; } else { vault=window.open('/img/img_repo_popup.jsp?DisplayCat='+fold+'&numImages='+numLeft+'&caller='+caller,'newVault', 'width=600,height=400,location=no,menubar=no,scrollbars=yes,resizable=yes,status=no'); if ((navigator.appName.indexOf("Explorer" != -1)) && (parseInt(navigator.appVersion) < 4)) { // do nothing } else { vault.opener = self.parent; } vault.focus(); } } else { Alert('You have selected all the images required for the ad. Please delete the images not required in this ad to select new images'); } } function doSectionSelectPopup(numImages, sectionNum) { var fold = ""; if (document.forms[myform]) { if (document.forms[myform].selfolder) { var ind = document.forms[myform].selfolder.selectedIndex; fold = document.forms[myform].selfolder.options[ind].value; } else { fold = document.forms[myform].sfFolder.value; } } // Encode the foldername so that NN doesnt choke - // replace spaces with pluses fold = fold.replace(/\s/g, "+"); var numLeft = numImages; for(i=0; i 1 ) numLeft--; } if (numLeft > 0) { if (navigator.appVersion.indexOf("WebTV") != -1) { window.status="WebTV does not support this feature."; } else { vault=window.open('/img/img_repo_popup2.jsp?secNum=' + sectionNum + '&DisplayCat='+fold+'&numImages='+numLeft,'newVault', 'width=600,height=400,location=no,menubar=no,scrollbars=yes,resizable=yes,status=yes'); if ((navigator.appName.indexOf("Explorer" != -1)) && (parseInt(navigator.appVersion) < 4)) { // do nothing } else { vault.opener = self.parent; } vault.focus(); } } else { Alert('You have selected all the images required for the ad. Please delete the images not required in this ad to select new images'); } } function doSectionUploadPopup(sectionImg){ //Before decrementing the number of images left, we intitalize another variable //representing the maximun number of images in the parent window. var imgAvailable = false; if (navigator.appVersion.indexOf("WebTV") != -1) { window.status="WebTV does not support this feature."; } else { if (img_sec_urls[sectionImg].value.length > 1) imgAvailable = true; if (!imgAvailable){ vault=window.open('/img/img_upload_popup.jsp?num=1&caller=store§ionImg=' + sectionImg,'newVault', 'width=800,height=625,location=no,menubar=no,scrollbars=yes,resizable=no,status=no'); if ((navigator.appName.indexOf("Explorer" != -1)) && (parseInt(navigator.appVersion) < 4)) { // do nothing } else { vault.opener = self.parent; } vault.focus(); } else { Alert('You have selected the image for this section.'); } } } function doUploadPopup(numleft){ //Before decrementing the number of images left, we intitalize another variable //representing the maximun number of images in the parent window. var maxImages = numleft; if (navigator.appVersion.indexOf("WebTV") != -1) { window.status="WebTV does not support this feature."; } else { for (i=0; i < maxImages; i++) { if(img_urls[i].value.length > 1 ) numleft--; } if (numleft > 0){ vault=window.open('/img/img_upload_popup.jsp?num='+numleft+'&maxImages=' + maxImages,'newVault', 'width=800,height=625,location=no,menubar=no,scrollbars=yes,resizable=no,status=no'); if ((navigator.appName.indexOf("Explorer" != -1)) && (parseInt(navigator.appVersion) < 4)) { // do nothing } else { vault.opener = self.parent; } vault.onUploadFinish = doUploadFinish; vault.focus(); } else { Alert('You have selected all the 8 images required for the ad. Please delete the images not required in this ad to upload new images'); } } } function doDesignUploadPopup(numleft, imgUrl, caller){ //Before decrementing the number of images left, we intitalize another variable //representing the maximun number of images in the parent window. var maxImages = numleft; if(caller == null || caller == ""){ caller = "store"; } if (navigator.appVersion.indexOf("WebTV") != -1) { window.status="WebTV does not support this feature."; } else { for (i=0; i < maxImages; i++) { if(img_urls[i].value.length > 1 ) numleft--; } if (numleft > 0){ vault=window.open('/img/img_upload_popup.jsp?num='+numleft+'&maxImages=' + maxImages+'&caller='+caller+'&adminImg=Y&oldAdminImg='+imgUrl,'newVault', 'width=800,height=625,location=no,menubar=no,scrollbars=yes,resizable=no,status=no'); if ((navigator.appName.indexOf("Explorer" != -1)) && (parseInt(navigator.appVersion) < 4)) { // do nothing } else { vault.opener = self.parent; } vault.onUploadFinish = doUploadFinish; vault.focus(); } else { Alert('You have selected all the 8 images required for the ad. Please delete the images not required in this ad to upload new images'); } } } function doUploadPopupAX(numleft){ //Before decrementing the number of images left, we intitalize another variable //representing the maximun number of images in the parent window. var maxImages = numleft; for (i=0; i < maxImages; i++) { if(img_urls[i].value.length > 1 ) numleft--; } if (numleft > 0){ window.open('/img/img_poweruploader.jsp?num='+numleft+'&maxImages=' + maxImages+'&popup=Y','newVault', 'width=800,height=625,scrollbars=yes,resizable=yes,status=yes'); } else { Alert('You have selected all the 8 images required for the ad. Please delete the images not required in this ad to upload new images'); } } function removeImage(index, maxImages){ //have to decrement max images since the java arrays start at zero. maxImages = maxImages - 1; for(var n=index; n < maxImages-1; n++){ img_urls[n].value = img_urls[n+1].value; img_alias[n].value = img_alias[n+1].value; img_tnails[n].value = img_tnails[n+1].value; img_tholders[n].src = img_tholders[n+1].src; img_captions[n].src = img_captions[n+1].src; } // The last image is an exception and must be defaulted to the original img_urls[maxImages].value = ""; img_alias[maxImages].value = ""; img_tnails[maxImages].value = ""; img_captions[maxImages].value = ""; img_tholders[maxImages].src = "/images/box_image.gif"; } function removeSectionImage(sec_n){ //have to decrement max images since the java arrays start at zero. // The last image is an exception and must be defaulted to the original img_sec_urls[sec_n].value = ""; img_sec_alias[sec_n].value = ""; img_sec_tnails[sec_n].value = ""; img_sec_captions[sec_n].value = ""; img_sec_tholders[sec_n].src = "/images/box_image.gif"; } /* Added by Krishna Raghavan * Displays an alert box that will prevent the honesty user from uploading images if * he/she has not signed up for an image hosting plan. * */ function displayUploadMsg() { alert('To add images, please sign up for an honesty image hosting plan'); return false; } /* Added by Karthik. * Function similar to removeImage. This function will remove the given * index image and then will do an intelligent way of moving the * following images before. */ function removeAndShift(index, maxImages) { //decrement the maxImages by 1 to account for 0..7 var imageUrl; var boxImageArr = new Array(maxImages); for (i=0; i 1) { Alert('Please delete the image before trying to upload or select another one'); return false; } return true; } function getDottedLocation(val){ if(val==null || val=="") return val; var myString=decodeClsLocationString(val); if(myString==null || myString=="") return myString; var mySplitResult = myString.split(","); if(mySplitResult.length==1) return myString; var retStr=mySplitResult[0]; retStr=retStr+'...' ; retStr=retStr+ mySplitResult[mySplitResult.length-1]; return retStr; } function decodeClsLocationString(str){ if(str==null || str=="" || str=='') return str; var c; var intStr = ""; if(str.charAt(0)=="Y" || str.charAt(0)=="N") { for (i=0; i<18; i++){ c = str.charAt(i); switch(i){ case 0: if (c == "Y") intStr += "Canada"; break; case 1: if (c == "Y") intStr += writeStr(intStr, "Europe"); break; case 2: if (c == "Y") intStr += writeStr(intStr, "Australia"); break; case 3: if (c == "Y") intStr += writeStr(intStr, "Asia"); break; case 4: if (c == "Y") intStr += writeStr(intStr, "South America"); break; case 5: if (c == "Y") intStr += writeStr(intStr, "Africa"); break; case 6: if (c == "Y") intStr += writeStr(intStr, "Mexico"); break; case 7: if (c == "Y") intStr += writeStr(intStr, "MiddleEast"); break; case 8: if (c == "Y") intStr += writeStr(intStr, "Caribbean"); break; case 9: if (c == "Y") intStr += writeStr(intStr, "Germany"); break; case 10: if (c == "Y") intStr += writeStr(intStr, "France"); break; case 11: if (c == "Y") intStr += writeStr(intStr, "Japan"); break; case 12: if (c == "Y") intStr += writeStr(intStr, "Americas"); break; case 13: if (c == "Y") intStr += writeStr(intStr, "US"); break; case 14: if (c == "Y") intStr += writeStr(intStr, "UK"); break; case 15: if (c == "Y") intStr += writeStr(intStr, "Switzerland"); break; case 16: if (c == "Y") intStr += writeStr(intStr, "Austria"); break; case 17: if (c == "Y") intStr += writeStr(intStr, "WorldWide"); break; } } }else{ return str; } return intStr; } function writeStr(pStr, str) { //alert(str); var retStr = ""; if (pStr != "") retStr += ", " + str; else retStr += str ; return retStr; }