Created
September 18, 2009 18:16
-
-
Save ng/189207 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//<![CDATA[ | |
// define checkbox array | |
// [element_id, hide shipping div on load?] | |
var checkboxes = new Array( | |
new Array('uc_delivery_rpt_orders_ctl00_rbl_deliveryMethods_0', true), | |
new Array('uc_delivery_rpt_orders_ctl00_rbl_deliveryMethods_1', false), | |
new Array('uc_delivery_rpt_orders_ctl00_rbl_deliveryMethods_2', true) | |
); | |
document.observe('dom:loaded', function(){ | |
// show or hide divs based on available delivery methods | |
checkboxes.each(function(e){ | |
// element doesn't exist | |
if($(e[0]) == null) { | |
return false | |
} else { | |
// should the shippinig div be hidden? | |
if(e[1] == true){ | |
$("div_shipping").hide(); | |
} else { | |
Effect.BlindDown('div_shipping', { duration: 0.2 }); | |
var element_name = e[0]; | |
} | |
// set up event observers for each element | |
$(e[0]).observe('click', function(element){ | |
// if element should be able to toggle shipping div | |
if(this.id == element_name){ | |
if(!$("div_shipping").visible("div_shipping")){ | |
Effect.BlindDown('div_shipping', { duration: 0.2 }); | |
} | |
} else { | |
if($("div_shipping").visible("div_shipping")){ | |
Effect.BlindUp('div_shipping', { duration: 0.2 }); | |
} | |
} | |
}) | |
} | |
}); | |
// more details detail tip | |
if($('dt_more_details')){ | |
$$('a.lnk_more_details').invoke('show'); // only show the links for js users | |
detailTip = new DetailTip('detailtip', $$('a.lnk_more_details')); | |
} | |
}); | |
//]]> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment