//set some omniture defaults a
var products = "";
function showTabCom(objComDivId) {
var imgPath = "/assets/images/shopping/"
var objComDivArr = new Array("tab-more-info","tab-files","tab-review","tab-email-friend","tab-products");
for (i = 0; i < objComDivArr.length; i++) {
if (document.getElementById(objComDivArr[i] + "-img")) {
document.getElementById(objComDivArr[i] + "-img").src = imgPath + objComDivArr[i] + "-off.gif";
document.getElementById(objComDivArr[i]).style.display = "none";
}
}
document.getElementById(objComDivId + "-img").src = imgPath + objComDivId + ".gif";
document.getElementById(objComDivId).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".
*
* 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.
*/
var newWindow = '';
function openWindow(address, width, height,features)
{
if (!newWindow.closed && newWindow.location) {
newWindow.close();
}
/* Find out what features need to be enable
*
*/
if(features)
features = features.toLowerCase();
else
features = "";
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 scrollbars = (features == "all" ? 1 : 0);
var resizable = (features == "all" ? 1 : 0);
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] == "scrollbars")
scrollbars = 1;
else if(feature[i] == "resizable")
resizable = 1;
}
}
features = "toolbar=" + toolbar + ",";
features += "menubar=" + menubar + ",";
features += "location=" + location + ",";
features += "directories=" + directories + ",";
features += "status=" + status + ",";
features += "scrollbars=" + scrollbars + ",";
features += "resizable=" + resizable;
newWindow = window.open(address, 'Popup_Window', 'width=' + width + ',height=' + height + ',"' + features + '"');
newWindow.focus();
}
function confirmWindow(url, text) {
if (confirm(text)) {
window.go = url;
window.location = url;
}
}
function setOperation(opType,needSubmit,addressIndex) {
document.addUpdateDeleteAddressForm.operation.value = opType;
if(addressIndex)
document.addUpdateDeleteAddressForm.selectedAddressIndex.value = addressIndex;
if(needSubmit) {
if(opType == "EDIT")
window.location='/user/address_book.jsp?addressIndex=' + addressIndex;
else
document.addUpdateDeleteAddressForm.submit();
}
}
function setAddTo(addToType) {
document.productForm.addTo.value = addToType;
}
// This is an example of sending product data from the server
// to the client, then formatting the variants on the client-side
// based on certain criteria.
function cbFormatter(list, attribute, opt)
{
// Get the price for this variant.. If this is the primary list, get all related
// variants from the group and get their prices as well so we can build a range.
var pvds = list.productVariantDropdownSupport;
// Get all of the product variants for this attribute
var variantGroup = attribute.getVariant().getProductVariantGroup();
var groupVariants = variantGroup.getAllVariants()
// Are all of the prices the same within the group?
var lowGroupPrice = 999999.00;
var highGroupPrice = -1.00;
for (var idx = 0; idx < groupVariants.length; idx++)
{
lowGroupPrice = groupVariants[idx].numericPrice < lowGroupPrice ? groupVariants[idx].numericPrice : lowGroupPrice;
highGroupPrice = groupVariants[idx].numericPrice > highGroupPrice ? groupVariants[idx].numericPrice : highGroupPrice;
}
// Are all of the prices the same within the variant?
var variants = variantGroup.getVariantsMatching(attribute.name, attribute.value);
var lowVariantPrice = 999999.00;
var highVariantPrice = -1.00;
var lowVariantDisplay = variants[0].displayPrice;
var highVariantDisplay = variants[0].displayPrice;
for (var idx = 0; idx < variants.length; idx++)
{
// Display really needs to be done before the re-assignment...
lowVariantDisplay = variants[idx].numericPrice < lowVariantPrice ? variants[idx].displayPrice : lowVariantDisplay;
lowVariantPrice = variants[idx].numericPrice < lowVariantPrice ? variants[idx].numericPrice : lowVariantPrice;
highVariantDisplay = variants[idx].numericPrice > highVariantPrice ? variants[idx].displayPrice : highVariantDisplay;
highVariantPrice = variants[idx].numericPrice > highVariantPrice ? variants[idx].numericPrice : highVariantPrice;
}
if (lowGroupPrice != highGroupPrice)
{
// secondary list should display price if the variants have different pricing
if (!pvds.isPrimary)
opt.text = opt.text + " - " + attribute.getVariant().displayPrice;
}
return opt;
}
/* This function is called when a subject is changed so that actual subject text can be
* stored in to a hidden subject field. Since value of the subject list is a keyword define
* in the command configuration file to identify it's email address.
*/
function setSubject(thisRef)
{
var formRef = document.forms["contactUsForm"];
//set subject value
formRef.elements["subject"].value = (thisRef.options[thisRef.selectedIndex]).text;
}
/**
* These functions make it possible to make the forms a bit more interactive
*/
function setClass(field, addClass, removeClass) {
if (document.documentElement){
if(!field.className)
field.className = '';
var clsnm = field.className;
if(clsnm.match(removeClass))
clsnm = clsnm.replace(removeClass,addClass);
else if(!clsnm.match(addClass))
clsnm = clsnm + " " + addClass + " ";
field.className = clsnm;
}
}
function makeCurrent(field) {
setClass(field, "form-field-current", "form-field-normal");
}
function makeNormal(field) {
setClass(field, "form-field-normal", "form-field-current");
}
function styleToggle(rdoVar) {
for ( var i = 0; i < rdoVar.form.length; i++){
if (rdoVar.form[i].name == rdoVar.name) {
if(rdoVar.form[i].checked) {
setClass(rdoVar.form[i].parentNode, "form-field-radio-on", "form-field-radio-off");
} else {
setClass(rdoVar.form[i].parentNode, "form-field-radio-off", "form-field-radio-on");
}
}
}
}
var doc = function() {
if (self.innerHeight) {
doc.pageYOffset = self.pageYOffset;
doc.pageXOffset = self.pageXOffset;
doc.innerHeight = self.innerHeight;
doc.innerWidth = self.innerWidth;
} else if (document.documentElement && document.documentElement.clientHeight) {
doc.pageYOffset = document.documentElement.scrollTop;
doc.pageXOffset = document.documentElement.scrollLeft;
doc.innerHeight = document.documentElement.clientHeight;
doc.innerWidth = document.documentElement.clientWidth;
} else if (document.body) {
doc.pageYOffset = document.body.scrollTop;
doc.pageXOffset = document.body.scrollLeft;
doc.innerHeight = document.body.clientHeight;
doc.innerWidth = document.body.clientWidth;
}
return doc;
};
function getMouseCoord(e){
(!e) ? e = window.event : e = e;
objDoc = new doc();
(e.pageX) ? objDoc.pageX = e.pageX : objDoc.pageX = e.clientX + objDoc.scrollLeft;
(e.pageY) ? objDoc.pageY = e.pageY : objDoc.pageY = e.clientY + objDoc.scrollTop;
return [e.pageX,e.pageY];
}
/**
* Utility method to clear text fields with user action such as onClick.
*/
function clearDefaultText(field) {
field.value = "";
}
/*
* This is used to set the starting position of Recently Viewed on the Section Landing page
* based on the height of the main content image.
*
* The initial value is 490
* If the image on the Section Landing page is taller than 490px then the value is set to that height.
* The element "#sectionMain" is a table cell on section_body.jsp
*/
{
$(document).ready(function setRecentlyViewed(minValue){
minValue = "490";
var newHeight = $("#sectionMain").height();
if (newHeight < minValue){
newHeight = minValue;
}
if (jQuery.browser.msie && jQuery.browser.version < 7){
$("#leftNav").height(newHeight);
} else {
$("#leftNav").css("min-height",newHeight);
}
return;
});
}
/*
* This function will load the specified URL into the original window from where the current popup was launched.
* The second parameter will set focus on the opener window. It is optional and will default to false.
* The third parameter will close the popup window. It is optional and will default to false. If this parameter
* is passed, then the setOpenerFocus will be required.
*/
function redirectOpener(url, setOpenerFocus, closeWindow) {
window.opener.location = url;
if ((setOpenerFocus != null) && (setOpenerFocus)) {
window.opener.focus();
}
if ((closeWindow != null) && (closeWindow)) {
window.close();
}
}
function SetCookie (name, value, expires, path, domain, secure) {
// set time, it's in milliseconds
var today = new Date();
today.setTime( today.getTime() );
// if the expires variable is set, make the correct
// expires time, the current script below will set
// it for x number of days, to make it for hours,
// delete * 24, for minutes, delete * 60 * 24
if (expires) {
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );
document.cookie = name + "=" + escape (value) +
((expires) ? "; expires=" + expires_date.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}
function emailSignUp()
{
if (document.subscribeForm.userEmail.value=='sign up for email here'){
document.subscribeForm.userEmail.value='';
}
email=document.subscribeForm.userEmail.value;
targetURL='http://ebm.cheetahmail.com/r/regf2?aid=272412835&a=0&email=' + email;
window.open(targetURL,'signup','top=1,left=1,directories=no,hotkeys=no,location=no,menubar=no,resizable=no,status=no,toolbar=no,width=542,height=550');
//alert(targetURL +email);
return false;
}
/**
* Utility method to build the Content Pages breadcrumbs.
*/
function buildBreadCrumb(breadCrumbName1, breadCrumbURL1, breadCrumbName2, breadCrumbURL2, breadCrumbName3, breadCrumbURL3, breadCrumbName4) {
// Open the breadcrumb container.
var breadCrumb = "";
// Build site level breadcrumb. Use this if you need the first link to be HOME
//breadCrumb += "Home";
// Build first level breadcrumb.
if (breadCrumbName1 != null && breadCrumbName1 != "") {
if (breadCrumbURL1 != null && breadCrumbURL1 != "") {
breadCrumb += "" + breadCrumbName1 + "";
} else {
breadCrumb += "" + breadCrumbName1 + "";
}
}
// Build second level breadcrumb.
if (breadCrumbName2 != null && breadCrumbName2 != "") {
if (breadCrumbURL2 != null && breadCrumbURL2 != "") {
breadCrumb += " > " + breadCrumbName2 + "";
} else {
breadCrumb += " > " + breadCrumbName2 + "";
}
}
// Build third level breadcrumb.
if (breadCrumbName3 != null && breadCrumbName3 != "") {
if (breadCrumbURL3 != null && breadCrumbURL3 != "") {
breadCrumb += " > " + breadCrumbName3 + "";
} else {
breadCrumb += " > " + breadCrumbName3 + "";
}
}
// Build forth level breadcrumb.
if (breadCrumbName4 != null && breadCrumbName4 != "") {
breadCrumb += " > " + breadCrumbName4 + "";
}
// Close the breadcrumb container. Only if you opened it from above.
//breadCrumb += "";
// Insert HTML into breadcrumbWrapper div.
$("#breadcrumb").html(breadCrumb);
}
/** ********************************************
*/
var ieSelectFix = function($) {
/*
****
presumes the following classes:
.expandMe - apply to all select elements that should be monitored,
THIS CLASS SHOULD ALSO CONTAIN THE CONTRACTED WIDTH VALUE, other style settings can be added here as well
the following vars need to be set:
expandedW - the width of the expanded state of the select (usually auto)
Each select menu needs to have a unique ID in order to keep track of which one is currently focused
****
*/
var expandedW = "auto"; //generally set to auto
var currentFocus = null;
var qualifies = function(el) {
var qualified = false;
if ($(el).hasClass("qualified")) {
qualified = true; // prevents rechecking elements
} else {
if (el.options.length > 0) {
var defaultLen = el.options[0].text.length;
for (i=1; i<=(el.options.length - 1); i++)
{
//we can skip [0] since that is the default
if (el.options[i].text.length > defaultLen) {
qualified = true;
$(el).addClass("qualified");
break;
}
}
}
}
if (qualified)
return true;
else
return false;
};
var contract = function() {
if (this.id != currentFocus) {
//this check keeps the focused element expanded but allows hovered (but not focused) els to contract
//if the element is hovered and focused, it will be contracted via the blur event
$(this).css("width","");
$(this).unbind("blur mouseleave", contract);
}
};
var expand = function() {
if (qualifies(this)) {
$(this).css("width",expandedW);
$(this).bind("blur mouseleave", contract);
} else {
// stop trying if it fails
$(this).unbind("mouseenter focus", expand);
}
};
var focused = function() {
currentFocus = this.id;
};
var blurred = function() {
currentFocus = null;
};
return {
init : function() {
$('.expandMe').bind("mouseenter focus", expand);
$('.expandMe').bind("focus", focused);
$('.expandMe').bind("blur", blurred);
}
};
}($);
$(document).ready(function(){
if(jQuery.browser.msie){
ieSelectFix.init();
}
});