MESSAGES













$’+grilleToolData.config.speaker.price.toFixed(2)+”
}
}

//populate mount loc html
var mountLoc = ”;
if(grilleToolData.config.custom==false && grilleToolData.config.displayAttrId!=undefined){
mountLoc = ‘Fit To Display’;
}else if(grilleToolData.config.custom==true && grilleToolData.config.displayAttrId==undefined){
mountLoc = ‘Custom’;
}else if(grilleToolData.config.custom==false && grilleToolData.config.displayAttrId==undefined){
mountLoc = ‘Fit to Speaker’
}
grilleDiv+=’

‘+ ‘Mounting Location :

‘ + mountLoc + ‘

‘;

// populate make/model html
if(grilleToolData.customDisplay.make!=undefined || grilleToolData.config.displayMake!=undefined){
var makeLabel = ”;
var modelLabel = ”;
if(grilleToolData.config.displayMake!=undefined){
makeLabel = grilleToolData.config.displayMake;
modelLabel = grilleToolData.config.displayModel;
}else if(grilleToolData.customDisplay.make!=undefined){
makeLabel = grilleToolData.customDisplay.make;
modelLabel = grilleToolData.customDisplay.model;
}
grilleDiv+=’

‘+ ‘Make : ‘ + ‘

‘+ makeLabel +’

‘;
grilleDiv+=’

‘+ ‘Model : ‘ + ‘

‘+ modelLabel +’

‘;
}

// populate grille data
var unitLabel = ‘ “‘;
if (grilleToolData.config.displayUnitOfMeasure == ‘Centimeters’) unitLabel = ‘ cm’;

if(grilleToolData.config.height!=undefined && grilleToolData.config.speaker.grilleReq == ‘LCR MK2′) {
grilleDiv+=’

‘+ ‘Display Height : ‘ + ‘

‘+ grilleToolData.config.height + unitLabel + ‘

‘;
}
if(grilleToolData.config.width!=undefined && grilleToolData.config.speaker.grilleReq == ‘Studio Soundbar’) {
grilleDiv+=’

‘+ ‘Display Width : ‘ + ‘

‘+ grilleToolData.config.width + unitLabel + ‘

‘;
}

// populate grille data
if(grilleToolData.config.speaker.grilleReq==’LCR MK2’){
var isCurved = ‘Yes’;
if(grilleToolData.config.curved==false) isCurved = ‘No’;
grilleDiv+=’

‘+ ‘Curve? :

‘+ isCurved + ‘

‘;
}

// populate notch data
if(grilleToolData.config.speaker.grilleReq==’Studio Soundbar’){
if(grilleToolData.config.hasInsigniaNotch==’Yes’){
grilleDiv+=’

‘+ ‘Has Insignia Notch? :

Yes

‘;
grilleDiv+=’

‘+ ‘Insignia Notch Height : ‘+ ‘

‘+ grilleToolData.config.insigniaNotchHeight + unitLabel +’

‘;
grilleDiv+=’

‘+ ‘Insignia Notch Width : ‘+ ‘

‘+ grilleToolData.config.insigniaNotchWidth + unitLabel + ‘

‘;
}else{
grilleDiv+=’

‘+ ‘Has Insignia Notch? :

No

‘;
}
if(grilleToolData.config.hasIRNotch==’Yes’){
grilleDiv+=”;
grilleDiv+=’

‘+ ‘IR Notch Offset : ‘+ ‘

‘+ grilleToolData.config.irNotchOffset + unitLabel +’

‘;
grilleDiv+=’

‘+ ‘IR Notch Height : ‘+ ‘

‘+ grilleToolData.config.irNotchHeight + unitLabel +’

‘;
grilleDiv+=’

‘+ ‘IR Notch Width : ‘+ ‘

‘+ grilleToolData.config.irNotchWidth + unitLabel +’

‘;
}else{
grilleDiv+=”;
}
}

grilleDiv+=’

‘;

grilleDiv+=’‘;
grilleDiv+=’

‘;
$(‘#productOutput’).append(grilleDiv);
if (grilleToolData.config.grille.price!=undefined){
total += grilleToolData.config.grille.price;
priceDiv += ‘

Grille:$’+grilleToolData.config.grille.price.toFixed(2)+’


}
}

