$(document).ready(function() {
	// Country change modal dialog - from Xerox website
	$('#country_selector_modal_hdr_link').click(function(e){
		e.preventDefault();
		if ( true && $('#country_selector_modal_hdr_iframe') && (!$('#country_selector_modal_hdr_iframe').attr('src') || $('#country_selector_modal_hdr_iframe').attr('src') == null) ) {
			$('#country_selector_modal_hdr_iframe').attr('src', 'assets/profile-change.html');
		}
		$('#country_selector_modal_hdr').modal({
			opacity: 80,
			persist: true,
			overlayCss: {
				backgroundColor: '#000',
				cursor: 'wait'
			},
			onOpen: function(dialog){
				scroll(0,0);
				this.dialog.overlay.show();
				this.dialog.container.show();
				this.dialog.data.show();
				if(jQuery.browser.msie){
					if (document.getElementById("modalOverlay")){
						document.getElementById("modalOverlay").style.height = document.body.scrollHeight + 'px';
					}
				}
			}
		});
	});

	$(".collapsible span a").click(function() {
		if(!$(this).hasClass("collapsed")) {
			if($(".homeRightColumn-content").length > 0)
				var container = ".homeRightColumn-content";
			else
				container = ".sidebar";
			$(container).find(".collapsed").each(function() {
				$(this).toggleClass("collapsed");
				$(this).parent().next().toggle();
			});
		}
		$(this).toggleClass("collapsed");
		$(this).parent().next().toggle();
	});

	if($("#links_ftr .moduleTitle h3").length > 0 && $("#footerTitle").length > 0) {
		$("#links_ftr .moduleTitle h3").html($("#footerTitle").html());
	}
});