// JavaScript Document
function swapImage(id, img){
	
	document.getElementById(id).src = 'images/' + img;
	
}

function popUp(name, width, height, url){
	
	var s_width = (window.screen.width - width) / 2;
    var s_height = (window.screen.height - height) / 3;
    
	window.open(url, name, 'resizable=0,width=' + width + 
        ',height=' + height + 
        ',left=' + s_width +
		',top='+ s_height + 
		',screenX=' + s_width +
		',screenY=' + s_height +
		',scrollbars=yes, toolbar=yes');
	
}

function addCommas(nStr){

	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}

	return x1 + x2;
}
