colorDropdownId = ""; sizeDropdownId = ""; function swatchSetup() { // setup the large image and change of drop-down colorDropdownId = "#Color" + $("#widget-product-swatches").attr("class").split("-")[1] + "Variants"; sizeDropdownId = "#Size" + $("#widget-product-swatches").attr("class").split("-")[1] + "Variants"; $("#widget-product-swatches img").each(function(i) { $(this).unbind("click").click(function(evt) { updateColorDropdown($(this).attr("alt")); }); }); $(sizeDropdownId).change(function() { setTimeout(function() { changeSwatch(); }, 10); }); $(colorDropdownId).change(function() { if( $(this).val() != "" ) { $("#widget-product-swatches img").removeClass('cat-prod-swatch-border'); newColor = $(this).val(); nImageSRC = ""; $(".cat-pro-swatch").each(function(i) { if( $(this).attr("alt") == newColor ) { $(this).addClass('cat-prod-swatch-border'); setColor(i, "#cat-prod-flash-alt-views", product_imagset, product_imagset_index); activeSwatchId = i; } }); } }); changeSwatch(); if( $(colorDropdownId).size() > 0 ){ $(colorDropdownId).change(); updateColorDropdown( $(colorDropdownId).val() ); } }; function changeSwatch() { resetSwatches(); $(colorDropdownId + " option").each(function() { showSwatch( $(this).val() ); }); $(colorDropdownId).width(150); //If IE, implement ieSelectFix function below, don't set width here if(!jQuery.browser.msie){ $(sizeDropdownId).width(150); } }; function showSwatch(color) { $(".cat-pro-swatch[alt=" + color + "]").show(); }; function updateColorDropdown(color) { if( $(colorDropdownId).size() > 0 ){ $(colorDropdownId).val(color); $(colorDropdownId).change(); __getDropdownSupport(document.getElementById(colorDropdownId.split("#")[1])).updateListsNew(document.getElementById(colorDropdownId.split("#")[1])); __getDropdownSupport(document.getElementById(colorDropdownId.split("#")[1])).setVariantField(); } }; function updateChars() { var limit = 180; var text = $('#personalMessageTextAreaId').val(); var textlength = text.length; if(textlength > limit) { $('#charsRemaining').html('0'); $('#personalMessageTextAreaId').val(text.substr(0, limit)); return false; }if(textlength == limit) { $('#charsRemaining').html('0'); return true; } else { $('#charsRemaining').html((limit - textlength)); return true; } } var BVisLoaded = false; function BVcheckLoadState() { if(!BVisLoaded) { var page = document.getElementById('BVFrame').src; document.getElementById('BVFrame').src='http://reviews.express.com/logging?page=' + escape(page); document.getElementById('BVReviewsContainer').innerHTML = ''; } } function bvLoadRR() { var bvPage = 'http://reviews.express.com/6549/' + "/P-" + 18199 + '/reviews.htm?format=embedded'; var bvReviewIDName = 'featurereview'; var bvReviewIDRegex = new RegExp('[?&]' + bvReviewIDName + '=([^&#]+)'); var bvReviewIDMatch = bvReviewIDRegex.exec(window.location.search); var bvReviewID = bvReviewIDMatch ? decodeURIComponent(bvReviewIDMatch[1]) : null; document.getElementById('BVFrame').src = /^[0-9]+$/.test(bvReviewID) ? bvPage + '&reviewid=' + bvReviewID : bvPage; //Timeout for review load. Consider reviews unavailable if not loaded within 15 seconds setTimeout("BVcheckLoadState()", 15000); } function resetSwatches() { $(".cat-pro-swatch").hide(); }; function updateFromLarger(i,color) { setColor(i, "#cat-prod-flash-alt-views", product_imagset, product_imagset_index); updateColorDropdown(color) }; var inited = false; function updateIFrameCSS () { if(navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) <= 6) { if(!inited) { var x = document.getElementsByTagName("iframe"); for(i=0; i < x.length; ++i) { id = x[i].id + ""; if(id.charAt(0) == "a" && id.charAt(1) == "t"){ $(x[i]).css("width", "800px"); $(x[i]).css("height", "640px"); inited = true; } } } } } var addthis_pub = "snicholas"; var addthis_share = { url: 'http://www.express.com/luxury-stretch-ruffle-pencil-skirt-18199-23.pro', title: 'EXPRESS: LUXURY STRETCH RUFFLE PENCIL SKIRT', content: '' }; var addthis_config = { ui_cobrand: 'Express', ui_hover_direction: -1, ui_click: true, data_track_linkbacks: 'true' } $(function() { bvLoadRR(); var activeSwatchId = -1; var originalWidth = 0; var nowWidth = 0; $(".cat-pro-but-add-basket").widgetButton({ cssButton: 1 }); $(".cat-pro-but-add-basket").parent().click(function() {addToCart();}); exp.utils.jsLink( $(".cat-pro-but-add-basket").parent() ); $(".cat-prod-related-item").hover( function() { $(".cat-pro-related-item-info", this).show(); }, function() { $(".cat-pro-related-item-info", this).hide(); } ); $(".cat-pro-related-item-info").mouseover(function() { $(".glo-related-items-ima", $(this).parent()).mouseover(); }); function setAddTo(addToType) { document.productForm.addTo.value = addToType; } //set the swatches setTimeout(function() { if( $("#widget-product-swatches").size() > 0 ) { resetSwatches(); swatchSetup(); } },15); // popup link for view larger info exp.utils.popupLink("#cat-pro-con-img .widget-popup-window", { width: 800, height: 650, scrollbars: 0 }); // popup link for email a friend exp.utils.popupLink("#cat-pro-con-detail .widget-popup-window", { width: 666, height: 540, scrollbars: 1 }); // popup link for size chart exp.func.sizeChartSetup("#cat-pro-con-detail .widget-popup-window-sc"); // popup link for product alt images exp.utils.popupLink("#cat-pro-con-img .widget-popup-window-alt", { width: 600, height: 650, scrollbars: 0 }); if ($.browser.msie) { $("select[id^=Color]").bind("mouseover", function(){ originalWidth = $(this).css("width"); originalWidth = originalWidth.substring(0, originalWidth.indexOf('px')); $(this).css("width", "auto"); nowWidth = $(this).width(); if( nowWidth < originalWidth ) { $(this).width(originalWidth + "px"); } }); } }); /***********************************************/ 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 = "235"; //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); //reset size chart $('.widget-popup-window-sc').removeAttr('style'); } }; var expand = function() { if (qualifies(this)) { $(this).css("width",expandedW); $(this).bind("blur mouseleave", contract); //hide size chart $('.widget-popup-window-sc').css('display', 'none'); } 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(); } });