// jQuery // $(document).ready(function(){ // // // toggle // $('.toggle').click(function () { // $('.to_be_toggled').toggle(); // }); // // }); // toggle (show/hide) DOM elements function toggle(obj) { var el = document.getElementById(obj); el.style.display = (el.style.display != 'none' ? 'none' : '' ); return false; } $(document).ready(function() { // jQuery Accordion $('.product-categories-intranet').accordion({ header: 'li.title', active: 'li.active', alwaysOpen: false, autoHeight: false }); // print $(".print_page").click(function(event) { event.preventDefault(); print(); }); // "save changes"" buttons // do NOT break the selectors to multiple lines, or it will break some other jquery functions ! $("#request_form input.track-changes, #request_form textarea.track-changes, #request_form select.track-changes, #orderform input, #orderform textarea, #orderform select").change(function() { if ($("#save_changes").hasClass('activeChanges') == false) { $("#save_changes").addClass("activeChanges").hide().fadeIn(); } }); $("#request_form input.qty").click(function() { if ($("#save_changes").hasClass('activeChanges') == false) { $("#save_changes").addClass("activeChanges").hide().fadeIn(); } }); // tabs $("#tabs > ul").tabs(); }); $(window).load(function(){ // thumbnail resize thumbs = $(".product-small-block .p-img img"); for(x = 0; x < thumbs.length; x++) { oldW = thumbs.eq(x).attr("width"); newW = oldW*.8; oldH = thumbs.eq(x).attr("height"); newH = oldH*.8; thumbs.eq(x).attr("width", newW); thumbs.eq(x).attr("height", newH); } // thumbs = $(".product-thumb .p-img img"); // for(x = 0; x < thumbs.length; x++) // { // oldW = thumbs.eq(x).attr("width"); // newW = oldW*1; // // oldH = thumbs.eq(x).attr("height"); // newH = oldH*1; // // thumbs.eq(x).attr("width", newW); // thumbs.eq(x).attr("height", newH); // } thumbs = $("#list-items .p-img img"); for(x = 0; x < thumbs.length; x++) { oldW = thumbs.eq(x).attr("width"); newW = oldW*.8; oldH = thumbs.eq(x).attr("height"); newH = oldH*.8; thumbs.eq(x).attr("width", newW); thumbs.eq(x).attr("height", newH); } }); // return the value of the radio button that is checked // return an empty string if none are checked, or // there are no radio buttons // taken from: http://www.somacon.com/p143.php function getCheckedValue(radioObj) { if(!radioObj) return ""; var radioLength = radioObj.length; if(radioLength == undefined) if(radioObj.checked) return radioObj.value; else return ""; for(var i = 0; i < radioLength; i++) { if(radioObj[i].checked) { return radioObj[i].value; } } return ""; }