function getValidCombos() { var combo_list = new Array(); var combo_index = 0; combo_list[combo_index ++] = { 'Type':{'H':1}, 'Material':{'A':1,'F':1}, 'Material Size':{'100':1}, 'End Port Code':{'NA':1}, 'Port Orientation':{'000':1,'090':1,'180':1,'270':2}, 'NO. of Stations':{'01':1,'02':1,'03':1,'04':1,'05':1,'06':1,'07':1,'08':1,'09':1,'10':1}, 'Side Port Code':{'NR':1}, 'Mounting':{'U':1} } combo_list[combo_index ++] = { 'Type':{'H':1}, 'Material':{'A':1,'F':1}, 'Material Size':{'150':1}, 'End Port Code':{'NB':1}, 'Port Orientation':{'000':1,'090':1,'180':1,'270':2}, 'NO. of Stations':{'01':1,'02':1,'03':1,'04':1,'05':1,'06':1,'07':1,'08':1,'09':1,'10':1}, 'Side Port Code':{'NA':1}, 'Mounting':{'U':1} } combo_list[combo_index ++] = { 'Type':{'H':1}, 'Material':{'A':1,'F':1}, 'Material Size':{'175':1}, 'End Port Code':{'SC':1}, 'Port Orientation':{'000':1,'090':1,'180':1,'270':2}, 'NO. of Stations':{'01':1,'02':1,'03':1,'04':1,'05':1,'06':1,'07':1,'08':1,'09':1,'10':1}, 'Side Port Code':{'SB':1,'NB':2}, 'Mounting':{'U':1} } combo_list[combo_index ++] = { 'Type':{'H':1}, 'Material':{'A':1,'F':1}, 'Material Size':{'175':1}, 'End Port Code':{'NC':1}, 'Port Orientation':{'000':1,'090':1,'180':1,'270':2}, 'NO. of Stations':{'01':1,'02':1,'03':1,'04':1,'05':1,'06':1,'07':1,'08':1,'09':1,'10':1}, 'Side Port Code':{'SB':2,'NB':1}, 'Mounting':{'U':1} } combo_list[combo_index ++] = { 'Type':{'H':1}, 'Material':{'A':1,'F':1}, 'Material Size':{'175':1}, 'End Port Code':{'SD':1}, 'Port Orientation':{'000':1,'090':1,'180':1,'270':2}, 'NO. of Stations':{'01':1,'02':1,'03':1,'04':1,'05':1,'06':1,'07':1,'08':1,'09':1,'10':1}, 'Side Port Code':{'SC':1,'NC':2}, 'Mounting':{'U':1} } combo_list[combo_index ++] = { 'Type':{'H':1}, 'Material':{'A':1,'F':1}, 'Material Size':{'175':1}, 'End Port Code':{'ND':1}, 'Port Orientation':{'000':1,'090':1,'180':1,'270':2}, 'NO. of Stations':{'01':1,'02':1,'03':1,'04':1,'05':1,'06':1,'07':1,'08':1,'09':1,'10':1}, 'Side Port Code':{'SC':2,'NC':1}, 'Mounting':{'U':1} } combo_list[combo_index ++] = { 'Type':{'H':1}, 'Material':{'A':1,'F':1}, 'Material Size':{'200':1}, 'End Port Code':{'SF':1}, 'Port Orientation':{'000':1,'090':1,'180':1,'270':2}, 'NO. of Stations':{'01':1,'02':1,'03':1,'04':1,'05':1,'06':1,'07':1,'08':1,'09':1,'10':1}, 'Side Port Code':{'SD':1,'ND':2}, 'Mounting':{'U':1} } combo_list[combo_index ++] = { 'Type':{'H':1}, 'Material':{'A':1,'F':1}, 'Material Size':{'200':1}, 'End Port Code':{'NF':1}, 'Port Orientation':{'000':1,'090':1,'180':1,'270':2}, 'NO. of Stations':{'01':1,'02':1,'03':1,'04':1,'05':1,'06':1,'07':1,'08':1,'09':1,'10':1}, 'Side Port Code':{'SD':2,'ND':1}, 'Mounting':{'U':1} } combo_list[combo_index ++] = { 'Type':{'H':1}, 'Material':{'A':1,'F':1}, 'Material Size':{'250':1}, 'End Port Code':{'SH':1}, 'Port Orientation':{'000':1,'090':1,'180':1,'270':2}, 'NO. of Stations':{'01':1,'02':1,'03':1,'04':1,'05':1,'06':1,'07':1,'08':1,'09':1,'10':1}, 'Side Port Code':{'SF':1,'NF':2}, 'Mounting':{'U':1} } combo_list[combo_index ++] = { 'Type':{'H':1}, 'Material':{'A':1,'F':1}, 'Material Size':{'250':1}, 'End Port Code':{'NH':1}, 'Port Orientation':{'000':1,'090':1,'180':1,'270':2}, 'NO. of Stations':{'01':1,'02':1,'03':1,'04':1,'05':1,'06':1,'07':1,'08':1,'09':1,'10':1}, 'Side Port Code':{'SF':2,'NF':1}, 'Mounting':{'U':1} } combo_list[combo_index ++] = { 'Type':{'H':1}, 'Material':{'A':1,'D':1}, 'Material Size':{'300':1}, 'End Port Code':{'SI':1}, 'Port Orientation':{'000':1,'090':1,'180':1,'270':2}, 'NO. of Stations':{'01':1,'02':1,'03':1,'04':1,'05':1,'06':1,'07':1,'08':1,'09':1,'10':1}, 'Side Port Code':{'SH':1,'NH':2}, 'Mounting':{'U':1} } combo_list[combo_index ++] = { 'Type':{'H':1}, 'Material':{'A':1,'D':1}, 'Material Size':{'300':1}, 'End Port Code':{'NI':1}, 'Port Orientation':{'000':1,'090':1,'180':1,'270':2}, 'NO. of Stations':{'01':1,'02':1,'03':1,'04':1,'05':1,'06':1,'07':1,'08':1,'09':1,'10':1}, 'Side Port Code':{'SH':2,'NH':1}, 'Mounting':{'U':1} } combo_list[combo_index ++] = { 'Type':{'H':1}, 'Material':{'A':1,'D':1}, 'Material Size':{'350':1}, 'End Port Code':{'SJ':1}, 'Port Orientation':{'000':1,'090':1,'180':1,'270':2}, 'NO. of Stations':{'01':1,'02':1,'03':1,'04':1,'05':1,'06':1,'07':1,'08':1,'09':1}, 'Side Port Code':{'SI':1,'NI':2}, 'Mounting':{'U':1} } combo_list[combo_index ++] = { 'Type':{'H':1}, 'Material':{'A':1,'D':1}, 'Material Size':{'350':1}, 'End Port Code':{'NJ':1}, 'Port Orientation':{'000':1,'090':1,'180':1,'270':2}, 'NO. of Stations':{'01':1,'02':1,'03':1,'04':1,'05':1,'06':1,'07':1,'08':1,'09':1}, 'Side Port Code':{'SI':2,'NI':1}, 'Mounting':{'U':1} } combo_list[combo_index ++] = { 'Type':{'H':1}, 'Material':{'A':1,'D':1}, 'Material Size':{'400':1}, 'End Port Code':{'SK':1}, 'Port Orientation':{'000':1,'090':1,'180':1,'270':2}, 'NO. of Stations':{'01':1,'02':1,'03':1,'04':1,'05':1,'06':1,'07':1}, 'Side Port Code':{'SJ':1,'NJ':2}, 'Mounting':{'U':1} } combo_list[combo_index ++] = { 'Type':{'H':1}, 'Material':{'A':1,'D':1}, 'Material Size':{'400':1}, 'End Port Code':{'NK':1}, 'Port Orientation':{'000':1,'090':1,'180':1,'270':2}, 'NO. of Stations':{'01':1,'02':1,'03':1,'04':1,'05':1,'06':1,'07':1}, 'Side Port Code':{'SJ':2,'NJ':1}, 'Mounting':{'U':1} } combo_list[combo_index ++] = { 'Type':{'J':1}, 'Material':{'A':1,'F':1}, 'Material Size':{'100':1}, 'End Port Code':{'XX':1}, 'Port Orientation':{'090':1,'180':1,'270':1}, 'NO. of Stations':{'01':1,'02':1,'03':1,'04':1,'05':1,'06':1,'07':1,'08':1,'09':1,'10':1}, 'Side Port Code':{'NR':1}, 'Mounting':{'U':1} } combo_list[combo_index ++] = { 'Type':{'J':1}, 'Material':{'A':1,'F':1}, 'Material Size':{'150':1}, 'End Port Code':{'XX':1}, 'Port Orientation':{'090':1,'180':1,'270':1}, 'NO. of Stations':{'01':1,'02':1,'03':1,'04':1,'05':1,'06':1,'07':1,'08':1,'09':1,'10':1}, 'Side Port Code':{'NA':1}, 'Mounting':{'U':1} } combo_list[combo_index ++] = { 'Type':{'J':1}, 'Material':{'A':1,'F':1}, 'Material Size':{'175':1}, 'End Port Code':{'XX':1}, 'Port Orientation':{'090':1,'180':1,'270':1}, 'NO. of Stations':{'01':1,'02':1,'03':1,'04':1,'05':1,'06':1,'07':1,'08':1,'09':1,'10':1}, 'Side Port Code':{'SB':1,'NB':1}, 'Mounting':{'U':1} } combo_list[combo_index ++] = { 'Type':{'J':1}, 'Material':{'A':1,'F':1}, 'Material Size':{'175':1}, 'End Port Code':{'XX':1}, 'Port Orientation':{'090':1,'180':1,'270':1}, 'NO. of Stations':{'01':1,'02':1,'03':1,'04':1,'05':1,'06':1,'07':1,'08':1,'09':1,'10':1}, 'Side Port Code':{'SC':1,'NC':1}, 'Mounting':{'U':1} } combo_list[combo_index ++] = { 'Type':{'J':1}, 'Material':{'A':1,'F':1}, 'Material Size':{'200':1}, 'End Port Code':{'XX':1}, 'Port Orientation':{'090':1,'180':1,'270':1}, 'NO. of Stations':{'01':1,'02':1,'03':1,'04':1,'05':1,'06':1,'07':1,'08':1,'09':1,'10':1}, 'Side Port Code':{'SD':1,'ND':1}, 'Mounting':{'U':1} } combo_list[combo_index ++] = { 'Type':{'J':1}, 'Material':{'A':1,'F':1}, 'Material Size':{'250':1}, 'End Port Code':{'XX':1}, 'Port Orientation':{'090':1,'180':1,'270':1}, 'NO. of Stations':{'01':1,'02':1,'03':1,'04':1,'05':1,'06':1,'07':1,'08':1,'09':1,'10':1}, 'Side Port Code':{'SF':1,'NF':1}, 'Mounting':{'U':1} } combo_list[combo_index ++] = { 'Type':{'J':1}, 'Material':{'A':1,'D':1}, 'Material Size':{'300':1}, 'End Port Code':{'XX':1}, 'Port Orientation':{'090':1,'180':1,'270':1}, 'NO. of Stations':{'01':1,'02':1,'03':1,'04':1,'05':1,'06':1,'07':1,'08':1,'09':1,'10':1}, 'Side Port Code':{'SH':1,'NH':1}, 'Mounting':{'U':1} } combo_list[combo_index ++] = { 'Type':{'J':1}, 'Material':{'A':1,'D':1}, 'Material Size':{'350':1}, 'End Port Code':{'XX':1}, 'Port Orientation':{'090':1,'180':1,'270':1}, 'NO. of Stations':{'01':1,'02':1,'03':1,'04':1,'05':1,'06':1,'07':1,'08':1,'09':1}, 'Side Port Code':{'SI':1,'NI':1}, 'Mounting':{'U':1} } combo_list[combo_index ++] = { 'Type':{'J':1}, 'Material':{'A':1,'D':1}, 'Material Size':{'400':1}, 'End Port Code':{'XX':1}, 'Port Orientation':{'090':1,'180':1,'270':1}, 'NO. of Stations':{'01':1,'02':1,'03':1,'04':1,'05':1,'06':1,'07':1}, 'Side Port Code':{'SJ':1,'NJ':1}, 'Mounting':{'U':1} } return combo_list; } function customRules(valid_options,current_selection) { } function customRules2(valid_options,current_selection,key) { return valid_options; }//$(document).ready( // function () // { // generator.init(); // } //); var generator = { combo_list: [], valid_combos: [], valid_options: [], current_selection: {}, current_part_number: "", current_status : 1, last_changed : false, manifold_link : "http://manifold.ca", ajax_page: "actionPage.php", init: function () { var selects = $('.select_main').not('.read_only'); var read_only = $('.select_main.read_only'); selects.mouseenter( function () { $(this).addClass('selected'); } ); selects.mouseleave( function () { $(this).removeClass('selected'); } ); selects.find('.select_option').mouseenter( function () { if(!$(this).is('.select_option_disabled')) { $(this).addClass('selected'); } } ); selects.find('.select_option').mouseleave( function () { $(this).removeClass('selected'); } ); selects.bind('do_open', function () { var ele = $(this); var s_options = ele.find('.select_options'); //s_options.fadeIn(300); s_options.show(); ele.addClass('option_open'); } ); selects.bind('do_close', function () { var ele = $(this); var s_options = ele.find('.select_options'); //s_options.fadeOut(300); s_options.hide(); ele.removeClass('option_open'); } ); selects.find('.selected_option').click( function () { var o = $(this).closest('.select_main'); if(o.is('.option_open')) { o.trigger('do_close'); } else { $('.select_main.option_open').trigger('do_close'); o.trigger('do_open'); } } ); selects.find('.select_option').click( function () { var ele = $(this); var o = ele.closest('.select_main'); if(!ele.is('.select_option_disabled')) { ele.trigger('select_option'); o.trigger('do_close'); generator.updateSelection(); } } ); selects.add(read_only).find('.select_option').bind('select_option', function () { var ele = $(this); var o = $(this).closest('.option'); var s_o = o.find('.selected_option'); generator.last_changed = o; s_o.find('.select_label').first().html(ele.find('.select_label').first().html()); s_o.find('.select_key').first().html(ele.find('.select_key').first().html()); s_o.removeClass('special_order'); s_o.removeClass('non_standard'); if(ele.hasClass('special_order')) { s_o.addClass('special_order'); } if(ele.hasClass('non_standard')) { s_o.addClass('non_standard'); } } ); $('.reset_button').click( function () { generator.resetSelection(); } ); $(document).click( function (e) { if($(e.target).closest('.option').size() == 0) { $('.option_open').trigger('do_close'); } } ); $('.current_selection_input').bind("input", function () { generator.setPartNumber($(this).val()); generator.updateSelection(false); } ); $('.quote_button').click( function () { generator.getQuotePage(generator.current_part_number) } ); $('.catalog_button').click( function () { generator.getCatalogPage(generator.current_part_number) } ); $('.contact_link').click( function () { generator.getContactPage(generator.current_part_number) } ); var original_value = $('.current_selection_input').val(); this.combo_list = getValidCombos(); this.current_part_number = ""; this.resetValidCombos(); this.updateSelection(); $('.default_option').click(); if(original_value != '') { generator.setPartNumber(original_value); generator.updateSelection(true); } }, getPartNumber: function () { var o_list = $('.option'); var val; var name; this.current_part_number = ""; this.current_selection = {}; for(var i = 0; i < o_list.size(); i ++) { if(o_list.eq(i).hasClass('fixed_part')) { val = o_list.eq(i).text(); this.current_part_number += val; } else { val = o_list.eq(i).find('.selected_option').find('.select_key').first().text(); name = o_list.eq(i).find('.name').text(); this.current_part_number += val; this.current_selection[name] = val; } } return this.current_part_number; }, getCurrentStatus: function () { var o_list = $('.option'); var s_l; var ans = 1; for(var i = 0; i < o_list.size(); i ++) { if(o_list.find('.selected_option').hasClass('special_order') && ans < 2) { ans = 2; } else if(o_list.find('.selected_option').hasClass('non_standard') && ans < 3) { ans = 3 } } return ans; }, resetValidCombos: function () { this.valid_combos = []; for(var i = 0; i < this.combo_list.length; i ++) { this.valid_combos[i] = true; } }, updateValidCombos: function (ignore_key) { this.resetValidCombos(); for(var i = 0 ; i < this.combo_list.length; i ++) { for(var key in this.current_selection) { if(this.current_selection.hasOwnProperty(key) && key != ignore_key) { if(!this.isEmptySelection(this.current_selection[key]) && !this.comboHasOption(i,key,this.current_selection[key])) { this.valid_combos[i] = false; break; } } } } }, getValidOptions: function (key) { var ans = {}; var o_list; this.updateValidCombos(key); for(var i = 0; i < this.valid_combos.length; i ++) { if(this.valid_combos[i]) { o_list = this.combo_list[i][key]; for(var o_key in o_list) { if(o_list.hasOwnProperty(o_key)) { if(typeof ans[o_key] == 'undefined' || (o_list[o_key] != 0 && o_list[o_key] < ans[o_key])) { ans[o_key] = o_list[o_key]; } } } } } ans = customRules2(ans,this.current_selection,key); return ans; }, updateValidOptions: function () { var o_list = $('.option').not('.fixed_part'); var o_levels = {}; var s_list; var s; var key = ""; var val = ""; for(var i = 0; i < o_list.size(); i ++) { key = o_list.eq(i).find('.name').text(); o_levels = this.getValidOptions(key); this.valid_options[key] = o_levels; s_list = o_list.eq(i).find('.select_option'); for(var a = 0; a < s_list.size(); a ++) { s = s_list.eq(a); if(!s.hasClass('unselected')) { val = s.find('.select_key').text(); if(val == "" && s.hasClass('empty_option')) { val = ""; } if(typeof o_levels[val] != 'undefined') { if(o_levels[val] == 3) { s.removeClass('non_standard'); s.addClass('special_order'); s.removeClass('select_option_disabled'); } else if(o_levels[val] == 2) { s.addClass('non_standard'); s.removeClass('special_order'); s.removeClass('select_option_disabled'); } else if(o_levels[val] == 1) { s.removeClass('non_standard'); s.removeClass('special_order'); s.removeClass('select_option_disabled'); } else if(o_levels[val] == 0) { s.removeClass('non_standard'); s.removeClass('special_order'); s.addClass('select_option_disabled'); } else { //Default action? } } else { s.removeClass('non_standard'); s.removeClass('special_order'); s.addClass('select_option_disabled'); } } } } }, updateSelection : function (update_input) { this.current_part_number = this.getPartNumber(); this.current_status = this.getCurrentStatus(); this.update(); if(update_input !== false) { if(!this.doAutoSelect()) { return; } this.showPartNumber(this.current_part_number); $('.current_selection_input').val(this.current_part_number); } if(this.current_status == 2) { $('.current_selection_input').addClass('special_order'); $('.current_selection_input').removeClass('non_standard'); $('.special_order_text').show(200); $('.non_standard_text').hide(200); } else if(this.current_status == 3) { $('.current_selection_input').removeClass('special_order'); $('.current_selection_input').addClass('non_standard'); $('.special_order_text').hide(200); $('.non_standard_text').show(200); } else { $('.current_selection_input').removeClass('special_order'); $('.current_selection_input').removeClass('non_standard'); $('.special_order_text').hide(200); $('.non_standard_text').hide(200); } if(this.isComplete()) { $('.part_action').find('.download_link').html('Searching for model...'); $.ajax( { url:generator.ajax_page, data:{ action:'getModel', material:this.current_part_number }, type:'POST', dataType: 'json', success: function (response) { var new_link = ""; if(response.status != 1) { new_link = $("Request a 3D model"); new_link.click(function (){generator.getModelRequestPage(generator.current_part_number)}); $('.part_action').find('.download_link').html(new_link); return; } if(response.found != 1) { new_link = $("Request a 3D model"); new_link.click(function (){generator.getModelRequestPage(generator.current_part_number)}); $('.part_action').find('.download_link').html(new_link); return; } new_link = $('Download 3D model'); new_link.click(function (){generator.getModelDownloadPage(generator.current_part_number)}); $('.part_action').find('.download_link').html(new_link); }, error: function () { $('.part_action').find('.download_link').html('Error in AJAX request'); } } ); $('.part_action').show(200); } else { $('.part_action').hide(200); } }, doAutoSelect : function () { var o_list = $('.option').not('.fixed_part').not(this.last_changed); var o_selected; var s_list; for(var i = 0; i < o_list.size(); i++) { o_selected = o_list.eq(i).find('.selected_option'); if(this.isEmptySelection(o_selected.find('.select_key').text())) { s_list = o_list.eq(i).find('.select_option').not('.select_option_disabled').not('.unselected'); if(s_list.size() == 1) { s_list.trigger('select_option'); this.updateSelection(); return false;//Stop early since updateSelection() will get the next option that needs to be auto selected anyways } } } return true; }, isComplete : function () { var ans = true; var o_list = $('.option').not('.fixed_part'); for (var i = 0; i < o_list.size(); i ++) { if(this.isEmptySelection(o_list.eq(i).find('.selected_option').find('.select_key').text())) { ans = false; return ans; } } return ans; }, update : function () { //this.updateValidCombos(); this.updateValidOptions(); }, resetSelection : function () { var o_list = $('.option').not('.fixed_part'); var s_o; var s_list; $('.select_option.unselected').trigger('select_option'); $('.select_option.default_option').trigger('select_option'); //for(var i = 0; i < o_list.size(); i ++) //{ // s_o = o_list.eq(i).find('.selected_option'); // s_list = o_list.eq(i).find('.select_option'); // s_o.find('.select_label').first().html(s_list.eq(0).find('.select_label').first().html()); // s_o.find('.select_key').first().html(s_list.eq(0).find('.select_key').first().html()); //} this.updateSelection(); }, setPartNumber: function (new_pn) { var o_list = $('.option'); var o; var s_list; var s_o; var current_position = 0; var key_length = 0; var pn_part = ""; var new_state = "unused"; var last_state = "unused"; var new_selection_state = ""; for(var i = 0; i < o_list.size(); i ++) { o = o_list.eq(i); if(o.hasClass('fixed_part')) { key_length = o.text().length; pn_part = new_pn.substr(current_position,key_length).toUpperCase(); if(pn_part == o.text()) { new_state = "correct"; } else { new_state = "incorrect"; } } else { key_length = o.find('.select_key').first().text().length; pn_part = new_pn.substr(current_position,key_length).toUpperCase(); s_list = o.find('.select_option'); s_o = o.find('.selected_option'); new_state = "incorrect"; for(var a = 0; a < s_list.size(); a ++) { if(s_list.eq(a).find('.select_key').text() == pn_part && !s_list.eq(a).hasClass('select_option_disabled') && pn_part != "") { //s_o.find('.select_label').first().html(s_list.eq(a).find('.select_label').first().html()); //s_o.find('.select_key').first().html(s_list.eq(a).find('.select_key').first().html()); s_list.eq(a).trigger('select_option'); if(this.isEmptySelection(pn_part)) { new_state = "unused"; } else { new_state = "correct"; } //this.updateValidCombos(); //this.updateValidOptions(); this.updateSelection(false); break; } } } if(new_state == "incorrect") { //s_o.find('.select_label').first().html(s_list.eq(0).find('.select_label').first().html()); //s_o.find('.select_key').first().html(s_list.eq(0).find('.select_key').first().html()); } if(new_state != last_state) { new_selection_state += ""; last_state = new_state; } new_selection_state += pn_part; current_position += key_length; if(current_position > new_pn.length) { //TODO: Maybe we should just loop instead of using each? //var u_list = o_list.slice(i +1); var last_option = true; for(a = i; a < o_list.size(); a ++) { if(!o_list.eq(a).hasClass('fixed_part')) { //s_o = o_list.eq(a).find('.selected_option'); if(o_list.eq(a).find('.empty_option').size() == 1 && last_option == true && o_list.find('.select_option').not('select_disabled_opiton').not('.empty_option').not('unselected').size() == 0) { s_list = o_list.eq(a).find('.select_option.empty_option'); s_list.first().trigger('select_option'); this.updateSelection(false); } else { last_option = false; s_list = o_list.eq(a).find('.select_option.unselected'); s_list.first().trigger('select_option'); this.updateSelection(false); } //s_o.find('.select_label').first().html(s_list.first().find('.select_label').first().html()); //s_o.find('.select_key').first().html(s_list.first().find('.select_key').first().html()); } } break; } } if(current_position < new_pn.length) { new_selection_state += "" + new_pn.substr(current_position + 1); } new_selection_state += ""; $('.selection_state').html(new_selection_state); }, showPartNumber: function (new_pn) { var o_list = $('.option'); var o; var s_list; var s_o; var current_position = 0; var key_length = 0; var pn_part = ""; var new_state = "unused"; var last_state = "unused"; var new_selection_state = ""; for(var i = 0; i < o_list.size(); i ++) { o = o_list.eq(i); if(o.hasClass('fixed_part')) { key_length = o.text().length; pn_part = new_pn.substr(current_position,key_length).toUpperCase(); if(pn_part == o.text()) { new_state = "correct"; } else { new_state = "incorrect"; } } else { key_length = o.find('.select_key').first().text().length; pn_part = new_pn.substr(current_position,key_length).toUpperCase(); s_list = o.find('.select_option'); s_o = o.find('.selected_option'); for(var a = 0; a < s_list.size(); a ++) { if(s_list.eq(a).find('.select_key').text() == pn_part) { if(this.isEmptySelection(pn_part)) { new_state = "unused"; } else { new_state = "correct"; } break; } } } if(new_state != last_state) { new_selection_state += ""; last_state = new_state; } new_selection_state += pn_part; current_position += key_length; if(current_position > new_pn.length) { break; } } if(current_position < new_pn.length) { new_selection_state += "" + new_pn.substr(current_position + 1); } new_selection_state += ""; $('.selection_state').html(new_selection_state); }, comboHasOption: function (combo_index,combo_key,value) { var o_list = this.combo_list[combo_index][combo_key]; var v = value; if(v == "") { v = ""; } if(this.isEmptySelection(v)) { return true; } if(typeof o_list[v] != 'undefined' && o_list[v] > 0) { return true; } return false; }, isEmptySelection: function (value) { if(value.length < 1) { return false;//Empty string is not an empty selection... } for(var i = 0; i < value.length; i ++) { if(value.charAt(i) != '-') { return false; } } return true; }, getModelDownloadPage: function (part_number) { var msg=open(this.manifold_link + "/PNGModelDownload?PartNo="+escape(part_number), 'PNGModelDownload', "status=no,toolbar=no,directories=no,scrollbars=yes,menubar=no,location=no,resizable=yes,width=590,height=720"); }, getModelRequestPage: function (part_number) { var msg=open(this.manifold_link + "/PNGModelRequest?PartNo="+escape(part_number), 'PNGModelDownload', "status=no,toolbar=no,directories=no,scrollbars=yes,menubar=no,location=no,resizable=yes,width=590,height=720"); }, getQuotePage: function (part_number) { var msg=open(this.manifold_link + "/PNGQuotePage?PartNo="+escape(part_number), 'PNGHelpPage', "status=no,toolbar=no,directories=no,scrollbars=yes,menubar=no,location=no,resizable=yes,width=590,height=720"); }, getCatalogPage: function (part_number) { var msg=open(this.manifold_link + "/OnePage?PartNo="+escape(part_number), 'PNGCatalog',""); }, getContactPage: function (part_number) { var msg=open(this.manifold_link + "/PNGContactPage?PartNo="+escape(part_number), 'PNGHelpPage', "status=no,toolbar=no,directories=no,scrollbars=yes,menubar=no,location=no,resizable=yes,width=590,height=720"); } };$(document).ready( function () { generator.ajax_page = "/AJAX/actionPage.php"; generator.init(); } );