var win=null;

function getURL()
{
		alert(document.URL);
		return;
}

function NewWindow(mypage,myname,w,h){
	LeftPosition=(screen.width)?(screen.width-w)/2:100;
	TopPosition=(screen.height)?(screen.height-h)/2:100;
	settings='width='+ w +',height='+ h +',top='+TopPosition+',left='+LeftPosition+',scrollbars='+'no'+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
	win=window.open(mypage,myname,settings);
	if(win.focus){
		win.focus();
	}
}
//Used to open image window
//By Trinh Minh Cuong
function OpenImageWindow(strURL,iWidth, iHeight){
	var nHeight= iHeight+40;
	LeftPosition=(screen.width)?(screen.width-iWidth)/2:100;
	TopPosition=(screen.height)?(screen.height-nHeight)/2:100;
	var settings='width='+ iWidth +',height='+ nHeight +',top='+TopPosition+',left='+LeftPosition+',scrollbars='+'no'+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
	win=window.open('showimage.htm?' + strURL,'ImageWindow',settings);
	if(win.focus){
		win.focus();
	}
}


function CloseNewWin(){if(win!=null && win.open)win.close()}
window.onfocus=CloseNewWin;

function openwin(winurl,winname)
{
	window.open(winurl,winname,'scrollbars=no, status=no')
}

function openImage(vLink, vHeight, vWidth, vTitle, vComment, vLang)
{
	var sLink = (typeof(vLink.href) == 'undefined') ? vLink : vLink.href;

	if (sLink == '')
	{
		return false;
	}

	winDef = 'status=no,resizable=no,scrollbars=no,toolbar=no,location=no,fullscreen=no,titlebar=yes,height='.concat(vHeight).concat(',').concat('width=').concat(vWidth).concat(',');
	winDef = winDef.concat('top=').concat((screen.height - vHeight)/2).concat(',');
	winDef = winDef.concat('left=').concat((screen.width - vWidth)/2);
	newwin = open('', '_blank', winDef);

	newwin.document.writeln('<html><head><title>'+vTitle+'</title></head>');
	newwin.document.writeln('<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />');
	newwin.document.writeln('<link href="includes/main.css" rel="stylesheet" type="text/css" />');
	newwin.document.writeln('<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">');
	if (vLang == '1') {
		newwin.document.writeln('<a href="" onClick="window.close(); return false;"><img src="', sLink, '" alt="Close" border=0></a>');
	} 
	else {
		newwin.document.writeln('<a href="" onClick="window.close(); return false;"><img src="', sLink, '" alt="&#272;&#243;ng l&#7841;i" border=0></a>');
	}
	newwin.document.writeln("<div align='center'><table width='80%' border='0' cellspacing='0' cellpadding='5' class='xtbl'><tr height='3'><td></td></tr><tr height='6'><td class='xlinetop'></td></tr><tr><td align='center'><span class='smallfont'>",vComment,"</span></td></tr><table></div>");
	newwin.document.writeln('</body></html>');

	if (typeof(vLink.href) != 'undefined')
	{
		return false;
	}
}