$(document).ready(function(){
	if (acctype == 1) {
		$('.acc .acc_content').hide();
		var selector = '.acc .acc_header a';
	}else if (acctype == 2) {
		$('.faqContent').hide();
		var selector = '.faqHeader';
	}
	$(selector).click(
		function() {
			if (acctype == 1) {
				var checkElement = $(this).parents(".acc_header").next();
				$('.xAccClose').remove();
				$('.xAccReadMore').show();
				$(this).hide();
				if((checkElement.is('div.acc_content')) && (checkElement.is(':visible'))) {
					return false;
				}
				if((checkElement.is('div.acc_content')) && (!checkElement.is(':visible'))) {
					$('.acc div.acc_content:visible').slideUp('slow');
					checkElement.slideDown('slow');
					$(checkElement).children('p:last').append(' <a href="" class="xAccClose" onclick="closeAccordion();return false;">Close</a>');
					return false;
				}
			} else if (acctype == 2) {
				var checkElement = $(this).next('.faqContent');
				if(checkElement.is(':visible')) {
					return false;
				}
				if(!checkElement.is(':visible')) {
					$('.faqContent').slideUp('slow');
					checkElement.slideDown('slow');
					//$(checkElement).append('<a href="" class="xAccClose" onclick="closeAccordion();return false;">Close</a>');
					return false;
				}
			}
			return false;
		}
	);
});

function closeAccordion() {
	$('.acc div.acc_content:visible').slideUp('slow');
	$('.xAccClose').remove();
	$('.xAccReadMore').show();
}
