jQuery(document).ready(function(){ //init sortable jQuery('.sortable').each(function(){ jQuery(this).sortable({ "handle": '.handler', "placeholder": 'ui-state-highlight', "stop": function(event,ui){ jQuery('#product-images .sortable li').removeClass('first-image'); check_product_first_image(); } }); }); //init the tool-tip (for product-modify page) tool_tip(); //clone mySlides search input jQuery('#product-filter').prepend(jQuery('#mySlides_filter').children('input').clone(true)); //The first image in product images list got the class first-image & become bigger check_product_first_image(); //when click on add-product-link open the div below jQuery('#add-product-link').bind('click', function(){ jQuery('#existing-products').toggleClass('open'); jQuery('#existing-products').toggle('blind'); }); jQuery('#product_product_type_id, #pack_product_type_id').live('change',function(e){ jQuery.ajax({ "before": function(){ tmce_unload_children('#product-types-panel');}, "data": { "product_type_id": jQuery(e.target).val(), "authenticity_token": window._forgeos_js_vars.token, "id": get_id_from_rails_url() }, "success": function(request){ jQuery('#product-types-panel').html(request); tmce_load_children('#product-types-panel'); }, "type": 'post', "url": '/admin/products/update_attributes_list' }); }); jQuery('.add_a_size').live('click', function(){ var itemInTable = jQuery('#product_sizes tbody tr').length; var new_tr = ''; new_tr += '