var popUp; 

//var popUpInfoObjeto; 
L_MinimizeTip_Text = "Minimizar";
L_ExpandTip_Text = "Expandir";
var action;
IE4 = (document.all && !document.getElementById) ? true : false;
NS4 = (document.layers) ? true : false;
IE5 = (document.all && document.getElementById) ? true : false;
NS6 = (!document.all && document.getElementById) ? true : false;


function LayoutInicial()
{
	document.all.item('DSVerticalMenuZone').style.width = "20%";
}

function MinimizarRestaurarMenu(partElem,zoneElem,zoneControl,imgMin,imgMax,widthZona)
{
	var varProp;
	// Determine the new value for the FrameState property.
	if (partElem.style.display == "none")
	{
		partElem.style.display = "";
		document.activeElement.children.item(0).src = imgMin;
		document.activeElement.children.item(0).title = L_MinimizeTip_Text;
		zoneElem.style.width = widthZona;
		zoneControl.style.width = "80%";
	}
	else
	{
		partElem.style.display = "none";
		document.activeElement.children.item(0).src = imgMax;
		document.activeElement.children.item(0).title = L_ExpandTip_Text;
		zoneElem.style.width = "";
		zoneControl.style.width = "100%";
	}
}

function OpenPopUp(url){
	popUp = window.open(url,'test','width=640,height=480,left=0,top=0,scrollbars=yes');
	popUp.moveTo('middle','middle');
}

function OpenPopUpInfoObjeto(url){
	var popUpInfoObjeto;	
	popUpInfoObjeto = window.open(url,'test','width=500,height=550,scrollbars=yes');
	popUpInfoObjeto.moveTo('middle','middle');
}

function OpenWindow(url,windowWidth,windowHeight,windowStatusBar,windowScrollbar){
	var status;
	//var popUpInfoObjeto = window.open(url,"","width="+windowWidth+",height="+windowHeight+",left=0,top=0,scrollbars="+windowScrollbar+",status="+windowStatusBar);
	popUp = window.open(url,"","width="+windowWidth+",height="+windowHeight+",left=0,top=0,scrollbars="+windowScrollbar+",status="+windowStatusBar);
	popUp.moveTo('middle','middle');
}

function SelectImage(strImageName,controlId)
{
	self.close();		
	var control = opener.document.getElementById(controlId);
	control.value = strImageName;
}

function RefreshAlerts(controlId)
{
	//eval('var theForm = document.Default;');
	//var exp = 'var theControl = theForm.' + controlId
	//eval(exp);
	var theControl = document.getElementById(controlId);
	popUp.close();
	theControl.value = 'true';
		__doPostBack('theForm','');
}		

function RefreshPanel(controlId)
{
	//var theForm = document.Default;
	var theForm = document.forms(0);
	var theControl = document.getElementById(controlId);
	if ( theControl != null )
	{
		theControl.value = 'true';
			__doPostBack('theForm','');
	}
	popUp.close();
}		


function RefreshPanelWithValue(controlId, strValue)
{
	//var theForm = document.Default;
	var theForm = document.forms(0);
	var theControl = document.getElementById(controlId);
	
	theControl.value = strValue;
		__doPostBack('theForm','');
		popUp.close();
}		


function RefreshPlans(strParentControl)
{
	eval('var theForm = document.Default;');
	var exp = 'var theControl = theForm.' + strParentControl + '_UcPanelPlanAccion1_txtHasNewPlans;'
	eval(exp);
	popUp.close();
	theControl.value = 'true';
		__doPostBack('theForm','');
}		

function RefreshDocs(strParentControl)
{
	eval('var theForm = document.Default;');
	var exp = 'var theControl = theForm.' + strParentControl + '_UcPanelDocumentos1_txtHasNewDocs;'
	eval(exp);
	popUp.close();
	theControl.value = 'true';
		__doPostBack('theForm','');
}		

function RefreshComments(strParentControl)
{
	eval('var theForm = document.Default;');
	var exp = 'var theControl = theForm.' + strParentControl + '_UcPanelComentarios1_txtHasNewComments;'
	eval(exp);
	popUp.close();
	theControl.value = 'true';
		__doPostBack('theForm','');
}		

function RefreshPrecedingRelation(strParentControl)
{
	eval('var theForm = document.Default;');
	var exp = 'var theControl = theForm.' + strParentControl + '_UcPanelRelacionIndicadorPrec1_txtHasNewPrecedingRelation;'
	eval(exp);
	popUp.close();
	theControl.value = 'true';
		__doPostBack('theForm','');
}		

function RefreshDependingRelation(strParentControl)
{
	eval('var theForm = document.Default;');
	var exp = 'var theControl = theForm.' + strParentControl + '_UcPanelRelacionIndicadorPrec1_txtHasNewDepending;'
	eval(exp);
	popUp.close();
	theControl.value = 'true';
		__doPostBack('theForm','');
}		

function RefreshKpiValues(strParentControl)
{
	eval('var theForm = document.Default;');
	var exp = 'var theControl = theForm.' + strParentControl + '_UcValoresIndicador1_txtHasNewKpiValues;'
	eval(exp);
	popUp.close();
	theControl.value = 'true';
	__doPostBack('theForm','');
}		

function RefreshGoals(strParentControl)
{
	eval('var theForm = document.Default;');
	var exp = 'var theControl = theForm.' + strParentControl + '_txtHasNewGoals;'
	eval(exp);
	popUp.close();
	theControl.value = 'true';
		__doPostBack('theForm','');
}		

function CloseWindow()
{
 self.close();
}

function ConfirmTest()
{
	return confirm('Esto es');
}

function ConfirmDeletion() 
{
return confirm('¿Esta seguro de querer eliminar este registro?');
}

/*Mostrar y esconder areas en un datagrid*/


function showDetails(action)
{
   x = 0;
   changeImage(arguments[x]);
    if (IE4) { prefix = document.all(arguments[x]).style; }
    if (NS6 || IE5) { prefix = document.getElementById(arguments[x]).style }
    if (NS4){ prefix = document.layers(arguments[x]); }

    if (prefix.visibility == "visible")
    {
       prefix.visibility = "hidden";
       prefix.fontSize = "0";
    }
    else
    {
       prefix.visibility = "visible";
       prefix.fontSize = "16";
    }
}

function changeImage(link)
{
  link += "link";
  linkText = document.getElementById(link);
  linkText.firstChild.nodeValue;

  if (linkText.firstChild.src == "images/btnPlus.gif")
  {
    linkText.firstChild.src = "images/btnMinus.gif";
  }
  else
  {
    linkText.firstChild.src = "images/btnMinus.gif";
  }
}

function ocultarSeccion(vstrObjeto)
{
            var strEstado = document.all(vstrObjeto).getAttribute("oEstado", 0)
            if (strEstado == "1") 
			{
                        document.all(vstrObjeto).style.display = "none";
                        document.all(vstrObjeto).setAttribute("oEstado", "0", 0);
                        window.event.srcElement.src = "images/downarrows_white.gif";
                        //window.event.srcElement.alt = "Maximizar Sección";
              }
              else 
              {
                        document.all(vstrObjeto).style.display = "";
                        document.all(vstrObjeto).setAttribute("oEstado", "1", 0);
                        window.event.srcElement.src = "images/uparrows_white.gif";
                        //window.event.srcElement.alt = "Minimizar Sección";
            }
}

function CambiarImagen(vstrImagen)
{
	window.event.srcElement.src = vstrImagen
}
