function asociarOficina(){
	//IDENTIFICAMOS LOS USUARIOS RESPONSABLES SELECCIONADOS
	content=document.getElementById('oficinassistema'); 
	var cadResp="";
	var op=content.getElementsByTagName("input");	
	var pos=0; var sw=false;
	for(i=0;i<op.length;i++){
		id=op[i].getAttribute("id");
		if(op[i].checked)cadResp+=op[i].value+",";
	}
	document.getElementById('IdsMaster').value=cadResp;
	document.getElementById('formeventos').submit();
}

// JavaScript Document
function menuprincipal()
{	
	document.frmdatos.action='../administrador/menu.php';
	document.frmdatos.submit();	
}


function popupeditarevento(Identificador_Xmod_Eventos)
{
	var cadena="";
	//IdMaster=document.getElementById('master').value;
	cadena="editarevento.php?idevento="+Identificador_Xmod_Eventos;//+"&IdMaster="+IdMaster;
	secondwindow=open(cadena,'Editar','height=900,width=600,scrollbars=yes,directories=NO,location=NO,alwaysRaised');
    secondwindow.moveTo(150,120);
}

function popupverevento(Identificador_Xmod_Eventos)
{
	var cadena="";
	//IdMaster=document.getElementById('master').value;
	cadena="verevento.php?idevento="+Identificador_Xmod_Eventos;//+"&IdMaster="+IdMaster;
	secondwindow=open(cadena,'Editar','height=220,width=680,scrollbars=no,directories=NO,location=NO,alwaysRaised');
    secondwindow.moveTo(150,120);
}
function popupvereventovermas(Identificador_Xmod_Eventos)
{
	var cadena="";
	//IdMaster=document.getElementById('master').value;
	cadena="vereventovermas.php?idevento="+Identificador_Xmod_Eventos;//+"&IdMaster="+IdMaster;
	secondwindow=open(cadena,'Editar','height=620,width=680,scrollbars=yes,directories=NO,location=NO,alwaysRaised');
    secondwindow.moveTo(150,120);
}

function editarevento(valor)
{
	if(valor==0){cargar();setTimeout("salir()",4500);}	
}

function cargar(){
document.getElementById('qq').innerHTML="<table border='0' align='center'><tr><td>&nbsp;</td><td><strong>--------------Guardando-------------</strong></td><td>&nbsp;</td></tr><tr><td>0%</td><td><dl><dd><span><em style='left:200px'>100%</em></span></dd></dl></td><td>100%</td></tr></table>";
}
function salir(){
window.opener.location.reload();
window.close();
}

function eliminarevento(Identificador_Xmod_Eventos)
{
	if(confirm("Realmente desea eliminar este evento"))
	{
		document.frmdatos.action='eliminarevento.php';
		document.getElementById('Identificador_Xmod_Eventos').value=Identificador_Xmod_Eventos;
		document.frmdatos.submit();			
	}	
}

function mensajes()
{	
	document.getElementById('evento').style.display ="none";
	document.getElementById('mens').style.display ="";
	/*document.frmdatos.action='registromensajeseventos.php';
	document.frmdatos.submit();	*/
}


function guardamensajes()
{
	$(document).ready(
				function()
				{				
					$.post("ajaxmensajeseventos.php",{mensajebda:$("#mensajebda").val(),descripcionbda:$("#descripcionbda").val(),mensajedda:$("#mensajedda").val(),descripciondda:$("#descripciondda").val(),mensajebdaing:$("#mensajebdaing").val(),descripcionbdaing:$("#descripcionbdaing").val(),mensajeddaing:$("#mensajeddaing").val(),descripcionddaing:$("#descripcionddaing").val()},
								function(data)
								{ 	
									alert("Los Mensajes se guardaron satisfactoriamente");
									//$('form')[0].reset();								
								}
							);						
				}
	);	
}
function vermas(Identificador_Xmod_Eventos,Idioma)
{
//	alert(Identificador_Xmod_Eventos);
	$(document).ready(
				function()
				{				
					$.post("xmod_eventos/ajaxeventos.php",{Identificador_Xmod_Eventos:Identificador_Xmod_Eventos,Idioma:Idioma,Id_Master:$("#IdMaster").val()},
								function(data)
								{ 																			
									$("#subseccion").html(data);
								}
							);						
				}
	);	
}
function vermastodos(Identificador_Xmod_Eventos,Id_Master,Idioma)
{
//	alert(Identificador_Xmod_Eventos);
	$(document).ready(
				function()
				{				
					$.post("xmod_eventos/ajaxeventos.php",{Identificador_Xmod_Eventos:Identificador_Xmod_Eventos,Idioma:Idioma,Id_Master:Id_Master},
								function(data)
								{ 																			
									$("#subseccion").html(data);
								}
							);						
				}
	);	
}
function creareventogaleriafotos(Identificador_Xmod_Eventos_Galeria)
{	
	document.getElementById('Identificador_Xmod_Eventos_Galeria').value=Identificador_Xmod_Eventos_Galeria;
	document.frmdatos.action='creaeventogaleriafotos.php';
	document.frmdatos.submit();	
}

