function webtv(url)
{
	if(!url){
		url = "http://app.hkatv.com/webtv/control.php";
	} else {
		if(url.search(/www.hkatv.com/gi)>0)
			url = url.replace ('www.hkatv.com', 'app.hkatv.com');
		else if(url.search(/app.hkatv.com/gi)<0) {
			url = 'http://app.hkatv.com' + url;
		}	

	}
	remote = window.open(url, "", 
		"toolbar=0,width=600,height=430,resizable=1,status=0," +
		"menubar=0,toolbar=0," 
		+ "scrollbars=0,directories=0,copyhistory=no,top=0,left=0");
	if(remote != null) remote.focus()
}
	
	
function openWin(url, w, h)
{
	if(!w)                  w = screen.width - 50;
	else if(w>screen.width)	w = screen.width;

	if(!h)                    h = screen.height - 100;
	else if(h>screen.height)  h = screen.height;

	win = window.open(url, "newwin","width=" + w + ",height=" + h + ",resizable=1,scrollbars=1");
	win.focus()
}
