var WinPop;

function PopUpNewHQ(video, title) {	
							   		  
	var url = //'funct/youtube.aspx?'
		'http://tv.icac.org.hk/big5/funct/youtube.html?' 
		+ escape('video')+'='+escape(video)
		+'&'+escape('title')+'='+escape(title); //+escape(encodeURI(title)) 
	
	if (WinPop != null) {
		WinPop.close();
	}
		
	WinPop=window.open(
		url,"WinPop","left=0,screenx=0,top=0,screeny=0"
		+",width=" + 300//width 
		+ ",height=" + 200//height 
		+",scrollbars=no,resizable=yes,toolbar=no,status=no,menubar=no,location=no");
	rePopUp();

}

function PopUpMediaPlayer(video, title, eng, provider, ratio, debug) {	

	var url;
	if (eng) url =  'http://tv.icac.org.hk/eng/funct/mediaplayer.html?';
	else url = 'http://tv.icac.org.hk/big5/funct/mediaplayer.html?';
	url = url + escape('video')+'='+escape(video)
		+'&'+escape('title')+'='+escape(title); 
	if (provider != null && provider != "") {
		url = url + '&provider='+provider
	}
	if (ratio != null && ratio != "") {
		url = url + '&ratio='+ratio
	}
	if (debug != null && debug != "") {
		url = url + '&debug='+debug
	}
	
	if (WinPop != null) {
		WinPop.close();
	}
		
	WinPop=window.open(
		url,"WinPop","left=0,screenx=0,top=0,screeny=0"
		+",width=" + 300//width 
		+ ",height=" + 200//height 
		+",scrollbars=no,resizable=no,toolbar=no,status=no,menubar=no,location=no");
	rePopUp();

}

function PopUpMediaPlayer1(video, title, eng, provider, ratio, width, height, debug) {	
	var url;
	if (eng) url =  'http://tv.icac.org.hk/eng/funct/mediaplayer.html?';
	else url = 'http://tv.icac.org.hk/big5/funct/mediaplayer.html?';
	url = url + escape('video')+'='+escape(video)
		+'&'+escape('title')+'='+escape(title); 
	if (provider != null && provider != "") {
		url = url + '&provider='+provider
	}
	if (ratio != null && ratio != "") {
		url = url + '&ratio='+ratio
	}
	if (width != null && width != "") {
		url = url + '&width='+width
	}
	if (height != null && height != "") {
		url = url + '&height='+height
	}
	if (debug != null && debug != "") {
		url = url + '&debug='+debug
	}
	
	if (WinPop != null) {
		WinPop.close();
	}
		
	WinPop=window.open(
		url,"WinPop","left=0,screenx=0,top=0,screeny=0"
		+",width=" + 300//width 
		+ ",height=" + 200//height 
		+",scrollbars=no,resizable=no,toolbar=no,status=no,menubar=no,location=no");
	rePopUp();

}

function PopUpMediaPlayerMP3(video, title, eng, provider, ratio, width, height, debug) {	
	var url;
	if (eng) url =  'http://tv.icac.org.hk/eng/funct/mediaplayer.html?';
	else url = 'http://tv.icac.org.hk/big5/funct/mediaplayer.html?';
	url = url + escape('video')+'='+escape(video)
		+'&'+escape('title')+'='+escape(title); 
	if (provider != null && provider != "") {
		url = url + '&provider='+provider;
	}
	if (ratio != null && ratio != "") {
		url = url + '&ratio='+ratio;
	}
	if (width != null && width != "") {
		url = url + '&width='+width;
	}
	if (height != null && height != "") {
		url = url + '&height='+height;
	}
	if (debug != null && debug != "") {
		url = url + '&debug='+debug;
	}
		url = url + '&mp3=true';
	
	
	if (WinPop != null) {
		WinPop.close();
	}
		
	WinPop=window.open(
		url,"WinPop","left=0,screenx=0,top=0,screeny=0"
		+",width=" + 300//width 
		+ ",height=" + 200//height 
		+",scrollbars=no,resizable=no,toolbar=no,status=no,menubar=no,location=no");
	rePopUp();

}

function PopUpNew(URL){
	if (WinPop != null) {
		WinPop.close();
	}
	WinPop=window.open(
	URL,"WinPop","screenx=100,screeny=10,left=100,top=10,width=500,height=570,scrollbars=yes,resize=no,toolbar=no,status=no,menubar=no");
	rePopUp();
}

function rePopUp() {
	if (WinPop != null) {
		if (!WinPop.closed) WinPop.focus();
	}
	return true;
}

function end() {
	window.close(self);
}

function resize350() {
	self.window.moveTo(1, 1);
	if (self.name.length > 0) self.window.resizeTo(750, 850);
	else self.window.resizeTo(750, 950);
}

function resize100() {
	self.window.moveTo(150, 30);
	if (self.name.length > 0) self.window.resizeTo(380, 420);
	else self.window.resizeTo(380, 500);
}
