var imagesBaseUrl = 'http://a248.e.akamai.net/f/248/37847/4h/www.baseballexp.com/assets/bbx'; function setImageUrl(imgId, imgUrl) { var target = document.getElementById(imgId); if (target != null) { target.src = imagesBaseUrl + imgUrl; } } function showTabCom(objComDivId, objComDivArr) { var imgPath = "http://a248.e.akamai.net/f/248/37847/4h/www.baseballexp.com/assets/bbx/assets/images/catalog/" var tab; var div; for (i = 0; i < objComDivArr.length; i++) { tab = document.getElementById(objComDivArr[i] + "-id"); div = document.getElementById(objComDivArr[i]); // turn everything off if (tab) { tab.className = "prodTab"; div.style.display = "none"; } } // turn on the one selected tab = document.getElementById(objComDivId + "-id"); div = document.getElementById(objComDivId); tab.className = "prodTabOn"; div.style.display = "block"; } utilityBrowserVer = parseInt(navigator.appVersion); function imgOn(imgName) { if (utilityBrowserVer >= 3) { imgOnString = eval(imgName + "_on.src"); document.images[imgName].src = imgOnString; } } function imgOff(imgName) { if (utilityBrowserVer >= 3) { imgOffString = eval(imgName + "_off.src"); document.images[imgName].src = imgOffString; } } function goToLink(address) { var linkURL = address.options[address.selectedIndex].value; window.top.location.href = linkURL; address.selectedIndex = 0; } /* * This function launches a new web browser window to a specified width, height and features. * Features string is a comma separated window's feature needed for this new window. For Instance * If a new window needs a toolbar the feature string must be "toolbar" like needs scroll bar and * and toolbar then it must be "toolbar,scrollbar". Note that the order of the feature is not required. * Also it's case insensitive. Therefore, "scrollbar,toolbar" is identical to "Toolbar,ScrollBar". * * NOTE: By default window will be shown at center of screen, if you'd like to display it at a specific coordinates * pass the left and top properties as a feature string. * For instance, to display a window at 100px on X and 100px on Y set feature string as "left=100,top=100" * * If the features string is ommitted then all the features are turned off. To turn all the features on * use the word "all" for features instead of specifying each feature. * * @address URL to open in new window * @width width of new window in pixel. Defaults to 400 pixels. * @height height of new window in pixel. Default to 350 pixels. * @features feature string to have window features enable. Such as toolbars,menubars etc. * @name string if new window to be named window. */ function newWindow(address, width, height, features, name) { if (name == 'zoom') { width = 570; //NOTE - ZOOM WIDTH is overridden to 570 for Team Express height = 615; //NOTE - ZOOM HEIGHT is overridden to 610 for Team Express } else { if (String(width).indexOf('=') == 0) { width = parseInt(width.substring(1)); } else { width = 500; //NOTE - WIDTH is overridden to 500 for Team Express } if (String(height).indexOf('=') == 0) { height = parseInt(height.substring(1)); } else { height = 550; //NOTE - HEIGHT is overridden to 550 for Team Express } } /* Find out what features need to be enable * */ if (features) { features = features.toLowerCase(); } else { features = ""; } if (!name) { name = "Popup_Window"; } var toolbar = (features == "all" ? 1 : 0); var menubar = (features == "all" ? 1 : 0); var location = (features == "all" ? 1 : 0); var directories = (features == "all" ? 1 : 0); var status = (features == "all" ? 1 : 0); var resizable = (features == "all" ? 1 : 0); if (typeof(width) != "number") { width = 500; } if (typeof(height) != "number") { height = 550; } var left = ("left=" + ((screen.width - width) / 2)); var top = ("top=" + ((screen.height - height) / 2)); if (features != "all") { //split features var feature = features.split(","); for (i = 0; i < feature.length; i++) { if (feature[i] == "toolbar") { toolbar = 1; } else if (feature[i] == "menubar") { menubar = 1; } else if (feature[i] == "location") { location = 1; } else if (feature[i] == "directories") { directories = 1; } else if (feature[i] == "status") { status = 1; } else if (feature[i] == "resizable") { resizable = 1; } else if (feature[i].indexOf("left=") != -1) { left = feature[i]; } else if (feature[i].indexOf("top=") != -1) { top = feature[i]; } } } features = "toolbar=" + toolbar + ","; features += "menubar=" + menubar + ","; features += "location=" + location + ","; features += "directories=" + directories + ","; features += "status=" + status + ","; features += "scrollbars=1,"; // always use scrollbars features += "resizable=" + resizable + ","; features += left + "," + top; /* ** To avoid javascript error for window name if it contains multiple words, remove all spaces ** between words to make it as a single word. */ var thisWindow = window.open( address, removeNonAlphaNumericChars(name), 'width=' + width + ',height=' + height + ',"' + features + '"'); thisWindow.focus(); } function openWindow(address, width, height) { height = 550; //NOTE - HEIGHT is overridden to 550 for Team Express var newWindow = window.open( address, 'Popup_Window', 'width=' + width + ',height=' + height + ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no'); newWindow.focus(); } // printableWindow was added so different width could be used and scrollbars could be turned on function printableWindow(address) { height = 600; //NOTE - HEIGHT is set to 600 for the printable window width = 540; //NOTE - WIDTH is set to 540, which is the equivalent of a 7.5 inch width when printed var newWindow = window.open( address, 'Popup_Window', 'width=' + width + ',height=' + height + ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no'); newWindow.focus(); } /** * Function to remove all non alpha numeric character from a given string * and return the modified string. If there are errors return the given string as is */ function removeNonAlphaNumericChars(string) { if (typeof(string) != 'string') { return string; } var modifiedString = ""; var tempChar; for (i = 0; i < string.length; i++) { var tempChar = string.charAt(i); if ((tempChar >= '0' && tempChar <= '9') || (tempChar >= 'a' && tempChar <= 'z') || (tempChar >= 'A' && tempChar <= 'Z')) { modifiedString += tempChar; } } if (modifiedString != "") { return modifiedString; } else { return string; } } function confirmWindow(url, text) { if (confirm(text)) { window.go = url; window.location = url; } } function buildBreadCrumb(pageName, secondaryLinkName, secondaryLinkURL, thirdLinkName, thirdLinkURL ) { //we assume here that there is more than home to show if (document.getElementById("breadcrumb")) { var breadcrumb = "Home / "; if (secondaryLinkURL != null) { breadcrumb += "" + secondaryLinkName + " / "; } if (thirdLinkURL != null) { breadcrumb += "" + thirdLinkName + " / "; } breadcrumb += "" + pageName + ""; document.getElementById("breadcrumb").innerHTML = breadcrumb; } } /* * The following 3 functions handle the image rollovers. */ function MM_swapImgRestore() { //v3.0 var i; var x; var a = document.MM_sr; for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) { x.src = x.oSrc; } } function MM_findObj(n, d) { //v4.01 var p; var i; var 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.layers && i < d.layers.length; i++) { x = MM_findObj(n, d.layers[i].document); } if (!x && d.getElementById) { x = d.getElementById(n); } return x; } function MM_swapImage() { //v3.0 var i; var j = 0; var x; var a = MM_swapImage.arguments; document.MM_sr = new Array; for (i = 0; i < (a.length - 2); i += 3) { if ((x = MM_findObj(a[i])) != null) { document.MM_sr[j++] = x; if (!x.oSrc) { x.oSrc = x.src; } x.src = a[i + 2]; } } } /* ** This function loads a popup page given a user's email address. ** The idea is to popup a dialog box that loads a predetermined page from ResponseSys ** ** URL, email ** returns nothing. */ function emailSignUpPopup(url, emailAddress) { var winWidth = 700; var winHeight = 450; var winLeft = (screen.width-winWidth)/2; var winTop = (screen.height-winHeight)/2; if (emailAddress != null) { url = url + '&emailAddress=' + emailAddress; newWindow(url, winWidth, winHeight, 'resizable', 'ResponseSys'); } } //email validation and post to command specified in form function emailSignUpPost(emailFieldName, form, postEmail) { var invalidEmailMessage = "Please enter a valid email address."; // var thisForm = document.getElementById(formName); var emailAddressField = document.getElementById(emailFieldName); var emailAddress = emailAddressField.value; var valid = validateEmail(emailAddress); if (postEmail == "n") { return valid; } //input validated, submit the form if ((valid == true) && (postEmail == "y")) { form.submit(); } //input invalid, alert if ((valid == false) && (postEmail == "y")) { alert(invalidEmailMessage); } } //Email Validation function validateEmail(str) { var at = "@" var dot = "." var lat = str.indexOf(at) var lstr = str.length var ldot = str.indexOf(dot) if (str.indexOf(at) == -1) { return false } if (str.indexOf(at) == -1 || str.indexOf(at) == 0 || str.indexOf(at) == lstr) { return false } else if (str.indexOf(dot) == -1 || str.indexOf(dot) == 0 || str.indexOf(dot) == lstr) { return false } else if (str.indexOf(at, (lat + 1)) != -1) { return false } else if (str.substring(lat - 1, lat) == dot || str.substring(lat + 1, lat + 2) == dot) { return false } else if (str.indexOf(dot, (lat + 2)) == -1) { return false } else if (str.indexOf(" ") != -1) { return false } return true }