// these variable are needed for fancybox var opts = {}, imgPreloader = new Image(), imgTypes = ['png', 'jpg', 'jpeg', 'gif'], loadingTimer, loadingFrame = 1; // Eventhandler Plugin JDistill: /* * Distill * a extremely fast event handling solution * version: 1.0 * written by: * Gabor de Mooij * Robert Cabri * * modifications by: * mikko wuokko (28.02.2008) * Tobias Herrmann (20.10.2008) */ /** * Modified to use Click-Events only. It is still possible to assign Click-Event-Handlers otherwise. * * * obj: A list of attribute suffixes and the events linked to those * suffixes. No default. * attribute: Which attribute to use for prefix+suffix match eg. id, class, etc. * Defaults to "class". * prefix: Which prefix to use for attribute match. Defaults to "com_". * * $.distill({ * obj: function() { * alert("obj clicked"); * }, * obj2: function() { * alert("obj2 hovered"); * } * }, "id","link_"); * **/ $.distill = function(obj,attribute,prefix) { var follow = true ; var dispatcher = function(ev,handler,attribute,prefix) { var attribute = (attribute == null) ? "class" : attribute; var prefix = (prefix == null) ? "com_" : prefix; try{ var values = []; var elem ; if (ev.target!=null) elem= ev.target; else elem=ev.srcElement; while(elem.nodeName.toLowerCase()!= "body"){ var atrStr = $(elem).attr(attribute); if (atrStr.indexOf(" ")>-1) values = atrStr.split(" "); else values = [atrStr]; for (var j in values){ if (values[j].indexOf(prefix)>=0){ rexexp = new RegExp(prefix) var hname = values[j].replace(rexexp,''); if (handler[hname]) return handler[hname](elem,ev); } } elem=elem.parentNode; } }catch(e){ // Return true, in case a normal link was clicked return true; } return follow; } $("body").click(function(evt){ if(!(dispatcher(evt,obj,attribute,prefix))) return false; }); } // Stuff to do on page load $(document).ready(function() { $('#navi > li:last').addClass('last'); if (jQuery.browser.msie && parseInt(jQuery.browser.version) == 6) { $('#navi > li').mouseover(function(){ $('ul', this).show(); }).mouseout(function(){ $('ul', this).hide(); }); } $('#language').selectbox(); $('#languagesubmit').css("display", "none"); $('.language input').addClass("selectbox-language"); $('.language input').addClass("selectbox-language"); $('.language #language_container').addClass("selectbox-wrapper-language"); $('.language input').removeClass("selectbox"); $('.language #language_container').removeClass("selectbox-wrapper"); $('.selectbox-wrapper-language ul li').click(function(event) { myURL = $(this).attr("id").split("http"); if (myURL.length == 2) window.location.href = "http" + myURL[myURL.length-1]; }); $('#contentarea select:not(.multiselect)').selectbox(); $('#landingpagechooser').selectbox(); $('#landingpagechoosersubmit').css("display", "none"); $('.landingpagechooser input').addClass("selectbox-landingpagechooser"); $('.landingpagechooser #landingpagechooser_container').addClass("selectbox-wrapper-language"); $('.landingpagechooser #landingpagechooser_container').removeClass("selectbox-wrapper"); $('.language input').removeClass("selectbox"); $('.language #language_container').removeClass("selectbox-wrapper"); $('.selectbox-wrapper-language ul li').click(function(event) { myURL = $(this).attr("id").split("http"); if (myURL.length == 2) window.location.href = "http" + myURL[myURL.length-1]; }); $(document).pngFix(); $.distill({ fancybox: function(elem) { if (!$('#fancy_wrap').length) $.fn.fancybox.init(); opts.settings = $.extend({}, $.fn.fancybox.defaults); $.fn.fancybox.start(elem, opts.settings); return false; }, opt_toolbox: function(elem, evt) { var targetElem; if (evt.target!=null) targetElem= evt.target; else targetElem=evt.srcElement; if (targetElem.nodeName.toLowerCase()!='a') $(elem).next(':not(h3)').slideToggle().prev().toggleClass('open'); return true; }, opt_content: function(elem) { $(elem).toggleClass('open').next().slideToggle(); return false; }, opt_contact: function(elem) { $(elem).parent().next('form').toggle('slow'); $(elem).hide(); return false; }, downloads: function(elem) { if ($('#__error').length) $('#__error').remove(); if (elem.nodeName.toLowerCase()=="input" && !$("input[@name=download-control]:checked",$(elem).parent().parent()).length){ $(elem).parent().prepend("

Please select one or more files to download.

