var popUp; 

function OpenWindow(idForm,idControl,idName,postBack)
{
	aleatorio = (Math.round((Math.random()*99999)+1))
	popUp = window.open(idForm + '?formname=' + document.forms[0].name + 
	'&Control=' + idControl + '&valor=' + document.forms[0].elements[idName].value + '&postBack=' + postBack,
	aleatorio,"top=100,left=150,height=400,width=700,status=yes,toolbar=no,menubar=no,resizable=yes" );
}

function OpenWinSimple(sTipo,sUrl, iWidth, iHeight, iTop, iLeft)
{
	aleatorio = (Math.round((Math.random()*99999)+1))
	Args="width=" + iWidth + ",height=" + iHeight + ",resizable=yes,scrollbars=no,status=1,top=" + iTop + ",left=" + iLeft + ";"
	popUp=window.open(sUrl,aleatorio,Args);
	if (popUp != null) {
		if (popUp.opener == null)
		popUp.opener = self;
	}
}

function fillTxt()
{
	var State = new Object()
	var aa;
	document.getElementById("hdnmsg").innerText=NewsBody_rich.document.body.innerHTML; 
}

function SetValor(FormName,idControl, valor, postBack)
{
	eval('var theform = document.' + FormName + ';');
	popUp.close();
	theform.elements["hidControl"].value = idControl;
	theform.elements["hidValor"].value = valor;
	if (postBack)
		__doPostBack('btnRecargar','');
}		

function OpenWindowForSelect(idForm,idName,postBack)
{	
	aleatorio = (Math.round((Math.random()*99999)+1))
	popUp = window.open(idForm + '?formname=' + document.forms[0].name + 
	'&Control=' + idName + '&valor=' + document.forms[0].elements[idName].value + '&postBack=' + postBack,
	aleatorio,"top=150,left=250,height=250,width=220,status=yes,toolbar=no,menubar=no,resizable=no" );
}


function SetValorForSelect(FormName,idControl, valor, postBack)
{
	eval('var theform = document.' + FormName + ';');
	popUp.close();
	theform.elements[idControl].value = valor;		
	if (postBack)
		__doPostBack('btnRecargar','');
}	

function SetValorForLista(FormName,idControl, valor, postBack)
{
	eval('var theform = document.' + FormName + ';');
	popUp.close();
	theform.elements[idControl].value = valor;	
	theform.elements["hidControl"].value = idControl
	if (postBack)
		__doPostBack('btnRecargar','');
}	

function OpenWindowLista(idForm,idName,idRecurso, postBack)
{
	aleatorio = (Math.round((Math.random()*99999)+1))
	popUp = window.open(idForm + '?formname=' + document.forms[0].name + '&Control=' + idName + '&valor=' + document.forms[0].elements[idName].value + '&postBack=' + postBack + '&Recurso=' + idRecurso,aleatorio,"top=100,left=150,height=450,width=600,resizable=yes,scrollbars=no,status=yes");
}

function OpenForm(idForm,idControl, iWidth, iHeight, iTop, iLeft,postBack)
{
	aleatorio = (Math.round((Math.random()*99999)+1))
	Args="width=" + iWidth + ",height=" + iHeight + ",resizable=yes,scrollbars=no,status=yes,top=" + iTop + ",left=" + iLeft 
	Url='?formname=' + document.forms[0].name + '&Control=' + idControl + '&Valor=' + document.forms[0].elements[idControl].value + '&PostBack=' + postBack 	
	popUp = window.open(idForm + Url,aleatorio,Args);	
}


function OpenWindowListaValores(idForm,idName,idRecurso,idColumnas, postBack)
{
	aleatorio = (Math.round((Math.random()*99999)+1))
	popUp = window.open(idForm + '?formname=' + document.forms[0].name + 
	'&Control=' + idName + '&valor=' + document.forms[0].elements[idName].value + '&postBack=' + postBack + '&Recurso=' + idRecurso + '&Columnas=' + idColumnas,
	aleatorio,"top=100,left=150,height=350,width=500,status=yes,toolbar=no,menubar=no,resizable=yes" );
}

function CloseWindow()
            {
                self.close();
            }
            
function MostrarOcultar(id) {
 var disp = document.all(id).style.display;

 if(disp != "none" || disp == "") {
   document.all(id).style.display = "none";
  }
 else {
   document.all(id).style.display = "block";
  }
}

function ConfirmSubmit(valor)
	{
	var agree=confirm(valor);
	if (agree)
		return true ;
	else
		return false ;
	}
		