function vereventosatras(Idioma)
{
$(document).ready(
				function()
				{				
					$.post("xmod_eventos/ajaxeventosatras.php",{Idioma:Idioma,Id_Master:$("#IdMaster").val()},
								function(data)
								{ 																			
									$("#subseccion").html(data);
								}
							);						
				}
	);	
}
function vereventostodos(Idioma)
{
$(document).ready(
				function()
				{				
					$.post("xmod_eventos/ajaxeventostodos.php",{Idioma:Idioma,Id_Master:$("#IdMaster").val()},
								function(data)
								{ 																			
									$("#subseccion").html(data);
								}
							);						
				}
	);	
}

function creaevento(IdMaster)
{
	document.getElementById('evento').style.display ="";
	document.getElementById('mens').style.display ="none";
	//document.getElementById('IdMaster').value=IdMaster;
	document.frmdatos.action='creaevento.php';
	document.frmdatos.submit();		
}
function recargarmastereventos()
{	
	//IdMaster=document.getElementById('master').value;
	document.frmdatos.method='get';
	document.frmdatos.action='listaevento.php';//?IdMaster='+IdMaster;
	document.frmdatos.submit();	
}
function EventosFrontVermasEnlaceOficina(Id_Seccion,Ids_Master,idioma)
{
	//document.getElementById('subseccioneventos').style.display ="";
	document.getElementById('frontvermas').style.display ="";
	document.getElementById('front').style.display ="none";	
	
	if(Id_Seccion!=0)
	{
		$(document).ready(
						function()
						{				
							$.post("xmod_eventos/ajaxeventosfrontenlacevermas.php",{id:Id_Seccion,idioma:idioma,Id_Master:Ids_Master},
										function(data)
										{ 																
											//document.getElementById('subseccionnoticias').style.display ="";										
											$("#subseccionfrontvermas").html(data);
										}
									);												
						}
			);	
	}
}

function EventosFrontVermasEnlace(Id_Seccion,Ids_Master,idioma,id1)
{
/*	
	document.getElementById('subseccioneventos').style.display ="";	
	document.getElementById('fronteventos').style.display ="none";	
	
	if(id!=0)
	{
		$(document).ready(
						function()
						{				
							$.post("xmod_eventos/ajaxeventosfrontenlacevermas.php",{id:id,idioma:idioma,Id_Master:idmaster},
										function(data)
										{ 																		
											//document.getElementById('subseccionnoticias').style.display ="";										
											$("#subseccioneventos").html(data);
										}
									);												
						}
			);	
	}
	*/
	if(Ids_Master!=1)
	{
		document.frmdatospagina.target="_self";
		document.frmdatospagina.action="index2.php?Id_Master="+Ids_Master+"&Id_Seccions="+Id_Seccion+"&OpciVerm=0"+"&modulos=2"+"&Id="+id1;
		document.frmdatospagina.submit();		
	}
}
function fronteventoenlace()
{
	document.getElementById('frontvermas').style.display ="none";	
	document.getElementById('front').style.display ="";

}

function recargareventosfront()
{			
	validmaster=document.getElementById('mastereven').value;
	if(validmaster!="")
	{	
		$(document).ready(
				function()
				{				
					$.post("xmod_eventos/ajaxrecargareventosfront.php",{Id_Master:validmaster},
							function(data)
							{ 	
								$("#idfronteventos").html(data);
							}
						);						
				}
		);
	}
	else
	{
		document.getElementById('idfronteventos').innerHTML ='<div align="left" class="style13front">Selecione una oficina</div>';
	}
}
function niveleventos(Identificador_Xmod_Eventos,Ord_Xmod_Eventos,Opcion)
{
	document.frmdatos.action='niveleventos.php';
	document.getElementById('Ord_Xmod_Eventos').value=Ord_Xmod_Eventos;
	document.getElementById('Identificador_Xmod_Eventos').value=Identificador_Xmod_Eventos;
	document.getElementById('opcion').value=Opcion;
	document.frmdatos.submit();			
}
