
function ampPlayVideo( href, width, height ) {
	if ( width < 320 ) width = 320;
	
	resizePopup( width + 90, height + 260 );
    location = href;
}

function ampPlayAudio( href ) {
	if ( window.opener ) {
		window.opener.location = href;
		window.close();
		return false;
	}
	else {
		return true;
	}
}

function ampOpenAmplifier( href ) {
	if ( window.opener ) {
		if(window.opener.location.host.indexOf("amplifier") != -1) {
			window.opener.location = href;
			window.opener.focus();
			//window.close();
			return false;
		}
		else {
			// Open in new window
			return true;
		}
	}
	else {
		// Open in new window
		//window.close();
		return true;
	}
}

function resizePopup( width, height ) {
	var currentWidth;
	var currentHeight;
	var chromeWidth;
	var chromeHeight;
	
	if ( top.window.outerWidth ) {
		currentWidth = top.window.outerWidth;
		currentHeight = top.window.outerHeight;
		
		chromeWidth = top.window.outerWidth - top.window.innerWidth;
		chromeHeight = top.window.outerHeight - top.window.innerHeight;
	}
	else if ( document.body && document.body.clientWidth ) {
		currentWidth = document.body.clientWidth;
		currentHeight = document.body.clientHeight;
		
		// Determine chrome widths
		top.window.resizeTo( currentWidth, currentHeight );
	
		chromeWidth = currentWidth - document.body.clientWidth;
		chromeHeight = currentHeight - document.body.clientHeight;
	}
	else {
		return;
	}
	
	currentWidth = width + chromeWidth;
	currentHeight = height + chromeHeight;
		
	top.window.resizeTo( currentWidth, currentHeight );
}