"); return false; }else{ if (!$('#fancy_wrap').length) $.fn.fancybox.init(); opts.settings =$.extend({}, $.fn.fancybox.defaults, {'itemLoadCallback': showSoftReg, 'frameWidth': 527, 'frameHeight':320}) return download_reg(elem,opts.settings); } }, order: function(elem) { if ($('#__error').length) $('#__error').remove(); if (elem.nodeName.toLowerCase()=="input" && !$("input[@name=order-control]:checked",$(elem).parent().parent()).length){ $(elem).parent().prepend("

Please select one or more brochures to order.

"); return false; }else{ if (!$('#fancy_wrap').length) $.fn.fancybox.init(); var thisFormID=$(elem).parent().parent().attr('id'); $('body').data('formID',thisFormID); opts.settings=$.extend({}, $.fn.fancybox.defaults, {'itemLoadCallback': getOrderParams,'frameWidth': 700, 'frameHeight':700}); $.fn.fancybox.start(elem,opts.settings); return false; } }, select_all_d: function(elem){ var formID=$(elem).parent().parent().attr('id'); if ($(elem).attr('value')=='Select All Downloads'){ selectAll(formID,'download-control'); $(elem).attr('value','Deselect All Downloads'); $(elem).attr('title','Deselect All Downloads'); } else if ($(elem).attr('value')=='Deselect All Downloads'){ deselectAll(formID,'download-control'); $(elem).attr('value','Select All Downloads'); $(elem).attr('title','Select All Downloads'); } return false; }, contact_search: function(elem, evt) { var targetElem; if (evt.target!=null) targetElem= evt.target; else targetElem=evt.srcElement; if (targetElem.nodeName.toLowerCase()=="li"){ contact_search( $('#contact_search form').attr('id') ); return false; }else return true; }, distributor_search: function(elem){ if (!$('#fancy_wrap').length) $.fn.fancybox.init(); var fW, fH; if ( ( $("#dsearchform #businessUnit").val()=="canada" && $("#dsearchform select[name=state]").val()=="") || ( ( $("#dsearchform #businessUnit").val()=="corp" || $("#dsearchform #businessUnit").val()=="npa" ) && ( $("#dsearchform select[name=radius]").val()=="" || !($("#dsearchform input[name=zipcode]").val().match(/^[0-9]{5}$/)) ) ) ){ fW=300; fH=30; }else{ fW=937; fH=600; } opts.settings = $.extend({}, $.fn.fancybox.defaults,{'itemLoadCallback': submitDSearch, 'frameWidth':fW, 'frameHeight':fH }); $.fn.fancybox.start(elem, opts.settings); return false; } },"class","ev_"); // manipulate links in distributor search list view $('.maplinks').href="void(0)"; // Initialize tab module if ($('.tabnavigation > ul > li').length){ $('.tabnavigation > ul').tabs(); } // Init swing teaser / downloads $('.swingteaser ul').jcarousel({scroll: 3}); $('.swingdownload ul').each(function(i, e) { if ($('li', e).length > 3) { $(e).jcarousel({scroll: 3}); } }); $('.swingdownload ul li.jcarousel-item:last-child, .swingteaser ul li.jcarousel-item:last-child').css('padding-right', '26px'); // Hide Sidebar boxes $('#contentright ul.closed').hide(); // Hide all toolbar boxes except contact forms $('#contentright .wrapper h3:not(.navigation, .contact, .empty)').removeClass('open').next().hide(); // Show all toolbar boxes which are explicitly flagged to show them $('#contentright .wrapper h3').next('.showtoolbox').show().prev().addClass('open'); // Open first FAQ content box $('.faq h3, .downloads h3.option').not(':first-child').next().hide(); $('.faq h3:first').toggleClass('open'); $('.faq h3').next().hide(); //Open first download box: //$('.downloads h3.first').toggleClass('open'); // Keep all downloads content boxes $('.downloads h3.option').next().hide(); $('.downloads h3.option:first-child').click(); //hide // Hide toolbox-contact-form $('#contentright div.form-toggle form').hide(); $('form.download_only_list').each(function(){ var formID=$(this).attr('id'); $('fieldset',this).prepend('
'); }); // Search $('#search').focus(function(){ if ( $(this).val() === $(this).attr('title') ) $(this).val(''); }).blur(function(){ if ( $(this).val() === '' ) $(this).val($(this).attr('title')); }); $('#topbar form').submit(function(){ if ( $('input:last', this).val() === '' || $('input:last', this).val() === $('input:last', this).attr('title') ) { alert('Please enter a term to search for.'); return false; } }); //Distributor Locator business unit selection $('#distributor_locator li').click( function() { $('#distributor_locator').submit(); }); // Initialize autosuggest for search var options_xml = { script: function (input) { return "/cps/rde/xchg/na_en/word_list.xsl/word_list.xml?search_query="+input; }, varname:"search_query" }; var as_xml = new bsn.AutoSuggest('search', options_xml); var as_xml2 = new bsn.AutoSuggest('yoursearch', options_xml); });