// opens new window
function NewWin(url) {
	var newWindow = window.open(url);
	newWindow.focus();
}

// opens new window of specified size
function NewWinSized(url, x, y) {
	var newWindow = window.open(url, 'popupwindow', 'width='+x+',height='+y+',toolbar=0,location=0,menubar=0,scrollbars=0,status=0');
	newWindow.focus();
}

// opens new window of specified size, with scrollbars
function NewWinSizedScroll(url, x, y) {
	var newWindow = window.open(url, 'popupwindow', 'width='+x+',height='+y+',toolbar=0,location=0,menubar=0,scrollbars=1,status=0');
	newWindow.focus();
}

// opens new window for england tv feed
function EnglandTV(url, speed) {
	var idIx = url.indexOf('=');
	if (idIx != -1) {
		var identifier = url.substring(idIx+1, url.length);
		var construct = '/templates/video/englandtv.aspx?id='+identifier+'&speed='+speed;
		var newWindow = window.open(construct, 'englandtv','width=332,height=430,toolbars=no,status=no,scrollbars=no');
		newWindow.focus();
	}
}

// opens new window for FATV with supplied video id
function FATV(vid) {

		NewWinSized("/fatv/microsite.aspx?i=" + vid,760,507);
}

// opens new window for england tv feed
function EnglandTVRM(url, speed) {
	var idIx = url.indexOf('=');
	if (idIx != -1) {
		//var identifier = url.substring(idIx+1, url.length);
		var construct = '/templates/video/englandtvrm.aspx?url='+url+'&speed='+speed;
		var newWindow = window.open(construct, 'englandtv','width=332,height=430,toolbars=no,status=no,scrollbars=no');
		newWindow.focus();
	}
}
// opens new window for FA Cup tv feed
function FACupTV(url, speed) {
	var idIx = url.indexOf('=');
	if (idIx != -1) {
		var identifier = url.substring(idIx+1, url.length);
		var construct = 'http://www.thefa.com/templates/video/facuptv.aspx?id='+identifier+'&speed='+speed;
		var newWindow = window.open(construct, 'facuptv','width=332,height=430,toolbars=no,status=no,scrollbars=no');
		newWindow.focus();
	}
}

// opens new window for FA Cup audio feed
function FACupAudio(feedUrl) {
	var baseUrl = "http://www.thefa.com/static/audiopopup/?src=";
	var construct = baseUrl + escape(feedUrl)
	var newWindow = window.open(construct, 'facupaudio','width=332,height=100,toolbars=no,status=no,scrollbars=no');
	newWindow.focus();
}
