var isNetscape = (document.layers) ? true : false; function windowWidth() { return (isNetscape) ? (window.innerWidth + document.scrollLeft) : (document.body.clientWidth + document.body.scrollLeft); } function windowHeight() { return (isNetscape) ? (window.innerHeight + document.scrollTop) : (document.body.clientHeight + document.body.scrollTop); } function getOffset() { if (window.pageYOffset) { pos = window.pageYOffset; } else if (document.documentElement && document.documentElement.scrollTop) { pos = document.documentElement.scrollTop; } else if (document.body) { pos = document.body.scrollTop; } return pos; } var topTabs = new Array(); var topTabsSrc = new Array( 'images/hdr_recipient.gif', 'images/hdr_recipientOn.gif', 'images/hdr_personality.gif', 'images/hdr_personalityOn.gif', 'images/hdr_occasion.gif', 'images/hdr_occasionOn.gif', 'images/hdr_category.gif', 'images/hdr_categoryOn.gif', 'images/hdr_GiftRap.gif', 'images/hdr_GiftRapOn.gif' ); function preloadTopTabs() { for (i = 0; i < topTabsSrc.length; i++) { topTabs[i] = new Image(); topTabs[i].src = topTabsSrc[i]; } } function show(id) { if (document.getElementById(id) != null) { document.getElementById(id).style.visibility = "visible"; document.getElementById(id).style.display = "block"; } } function hide(id) { if (document.getElementById(id) != null) { document.getElementById(id).style.visibility = "hidden"; document.getElementById(id).style.display = "none"; } } function showTopMenu(num) { document.getElementById("HPnavParent" + num).style.zIndex = "46"; showTopTab(num); document.getElementById("topMenu" + num).style.visibility = "visible"; } function hideTopMenu(num) { document.getElementById("HPnavParent" + num).style.zIndex = "45"; hideTopTab(num); document.getElementById("topMenu" + num).style.visibility = "hidden"; } function showTopTab(num) { document.images["topTab" + num].src = topTabs[(num * 2) + 1].src; } function hideTopTab(num) { document.images["topTab" + num].src = topTabs[num * 2].src; } function hiliteMenuItem(obj) { obj.style.background = '#E0E0DE'; } function resetMenuItem(obj) { obj.style.background = '#F8F8F6'; } function showImg(id) { for (i = 0; i < showImg.arguments.length; i++) { eval("document.all." + showImg.arguments[i] + ".style.display = ''"); } } function hideImg(id) { for (i = 0; i < hideImg.arguments.length; i++) { eval("document.all." + hideImg.arguments[i] + ".style.display = 'none'"); } } function positionTopMenuW(num) { divW = getDivWidth("topMenu" + num); divWPar = getDivWidth("HPnavParent" + num); newX = getDiv("HPnavParent" + num).left - (divW / 2) + (divWPar / 2); getDiv("topMenu" + num).left = newX; } function getDivWidth(who) { return(document.getElementById(who).offsetWidth); } function getDiv(who) { return document.getElementById(who).style; } // switch the image sources function swap(who, what) { document.images[who].src = img[what].src; return true; } function rollOver(image) { if (image.src.indexOf("_on") == -1) { var src = image.src; src = replace(src, "giftdunia.com", "<-->"); src = replace(src, "_down.gif", ".gif"); src = replace(src, ".gif", "_roll.gif"); src = replace(src, "<-->", "giftdunia.com"); image.src = src; } } function rollOut(image) { if (image.src.indexOf("_on") == -1) { var src = image.src; src = replace(src, "giftdunia.com", "<-->"); src = replace(src, "_down.gif", ".gif"); src = replace(src, "_roll.gif", ".gif"); src = replace(src, "<-->", "giftdunia.com"); image.src = src; } } function mouseDown(image) { var src = image.src; src = replace(src, "giftdunia.com", "<-->"); src = replace(src, "_roll.gif", ".gif"); src = replace(src, ".gif", "_down.gif"); src = replace(src, "<-->", "giftdunia.com"); image.src = src; } function mouseUp(image) { var src = image.src; src = replace(src, "giftdunia.com", "<-->"); src = replace(src, "_roll.gif", ".gif"); src = replace(src, "_down.gif", ".gif"); src = replace(src, "<-->", "giftdunia.com"); image.src = src; } function uniPop(href, winname, width, height, x, y, toolbar, scrollbars, resizable, status) { if (href == "") href = '/support'; if (winname == 'spellChecker') href += escape(document.eventForm.notes.value); if ((width < 100) || (width == null)) var width = '515'; if ((height < 100) || (height == null)) var height = '475'; if (toolbar == null) var toolbar = 'yes'; if (scrollbars == null) var scrollbars = 'yes'; if (resizable == null) var resizable = 'yes'; if (status == null) var status = 'yes'; var theParam = "width=" + width + ",height=" + height + ",toolbar=" + toolbar + ",menubar=" + toolbar + ",location=" + toolbar + ",scrollbars=" + scrollbars + ",resizable=" + resizable + ",status=" + status + ",screenX=" + x + ",screenY=" + y + ",top=" + y + ",left=" + x; var thePopup = window.open(href, winname, theParam); if (thePopup.opener == null) thePopup.opener = self; } function externalPop(href) { uniPop(href, "_blank", 750, 400, 75, 50, 'yes', 'yes', 'yes', 'yes'); } function confirmURL(text, url) { if (confirm(text)) { location.href = (url); } } function deleteOnFocus(field, default_value) { if (field.value == default_value) { field.value = ''; } } function textCounter(field, countfield, maxlimit) { if (field.value.length > maxlimit) // if too long...trim it! field.value = field.value.substring(0, maxlimit); // otherwise, update 'characters left' counter else countfield.value = maxlimit - field.value.length; } function replace(s, t, u) { /* ** Replace a token in a string ** s string to be processed ** t token to be found and removed ** u token to be inserted ** returns new String */ i = s.indexOf(t); r = ""; if (i == -1) return s; r += s.substring(0, i) + u; if (i + t.length < s.length) r += replace(s.substring(i + t.length, s.length), t, u); return r; } function checkAll(field) { for (i = 0; i < field.length; i++) field[i].checked = true; } function uncheckAll(field) { for (i = 0; i < field.length; i++) field[i].checked = false; } function findObj(n, d) { var p,i,x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) { d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p); } if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n]; for (i = 0; !x && d.ls && i < d.ls.length; i++) x = findObj(n, d.ls[i].document); if (!x && document.getElementById) x = document.getElementById(n); return x; } function showSelect(layer, link_name) { for (i = 0; i < 3; i++) { var obj = findObj(layer + i); if (obj.style.display == 'none') { obj.style.display = 'block'; break; } } for (i = 0; i < 3; i++) { var obj = findObj(layer + i); if (obj.style.display == 'none') return; } findObj(link_name).style.display = 'none'; checkAddLink(layer, link_name); } function checkAddLink(layer, link_name) { for (i = 0; i < 3; i++) { var obj = findObj(layer + i); if (obj.style.display == 'none') return; } findObj(link_name).style.display = 'none'; } function hideSelect(layer, select_obj, select_index, link_name) { var obj = findObj(layer); obj.style.display = 'none'; select_obj[select_index].selectedIndex = 0; findObj(link_name).style.display = 'block'; } function trim(strText) { //leading while (strText.substring(0, 1) == ' ') strText = strText.substring(1, strText.length); //trailing: while (strText.substring(strText.length - 1, strText.length) == ' ') strText = strText.substring(0, strText.length - 1); return strText; } /* show hide layers */ function SHL() { var i,p,v,obj,args = SHL.arguments; for (i = 0; i < (args.length - 2); i += 3) if ((obj = findObj(args[i])) != null) { v = args[i + 2]; if (obj.style) { obj = obj.style; v = (v == 'show')?'visible':(v = 'hide')?'hidden':v; } obj.visibility = v; } } function preloadImages() { var d = document; if (d.images) { if (!d.p) d.p = new Array(); var i,j = d.p.length,a = preloadImages.arguments; for (i = 0; i < a.length; i++) if (a[i].indexOf("#") != 0) { d.p[j] = new Image; d.p[j++].src = a[i]; } } } function swapImgRestore() { var i,x,a = document.sr; for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc; } function swapImage() { var i,j = 0,x,a = swapImage.arguments; document.sr = new Array; for (i = 0; i < (a.length - 2); i += 3) if ((x = findObj(a[i])) != null) { document.sr[j++] = x; if (!x.oSrc) x.oSrc = x.src; x.src = a[i + 2]; } } //for left hand nav expand-contract. function toggle(ID, switchID, xtraID) { var obj = document.getElementById(ID); var switchObj = document.getElementById(switchID); var xtraObj = document.getElementById(xtraID); if (obj.style.display == "block") { //if the section is expanded, then hide additional nav content & clean up. obj.style.display = "none"; switchObj.innerHTML = 'View more'; xtraObj.innerHTML = '...'; } else { obj.style.display = "block"; // otherwise, show additional nav content. switchObj.innerHTML = 'View fewer'; xtraObj.innerHTML = ''; } } // Check email syntax - return whether syntax is valid function checkMail(email) { var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; return filter.test(email); } //----------------------------- //hp functions: //function to show and hide gift finder menus function HPhideAllExcept(id) { menuType = new Array(); menuType[0] = "manMenu"; menuType[1] = "womanMenu"; menuType[2] = "teenGuyMenu"; menuType[3] = "teenGirlMenu"; menuType[4] = "childMenu"; menuType[5] = "babyMenu"; for (var i = 0; i < menuType.length; i++) { var layer = document.getElementById(menuType[i]); if (id != menuType[i]) { layer.style.display = "none"; layer.style.visibility = "hidden"; } else { layer.style.display = "block"; layer.style.visibility = "visible"; } } } function click(which) { document.giftFinder.recip[which].checked = true; } //----------------- OPD FUNCTIONS --------------------- function openNewWindow(URLtoOpen, windowName, width, height) { windowFeatures = "menubar=no,scrollbars=no,location=no,favorites=no,resizable=no,status=no,toolbar=no,directories=no"; winLeft = (screen.width - width) / 2; winTop = (screen.height - (height + 110)) / 2; myWin = open(URLtoOpen, windowName, "width=" + width + ",height=" + height + ",left=" + winLeft + ",top=" + winTop + windowFeatures); } //functions for finder function selectInterest() { var frm = document.microFinder.interest; removeAllOptions(frm); addOption(frm, "", "Select an interest", ""); if (document.microFinder.recip.value == '/ideas/him') { addOption(frm, "/recipients/him/gadget-guru/ohMr6a264icp", "Gadget Guru"); addOption(frm, "/recipients/him/outdoor-activities/ohMr6a398icp", "Outdoor Activities"); addOption(frm, "/recipients/him/eating-drinking-well/ohMr6a106icp", "Eating & Drinking Well"); addOption(frm, "/recipients/him/professional/ohMr6a212icp", "Professional"); addOption(frm, "/recipients/him/sports-fan/ohMr6a456icp", "Sports Fan"); addOption(frm, "/recipients/him/well-dressed/ohMr6a863icp", "Well-Dressed"); addOption(frm, "/recipients/him/music-lover/ohMr6a176icp", "Music Lover"); addOption(frm, "/recipients/him/golfing/ohMr6a384icp", "Golfing"); addOption(frm, "/recipients/him/travel-enthusiast/ohMr6a274icp", "Travel Enthusiast"); addOption(frm, "/recipients/him/creative-artistic/ohMr6a92icp", "Creative & Artistic"); addOption(frm, "/ideas/him", "View All"); } if (document.microFinder.recip.value == '/ideas/her') { addOption(frm, "/recipients/her/fashion-shopper/ohFr6a233icp", "Fashion Shopper"); addOption(frm, "/recipients/her/beauty-spa/ohFr6a118icp", "Beauty & Spa"); addOption(frm, "/recipients/her/creative-artistic/ohFr6a92icp", "Creative & Artistic"); addOption(frm, "/recipients/her/home-decorator/ohFr6a96icp", "Home Decorator"); addOption(frm, "/recipients/her/cooking-entertaining/ohFr6a109icp", "Cooking & Entertaining "); addOption(frm, "/recipients/her/proud-parent/ohFr6a477icp", "Proud Parent"); addOption(frm, "/recipients/her/gadget-guru/ohFr6a264icp", "Gadget Guru"); addOption(frm, "/recipients/her/travel-enthusiast/ohFr6a274icp", "Travel Enthusiast"); addOption(frm, "/recipients/her/professional/ohFr6a212icp", "Professional"); addOption(frm, "/recipients/her/active-healthy/ohFr6a376icp", "Active & Healthy"); addOption(frm, "/ideas/her", "View All"); } if (document.microFinder.recip.value == '/ideas/teen-boy') { addOption(frm, "/recipients/teen-boy/gadget-guru/ohMr14a264icp", "Gadget Guru"); addOption(frm, "/recipients/teen-boy/music-lover/ohMr14a176icp", "Music Lover"); addOption(frm, "/recipients/teen-boy/video-gamer/ohMr14a75icp", "Video Gamer"); addOption(frm, "/recipients/teen-boy/sports-fan/ohMr14a456icp", "Sports Fan"); addOption(frm, "/recipients/teen-boy/well-dressed/ohMr14a863icp", "Well-Dressed"); addOption(frm, "/recipients/teen-boy/playing-sports/ohMr14a854icp", "Playing Sports"); addOption(frm, "/recipients/teen-boy/room-dorm-decor/ohMr14a875icp", "Room & Dorm Decor"); addOption(frm, "/recipients/teen-boy/creative-artistic/ohMr14a92icp", "Creative & Artistic"); addOption(frm, "/recipients/teen-boy/surf-skate-board/ohMr14a391icp", "Surf / Skate / Board"); addOption(frm, "/recipients/teen-boy/tv-pop-culture-fan/ohMr14a83icp", "TV & Pop Culture Fan"); addOption(frm, "/ideas/teen-boy", "View All"); } if (document.microFinder.recip.value == '/ideas/teen-girl') { addOption(frm, "/recipients/teen-girl/fashion-shopper/ohFr14a233icp", "Fashion Shopper"); addOption(frm, "/recipients/teen-girl/creative-artistic/ohFr14a92icp", "Creative & Artistic"); addOption(frm, "/recipients/teen-girl/room-dorm-decor/ohFr14a875icp", "Room & Dorm Decor"); addOption(frm, "/recipients/teen-girl/music-lover/ohFr14a176icp", "Music Lover"); addOption(frm, "/recipients/teen-girl/gadget-guru/ohFr14a264icp", "Gadget Guru"); addOption(frm, "/recipients/teen-girl/beauty-spa/ohFr14a118icp", "Beauty & Spa"); addOption(frm, "/recipients/teen-girl/playing-sports/ohFr14a854icp", "Playing Sports"); addOption(frm, "/recipients/teen-girl/tv-pop-culture-fan/ohFr14a83icp", "TV & Pop Culture Fan"); addOption(frm, "/recipients/teen-girl/movie-buff/ohFr14a287icp", "Movie Buff"); addOption(frm, "/recipients/teen-girl/pets-animals/ohFr14a224icp", "Pets & Animals"); addOption(frm, "/ideas/teen-girl", "View All"); } if (document.microFinder.recip.value == '/ideas/children') { addOption(frm, "/recipients/child/educational-toys/ohr12a847icp", "Educational Toys"); addOption(frm, "/recipients/child/fashion-shopper/ohr12a233icp", "Fashion Shopper"); addOption(frm, "/recipients/child/playtime-make-believe/ohr12a555icp", "Playtime & Make-Believe"); addOption(frm, "/recipients/child/creative-artistic/ohr12a92icp", "Creative & Artistic"); addOption(frm, "/recipients/child/outdoor-activities/ohr12a398icp", "Outdoor Activities"); addOption(frm, "/recipients/child/well-dressed-child/ohr12a849icp", "Well-Dressed Child"); addOption(frm, "/recipients/child/playing-sports/ohr12a854icp", "Playing Sports"); addOption(frm, "/recipients/child/video-gamer/ohr12a75icp", "Video Gamer"); addOption(frm, "/recipients/child/cars-trucks-trains/ohr12a82icp", "Cars, Trucks & Trains"); addOption(frm, "/recipients/child/kids-favorite-characters/ohr12a848icp", "Kids Favorite Characters"); addOption(frm, "/ideas/child-boy", "View All"); } if (document.microFinder.recip.value == '/ideas/baby') { addOption(frm, "/recipients/baby/well-dressed-child/ohr13a849icp", "Well-Dressed Child"); addOption(frm, "/recipients/baby/baby-keepsakes/ohr13a862icp", "Baby Keepsakes"); addOption(frm, "/recipients/baby/educational-toys/ohr13a847icp", "Educational Toys"); addOption(frm, "/recipients/baby/practical-for-baby/ohr13a810icp", "Practical for Baby"); addOption(frm, "/recipients/baby/dolls-collectibles/ohr13a86icp", "Dolls & Collectibles"); addOption(frm, "/recipients/baby/baby-bedtime-bath/ohr13a861icp", "Baby Bedtime & Bath"); addOption(frm, "/recipients/baby/cars-trucks-trains/ohr13a82icp", "Cars, Trucks & Trains"); addOption(frm, "/recipients/baby/playtime-make-believe/ohr13a555icp", "Playtime & Make-Believe"); addOption(frm, "/recipients/baby/dinosaurs-monsters/ohr13a227icp", "Dinosaurs & Monsters"); addOption(frm, "/recipients/baby/pets-animals/ohr13a224icp", "Pets & Animals"); addOption(frm, "/ideas/baby", "View All"); } } function removeAllOptions(selectbox) { var i; for (i = selectbox.options.length - 1; i >= 0; i--) { selectbox.remove(i); } } function addOption(selectbox, value, text) { var optn = document.createElement("OPTION"); optn.text = text; optn.value = value; selectbox.options.add(optn); } function goto_URL(which) { if (document.microFinder.recip.options[document.microFinder.recip.selectedIndex].value == "") { alert('Please select a recipient'); document.microFinder.recip.focus(); return false; } window.location.href = which.options[which.selectedIndex].value; if (which.options[which.selectedIndex].value == "") { window.location.href = document.microFinder.recip.options[document.microFinder.recip.selectedIndex].value; } return false; } //---------------- END OPD FUNCTIONS ------------------- //---------------- IDEA RESULTS FUNCTIONS --------------- //==================== B: new look ====================== document.menuTimer = 0; if (document.images) { img1 = new Image(); img1.src = "images/ggtp/bgSideBox.gif"; img2 = new Image(); img2.src = "images/ggtp/bgSideBoxRev.gif"; } function changeImg(change, id) { if (change == "on") { document.images[id].src = "images/sr_viewallOn.gif"; } else { document.images[id].src = "images/sr_viewall.gif"; } } function showMoreMenu(id) { hideExcept(id); var moreH = document.getElementById(id).offsetHeight; var viewH = document.getElementById(id + "Parent").offsetHeight; var newH = document.getElementById(id + "Parent").style.top - (moreH / 2) + (viewH / 2); document.getElementById(id).style.top = newH + "px"; clearTimeout(document.menuTimer); } function hideMoreMenu(id) { document.menuTimer = setTimeout("hide('" + id + "'),changeImg('off','" + id + "Arrow')", 500); } function hideExcept(elm) { menus = new Array() menus[0] = "moreInt"; menus[1] = "moreCat"; menus[2] = "moreOcc"; for (var i = 0; i < menus.length; i++) { var layer = document.getElementById(menus[i]); if (layer != null) { if (elm != menus[i]) { layer.style.display = "none"; layer.style.visibility = "hidden"; document.images[menus[i] + "Arrow"].src = "images/sr_viewall.gif"; } else { layer.style.display = "block"; layer.style.visibility = "visible"; document.images[menus[i] + "Arrow"].src = "images/sr_viewallOn.gif"; } } } } function itemClicked(event) { var elementObj = Event.element(event); if (elementObj.tagName == "A") { top.location.replace(elementObj.href); } else if (elementObj.parentNode.tagName == "A") { top.location.replace(elementObj.parentNode.href); } } //==================== end B: new look ====================== //---------------- END IDEA RESULTS FUNCTIONS ---------------