function EnviarEMail()
{
	nSel=0;
	var aInput=document.getElementsByTagName("input");
	for( nEle=0; nEle<aInput.length && nSel<2; nEle++)
		if( aInput[nEle].type == 'checkbox' && aInput[nEle].name.indexOf( 'DGEMailPanelistas' ) > -1 && aInput[nEle].checked && aInput[nEle].name.substr( aInput[nEle].name.length -1 ) == "0" )
			nSel++;
	if( nSel==0 )
		alert( 'Seleccione los panelistas a los que quiere enviar el Mensaje');
	else
		__doPostBack('CorImgSend','');
}
function calendarPicker(Control, strField)
{
	Control.style.cursor='wait';
	window.open('DatePicker.aspx?field=' + strField,'calendarPopup','width=250,height=190,resizable=no,menubar=no,scrollbars=no,status=no,titlebar=no,toolbar=no,z-lock=yes,left=' + (screen.width - 250 ) / 2 + ',top=' + (screen.height - 190 ) / 2);
	Control.style.cursor='default';
}
function PresentarCNAE(Control, strField)
{
	Control.style.cursor='wait';
	window.open('CNAESSel.aspx?field=' + strField,'SeleccionDeCNAES','width=500,height=550,resizable=no,menubar=no,scrollbars=no,status=no,titlebar=no,toolbar=yes,z-lock=yes,left=' + (screen.width - 500 ) / 2 + ',top=' + (screen.height - 550 ) / 2);
	Control.style.cursor='default';
}
function PresentarAccionesFormativas(Control, strField, descField, IdSeccionVer, IdPregunta)
{
	Control.style.cursor='wait';
	window.open('AccionesFormativas.aspx?field=' + strField + '&IdSeccionVer=' + IdSeccionVer + '&IdPregunta=' + IdPregunta + '&desField=' + descField,'AccionesFormativas','width=500,height=550,resizable=no,menubar=no,scrollbars=yes,status=yes,titlebar=no,toolbar=no,z-lock=yes,left=' + (screen.width - 500 ) / 2 + ',top=' + (screen.height - 550 ) / 2);
	Control.style.cursor='hand';
}


function DetectarAlto()
{
	window.moveTo(0,0);
	window.resizeBy(screen.availWidth, screen.availHeight);
	document.getElementById("Alto").value=screen.availHeight;
	document.getElementById("Ancho").value=screen.availWidth;
	document.Form1.submit();
}

