var win = null;

function MM_openBrWindow(theURL,winName,features) { //v2.0
   jan = window.open(theURL,winName,features);
   jan.window.focus();
}

function MM_openPopUpBrWindow(theURL,winName,features,w,h) {
  var winl = (window.screen.availWidth-w)/2;
  var wint = (window.screen.availHeight-h)/2;
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'height=' + h + ',';
  settings += 'width=' + w + ',';
  settings += 'top=' + (wint-20) + ',';
  settings += 'left=' + winl + ',';
  settings += features;
  win = window.open(theURL,winName,settings);
  win.window.focus();
}

function MM_openExpandedPopUpBrWindow(theURL,winName,features,w,h) {
  var winl = 0
  var wint = 0
  var winwidth = window.screen.availWidth;
  var winheight = window.screen.availHeight;
  var settings = 'height=' + winheight + ',';
  settings += 'width=' + winwidth + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += features;
  win = window.open(theURL,winName,settings);
  win.moveTo(0,0);
  win.resizeTo(winwidth , winheight);
  win.window.focus();
}

function MM_openExpandedBrWindow(theURL,winName,features) { //v2.0
   jan = window.open(theURL,winName,features);
   var winwidth = window.screen.availWidth;
   var winheight = window.screen.availHeight;
   jan.moveTo(0,0);
   jan.resizeTo(winwidth , winheight);
   jan.window.focus();
}

function MM_openModalPopUpBrWindow(theURL,winName,features,w,h)
{
  var winl = (window.screen.availWidth-w)/2;
  var wint = (window.screen.availHeight-h)/2;
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'dialogHeight:' + h + 'px;';
  settings += 'dialogWidth:' + w + 'px;';
  settings += 'dialogTop:' + wint + ';';
  settings += 'dialogLeft:' + winl + ';';
  settings += features;
  win = window.showModalDialog(theURL, '', settings);
 }
 
function MM_closeBrWindow() { //v2.0
   window.close();
}

function MM_closePopUpBrWindow(prmRefreshParent) { 

	if (prmRefreshParent == 1)
   {
		var w = window.opener;
		
		var theform;
		
		if (w.navigator.appName.toLowerCase().indexOf("netscape") > -1) {
			theform = w.document.forms["Form1"];
		}
		else {
			theform = w.document.Form1;
		}
		
		if (theform.__hDATASOURCE.value == '0')
			{ w.execScript("__FazPostBack('ObterRegistros', 'ObterRegistros')","JavaScript"); }
		else
			{ w.execScript("__FazPostBack('ObterRegistros', 'FiltrarRegistros')","JavaScript"); }
	}
	
	self.close();
}

function closeParent(){ 
   try {
      var op = window.opener; 
      op.opener = self; 
      op.close(); 
   } 
   catch (er) 
      {}      
}