$(document).ready(function(){

	$.easing.def = "easeOutCirc";
	
	$('li.button a').click(function(e){
		if($(this).attr('href') != '/'){
			var dropDown = $(this).parent().next();
			$('.dropdown').not(dropDown).slideUp('slow');
			dropDown.stop(false,true).slideToggle('slow');
			e.preventDefault();
		}
	});
	
	$('.currpage').trigger('click');

	$("#search_country").change( function() {
		$(".US").hide();
		$(".CA").hide();
		$("."+$("#search_country").val()).show();
		$("#state option:first-child").attr("selected", "selected");

	});
	
	$(".US").hide();
	$(".CA").hide();
	$("."+$("#search_country").val()).show();
	
	$(".chc").click( function(event){
		var langid = $('html').attr('lang');
		var divid = $(this).attr('id');
		var num = divid.substr(1);
		if(event.target.id != 'extlink'){
			if ($('body').find('#t' + num).length == 0){
				if ($('.tmphldr').attr('id') != undefined){
					var openid = $('.tmphldr').attr('id').substr(1);
					$('#c' + openid).html($('#t' + openid).html() );
					$('#t' + openid).remove();
				}
				$.post('/core/modules/charity/ajax.php', { c : num, l : langid }, function(data) {
					$('.tmphldr').remove();
					$('body').append('<div id="t' + num + '" class="tmphldr" style="display:none;">' + $('#' + divid).html() + '</div>');
					$('#'+divid).html('<div id="z' + num + '" class="chbody">' + data + '</div>');
				});
			} else {
				$('#' + divid).html($('#t' + num).html() );
				$('#t' + num).remove();
			}
		}
	});
	
	$(".chtitle").attr("href","javascript:;"); 

});



