function popup(pageUrl, width, height) {
	var left = screen.width / 2 - width / 2;
	var top = screen.height / 2 - height / 2;
	
	window.open(pageUrl, '', 'width=' + width + ',height=' + height + ',top=' + top + ',left=' + left + ",scrollbars=yes,resizable=no");
}

function externalLinks() { 
	if (!document.getElementsByTagName) return; 
	var anchors = document.getElementsByTagName("a"); 
	for (var i = 0; i < anchors.length; i++) { 
		var anchor = anchors[i]; 
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
			anchor.target = "_blank"; 
		}
	}
}

if (window.addEventListener) {
	window.addEventListener('load', externalLinks, false); 
} else if (window.attachEvent) { 
	window.attachEvent('onload', externalLinks);
}

$(document).ready(function() {
moreBlocks('questionAndAnswer');
moreBlocks('answer');
});

function moreBlocks(className, appendStyle) {
	$('.' + className).hide();
	if (appendStyle != undefined) {
		$('.' + className).css(appendStyle);
	}
	$('.' + className + 'More').click(function() {
		var elementId = this.id.substring(0, this.id.indexOf('More'));
		if ($('#' + elementId).is(':visible')) {
			// hide the element contents
			$('#' + elementId).animate({height: "hide", marginTop: '0', paddingBottom: '0'});
		} else {
			// show the elements contents
			$('.' + className + ':visible:not(#' + elementId + ')').animate({height: "hide", marginTop: '0', paddingBottom: '0'});
			$hahaLol = $('#' + elementId).show();
			if ($.browser.msie) {
				$hahaLol.css('display', 'inline');
			}			
		}
		//return false;
	});
}
	
	
	$(document).ready(function() {
		var curLocation = document.location.toString().split("/");
		var realLocation = "";
		for (var i=3;  i < curLocation.length && i < 5; i++) { // strip away http://..../
			realLocation += "/" + curLocation[i];
		}
		$('div#menuCenter li a[href=' + realLocation + ']').parent().addClass('selected');
		
		$('div#menuCenter li li a[href=' + realLocation + ']').addClass('selected');
});




	
