function stopError() {
	return true;
}

window.onerror = stopError;

function playAudio(a,b,c,d){
	document.getElementById("player").load(a,b,c,d);
}

var playerwin = null;
function popplayer(url) {
	var iswin = (playerwin && !playerwin.closed && playerwin.location);
	if(!iswin) {
		popup(url, 120, 120, {status : "no"});
	}
}

function popup(url, width, height, options) {
	// calculate the window's X and Y position
	var x = (screen.width  - width ) / 2;
	var y = (screen.height - height) / 2;
	
	// Default the additional options:
	var defaults = {
		resizable : 'yes',
		titlebar : 'no',
		directories : 'no',
		toolbar : 'no',
		menubar : 'no',
		scrollbars : 'yes',
		status : 'no'
	};
	
	if(typeof options == 'undefined') {
		options = {};
	}
	
	for(var i in defaults) {
		if(typeof options[i] == 'undefined') {
			options[i] = defaults[i];
		} else {
			if(typeof options[i] == 'number') {
				options[i] = options[i] == 1 ? 'yes' : 'no';
			}
		}
	}

	// Prepare the popup window's parameter string
	var param = '';
	param +=  'left=' + x.toString();
	param += ',top=' + y.toString();
	param += ',width=' + width.toString();
	param += ',height=' + height.toString();
	param += ',location=no';
	param += ',resizable=' + options.resizable;
	param += ',titlebar=' + options.titlebar;
	param += ',directories=' + options.directories;
	param += ',toolbar=' + options.toolbar;
	param += ',menubar=' + options.menubar;
	param += ',scrollbars=' + options.scrollbars;
	param += ',status=' + options.status;
	
	// open the window
	var x = window.open(url, 'pwin', param);
	x.focus();
}
