$.fn.basicAccordion = function(options) {

	var defaults = {
				speedIn	: 750,
				speedOut: 300,
                                allowclose : true
			};
	var options = $.extend(defaults, options);

	return this.each(function(index, dom) {
			
			$(this).next('div[class!="active"]').slideUp(1).addClass('bac');
			
			$(dom).click(function() {

                            if ($(this).attr("href").substring(0,16) == "http://www.bupa-") {
                                $(this).attr("target", "_blank");
                            }
                            
                            if (($(this).attr('class') != 'button') && ($(this).attr("href").substring(0,16) != "http://www.bupa-") && ($(this).attr("href").substring(0,7) != "mailto:") && ($(this).attr("href").substring(0,18) != "https://global.ihi")) {
                            
				if ($(this).next("div").hasClass('active')) {
                                        if (options.allowclose == true) {
                                            $(this).parent().find('a.active').removeClass('active');
                                            $(this).parent().find('div.active').removeClass('active').slideUp(350);
                                        }
                                }
                                
                                else {

					$(this).parent().find('a.active').removeClass('active');
					$(this).parent().find('div.active').removeClass('active').slideUp(350);
				
                                        
                                        $(this).addClass('active');
                                        $(this).next('div').addClass('active').slideDown(500);
                                }
                                           
				return false;
                                
                                
                            }
			});	
	});
}