function DetectarPantalla()
{
	if( document.getElementById("Alto").value != screen.availHeight )
	{
		window.moveTo(0,0);
		window.resizeBy(screen.availWidth, screen.availHeight);
		document.getElementById("Alto").value=screen.availHeight;
		document.Form1.submit();
	}
}
function VerificaCheckBox(grupo, Accion, Elementos, Permisos)
{
	cMens = '';
	if( grupo == 'DGEmpresas' )
		cMens = 'una Empresa';
	else if( grupo == 'DGAgentes' )
		cMens = 'un Agente';
	else if( grupo == 'DGPanelistas' )
		cMens = 'un Panelista';
	else if( grupo == 'DGLlamadas' )
		cMens = 'una Llamada';
	else if( grupo == 'DGIncidencias' )
		cMens = 'una Incidencias';
	else if( grupo == 'DGCorreos' )
		cMens = 'un Mensaje';
	else if( grupo == 'DGEMailPanelistas' )
		cMens = 'los Panelistas a los que quiere enviar el mensaje';
		
		
	if( Permisos == 1 && document.Form1.AdminPanel.value == '0' )
	{
		alert( 'Opcion no Autorizada' );
		return;
	}
	if( Permisos == 2 && document.Form1.AdminPanel.value == '0' &&  document.Form1.AdminAgentes.value == '0' )
	{
		alert( 'Opcion no Autorizada' );
		return;
	}
	
	document.Form1.Accion.value = Accion;
	if( Elementos > 0 )
	{
		nSel=0;
		grupo = grupo + ":";
		var aInput=document.getElementsByTagName("input");
		for( nEle=0; nEle<aInput.length && nSel<2; nEle++)
			if( aInput[nEle].type == 'checkbox' && aInput[nEle].name.indexOf( grupo ) > -1 && aInput[nEle].checked && aInput[nEle].name.substr( aInput[nEle].name.length -1 ) == "0" )
				nSel++;
		if( nSel==0 )
		{
			alert( 'Seleccione ' + cMens );
			return;
		}
		else if( nSel>1 && Elementos == 1 )
		{
			alert( "Seleccione solo " + cMens );
			return;
		}
	}
	if( Accion == 'AFS' )
		window.open('AF.aspx','AsignarAccionesFormativas','width=500,height=550,resizable=no,menubar=no,scrollbars=no,status=no,titlebar=no,toolbar=no,z-lock=yes,left=' + (screen.width - 500 ) / 2 + ',top=' + (screen.height - 550 ) / 2);
	else if( Accion == 'CNAES' )
		window.open('CNAES.aspx','AsignarCNAES','width=500,height=550,resizable=no,menubar=no,scrollbars=no,status=no,titlebar=no,toolbar=no,z-lock=yes,left=' + (screen.width - 500 ) / 2 + ',top=' + (screen.height - 550 ) / 2);
	else if( Accion == 'Informes' )
		window.open('ResumenEjecutivo.aspx','ResumenEjecutivo','width=775,height=250,resizable=no,menubar=no,scrollbars=no,status=no,titlebar=no,toolbar=no,z-lock=yes,left=' + (screen.width - 775 ) / 2 + ',top=' + (screen.height - 250 ) / 2);
	else if( Accion == 'Excel' )
		window.open('Informes.aspx','Informes','width=775,height=350,resizable=no,menubar=no,scrollbars=no,status=no,titlebar=no,toolbar=no,z-lock=yes,left=' + (screen.width - 775 ) / 2 + ',top=' + (screen.height - 350 ) / 2);
	else if( Accion == 'Tablas' )
		window.open('Tablas.aspx','Tablas','width=775,height=350,resizable=no,menubar=no,scrollbars=no,status=no,titlebar=no,toolbar=no,z-lock=yes,left=' + (screen.width - 775 ) / 2 + ',top=' + (screen.height - 350 ) / 2);
	else
		__doPostBack('Img','');
}
function PanVerificar( control )
{
	if( control.id == 'chkPanActivo' && control.checked ) 
	{
		document.getElementById("chkPanMuestraSustitucion").checked = false;
		document.getElementById("chkPanBaja").checked = false;
		document.getElementById("lblMotivoBaja").style.display = 'none';
		document.getElementById("cboPanBajas").style.display = 'none';
	}
	else if( control.id == 'chkPanMuestraSustitucion' && control.checked ) 
	{
		document.getElementById("chkPanActivo").checked = false;
		document.getElementById("chkPanBaja").checked = false;
		document.getElementById("lblMotivoBaja").style.display = 'none';
		document.getElementById("cboPanBajas").style.display = 'none';
	}
	else if( control.id == 'chkPanBaja' ) 
	{
		document.getElementById("chkPanActivo").checked = false;
		document.getElementById("chkPanMuestraSustitucion").checked = false;
		if( control.checked )
		{
			document.getElementById("lblMotivoBaja").style.display = 'block';
			document.getElementById("cboPanBajas").style.display = 'block';
		}
		else
		{
			document.getElementById("lblMotivoBaja").style.display = 'none';
			document.getElementById("cboPanBajas").style.display = 'none';
		}
	}
}
function DeSeleccionarCheckboxes(id)
{
	var elm = document.getElementsByTagName("input");
	for(i=0;i<elm.length;i++)
		if(elm[i].type=="checkbox" && elm[i].id!=id)
			elm[i].checked=false;
}				
function CerrarVentana()
{
	window.close();
}
function Maximizar()
{
	window.innerWidth = screen.width;
	window.innerHeight = screen.height;
	window.screenX = 0;
	window.screenY = 0;
}
function AbrirEncuesta()
{
	setTimeout ("abrirEncuesta();", 1000); 
}

function abrirEncuesta()
{
//	window.open( 'Encuesta.aspx', 'Encuesta', 'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=0' );
window.open( 'Encuesta.aspx', 'Encuesta', '');
}
function Enfocar(Control)
{
try
{
  Control.focus();
}
catch(e)
{}
}