if(grilleToolData.config.mount!=undefined){
var mountDiv=”;
mountDiv+=’

Recommended Mount
‘;
mountDiv+=grilleToolData.config.mount.prodName + ‘

‘;

$(‘#productOutput’).append(mountDiv);

}

var tvDisplay = ”

var grilleHeight = 0.0;
var speakerHeight = 0.0;
var grilleWidth = 0.0;
var speakerWidth = 0.0;

if(grilleToolData.config.speaker!=undefined){
grilleHeight = grilleToolData.config.height !=undefined ? grilleToolData.config.height : 0.0;
speakerHeight = grilleToolData.config.speaker.speakerHeight !=undefined ? grilleToolData.config.speaker.speakerHeight : 0.0;
grilleWidth = grilleToolData.config.width !=undefined ? grilleToolData.config.width : 0.0;
speakerWidth = grilleToolData.config.speaker.speakerWidth !=undefined ? grilleToolData.config.speaker.speakerWidth : 0.0;
}

if (grilleToolData.config.displayUnitOfMeasure == ‘Centimeters’) {
grilleHeight=grilleHeight.toString()+’cm’;
speakerHeight = (speakerHeight*2.54).toFixed(3);
speakerHeight=(+speakerHeight).toString()+’cm’;
grilleWidth=grilleWidth.toString()+’cm’;
speakerWidth = (speakerWidth*2.54).toFixed(3);
speakerWidth=(+speakerWidth).toString()+’cm’;
}else{
grilleHeight=grilleHeight.toString()+'”‘;
speakerHeight=speakerHeight.toString()+'”‘;
grilleWidth=grilleWidth.toString()+'”‘;
speakerWidth=speakerWidth.toString()+'”‘;
}

if(grilleToolData.config.speaker!=undefined){
if(grilleToolData.config.speaker.grilleReq==’LCR MK2’){
tvDisplay+= ‘

‘;
tvDisplay+= ‘

‘;
tvDisplay+= ‘‘;
tvDisplay+= ”;
tvDisplay+= ‘‘;
tvDisplay+= ‘

‘;
tvDisplay+= ‘

‘;
tvDisplay+= ”;
tvDisplay+= ‘‘;
tvDisplay+= ”;
tvDisplay+= ‘‘;
tvDisplay+= ”;
tvDisplay+= ‘

‘;
tvDisplay += ‘

‘;
tvDisplay+= ‘

Display

‘;
tvDisplay+= ‘

‘;
tvDisplay+= ‘

‘;
tvDisplay+= ”;
tvDisplay+= ‘‘;
tvDisplay+= ”;
tvDisplay+= ‘‘;
tvDisplay+= ”;
tvDisplay+= ‘

‘;
tvDisplay+= ‘

‘;
tvDisplay+= ‘‘;
tvDisplay+= ”;
tvDisplay+= ‘‘;
tvDisplay+= ‘

‘;
tvDisplay+= ‘

‘;
tvDisplay+= ‘

‘;
tvDisplay+= ‘

Speaker: ‘ + speakerHeight + ‘
Grille: ‘ + grilleHeight + ‘

‘;
tvDisplay+= ‘

Speaker: ‘ + speakerHeight + ‘
Grille: ‘ + grilleHeight + ‘

‘;
tvDisplay+= ‘

‘;
}

if(grilleToolData.config.speaker.grilleReq==’Studio Soundbar’){
tvDisplay+= ‘

‘;
tvDisplay += ‘

‘;
tvDisplay+= ‘

Display

‘;
tvDisplay+= ‘

‘;
tvDisplay+= ‘

‘;
tvDisplay+= ”;
tvDisplay+= ‘

‘;
tvDisplay+= ‘‘;
tvDisplay+= ‘

Speaker: ‘ + speakerWidth + ‘

‘;
tvDisplay+= ‘‘;
tvDisplay+= ‘

‘;
tvDisplay+= ”;
tvDisplay+= ‘

‘;
tvDisplay+= ‘

‘;
tvDisplay+= ‘‘;
tvDisplay+= ‘

Grille: ‘ + grilleWidth + ‘

‘;
tvDisplay+= ‘‘;
tvDisplay+= ‘

‘;
tvDisplay+= ‘

‘;
}
}

$(‘#imageOutput’).append(tvDisplay);

setErrors();
}

function setErrors(){

if(grilleToolData.config.errors!=undefined){
if(grilleToolData.config.errors.length<1 || (grilleToolData.config.errors.length==1 && grilleToolData.config.errors.toString() == 'differentGrille' && $('#dimensionsAccept').is(':checked'))) { $('#dimensionsDisplay').css('display', 'none'); $('#dimensionsAccept').removeAttr('checked'); $('#dimensionsAccept').parent().removeClass('labelCheckChecked'); if(currentStep==2) { displayStep3(); if (differentGrille) { alert('We have updated the grille in your shopping cart.'); } differentGrille = false;if ($('input[name=grilleMeasurement]:checked').val() == 'fitDisplay') { Visualforce.remoting.Manager.invokeAction( 'GrilleToolExt.saveDisplayAttributes', grilleToolData, function(result, event){ if (event.status) { if (grilleToolData.config.displayAttrId != result.Id) { grilleToolData.config.displayAttrId = result.Id; }Visualforce.remoting.Manager.invokeAction( 'GrilleToolExt.resolveGrilleConfig', grilleToolData.config, true, function(result, event){ if (!event.status) { alert('An exception has occurred, Please contact your Inside Sales Associate.'); } },{escape: true} ); }else{ alert('An exception has occurred, Please contact your Inside Sales Associate.'); } },{escape: true} ); } } return; }else{ displayStep2(); if (grilleToolData.config.errors.toString() == 'differentGrille') { $('#dimensionsDisplay').css('display', 'block'); }else{ $('#errorDisplay').text(grilleToolData.config.errors.toString()); } validateStep2(); } $('#productOutput').empty(); }else{ if(currentStep==2) displayStep3(); return; } }var newCartId = '';function addToCart(){ $('.addToCartButton').prop('disabled', 'disabled'); var cartId = $('input[name=cartChoice]:checked').val(); displayLoader('Adding items to cart...'); buildConfig();var product2toAdd = [];$("#productOutput").find("input:checked").each(function (i, ob) { product2toAdd.push(ob.value); }); grilleToolData.products=product2toAdd;if ($('#newCartCartListText').is(':visible')) { var cartName = $('#newCartCartListName').val(); if (cartName == null || cartName.trim() == '') { $('#createCartModalError').text('Please enter a cart name'); $('.addToCartButton').removeProp('disabled'); return; } if (cartName.lastIndexOf(' ', 0) === 0 || cartName.lastIndexOf('t', 0) === 0) { $('#createCartModalError').text('Cart name can't start with a space'); $('.addToCartButton').removeProp('disabled'); return; } var pattern = new RegExp(/[~`!#$%^&*+=-[]\';,/{}|\":<>?]/); //unacceptable chars
if (pattern.test(cartName)) {
$(‘#createCartModalError’).text(‘Cart name can’t contain a special character’);
$(‘.addToCartButton’).removeProp(‘disabled’);
return;
}
Visualforce.remoting.Manager.invokeAction(
‘GrilleToolExt.createNewCart’,
cartName,
function(response, event){
if (response==’duplicatecartexist’){
$(‘#createCartModalError’).text(‘Cart name must be unique’);
$(‘.addToCartButton’).removeProp(‘disabled’);
return;
}

grilleToolData.config.cartId = response;
newCartId = response;
manifestToCart();
$(‘#createCartModalError’).text(”);
},{escape:false}
);
}else {
if (cartId == null || cartId.trim() == ”) {
alert(‘Please select a cart’);
$(‘.addToCartButton’).removeProp(‘disabled’);
}else{
grilleToolData.config.cartId = cartId;
manifestToCart();
}
}

}

function displayStep1(){
$(‘.step1’).css(‘display’, ‘block’);
$(‘.step2’).css(‘display’, ‘none’);
$(‘.step3’).css(‘display’, ‘none’);
$(‘#loaderPage’).css(‘display’, ‘none’);
currentStep = 1;
}

function displayStep2(){
$(‘.step1’).css(‘display’, ‘none’);
$(‘.step2’).css(‘display’, ‘block’);
$(‘.step3’).css(‘display’, ‘none’);
$(‘#loaderPage’).css(‘display’, ‘none’);
currentStep = 2;
}

function displayStep3(){
$(‘.step1’).css(‘display’, ‘none’);
$(‘.step2’).css(‘display’, ‘none’);
$(‘.step3’).css(‘display’, ‘block’);
$(‘#loaderPage’).css(‘display’, ‘none’);

if(grilleToolData.config.manufacturer==true){
$(‘#step3SendToManufacture’).css(‘display’,’block’);
}
currentStep = 3;
}

function displayLoader(loadingText){
$(‘.loaderMessage’).text(loadingText);
$(‘.step1’).css(‘display’, ‘none’);
$(‘.step2’).css(‘display’, ‘none’);
$(‘.step3’).css(‘display’, ‘none’);
$(‘#loaderPage’).css(‘display’, ‘block’);
}
function validateStep1(){
grilleToolData.config.project = $(‘#ProjectName’).val();
grilleToolData.config.location = $(“#LocationtName”).val();
if ($(‘#LocationtName’).val() && $(‘#ProjectName’).val()) {
$(‘.step1Continue’).removeAttr(“disabled”);
}else{
$(‘.step1Continue’).attr(“disabled”, “disabled”);
}
}
function validateStep2(){
var speakerConfig = false;
if(grilleToolData.config.speaker != undefined && grilleToolData.config.speaker.grilleReq==’Studio Soundbar’){
speakerConfig = $(‘#speakerModel’).val() != ‘Model’ && $(‘#speakerModel’).val() != null && $(‘#color’).val() != ‘Grille Color’ && $(‘#color’).val() != null && $(‘#installLocation’).val() != ‘Mounting Location’ && $(‘#installLocation’).val() != null;
}else{
speakerConfig = $(‘#speakerModel’).val() != ‘Model’ && $(‘#speakerModel’).val() != null && $(‘#color’).val() != ‘Grille Color’ && $(‘#color’).val() != null;
}
var grilleDisplayFit = $(‘input[name=grilleMeasurement]:checked’).val() == ‘fitDisplay’ && $(‘#displayMake’).val() != ‘Make’ && $(‘#displayMake’).val() != null && $(‘#displayModel’).val() != ‘Model’ && $(‘#displayModel’).val() != null;

//Check for Missing Display height and width
var missingDisplayWidth = ($(‘#displayMissingWidthMeasurement’).val() != null && $(‘#displayMissingWidthMeasurement’).val().trim() != ”) || ($(‘#displayMissingWidthFraction’).val() != ‘ ‘ || $(‘#displayMissingWidthFractionTenths’).val() != ‘ ‘);
var missingDisplayHeight = ($(‘#displayMissingHeightMeasurement’).val() != null && $(‘#displayMissingHeightMeasurement’).val().trim() != ”) || ($(‘#displayMissingHeightFraction’).val() != ‘ ‘ || $(‘#displayMissingHeightFractionTenths’).val() != ‘ ‘);
var missingDisplay = $(‘input#displayMissingCheckbox’).is(‘:checked’) && $(‘#displayMissingMake’).val().trim() != ” && $(‘#displayMissingModel’).val().trim() != ” && (missingDisplayHeight) && (missingDisplayWidth);

//Check for User Input Insignia Notch
var missingDisplayInsigniaNotchWidth = ($(‘#insigniaNotchWidthMeasurement’).val() != null && $(‘#insigniaNotchWidthMeasurement’).val().trim() != ”) || ($(‘#insigniaNotchWidthFraction’).val() != ‘ ‘ || $(‘#insigniaNotchWidthFractionTenths’).val() != ‘ ‘);
var missingDisplayInsigniaNotchHeight = ($(‘#insigniaNotchHeightMeasurement’).val() != null && $(‘#insigniaNotchHeightMeasurement’).val().trim() != ”) || ($(‘#insigniaNotchHeightFraction’).val() != ‘ ‘ || $(‘#insigniaNotchHeightFractionTenths’).val() != ‘ ‘);
var missingDisplayInsigniaNotch = (!$(‘#insigniaNotchCheckbox’).is(‘:checked’)) || ($(‘#insigniaNotchCheckbox’).is(‘:checked’) && missingDisplayInsigniaNotchWidth && missingDisplayInsigniaNotchHeight);

//Check for User Input IR Notch
var missingDisplayIRNotchWidth = ($(‘#irNotchWidthMeasurement’).val() != null && $(‘#irNotchWidthMeasurement’).val().trim() != ”) || ($(‘#irNotchWidthFraction’).val() != ‘ ‘ || $(‘#irNotchWidthFractionTenths’).val() != ‘ ‘);
var missingDisplayIRNotchHeight = ($(‘#irNotchHeightMeasurement’).val() != null && $(‘#irNotchHeightMeasurement’).val().trim() != ”) || ($(‘#irNotchHeightFraction’).val() != ‘ ‘ || $(‘#irNotchHeightFractionTenths’).val() != ‘ ‘);
var missingDisplayIRNotchOffset = ($(‘#irNotchOffsetMeasurement’).val() != null && $(‘#irNotchOffsetMeasurement’).val().trim() != ”) || ($(‘#irNotchOffsetFraction’).val() != ‘ ‘ || $(‘#irNotchOffsetFractionTenths’).val() != ‘ ‘);
var missingDisplayIRNotch = (!$(‘#irNotchCheckbox’).is(‘:checked’)) || ($(‘#irNotchCheckbox’).is(‘:checked’) && missingDisplayIRNotchWidth && missingDisplayIRNotchHeight && missingDisplayIRNotchOffset);

var missingDisplayNotch = missingDisplayInsigniaNotch && missingDisplayIRNotch;

//Check for unverified display info
var displayUnverifiedWidth = ($(‘#displayUnverifiedWidthMeasurement’).val() != null && $(‘#displayUnverifiedWidthMeasurement’).val().trim() != ”) || ($(‘#displayUnverifiedWidthFraction’).val() != ‘ ‘ || $(‘#displayUnverifiedWidthFractionTenths’).val() != ‘ ‘);
var displayUnverifiedHeight = ($(‘#displayUnverifiedHeightMeasurement’).val() != null && $(‘#displayUnverifiedHeightMeasurement’).val().trim() != ”) || ($(‘#displayUnverifiedHeightFraction’).val() != ‘ ‘ || $(‘#displayUnverifiedHeightFractionTenths’).val() != ‘ ‘);
var displayUnverifiedInfo = grilleToolData.config.dataVerified || ((!grilleToolData.config.dataVerified) && displayUnverifiedWidth && displayUnverifiedHeight && missingDisplayInsigniaNotch && missingDisplayIRNotch);

var grilleCustomFit = $(‘input[name=grilleMeasurement]:checked’).val() == ‘fitCustom’ && ($(‘#customMeasurement’).val().length > 0 || $(‘#customFraction’).val() != ‘ ‘);
var grilleSpeakerFit = $(‘input[name=grilleMeasurement]:checked’).val() == ‘fitSpeaker’;

var dimensionsAccept = !$(‘#dimensionsDisplay’).is(‘:visible’) || ($(‘#dimensionsDisplay’).is(‘:visible’) && $(‘#dimensionsAccept’).is(‘:checked’));
if (speakerConfig && ((grilleDisplayFit && displayUnverifiedInfo) || (missingDisplay && missingDisplayNotch) || grilleCustomFit || grilleSpeakerFit) && dimensionsAccept) {
$(‘.step2Continue’).removeAttr(“disabled”);
}else{
$(‘.step2Continue’).attr(“disabled”, “disabled”);
}
}
function validateGoToStep3() {
displayLoader(‘Please wait… Building your configuration…’);
buildConfig();
}

function manifestToCart(){

Visualforce.remoting.Manager.invokeAction(
‘GrilleToolExt.manifestToCart3’,
grilleToolData,
function(result, event){
if (event.status) {
$(‘#ChooseCartGrilleDiv’).modal(‘hide’);
alert(‘Custom grille has been added to your shopping cart.’);
initData();
location.reload();
} else {
alert(‘An exception has occurred, Please contact your Inside Sales Associate.’);
}
$(‘.addToCartButton’).removeProp(‘disabled’);
},
{escape: true}
);
}

function selectDisplayFit() {
$(‘.displayGrilleFit’).css(‘display’, ‘block’);
$(‘.customGrilleFit’).css(‘display’, ‘none’);
grilleToolData.config.displayUnitOfMeasure = ‘Inches’;
grilleToolData.config.custom=false;
grilleToolData.config.curved=false;
setConfigDA();
validateStep2();
}

function selectCustomFit() {
$(‘.displayGrilleFit’).css(‘display’, ‘none’);
$(‘.customGrilleFit’).css(‘display’, ‘block’);
grilleToolData.config.custom=true;
grilleToolData.config.displayAttrId = null;
$(‘#dimensionsDisplay’).css(‘display’, ‘none’);
$(‘#displayMakeSearch’).val(”);
$(‘#displayModelSearch’).val(”);
$(‘#displayMake’).val(‘Make’);
$(‘#displayModel’).val(‘Model’);
$(‘#displayMissingCheckbox’).removeProp(‘checked’);
$(‘#displayMissingCheckbox’).parent().removeClass(‘labelCheckChecked’);
$(‘#displayUnverifiedInfo’).css(‘display’, ‘none’);
$(‘#displayMissingInfo’).css(‘display’, ‘none’);
$(‘#displayGrilleHeader’).css(‘display’, ‘block’);
$(‘#makeField’).css(‘display’, ‘block’);
$(‘#modelField’).css(‘display’, ‘block’);

setCustomAttrib();
validateStep2();
}

function selectSpeakerFit() {
$(‘.displayGrilleFit’).css(‘display’, ‘none’);
$(‘.customGrilleFit’).css(‘display’, ‘none’);
grilleToolData.config.displayUnitOfMeasure = ‘Inches’;
grilleToolData.config.custom=false;
grilleToolData.config.displayAttrId = null;
$(‘#dimensionsDisplay’).css(‘display’, ‘none’);
$(‘#displayMakeSearch’).val(”);
$(‘#displayModelSearch’).val(”);
$(‘#displayMake’).val(‘Make’);
$(‘#displayModel’).val(‘Model’);
$(‘#displayMissingCheckbox’).removeProp(‘checked’);
$(‘#displayMissingCheckbox’).parent().removeClass(‘labelCheckChecked’);
$(‘#displayUnverifiedInfo’).css(‘display’, ‘none’);
$(‘#displayMissingInfo’).css(‘display’, ‘none’);
$(‘#displayGrilleHeader’).css(‘display’, ‘block’);
$(‘#makeField’).css(‘display’, ‘block’);
$(‘#modelField’).css(‘display’, ‘block’);

if (grilleToolData.config.speaker != undefined) {
if(grilleToolData.config.speaker.grilleReq==’Studio Soundbar’) {
grilleToolData.config.width = grilleToolData.config.speaker.minWidth;
grilleToolData.config.height = null;
} else {
grilleToolData.config.width = null;
grilleToolData.config.height = grilleToolData.config.speaker.minHeight;
}
}
grilleToolData.config.curved=false;
validateStep2();
}

function setFraction(fraction) {
if (fraction==0.03125) { $(‘#customFraction’).val(‘1/32’); }
else if (fraction==0.0625) { $(‘#customFraction’).val(‘1/16’); }
else if (fraction==0.09375) { $(‘#customFraction’).val(‘3/32’); }
else if (fraction==0.1000) { $(‘#customFractionTenths’).val(‘1/10’); }
else if (fraction==0.1250) { $(‘#customFraction’).val(‘1/8’); }
else if (fraction==0.15625) { $(‘#customFraction’).val(‘5/32’); }
else if (fraction==0.1875) { $(‘#customFraction’).val(‘3/16’); }
else if (fraction==0.2000) { $(‘#customFractionTenths’).val(‘1/5’); }
else if (fraction==0.21875) { $(‘#customFraction’).val(‘7/32’); }
else if (fraction==0.2500) { $(‘#customFraction’).val(‘1/4’); }
else if (fraction==0.28125) { $(‘#customFraction’).val(‘9/32’); }
else if (fraction==0.3000) { $(‘#customFractionTenths’).val(‘3/10’); }
else if (fraction==0.3125) { $(‘#customFraction’).val(‘5/16’); }
else if (fraction==0.34375) { $(‘#customFraction’).val(’11/32′); }
else if (fraction==0.3750) { $(‘#customFraction’).val(‘3/8’); }
else if (fraction==0.4000) { $(‘#customFractionTenths’).val(‘2/5’); }
else if (fraction==0.40625) { $(‘#customFraction’).val(’13/32′); }
else if (fraction==0.4375) { $(‘#customFraction’).val(‘7/16’); }
else if (fraction==0.46875) { $(‘#customFraction’).val(’15/32′); }
else if (fraction==0.5000) { $(‘#customFraction’).val(‘1/2’); $(‘#customFractionTenths’).val(‘1/2’); }
else if (fraction==0.53125) { $(‘#customFraction’).val(’17/32′); }
else if (fraction==0.5625) { $(‘#customFraction’).val(‘9/16’); }
else if (fraction==0.59375) { $(‘#customFraction’).val(’19/32′); }
else if (fraction==0.6000) { $(‘#customFractionTenths’).val(‘3/5’); }
else if (fraction==0.6250) { $(‘#customFraction’).val(‘5/8’); }
else if (fraction==0.65625) { $(‘#customFraction’).val(’21/32′); }
else if (fraction==0.6875) { $(‘#customFraction’).val(’11/16′); }
else if (fraction==0.7000) { $(‘#customFractionTenths’).val(‘7/10’); }
else if (fraction==0.71875) { $(‘#customFraction’).val(’23/32′); }
else if (fraction==0.7500) { $(‘#customFraction’).val(‘3/4’); }
else if (fraction==0.78125) { $(‘#customFraction’).val(’25/32′); }
else if (fraction==0.8000) { $(‘#customFractionTenths’).val(‘4/5’); }
else if (fraction==0.8125) { $(‘#customFraction’).val(’13/16′); }
else if (fraction==0.84375) { $(‘#customFraction’).val(’27/32′); }
else if (fraction==0.8750) { $(‘#customFraction’).val(‘7/8’); }
else if (fraction==0.9000) { $(‘#customFractionTenths’).val(‘9/10’); }
else if (fraction==0.90625) { $(‘#customFraction’).val(’29/32′); }
else if (fraction==0.9375) { $(‘#customFraction’).val(’15/16′); }
else if (fraction==0.96875) { $(‘#customFraction’).val(’31/32′); }
else if (fraction==’clear’ || fraction==0.0) { $(‘#customFraction’).val(‘ ‘); $(‘#customFractionTenths’).val(‘ ‘); }

}

function createDropdowns() {
$(‘.selector’).remove();
$(‘.options’).remove();
$(‘.arrow’).remove();
$(‘.grilleSearch’).remove();
$(“#grilleTool”).find(“select”).each(function() {
var currentSelect = this;
$(currentSelect).css(‘display’, ‘none’);//$(‘#ProjectName’).css(‘display’, ‘none’);
var selectedText = $(currentSelect).find(“:selected”).text();//$(‘#ProjectName’).find(“:selected”).text();
if (!selectedText.trim()) {
selectedText = ‘ ‘;
}
if ($(this).is(‘:disabled’)) {
var customSelect = ‘

    ‘;
    }
    else if (this.id == ‘displayMake’) {
    if (selectedText == ‘Make’) selectedText = ”;
    var customSelect = ‘

      ‘;
      }
      else if (this.id == ‘displayModel’) {
      if (selectedText == ‘Model’) selectedText = ”;
      var customSelect = ‘

        ‘;
        }
        else {
        var customSelect = ‘

          ‘;//’

            ‘;
            }

            $(“#”+currentSelect.id+” > option”).each(function() {//$(“#ProjectName > option”).each(function() {
            var thisText = this.text;
            if (!thisText.trim()) {
            thisText = ‘ ‘;
            }else if (currentSelect.id == ‘displayMake’ || currentSelect.id == ‘displayModel’) {
            if (!$(this).is(‘:disabled’)) {
            customSelect += ‘

          • ‘ + thisText + ‘
          • ‘;
            }
            }else {
            customSelect += ‘

          • ‘ + thisText + ‘
          • ‘;
            }
            });

            customSelect += ‘

          ‘;
          $(‘#’+currentSelect.id+’Select’).append(customSelect);
          });
          }

          function openOptions(element) {
          $(“.options:visible”).each(function() {
          if (element.id+’Options’!=this.id){
          $(this).slideToggle(0);
          $(this).parent().find(‘.arrow’).slideToggle(0);
          }
          });
          $(element).parent().find(“.options li”).each(function() {
          $(this).css(‘display’, ‘block’);
          });
          $(element).parent().find(‘.options’).slideToggle(0);
          $(element).parent().find(‘.arrow’).slideToggle(0);

          }

          function selectOption(element) {
          $(element).parent().find(‘.selector’).click();
          }

          function setSelectValue(element, value, text) {
          $(element).parent().parent().find(‘select’).val(value).change();
          $(element).parent().parent().find(‘.selector’).html(text+’‘);

          }

          function setSelectValueText(element, value, text) {
          $(element).parent().parent().find(‘select’).val(value).change();
          $(element).parent().parent().find(‘input’).val(text);

          }

          function changeMeasurementUnit() {
          $(‘#customMeasurement’).val(”);
          setFraction(‘clear’);
          $(‘#customFractionButton’).html(‘ ‘);
          $(‘#customFractionTenthsButton’).html(‘ ‘);
          if ($(‘#customUnit’).val() == ‘Centimeters’) {
          $(‘#customFractionSelect’).css(‘display’, ‘none’);
          $(‘#customFractionTenthsSelect’).css(‘display’, ‘inline-block’);
          }
          else {
          $(‘#customFractionSelect’).css(‘display’, ‘inline-block’);
          $(‘#customFractionTenthsSelect’).css(‘display’, ‘none’);
          }
          setCustomAttrib();
          }

          function searchdisplayMake(element) {
          if (!$(element).parent().find(‘.options’).is(‘:visible’)) {
          $(element).parent().find(‘.selector’).click();
          }
          var searchTerm = $(element).val().toUpperCase();
          $(element).parent().find(“.options li”).each(function() {
          if ($(this).text().toUpperCase().indexOf(searchTerm) !== -1) {
          $(this).css(‘display’, ‘block’);
          }
          else {
          $(this).css(‘display’, ‘none’);
          }
          });
          }

          function searchdisplayModel(element) {
          if (!$(element).parent().find(‘.options’).is(‘:visible’)) {
          $(element).parent().find(‘.selector’).click();
          }
          var searchTerm = $(element).val().toUpperCase();
          $(element).parent().find(“.options li”).each(function() {
          if ($(this).text().toUpperCase().indexOf(searchTerm) !== -1) {
          $(this).css(‘display’, ‘block’);
          }
          else {
          $(this).css(‘display’, ‘none’);
          }
          });
          }

          function getCartName() {
          $(‘#speakerProductHeader’).css(‘display’, ‘none’);
          $(‘#speakerProductBody’).css(‘display’, ‘none’);
          $(‘#speakerProductBtns’).css(‘display’, ‘none’);
          $(‘#loaderPage2’).css(‘display’, ‘block’);

          var currentCartName = ‘Cart’;

          Visualforce.remoting.Manager.invokeAction(
          ‘GrilleToolExt.getCurrentCartName’,
          function(result, event){
          if (result != undefined) {
          currentCartName = result;
          }
          $(‘.currentCartName’).text(currentCartName);
          $(‘#speakerProductHeader’).css(‘display’, ‘block’);
          $(‘#speakerProductBody’).css(‘display’, ‘block’);
          $(‘#speakerProductBtns’).css(‘display’, ‘block’);
          $(‘#loaderPage2’).css(‘display’, ‘none’);
          },{escape:false}
          );
          }

          function determinePurchasing() {
          if(‘DefaultStore Profile’!=’Customer Community Exec’ && ‘DefaultStore Profile’!=’Customer Community Exec Plus’ && ‘DefaultStore Profile’!=’Customer Community Store User’){
          $(‘#step3AddToCart’).remove();
          }
          }

          function displayMissing() {
          if ($(‘#displayMissingCheckbox’).is(‘:checked’)) {
          $(‘#displayMissingInfo’).css(‘display’, ‘block’);
          if(grilleToolData.config.speaker != undefined && grilleToolData.config.speaker.grilleReq==’Studio Soundbar’) {
          $(‘#insigniaNotch’).css(‘display’, ‘block’);
          $(‘#irNotch’).css(‘display’, ‘block’);
          }
          $(‘#displayMakeSearch’).val(”);
          $(‘#displayModelSearch’).val(”);
          $(‘#displayMake’).val(‘Make’);
          $(‘#displayModel’).val(‘Model’);
          grilleToolData.customDisplay.make = null;
          grilleToolData.customDisplay.model = null;
          $(‘#displayUnverifiedInfo’).css(‘display’, ‘none’);
          $(‘#displayModelButtonOptions’).empty();
          $(‘#dimensionsDisplay’).css(‘display’, ‘block’);
          grilleToolData.customDisplay.hasMasterDisplay = false;
          if(!initializing){
          grilleToolData.config.displayAttrId = null;
          grilleToolData.config.customDisplay.masterDisplayId = null;
          }else{
          setMissingDisplay();
          }

          }else{
          $(‘#displayMissingInfo’).css(‘display’, ‘none’);
          $(‘#insigniaNotch’).css(‘display’, ‘none’);
          $(‘#irNotch’).css(‘display’, ‘none’);
          $(‘#dimensionsDisplay’).css(‘display’, ‘none’);
          }

          if ($(‘#insigniaNotchCheckbox’).is(‘:checked’)) {
          $(‘#insigniaNotchCheckbox’).click();
          }

          $(‘#insigniaNotchWidthMeasurement’).val(”);
          setFraction(0.0, ‘insigniaNotchWidth’);
          $(‘#insigniaNotchHeightMeasurement’).val(”);
          setFraction(0.0, ‘insigniaNotchHeight’);

          if ($(‘#irNotchCheckbox’).is(‘:checked’)) {
          $(‘#irNotchCheckbox’).click();
          }
          $(‘#irNotchWidthMeasurement’).val(”);
          setFraction(0.0, ‘irNotchWidth’);
          $(‘#irNotchHeightMeasurement’).val(”);
          setFraction(0.0, ‘irNotchHeight’);
          $(‘#irNotchOffsetMeasurement’).val(”);
          setFraction(0.0, ‘irNotchOffset’);

          $(‘#displayGrilleHeader’).slideToggle(“fast”);
          $(‘#makeField’).slideToggle(“fast”);
          $(‘#modelField’).slideToggle(“fast”);
          validateStep2();
          }

          function displayInsigniaNotch() {
          if ($(‘#insigniaNotchCheckbox’).is(‘:checked’)) {
          $(‘#insigniaNotchInfo’).css(‘display’, ‘block’);
          $(‘#insigniaNotchDiagram’).css(‘display’, ‘block’);
          grilleToolData.config.hasInsigniaNotch = ‘Yes’;
          grilleToolData.customDisplay.hasInsigniaNotch = ‘Yes’;
          setInsigniaNotchMeasurements();
          }else{
          $(‘#insigniaNotchInfo’).css(‘display’, ‘none’);
          $(‘#insigniaNotchDiagram’).css(‘display’, ‘none’);
          grilleToolData.config.hasInsigniaNotch = ‘No’;
          grilleToolData.customDisplay.hasInsigniaNotch = ‘No’;
          grilleToolData.config.insigniaNotchWidth = null;
          grilleToolData.config.insigniaNotchHeight = null;
          }
          validateStep2();
          }

          function displayIRNotch() {
          if ($(‘#irNotchCheckbox’).is(‘:checked’)) {
          $(‘#irNotchInfo’).css(‘display’, ‘block’);
          $(‘#irNotchDiagram’).css(‘display’, ‘block’);
          grilleToolData.config.hasIRNotch = ‘Yes’;
          grilleToolData.customDisplay.hasIRNotch = ‘Yes’;
          setIRNotchMeasurements();
          }else{
          $(‘#irNotchInfo’).css(‘display’, ‘none’);
          $(‘#irNotchDiagram’).css(‘display’, ‘none’);
          grilleToolData.config.hasIRNotch = ‘No’;
          grilleToolData.customDisplay.hasIRNotch = ‘No’;
          grilleToolData.config.irNotchWidth = null;
          grilleToolData.config.irNotchHeight = null;
          grilleToolData.config.irNotchOffset = null;
          }
          validateStep2();
          }

          function setMissingDisplay() {
          var displayMissingMake = $(‘#displayMissingMake’).val();
          var displayMissingModel = $(‘#displayMissingModel’).val();
          grilleToolData.customDisplay.make = displayMissingMake;
          grilleToolData.customDisplay.model = displayMissingModel;
          validateStep2();
          }

          function setMissingDisplayMeasurements() {
          var customWidthDecimal = 0;
          var wholeWidthNumber = parseFloat($(‘#displayMissingWidthMeasurement’).val());

          var fractionWidth = [0, 1];
          if ($(‘#displayMissingHeightUnit’).val() == ‘Centimeters’) {
          fractionWidth = $(‘#displayMissingWidthFractionTenths’).val().split(‘/’);
          grilleToolData.config.displayUnitOfMeasure = ‘Centimeters’;
          }else{
          fractionWidth = $(‘#displayMissingWidthFraction’).val().split(‘/’);
          grilleToolData.config.displayUnitOfMeasure = ‘Inches’;
          }

          var numeratorWidth = fractionWidth[0];
          var denominatorWidth = fractionWidth[1];

          if ($(‘#displayMissingWidthMeasurement’).val()) {
          customWidthDecimal += wholeWidthNumber;
          }
          if ($.isNumeric(numeratorWidth/denominatorWidth)) {
          customWidthDecimal += (numeratorWidth/denominatorWidth);
          }
          if ($(‘#displayMissingWidthUnit’).val() == ‘Centimeters’) {
          grilleToolData.customDisplay.width = customWidthDecimal/2.54;
          grilleToolData.config.displayUnitOfMeasure = ‘Centimeters’;
          }else {
          grilleToolData.customDisplay.width = customWidthDecimal;
          grilleToolData.config.displayUnitOfMeasure = ‘Inches’;
          }

          var customHeightDecimal = 0;
          var wholeHeightNumber = parseFloat($(‘#displayMissingHeightMeasurement’).val());

          var fractionHeight = [0, 1];
          if ($(‘#displayMissingHeightUnit’).val() == ‘Centimeters’) {
          fractionHeight = $(‘#displayMissingHeightFractionTenths’).val().split(‘/’);
          }else{
          fractionHeight = $(‘#displayMissingHeightFraction’).val().split(‘/’);
          }

          var numeratorHeight = fractionHeight[0];
          var denominatorHeight = fractionHeight[1];

          if ($(‘#displayMissingHeightMeasurement’).val()) {
          customHeightDecimal += wholeHeightNumber;
          }
          if ($.isNumeric(numeratorHeight/denominatorHeight)) {
          customHeightDecimal += (numeratorHeight/denominatorHeight);
          }
          if ($(‘#displayMissingHeightUnit’).val() == ‘Centimeters’) {
          grilleToolData.customDisplay.height = customHeightDecimal/2.54;
          } else {
          grilleToolData.customDisplay.height = customHeightDecimal;
          }

          if(grilleToolData.config.speaker.grilleReq==’Studio Soundbar’){
          grilleToolData.config.width = customWidthDecimal;
          } else {
          grilleToolData.config.height = customHeightDecimal;
          }

          grilleToolData.customDisplay.curved = $(‘#curvedDisplayCheckbox’).is(‘:checked’);

          validateStep2();

          }

          function setInsigniaNotchMeasurements() {
          var customWidthDecimal = 0;
          var wholeWidthNumber = parseFloat($(‘#insigniaNotchWidthMeasurement’).val());

          var fractionWidth = [0, 1];
          if ($(‘#insigniaNotchHeightUnit’).val() == ‘Centimeters’) {
          fractionWidth = $(‘#insigniaNotchWidthFractionTenths’).val().split(‘/’);
          }else {
          fractionWidth = $(‘#insigniaNotchWidthFraction’).val().split(‘/’);
          }

          var numeratorWidth = fractionWidth[0];
          var denominatorWidth = fractionWidth[1];

          if ($(‘#insigniaNotchWidthMeasurement’).val()) {
          customWidthDecimal += wholeWidthNumber;
          }
          if ($.isNumeric(numeratorWidth/denominatorWidth)) {
          customWidthDecimal += (numeratorWidth/denominatorWidth);
          }
          if ($(‘#insigniaNotchWidthUnit’).val() == ‘Centimeters’) {
          grilleToolData.customDisplay.insigniaNotchWidth = customWidthDecimal/2.54;
          grilleToolData.config.insigniaNotchWidth = customWidthDecimal/2.54;
          } else {
          grilleToolData.customDisplay.insigniaNotchWidth = customWidthDecimal;
          grilleToolData.config.insigniaNotchWidth = customWidthDecimal;
          }

          var customHeightDecimal = 0;
          var wholeHeightNumber = parseFloat($(‘#insigniaNotchHeightMeasurement’).val());

          var fractionHeight = [0, 1];
          if ($(‘#insigniaNotchHeightUnit’).val() == ‘Centimeters’) {
          fractionHeight = $(‘#insigniaNotchHeightFractionTenths’).val().split(‘/’);
          }else {
          fractionHeight = $(‘#insigniaNotchHeightFraction’).val().split(‘/’);
          }

          var numeratorHeight = fractionHeight[0];
          var denominatorHeight = fractionHeight[1];

          if ($(‘#insigniaNotchHeightMeasurement’).val()) {
          customHeightDecimal += wholeHeightNumber;
          }
          if ($.isNumeric(numeratorHeight/denominatorHeight)) {
          customHeightDecimal += (numeratorHeight/denominatorHeight);
          }
          if ($(‘#insigniaNotchHeightUnit’).val() == ‘Centimeters’) {
          grilleToolData.customDisplay.insigniaNotchHeight = customHeightDecimal/2.54;
          grilleToolData.config.insigniaNotchHeight = customHeightDecimal/2.54;
          }else {
          grilleToolData.customDisplay.insigniaNotchHeight = customHeightDecimal;
          grilleToolData.config.insigniaNotchHeight = customHeightDecimal;
          }

          validateStep2();
          }

          function setIRNotchMeasurements() {
          var customWidthDecimal = 0;
          var wholeWidthNumber = parseFloat($(‘#irNotchWidthMeasurement’).val());

          var fractionWidth = [0, 1];
          if ($(‘#irNotchHeightUnit’).val() == ‘Centimeters’) {
          fractionWidth = $(‘#irNotchWidthFractionTenths’).val().split(‘/’);
          }else {
          fractionWidth = $(‘#irNotchWidthFraction’).val().split(‘/’);
          }

          var numeratorWidth = fractionWidth[0];
          var denominatorWidth = fractionWidth[1];

          if ($(‘#irNotchWidthMeasurement’).val()) {
          customWidthDecimal += wholeWidthNumber;
          }
          if ($.isNumeric(numeratorWidth/denominatorWidth)) {
          customWidthDecimal += (numeratorWidth/denominatorWidth);
          }
          if ($(‘#irNotchWidthUnit’).val() == ‘Centimeters’) {
          grilleToolData.customDisplay.irNotchWidth = customWidthDecimal/2.54;
          grilleToolData.config.irNotchWidth = customWidthDecimal/2.54;
          } else {
          grilleToolData.customDisplay.irNotchWidth = customWidthDecimal;
          grilleToolData.config.irNotchWidth = customWidthDecimal;
          }

          var customHeightDecimal = 0;
          var wholeHeightNumber = parseFloat($(‘#irNotchHeightMeasurement’).val());

          var fractionHeight = [0, 1];
          if ($(‘#irNotchHeightUnit’).val() == ‘Centimeters’) {
          fractionHeight = $(‘#irNotchHeightFractionTenths’).val().split(‘/’);
          }else {
          fractionHeight = $(‘#irNotchHeightFraction’).val().split(‘/’);
          }

          var numeratorHeight = fractionHeight[0];
          var denominatorHeight = fractionHeight[1];

          if ($(‘#irNotchHeightMeasurement’).val()) {
          customHeightDecimal += wholeHeightNumber;
          }
          if ($.isNumeric(numeratorHeight/denominatorHeight)) {
          customHeightDecimal += (numeratorHeight/denominatorHeight);
          }
          if ($(‘#irNotchHeightUnit’).val() == ‘Centimeters’) {
          grilleToolData.customDisplay.irNotchHeight = customHeightDecimal/2.54;
          grilleToolData.config.irNotchHeight = customHeightDecimal/2.54;
          }else {
          grilleToolData.customDisplay.irNotchHeight = customHeightDecimal;
          grilleToolData.config.irNotchHeight = customHeightDecimal;
          }

          var customOffsetDecimal = 0;
          var wholeOffsetNumber = parseFloat($(‘#irNotchOffsetMeasurement’).val());

          var fractionOffset = [0, 1];
          if ($(‘#irNotchHeightUnit’).val() == ‘Centimeters’) {
          fractionOffset = $(‘#irNotchOffsetFractionTenths’).val().split(‘/’);
          }else {
          fractionOffset = $(‘#irNotchOffsetFraction’).val().split(‘/’);
          }

          var numeratorOffset = fractionOffset[0];
          var denominatorOffset = fractionOffset[1];

          if ($(‘#irNotchOffsetMeasurement’).val()) {
          customOffsetDecimal += wholeOffsetNumber;
          }
          if ($.isNumeric(numeratorOffset/denominatorOffset)) {
          customOffsetDecimal += (numeratorOffset/denominatorOffset);
          }
          if ($(‘#irNotchOffsetUnit’).val() == ‘Centimeters’) {
          grilleToolData.customDisplay.irNotchOffset = customOffsetDecimal/2.54;
          grilleToolData.config.irNotchOffset = customOffsetDecimal/2.54;
          } else {
          grilleToolData.customDisplay.irNotchOffset = customOffsetDecimal;
          grilleToolData.config.irNotchOffset = customOffsetDecimal;
          }

          validateStep2();
          }

          function changeMissingDisplayWidthMeasurements() {
          $(‘#displayMissingWidthMeasurement’).val(”);
          setFraction(‘clear’, ‘displayMissingWidth’);
          $(‘#displayMissingWidthFractionButton’).html(‘ ‘);
          $(‘#displayMissingWidthFractionTenthsButton’).html(‘ ‘);
          if ($(‘#displayMissingWidthUnit’).val() == ‘Centimeters’) {
          $(‘#displayMissingWidthFractionSelect’).css(‘display’, ‘none’);
          $(‘#displayMissingWidthFractionTenthsSelect’).css(‘display’, ‘inline-block’);
          }
          else {
          $(‘#displayMissingWidthFractionSelect’).css(‘display’, ‘inline-block’);
          $(‘#displayMissingWidthFractionTenthsSelect’).css(‘display’, ‘none’);
          }
          setMissingDisplayMeasurements();
          }

          function changeMissingDisplayHeightMeasurements() {
          $(‘#displayMissingHeightMeasurement’).val(”);
          setFraction(‘clear’, ‘displayMissingHeight’);
          $(‘#displayMissingHeightFractionButton’).html(‘ ‘);
          $(‘#displayMissingHeightFractionTenthsButton’).html(‘ ‘);
          if ($(‘#displayMissingHeightUnit’).val() == ‘Centimeters’) {
          $(‘#displayMissingHeightFractionSelect’).css(‘display’, ‘none’);
          $(‘#displayMissingHeightFractionTenthsSelect’).css(‘display’, ‘inline-block’);
          }
          else {
          $(‘#displayMissingHeightFractionSelect’).css(‘display’, ‘inline-block’);
          $(‘#displayMissingHeightFractionTenthsSelect’).css(‘display’, ‘none’);
          }
          setMissingDisplayMeasurements();
          }

          function changeInsigniaNotchWidthMeasurements() {
          $(‘#insigniaNotchWidthMeasurement’).val(”);
          setFraction(‘clear’, ‘insigniaNotchWidth’);
          $(‘#insigniaNotchWidthFractionButton’).html(‘ ‘);
          $(‘#insigniaNotchWidthFractionTenthsButton’).html(‘ ‘);
          if ($(‘#insigniaNotchWidthUnit’).val() == ‘Centimeters’) {
          $(‘#insigniaNotchWidthFractionSelect’).css(‘display’, ‘none’);
          $(‘#insigniaNotchWidthFractionTenthsSelect’).css(‘display’, ‘inline-block’);
          }else {
          $(‘#insigniaNotchWidthFractionSelect’).css(‘display’, ‘inline-block’);
          $(‘#insigniaNotchWidthFractionTenthsSelect’).css(‘display’, ‘none’);
          }
          setInsigniaNotchMeasurements();
          }

          function changeInsigniaNotchHeightMeasurements() {
          $(‘#insigniaNotchHeightMeasurement’).val(”);
          setFraction(‘clear’, ‘insigniaNotchHeight’);
          $(‘#insigniaNotchHeightFractionButton’).html(‘ ‘);
          $(‘#insigniaNotchHeightFractionTenthsButton’).html(‘ ‘);
          if ($(‘#insigniaNotchHeightUnit’).val() == ‘Centimeters’) {
          $(‘#insigniaNotchHeightFractionSelect’).css(‘display’, ‘none’);
          $(‘#insigniaNotchHeightFractionTenthsSelect’).css(‘display’, ‘inline-block’);
          } else {
          $(‘#insigniaNotchHeightFractionSelect’).css(‘display’, ‘inline-block’);
          $(‘#insigniaNotchHeightFractionTenthsSelect’).css(‘display’, ‘none’);
          }
          setInsigniaNotchMeasurements();
          }

          function changeIRNotchWidthMeasurements() {
          $(‘#irNotchWidthMeasurement’).val(”);
          setFraction(‘clear’, ‘irNotchWidth’);
          $(‘#irNotchWidthFractionButton’).html(‘ ‘);
          $(‘#irNotchWidthFractionTenthsButton’).html(‘ ‘);
          if ($(‘#irNotchWidthUnit’).val() == ‘Centimeters’) {
          $(‘#irNotchWidthFractionSelect’).css(‘display’, ‘none’);
          $(‘#irNotchWidthFractionTenthsSelect’).css(‘display’, ‘inline-block’);
          }else {
          $(‘#irNotchWidthFractionSelect’).css(‘display’, ‘inline-block’);
          $(‘#irNotchWidthFractionTenthsSelect’).css(‘display’, ‘none’);
          }
          setIRNotchMeasurements();
          }

          function changeIRNotchHeightMeasurements() {
          $(‘#irNotchHeightMeasurement’).val(”);
          setFraction(‘clear’, ‘irNotchHeight’);
          $(‘#irNotchHeightFractionButton’).html(‘ ‘);
          $(‘#irNotchHeightFractionTenthsButton’).html(‘ ‘);
          if ($(‘#irNotchHeightUnit’).val() == ‘Centimeters’) {
          $(‘#irNotchHeightFractionSelect’).css(‘display’, ‘none’);
          $(‘#irNotchHeightFractionTenthsSelect’).css(‘display’, ‘inline-block’);
          }else {
          $(‘#irNotchHeightFractionSelect’).css(‘display’, ‘inline-block’);
          $(‘#irNotchHeightFractionTenthsSelect’).css(‘display’, ‘none’);
          }
          setIRNotchMeasurements();
          }

          function changeIRNotchOffsetMeasurements() {
          $(‘#irNotchOffsetMeasurement’).val(”);
          setFraction(‘clear’, ‘irNotchOffset’);
          $(‘#irNotchOffsetFractionButton’).html(‘ ‘);
          $(‘#irNotchOffsetFractionTenthsButton’).html(‘ ‘);
          if ($(‘#irNotchOffsetUnit’).val() == ‘Centimeters’) {
          $(‘#irNotchOffsetFractionSelect’).css(‘display’, ‘none’);
          $(‘#irNotchOffsetFractionTenthsSelect’).css(‘display’, ‘inline-block’);
          } else {
          $(‘#irNotchOffsetFractionSelect’).css(‘display’, ‘inline-block’);
          $(‘#irNotchOffsetFractionTenthsSelect’).css(‘display’, ‘none’);
          }
          setIRNotchMeasurements();
          }

          function setUnverifiedDisplayMeasurements() {
          var customWidthDecimal = 0;
          var wholeWidthNumber = parseFloat($(‘#displayUnverifiedWidthMeasurement’).val());

          var fractionWidth = [0, 1];
          if ($(‘#displayUnverifiedHeightUnit’).val() == ‘Centimeters’) {
          fractionWidth = $(‘#displayUnverifiedWidthFractionTenths’).val().split(‘/’);
          } else {
          fractionWidth = $(‘#displayUnverifiedWidthFraction’).val().split(‘/’);
          }

          var numeratorWidth = fractionWidth[0];
          var denominatorWidth = fractionWidth[1];

          if ($(‘#displayUnverifiedWidthMeasurement’).val()) {
          customWidthDecimal += wholeWidthNumber;
          }
          if ($.isNumeric(numeratorWidth/denominatorWidth)) {
          customWidthDecimal += (numeratorWidth/denominatorWidth);
          }
          if ($(‘#displayUnverifiedWidthUnit’).val() == ‘Centimeters’) {
          grilleToolData.customDisplay.width = customWidthDecimal/2.54;
          } else {
          grilleToolData.customDisplay.width = customWidthDecimal;
          }
          grilleToolData.config.width = grilleToolData.customDisplay.width;

          var customHeightDecimal = 0;
          var wholeHeightNumber = parseFloat($(‘#displayUnverifiedHeightMeasurement’).val());

          var fractionHeight = [0, 1];
          if ($(‘#displayUnverifiedHeightUnit’).val() == ‘Centimeters’) {
          fractionHeight = $(‘#displayUnverifiedHeightFractionTenths’).val().split(‘/’);
          }else {
          fractionHeight = $(‘#displayUnverifiedHeightFraction’).val().split(‘/’);
          }

          var numeratorHeight = fractionHeight[0];
          var denominatorHeight = fractionHeight[1];

          if ($(‘#displayUnverifiedHeightMeasurement’).val()) {
          customHeightDecimal += wholeHeightNumber;
          }
          if ($.isNumeric(numeratorHeight/denominatorHeight)) {
          customHeightDecimal += (numeratorHeight/denominatorHeight);
          }
          if ($(‘#displayUnverifiedHeightUnit’).val() == ‘Centimeters’) {
          grilleToolData.customDisplay.height = customHeightDecimal/2.54;
          }else {
          grilleToolData.customDisplay.height = customHeightDecimal;
          }
          grilleToolData.config.height = grilleToolData.customDisplay.height;

          validateStep2();
          }

          function changeUnverifiedDisplayWidthMeasurements() {
          $(‘#displayUnverifiedWidthMeasurement’).val(”);
          setFraction(‘clear’, ‘displayUnverifiedWidth’);
          $(‘#displayUnverifiedWidthFractionButton’).html(‘ ‘);
          $(‘#displayUnverifiedWidthFractionTenthsButton’).html(‘ ‘);
          if ($(‘#displayUnverifiedWidthUnit’).val() == ‘Centimeters’) {
          $(‘#displayUnverifiedWidthFractionSelect’).css(‘display’, ‘none’);
          $(‘#displayUnverifiedWidthFractionTenthsSelect’).css(‘display’, ‘inline-block’);
          }else {
          $(‘#displayUnverifiedWidthFractionSelect’).css(‘display’, ‘inline-block’);
          $(‘#displayUnverifiedWidthFractionTenthsSelect’).css(‘display’, ‘none’);
          }
          setUnverifiedDisplayMeasurements();
          }

          function changeUnverifiedDisplayHeightMeasurements() {
          $(‘#displayUnverifiedHeightMeasurement’).val(”);
          setFraction(‘clear’, ‘displayUnverifiedHeight’);
          $(‘#displayUnverifiedHeightFractionButton’).html(‘ ‘);
          $(‘#displayUnverifiedHeightFractionTenthsButton’).html(‘ ‘);
          if ($(‘#displayUnverifiedHeightUnit’).val() == ‘Centimeters’) {
          $(‘#displayUnverifiedHeightFractionSelect’).css(‘display’, ‘none’);
          $(‘#displayUnverifiedHeightFractionTenthsSelect’).css(‘display’, ‘inline-block’);
          } else {
          $(‘#displayUnverifiedHeightFractionSelect’).css(‘display’, ‘inline-block’);
          $(‘#displayUnverifiedHeightFractionTenthsSelect’).css(‘display’, ‘none’);
          }
          setUnverifiedDisplayMeasurements();
          }

          function setFraction(fraction, selectToSet) {
          if (fraction==0.03125) { $(‘#’+selectToSet+’Fraction’).val(‘1/32’); }
          else if (fraction==0.0625) { $(‘#’+selectToSet+’Fraction’).val(‘1/16’); }
          else if (fraction==0.09375) { $(‘#’+selectToSet+’Fraction’).val(‘3/32’); }
          else if (fraction==0.1000) { $(‘#’+selectToSet+’FractionTenths’).val(‘1/10’); }
          else if (fraction==0.1250) { $(‘#’+selectToSet+’Fraction’).val(‘1/8’); }
          else if (fraction==0.15625) { $(‘#’+selectToSet+’Fraction’).val(‘5/32’); }
          else if (fraction==0.1875) { $(‘#’+selectToSet+’Fraction’).val(‘3/16’); }
          else if (fraction==0.2000) { $(‘#’+selectToSet+’FractionTenths’).val(‘1/5’); }
          else if (fraction==0.21875) { $(‘#’+selectToSet+’Fraction’).val(‘7/32’); }
          else if (fraction==0.2500) { $(‘#’+selectToSet+’Fraction’).val(‘1/4’); }
          else if (fraction==0.28125) { $(‘#’+selectToSet+’Fraction’).val(‘9/32’); }
          else if (fraction==0.3000) { $(‘#’+selectToSet+’FractionTenths’).val(‘3/10’); }
          else if (fraction==0.3125) { $(‘#’+selectToSet+’Fraction’).val(‘5/16’); }
          else if (fraction==0.34375) { $(‘#’+selectToSet+’Fraction’).val(’11/32′); }
          else if (fraction==0.3750) { $(‘#’+selectToSet+’Fraction’).val(‘3/8’); }
          else if (fraction==0.4000) { $(‘#’+selectToSet+’FractionTenths’).val(‘2/5’); }
          else if (fraction==0.40625) { $(‘#’+selectToSet+’Fraction’).val(’13/32′); }
          else if (fraction==0.4375) { $(‘#’+selectToSet+’Fraction’).val(‘7/16’); }
          else if (fraction==0.46875) { $(‘#’+selectToSet+’Fraction’).val(’15/32′); }
          else if (fraction==0.5000) { $(‘#’+selectToSet+’Fraction’).val(‘1/2’); $(‘#’+selectToSet+’FractionTenths’).val(‘1/2’); }
          else if (fraction==0.53125) { $(‘#’+selectToSet+’Fraction’).val(’17/32′); }
          else if (fraction==0.5625) { $(‘#’+selectToSet+’Fraction’).val(‘9/16’); }
          else if (fraction==0.59375) { $(‘#’+selectToSet+’Fraction’).val(’19/32′); }
          else if (fraction==0.6000) { $(‘#’+selectToSet+’FractionTenths’).val(‘3/5’); }
          else if (fraction==0.6250) { $(‘#’+selectToSet+’Fraction’).val(‘5/8’); }
          else if (fraction==0.65625) { $(‘#’+selectToSet+’Fraction’).val(’21/32′); }
          else if (fraction==0.6875) { $(‘#’+selectToSet+’Fraction’).val(’11/16′); }
          else if (fraction==0.7000) { $(‘#’+selectToSet+’FractionTenths’).val(‘7/10’); }
          else if (fraction==0.71875) { $(‘#’+selectToSet+’Fraction’).val(’23/32′); }
          else if (fraction==0.7500) { $(‘#’+selectToSet+’Fraction’).val(‘3/4’); }
          else if (fraction==0.78125) { $(‘#’+selectToSet+’Fraction’).val(’25/32′); }
          else if (fraction==0.8000) { $(‘#’+selectToSet+’FractionTenths’).val(‘4/5’); }
          else if (fraction==0.8125) { $(‘#’+selectToSet+’Fraction’).val(’13/16′); }
          else if (fraction==0.84375) { $(‘#’+selectToSet+’Fraction’).val(’27/32′); }
          else if (fraction==0.8750) { $(‘#’+selectToSet+’Fraction’).val(‘7/8’); }
          else if (fraction==0.9000) { $(‘#’+selectToSet+’FractionTenths’).val(‘9/10’); }
          else if (fraction==0.90625) { $(‘#’+selectToSet+’Fraction’).val(’29/32′); }
          else if (fraction==0.9375) { $(‘#’+selectToSet+’Fraction’).val(’15/16′); }
          else if (fraction==0.96875) { $(‘#’+selectToSet+’Fraction’).val(’31/32′); }
          else if (fraction==’clear’ || fraction==0.0) { $(‘#’+selectToSet+’Fraction’).val(‘ ‘); $(‘#’+selectToSet+’FractionTenths’).val(‘ ‘); }

          $(‘#’+selectToSet+’FractionTenthsButton’).html($(‘#’+selectToSet+’FractionTenths’).val()+’‘);
          $(‘#’+selectToSet+’FractionButton’).html($(‘#’+selectToSet+’Fraction’).val()+’‘);
          }

          function checkCheckbox(checkbox) {
          if ($(checkbox).is(‘:checked’)) {
          $(checkbox).parent().addClass(‘labelCheckChecked’);
          }
          else {
          $(checkbox).parent().removeClass(‘labelCheckChecked’);
          }
          }

          function checkRadio(radio) {
          $(‘.labelRadioChecked’).removeClass(‘labelRadioChecked’);
          if ($(radio).is(‘:checked’)) {
          $(radio).parent().addClass(‘labelRadioChecked’);
          }
          else {
          $(radio).parent().removeClass(‘labelRadioChecked’);
          }
          }

          function chooseCartGrille() {
          Visualforce.remoting.Manager.invokeAction(
          ‘GrilleToolExt.getCarts’,
          function(result, event){
          $(‘#chooseCartCarts’).empty();
          var cartList = ”;
          if (result.length > 8) {
          $(‘#cartLongListButtons’).css(‘display’, ‘block’);
          }else {
          $(‘#cartLongListButtons’).css(‘display’, ‘none’);
          }

          $.each(result,function(index,cart){
          if (cart.ccrz__ActiveCart__c && cart.ccrz__User__c==’00570000004vBndAAE’) {
          cartList += ‘

          ‘;
          } else {
          cartList += ‘

          ‘;
          }
          });
          cartList += ”;
          cartList += ”;
          $(‘#chooseCartCarts’).append(cartList);

          $(‘#chooseCartItem’).text(grilleToolData.config.project+’ – ‘+grilleToolData.config.location);
          $(“#grilleTool”).modal(“hide”);
          $(“#ChooseCartGrilleDiv”).modal({show: true});
          },{escape: true}
          );

          }

          function unselectNewCart(element) {
          $(‘#newCartCartListButton’).css(‘display’, ‘block’);
          $(‘#newCartCartListText’).css(‘display’, ‘none’);
          $(‘#createCartModalError’).text(”);

          $(‘.labelCheckmark’).each(function(){
          $(this).removeClass(‘labelCheckmarkChecked’);
          });
          $(element).parent().addClass(‘labelCheckmarkChecked’);
          }

          function selectNewCart() {
          $(‘#newCartCartListText’).css(‘display’, ‘block’);
          $(‘#newCartCartListButton’).css(‘display’, ‘none’);
          $(‘#newCartCartListName’).val(”).focus();
          $(‘input[name=cartChoice]:checked’).prop(‘checked’, false);

          $(‘.labelCheckmark’).each(function(){
          $(this).removeClass(‘labelCheckmarkChecked’);
          });
          }

          // init page based off of product or existing config
          jQuery(function($) {
          $(“#grilleTool”).on(“show.bs.modal”, function () {
          $(“body”).addClass(“modal-open”);
          }).on(“hidden.bs.modal”, function () {
          $(“body”).removeClass(“modal-open”)
          });
          });

          function goToCart() {
          var cartId = $(‘input[name=cartChoice]:checked’).val();
          if (cartId == undefined) {
          cartId = newCartId;
          }

          if (cartId != undefined) {
          Visualforce.remoting.Manager.invokeAction(
          ‘GrilleToolExt.getCartEncId’,
          cartId,
          function(result, event){
          if (result != undefined) {
          window.location.href=”https://store.savant.com/DefaultStore/ccrz__Cart?cartId=”+result;
          }
          },
          {escape: true}
          );
          }

          }

{{note.notificationHeadline}} +







{{else}}

{{categoryLink this ‘cc_cat_name’}}

{{/if}}

{{#if children}}

{{#each children}}

{{#if children}}

{{categoryLink this ‘cc_cat_name’}}





{{else}}

{{categoryLink this ‘cc_cat_name’}}

{{/if}}

{{#if children}}

{{#each children}}

{{categoryLink this ‘cc_cat_name’}}


{{/each}}


{{/if}}
{{/each}}


{{/if}}

{{/each}}

{{#ifDisplay ‘MC.Ext’}}
{{#ifGreater cartItemCount 0}}
{{#ifDisplay ‘MC.DsplItem’}}

{{pageLabelMap ‘MiniCart_Product’}}

{{pageLabelMap ‘MiniCart_Quantity’}}

{{#each this.cartItems}}

{{#ifEquals pricingType ‘external’}}
{{#if extName}}
{{productLink this.mockProduct ‘small cc_product_name_link’ text=(displayProductName ‘Aggregate_Display’ displayProductBean.name extName)}}
{{else}}
{{productLink this.mockProduct ‘small cc_product_name_link’ text=(displayProductName ‘Aggregate_Display’ displayProductBean.name mockProduct.name)}}
{{/if}}
{{else}}
{{productLink this.mockProduct ‘small cc_product_name_link’ text=(displayProductName ‘Aggregate_Display’ displayProductBean.name mockProduct.name)}}
{{/ifEquals}}

{{/each}}
{{/ifDisplay}}


{{pageLabelMap ‘MiniCart_Total_Qty’}}

{{pageLabelMap ‘MiniCart_Total_Price’}}

{{cartItemCount}} {{pageLabelMap ‘MiniCart_Total_Items’}}

{{price subTotal}}


{{#ifDisplay ‘MC.DsplItem’}}
{{#ifDisplay ‘MC.RO’}}
{{else}}

{{/ifDisplay}}
{{/ifDisplay}}

{{else}}

{{pageLabelMap ‘Component_MiniCart_NoItems’}}

{{/ifGreater}}
{{else}}
{{#ifGreater cartItemCount 0}}

{{#ifEquals cartItemCount 1}}
{{pageLabelMap ‘Component_MiniCart_ThereIs’}} {{cartItemCount}} {{pageLabelMap ‘Component_MiniCart_Item’}}
{{else}}
{{pageLabelMap ‘Component_MiniCart_ThereAre’}} {{cartItemCount}} {{pageLabelMap ‘Component_MiniCart_Items’}}
{{/ifEquals}}

{{pageLabelMap ‘Component_MiniCart_Subtotal’}}: {{price subTotal}}

{{else}}

{{pageLabelMap ‘Component_MiniCart_NoItems’}}

{{/ifGreater}}
{{/ifDisplay}}

{{pageLabelMap ‘QuickOrder_QuickOrderBoxCaption’}}

{{/ifDisplay}}