// Modified standard OpenSANAWin method to allow closing of popups
function CustomOpenSANAWin(self,url,wd,hg,Sanakeyword) {

	var NewWin = null;
	var top = event.screenY-event.offsetY;
	var left = event.screenX-event.offsetX;
	hg = hg + 20;
	//alert(Sanakeyword);
	left+=10;
	top+=20;
	if ((top+hg+25) > screen.availHeight)	top-=(25+hg);
	if ((left+wd) > screen.availWidth)	left=(screen.availWidth-wd-15);
	var imgs = document.getElementsByName(Sanakeyword);
	var x;
	for (x=0;x<imgs.length;x++)
	{
		strsrc = new String(imgs(x).src);
		imgs(x).src = strsrc.replace(/1\./,'5.');
	}
	NewWin = window.open(url,'Sanatext','toolbar=No,location=No,directories=No,status=No, menubar=No,scrollbars=No,width='+wd+',height='+hg+',top='+top+',left='+left+',resizable=Yes');
	
	/*NewWin = window.showModalDialog(url,'Sanatext','status:Yes;scroll:No;dialogWidth:'+wd+'px;dialogHeight:'+hg+'px;dialogTop:'+top+'px;dialogLeft:'+left+'px;resizable:No;help:No');
	if (NewWin) 
	{
		window.location.reload();
	}*/
	for (x=0;x<imgs.length;x++)
	{
		strsrc = new String(imgs(x).src);
		imgs(x).src = strsrc.replace(/5\./,'1.');
	}
}
