jQuery(document).ready(function() { var counter=0; var duplicates = new Array(); var dock_open = 0; function mbd_addItem() { //get object id var cur_id = this.id; //get number represented var tmpval = cur_id.match(/_(\d+)_(\d+)$/); var catnum = tmpval[1]; var num = tmpval[2]; if(this.checked == true) { if(document.getElementById('mbd_dynitems_handle')) { if(dock_open == 0 && counter > 0) { var cur_num = counter + 1; document.getElementById('mbd_dynitems_handle').innerHTML = global_default_dock_handle_innerhtml + " (" + cur_num+ ")"; } } if(duplicates[catnum + '_' + num] != 1) { if(counter == 0 && dock_open == 0) { dock_open = 1; jQuery('#mbd_dynitems_wrapper').stop().animate({bottom: '0px'},400, function () { jQuery(this).css({bottom: '0px'}); if(!document.getElementById('mbd_dynitem_' + catnum + '_' + num)) { jQuery('#mbd_dynitems').prepend(''); } if(jQuery('#mbd_dynitem_' + catnum + '_' + num).length) jQuery('#mbd_dynitem_' + catnum + '_' + num).fadeIn("fast",function () { jQuery(this).css({'opacity':'1'}); }); else jQuery('#mbd_dynitem_' + catnum + '_' + num).css({'display':'block'}); }); } else { if(!document.getElementById('mbd_dynitem_' + catnum + '_' + num)) { jQuery('#mbd_dynitems').prepend(''); } if(jQuery('#mbd_dynitem_' + catnum + '_' + num).length) jQuery('#mbd_dynitem_' + catnum + '_' + num).fadeIn("fast", function () { jQuery(this).css({'opacity':'1'}); }); else jQuery('#mbd_dynitem_' + catnum + '_' + num).css({'display':'block'}); } counter++; duplicates[catnum + '_' + num] = 1; jQuery('#mbd_coupons_item_' + catnum + '_' + num).stop().animate({'opacity':'.5'},400); } } else { jQuery(this).trigger('uncheck'); } } function mbd_removeItem() { if(this.type == 'checkbox') { var cur_id = this.id; } else { var par = this.parentNode; var cur_id = par.id; } //get number represented var tmpval = cur_id.match(/_(\d+)_(\d+)$/); var catnum = tmpval[1]; var num = tmpval[2]; counter--; if(counter == 0 && dock_open == 1) { dock_open = 0; jQuery('#mbd_dynitems_wrapper').stop().animate({bottom: '-282px'},500, function () { jQuery(this).css({bottom: '-282px'}); }); } if(document.getElementById('mbd_dynitems_handle')) { if(dock_open == 0 && counter > 0) document.getElementById('mbd_dynitems_handle').innerHTML = global_default_dock_handle_innerhtml + " (" + counter + ")"; else if(dock_open == 0 && counter == 0) document.getElementById('mbd_dynitems_handle').innerHTML = global_default_dock_handle_innerhtml; } jQuery('#mbd_dynitem_' + catnum + '_' + num).fadeOut("fast", function () { jQuery(this).css({'opacity':'0'}); }); jQuery('#mbd_coupons_item_' + catnum + '_' + num).stop().animate({'opacity':'1.0'},400, function () { jQuery(this).css({'opacity':'1.0'}); }); if(counter < 0) counter = 0; if(duplicates[catnum + '_' + num] == 1) duplicates[catnum + '_' + num] = 0; document.getElementById("mbd_coupons_item_cb_" + catnum + "_" + num).checked = false; if(document.getElementById('mbd_dynitem_' + catnum + '_' + num)) { var mbd_liObj = document.getElementById('mbd_dynitem_' + catnum + '_' + num); mbd_liObj.parentNode.removeChild(mbd_liObj); } } function mbd_printPage() { if(counter > 0) { var mbd_dynitems_node = document.getElementById('mbd_dynitems'); var li_els = mbd_dynitems_node.getElementsByTagName("li"); if(li_els.length > 0) { var val; var mbd_str = ""; for(i=0;i 0) document.getElementById('mbd_dynitems_handle').innerHTML = global_default_dock_handle_innerhtml + " (" + counter + ")"; }); } else { if(document.getElementById('mbd_dynitems_handle')) { document.getElementById('mbd_dynitems_handle').innerHTML = global_default_dock_handle_innerhtml; } dock_open = 1; jQuery('#mbd_dynitems_wrapper').stop().animate({bottom: '0px'},400, function () { jQuery(this).css({bottom: '0px'}); }); } } function mbd_closePrint() { document.getElementById('mbd_printer_wrapper').style.display = 'none'; } jQuery('.mbd_add').live('click', mbd_addItem); jQuery('.mbd_add').bind('uncheck', mbd_removeItem); jQuery('.mbd_x').live('click', mbd_removeItem); jQuery('#mbd_dynlist_print_button').live('click',mbd_printPage); jQuery('#mbd_printer_close_button').live('click',mbd_closePrint); jQuery('#mbd_dynitems_handle').live('click',mbd_toggleDock); }); function mbd_clearCheckboxes(formid) { if(document.getElementById(formid)) { var mbd_form = document.getElementById(formid); var ele; for(i=0;i> 4); chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); chr3 = ((enc3 & 3) << 6) | enc4; output = output + String.fromCharCode(chr1); if (enc3 != 64) { output = output + String.fromCharCode(chr2); } if (enc4 != 64) { output = output + String.fromCharCode(chr3); } } while (i < input.length); return output; } function mbd_toggleTeaser(id) { if(document.getElementById(id).style.height == "100%") { jQuery(document).ready(function() { jQuery('#' + id).css({'height': '0'}); }); document.getElementById(id + "Link").innerHTML = "Display All Matchups"; } else { jQuery(document).ready(function() { jQuery('#' + id).animate({'height': '100%'}, function () { jQuery(this).css({'height':'100%'}); }); }); document.getElementById(id + "Link").innerHTML = "Hide Matchups"; } }