// JavaScript Document
//esta funcion me hace un llamdo ajax para refrescar una region del sitio 
//subseccion(1,1,2,'no',1,0);
///// codigo para desactivar el boton derecho del mouse
var message="";
///////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")
////
function subseccion(Id_Master,Id_Division,Id_Seccion,Id_Subseccion,Tip_Seccion,OpciVerm_Subseccion,Idioma)
{
	scrollBy(0,-550);		
	iniciar();
	if(Id_Seccion==8)
	{
		document.getElementById("idcabezote").style.display ="";
		document.getElementById("idcabezoteint").style.display ="none";
		document.getElementById("idlateral").style.display ="none";
		document.getElementById("front1").style.display ="";
		document.getElementById("front2").style.display ="none";
	}
	else
	{			
		document.getElementById("idcabezote").style.display ="none";
		document.getElementById("idcabezoteint").style.display ="";
		document.getElementById("idlateral").style.display ="";
		document.getElementById("front1").style.display ="none";
		document.getElementById("front2").style.display ="";
		if(Id_Seccion==3 || Id_Seccion==5 || Id_Seccion==9  )
		{		
			scrollBy(0,-550);		
		}
		$(document).ready(
					function()
					{				
						$.post("funciones/ajaxmenu.php",{Id_Master:Id_Master,Id_Division:Id_Division,Id_Seccion:Id_Seccion,Id_Subseccion:Id_Subseccion,Tip_Seccion:Tip_Seccion,OpciVerm_Subseccion:OpciVerm_Subseccion,Idioma:Idioma},
									function(data)
									{ 																			
									$("#subseccion").html(data);	
									document.getElementById("subseccion").innerHTML=data;									
									}
								);						
					}
		);
		$(document).ready(
					function()
					{				
						$.post("funciones/ajaxmenu2.php",{Id_Master:Id_Master,Id_Division:Id_Division,Id_Seccion:Id_Seccion,Id_Subseccion:Id_Subseccion,Tip_Seccion:Tip_Seccion,OpciVerm_Subseccion:OpciVerm_Subseccion,Idioma:Idioma},
									function(data)
									{ 																			
									$("#subsecciont").html(data);
									//document.getElementById("subsecciont").innerHTML=data;									
									}
								);						
					}
		);	
	}
}



//esta funcion me permite mostar los submenus al dar clic en  un menu

function mostrar(seccionactiva,secciones)

{

	

	CadenaSecciones = secciones.split('-');				

	for (i=0;i<CadenaSecciones.length;i++)

	{	

		if(CadenaSecciones[i] != seccionactiva)

		{

			document.getElementById(CadenaSecciones[i]).style.display ="none";

		}

		else

		{

			if(document.getElementById(seccionactiva).style.display=="none")

			{

				document.getElementById(seccionactiva).style.display ="";

			}

			else

			{

				document.getElementById(seccionactiva).style.display ="none";

			}

		}

	} 		

}

function acceso(opcion,idioma)
{
	scrollBy(0,-1000);
	iniciar();		
	document.getElementById("front1").style.display ="none";
	document.getElementById("front2").style.display ="";
	$(document).ready(
					function()
					{	
							$.post("xmod_noticias/ajaxbuscaracceso.php",{opcion:opcion,idioma:idioma},
							function(data)
							{ 																			
								$("#subseccion").html(data);							
								//alert("Datos Editados Correctamente");								
							}
						);						
					}
		);
}

function accesobuscador(palabra,idioma)
{
	if(Trim(palabra)!="")
	{
		scrollBy(0,-500);	
		document.getElementById("front1").style.display ="none";
		document.getElementById("front2").style.display ="";
		$(document).ready(
						function()
						{	
								$.post("administrador/buscador/ajaxbuscador.php",{palabra:palabra,idioma:idioma},
								function(data)
								{ 																			
									$("#subseccion").html(data);
									$("#subsecciont").html("");	
									//alert("Datos Editados Correctamente");								
								}
							);						
						}
			);
	}
	else
	{		
		alert("Ingrese una plabra para hacer la busqueda");	
	}
}
function vermasbuscador(id,palabra,idioma)
{
	scrollBy(0,-500);	
	if(id!=0)
	{
		$(document).ready(
						function()
						{				
							$.post("administrador/buscador/ajaxvermasbuscador.php",{id:id,idioma:idioma,palabra:palabra},
										function(data)
										{ 																																								
											$("#subseccion").html(data);
										}
									);						
						}
			);	
	}
}
function vermasbuscador2(Id_Master,Id_Division,Id_Seccion,Id_Subseccion,palabra,idioma)
{
	scrollBy(0,-500);	
	if(Id_Master!=0)
	{
		$(document).ready(
						function()
						{				
							$.post("administrador/buscador/ajaxvermasbuscador2.php",{Id_Master:Id_Master,Id_Division:Id_Division,Id_Seccion:Id_Seccion,Id_Subseccion:Id_Subseccion,idioma:idioma,palabra:palabra},
										function(data)
										{ 																																								
											$("#subseccion").html(data);
										}
									);						
						}
			);	
	}
}
function vermasbuscador3(id,palabra,idioma)
{
	scrollBy(0,-500);	
	if(id!=0)
	{
		$(document).ready(
						function()
						{				
							$.post("administrador/buscador/ajaxvermasbuscador3.php",{id:id,idioma:idioma,palabra:palabra},
										function(data)
										{ 																																								
											$("#subseccion").html(data);
										}
									);						
						}
			);	
	}
}
function vermasbuscador4(id,palabra,idioma)
{

scrollBy(0,-500);	
	if(id!=0)
	{
		$(document).ready(
						function()
						{				
							$.post("administrador/buscador/ajaxvermasbuscador4.php",{id:id,idioma:idioma,palabra:palabra},
										function(data)
										{ 																																								
											$("#subseccion").html(data);
										}
									);						
						}
			);	
	}
}
function vermasbuscador5(id,palabra,idioma)
{

scrollBy(0,-5000);	
	if(id!=0)
	{
		$(document).ready(
						function()
						{				
							$.post("administrador/buscador/ajaxvermasbuscador5.php",{id:id,idioma:idioma,palabra:palabra},
										function(data)
										{ 																																								
											$("#subseccion").html(data);
										}
									);						
						}
			);	
	}
}
function editarseccion()

{ 

	estado="0";

	tipo="0";

	if(document.getElementById('estadoseccion0').checked)

	{

		estado="0";	

	}

	else if(document.getElementById('estadoseccion1').checked)

	{

		estado="1";	

	}

	if(document.getElementById('tiposeccion0').checked)

	{

		tipo="0";	

	}

	else if(document.getElementById('tiposeccion1').checked)

	{

		tipo="1";	

	}

	$(document).ready(

				function()

				{	

			$.post("../../funciones/ajaxeditarseccion.php",{estado:estado,idseccion:$("#idseccion").val(),iddivision:$("#iddivision").val(),nombreseccion:$("#nombreseccion").val(),nombreseccioning:$("#nombreseccioning").val(),tipo:tipo},

								function(data)

								{ 																			

								//$("#subseccion").html(data);							

								//alert("Datos Editados Correctamente");

								//alert(data);

								cargar_pagina();

								}

							);						

				}

	);					

}



function cargar_pagina(){

//opener.location = 'otrapagina.php';si deseamos cargar otra pagina en lugar de la padre colocamos el codigo de esta linea

cargar();

setTimeout("salir()",4500);

}

function salir(){

window.opener.location.reload();

window.close();

}

function favoritos(Bandera)
{	
	var cadena="";
    if(Bandera)
    	cadena="favoritos.php?f1="+cadf1+"&f2="+cadf2+"&f3="+cadf3+"&nivel="+nivel+"&mod_descarga=true";
    else
        cadena="favoritos.php?f1="+cadf1+"&f2="+cadf2+"&f3="+cadf3+"&nivel="+nivel;
	secondwindow=open(cadena,'Editar','height=150,width=800,scrollbars=no,directories=NO,location=NO,alwaysRaised');	
    secondwindow.moveTo(150,120);	
	
}

function fcadsuseccion2desc(archivo,niv,xmod_descarga)
{	
	cadf3="descargar2('"+archivo+"');";
	nivel=niv;
    BanderaDescargas = false;    
    if(xmod_descarga){
        BanderaDescargas = true;
        cadf3 = archivo;
    }
	favoritos(BanderaDescargas);
}
function popupeditarseccion(iddivision,idseccion)

{

	var cadena="";

	cadena="editarseccion.php?iddivision="+iddivision+"&idseccion="+idseccion;

	secondwindow=open(cadena,'Editar','height=275,width=580,scrollbars=no,directories=NO,location=NO,alwaysRaised');

    secondwindow.moveTo(150,120);

}

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 creardivision()

{

		document.frmdatos.action='creardivision.php';

		document.frmdatos.submit();		

}

function eliminardivision(IdentificadorDivision,TipoDivision)

{

	if(confirm("Realmente desea eliminar la Division"))

	{

		document.frmdatos.action='eliminardivision.php';

		document.getElementById('iddivision').value=IdentificadorDivision;

		document.getElementById('tipodivision').value=TipoDivision;

		document.frmdatos.submit();		

	}	

}

function popupeditardivision(valor)

{

	var cadena="";

	cadena="editardivision.php?iddivision="+valor;

	secondwindow=open(cadena,'Editar','height=320,width=880,scrollbars=no,directories=NO,location=NO,alwaysRaised');

    secondwindow.moveTo(150,120);

}

function popupeditardivision1(valor)

{

	var cadena="";

	cadena="editardivision1.php?iddivision="+valor;

	secondwindow=open(cadena,'Editar','height=230,width=880,scrollbars=no,directories=NO,location=NO,alwaysRaised');

    secondwindow.moveTo(150,120);

}

function editardivision()

{ 

	tipo=document.getElementById('tipodivision').value;

	archivo=document.getElementById('archivo').value;

	if(tipo==1)

	{	

		estado=verificarcamposdiv(1);		

		if(estado==0)

		{

			alert("Ingrese los valores correspondientes en los campos marcados con rojo"); 

		}

		else

		{	if(archivo!="")

			{

				document.frmdatos.action='guardardivision.php';

				document.frmdatos.submit();	

			}

			else

			{

				alert("Ingrese un archivo a subir"); 

			}

		}		

	}

	if(tipo==2 || tipo==3)

	{

		estado=verificarcamposdiv(2);

		

		if(estado==0)

		{

			alert("Ingrese los valores correspondientes en los campos marcados con rojo"); 

		}

		else

		{	

			document.frmdatos.action='guardardivision.php';

			document.frmdatos.submit();				

		}

	}	

	

}

function editardivision1()

{ 

	

	document.frmdatos.action='guardardivision1.php';

	document.frmdatos.submit();					

}

function eliminarimamaster(IdentificadorImamaster)

{

	if(confirm("Realmente desea eliminar Eeste elemento"))

	{

		document.frmdatos.action='eliminarimamaster.php';

		document.getElementById('idimamaster').value=IdentificadorImamaster;

		document.frmdatos.submit();		

	}	

}

function popupeditarimamaster(valor)

{

	var cadena="";

	cadena="editarimamaster.php?idimamaster="+valor;

	secondwindow=open(cadena,'Editar','height=320,width=880,scrollbars=no,directories=NO,location=NO,alwaysRaised');

    secondwindow.moveTo(150,120);

}

function editarimamaster()

{ 	

	archivo=document.getElementById('archivo').value;	

	estado=verificarcamposima();		

	if(estado==0)

	{

		alert("Ingrese los valores correspondientes en los campos marcados con rojo"); 

	}

	else

	{	/*if(archivo!="")

		{

			document.frmdatos.action='guardarimamaster.php';

			document.frmdatos.submit();	

		}

		else

		{

			alert("Ingrese un archivo a subir"); 

		}*/

			document.frmdatos.action='guardarimamaster.php';

			document.frmdatos.submit();	

	}				

}

function visualizarimamaster(valor,ancho,alto)

{

	var cadena="";

	cadena="visualizarimamaster.php?idimamaster="+valor;

	valores='height='+alto+',width='+ancho+',scrollbars=no,directories=NO,location=NO,alwaysRaised';

	secondwindow=open(cadena,'Editar',valores);

    secondwindow.moveTo(150,120);

}



function verificarcamposima()

{	

		cont=4;

		cont2=4;

		vec=new Array ('nombre','ancho','alto','descripcion');

//		vec=new Array ('nombredivision','estructuradivision','nombre','ancho','alto');

	

	for (i=0;i<vec.length;i++)

	{

		if(Trim(document.getElementById(vec[i]).value)=="")

		{

			document.getElementById(vec[i]).style.background="red";

			document.getElementById(vec[i]).value =Trim(document.getElementById(vec[i]).value);

			cont=cont-1;

		}

		else

		{

			document.getElementById(vec[i]).style.background="";

			document.getElementById(vec[i]).value =Trim(document.getElementById(vec[i]).value);

		}					

	}

	if(cont==cont2)

	{

		return 1;

	}

	else

	{

		return 0;

	}	

}

	

function cargar_paginadiv(valor)

{

//opener.location = 'otrapagina.php';si deseamos cargar otra pagina en lugar de la padre colocamos el codigo de esta linea

	if(valor==0){cargar();setTimeout("salir()",4500);}

}

function cambiotipodivision()

{		

		modulo=document.getElementById('tipodivision').value;

		if(modulo==1)

		{

			document.getElementById('banner').style.display ="";

			document.getElementById('mod').style.display ="none";

			document.getElementById('rotar').style.display ="";

			document.getElementById('divisiones').style.display ="none";

			document.getElementById('idioma').style.display ="";	

		}

		if(modulo==2)

		{

			document.getElementById('banner').style.display ="none";

			document.getElementById('mod').style.display ="none";

			document.getElementById('rotar').style.display ="none";

			document.getElementById('divisiones').style.display ="none";	

			document.getElementById('idioma').style.display ="none";				

		}		

		if(modulo==3)

		{

			document.getElementById('banner').style.display ="none";

			document.getElementById('mod').style.display ="";

			document.getElementById('rotar').style.display ="none";

			document.getElementById('divisiones').style.display ="none";			

			document.getElementById('idioma').style.display ="none";				

		}

}

function mostrardivisiones(valor)

{

	if(valor==1)

	{

		document.getElementById('divisiones').style.display ="";			

	}

	else

	{

		document.getElementById('divisiones').style.display ="none";			

	}

}

function crearseccion(iddivision)

{	

		document.getElementById('iddivision').value=iddivision;

		document.frmdatos.action='crearseccion.php';

		document.frmdatos.submit();		

}

function eliminarseccion(iddivision,IdentificadorSeccion)

{

	if(confirm("Realmente desea eliminar la seccion"))

	{

		document.frmdatos.action='eliminarseccion.php';

		document.getElementById('idseccion').value=IdentificadorSeccion;

		document.getElementById('iddivision').value=iddivision;

		document.frmdatos.submit();		

	}	

}

function crearsubseccion(iddivision,IdentificadorSeccion)

{

		document.frmdatos.action='../subseccion/crearsubseccion.php';

		document.getElementById('idseccion').value=IdentificadorSeccion;

		document.getElementById('iddivision').value=iddivision;

		document.frmdatos.submit();		

}

function eliminarsubseccion(iddivision,IdentificadorSeccion,IdentificadorSubseccion)

{

	if(confirm("Realmente desea eliminar la subseccion"))

	{

		document.frmdatos.action='../subseccion/eliminarsubseccion.php';

		document.getElementById('iddivision').value=iddivision;

		document.getElementById('idseccion').value=IdentificadorSeccion;

		document.getElementById('idsubseccion').value=IdentificadorSubseccion;

		document.frmdatos.submit();		

	}	

}

function cambiaestado()

{

	if(document.getElementById('estadosubseccion0').checked)

	{

		document.getElementById('estado').value="0";

	}

	else if(document.getElementById('estadosubseccion1').checked)

	{

		document.getElementById('estado').value="1";

	}

}



function cambiaopcvermas()

{

	if(document.getElementById('opcvermas0').checked)

	{

		document.getElementById('vermas').value="0";

	}

	else if(document.getElementById('opcvermas1').checked)

	{

		document.getElementById('vermas').value="1";

	}

}

function nivelseccion(iddivision,IdentificadorSeccion,OrdenSeccion,Opcion)

{

	document.frmdatos.action='nivelseccion.php';

	document.getElementById('iddivision').value=iddivision;

	document.getElementById('idseccion').value=IdentificadorSeccion;

	document.getElementById('ordseccion').value=OrdenSeccion;

	document.getElementById('opcion').value=Opcion;

	document.frmdatos.submit();		

}

function nivelsubseccion(iddivision,IdentificadorSeccion,IdentificadorSubseccion,OrdenSubseccion,Opcion)

{

	document.frmdatos.action='../subseccion/nivelsubseccion.php';

	document.getElementById('iddivision').value=iddivision;

	document.getElementById('idseccion').value=IdentificadorSeccion;

	document.getElementById('idsubseccion').value=IdentificadorSubseccion;	

	document.getElementById('ordsubseccion').value=OrdenSubseccion;

	document.getElementById('opcion').value=Opcion;

	document.frmdatos.submit();		

}

function menuprincipal()

{	

	document.frmdatos.action='../menu.php';

	document.frmdatos.submit();		

}



function showLightbox(id)

{

	document.getElementById(id).style.display='block';

		

/*$(function()  {  

		   $("#mostrar").click(function(event) {         

			event.preventDefault();         

			$("#"+id).slideToggle();  

			});  		   

		});  

	

*/

}

function hideLightbox(id)

{

	document.getElementById(id).style.display='none';

}



function mostraryocultar(valor)

{	

if(valor==1)

	{

		document.getElementById('manejoesp').style.display ="";

		document.getElementById('manejoing').style.display ="none";

	}

	else if(valor==0)

	{

		document.getElementById('manejoesp').style.display ="none";

		document.getElementById('manejoing').style.display ="";

	}

}

function mostraryocultararchivo(valor)

{	

	if(valor==0 || valor==1)

	{

		document.getElementById('archivo').style.display ="";

	}

	else 

	{

		document.getElementById('archivo').style.display ="none";

	}

}

function opcionmenu(id)

{

	if(id==1)

	{

		document.getElementById('1').style.display ="";

		document.getElementById('2').style.display ="none";

		document.getElementById('3').style.display ="none";

	}

	else if(id==2)

	{

		document.getElementById('1').style.display ="none";

		document.getElementById('2').style.display ="";

		document.getElementById('3').style.display ="none";

	}

	else if(id==3)

	{

		document.getElementById('1').style.display ="none";

		document.getElementById('2').style.display ="none";

		document.getElementById('3').style.display ="";

	}

}



function chequear()

{	

	IdentificadorPerfil=document.getElementById('perfil').value;

	

	if(IdentificadorPerfil==1)

	{

		for (i=0;i<document.frmDatos.checkbox.length;i++)

		  if(document.frmDatos.checkbox[i].type == "checkbox")

		  {

			 if(document.frmDatos.checkbox[i].value=="1") 

			 {

			 	document.frmDatos.checkbox[i].checked=1 ;

 			 	document.frmDatos.checkbox[i].disabled="disabled";

			 }

			 else

			 {

				document.frmDatos.checkbox[i].checked=0 ;	 

			 }			 

		  }

	}

	else 

	{

		for (i=0;i<document.frmDatos.checkbox.length;i++)

		  if(document.frmDatos.checkbox[i].type == "checkbox")

		  {

			 document.frmDatos.checkbox[i].checked=0 ;

 			 document.frmDatos.checkbox[i].disabled="";

		  }

	}

}



function insertarusuario()

{

	estado=verificarcampos();

	vallog=ValidaCampo('loginu');

	valpass=ValidaCampo('password');

	if(estado==1)

	{

		if(vallog==1 && valpass==1)

		{

				cad="";

				for (i=0;i<document.frmDatos.checkbox.length;i++)

				{

				  if(document.frmDatos.checkbox[i].checked)

				  {

					  cad=cad+"1-";

				  }

				  else

				  {

					  cad=cad+"0-";

				  }

				}



				document.getElementById('cadena').value =cad.substring(0,cad.length-1);	

				document.frmDatos.action='crearusuarioguardad.php';								

				if(document.getElementById('opcion').value=='3')

				{

					if(confirm("Realmente desea eliminar este usuario"))

					{

						document.frmDatos.submit();			

					}

				}	

				else	

				{

					document.frmDatos.submit();					

				}

		}

		else

		{

			alert("Por favor verifique loa campos de Login y Clave ya que posee caracteres que no son permitidos");	

		}

	}

	else

	{

		alert('rellene los campos de color rojo');	

	}

}

function ValidaCampo(ident)

{  

   campo=document.getElementById(ident).value;

   caract_extra =""; 

   var ubicacion  

   var enter = "\n"  

   var caracteres = "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ" + String.fromCharCode(13) + enter + caract_extra  

   

   var contador = 0  

   for (var i=0; i < campo.length; i++)

   {  

     ubicacion = campo.substring(i, i + 1)  

     if (caracteres.indexOf(ubicacion) != -1)

	 {  

       contador++  

     } 

	 else

	 {  

    //   alert("ERROR: No se acepta el caracter '" + ubicacion + "'.")  

       return 0;  

     }  

   }  

   

  // alert("Datos correctos.")  

   return 1;  

 }  

function checkearmenu(cadena)

{

	vectopcionesmenu=cadena.split('-');

	for (i=0;i<vectopcionesmenu.length;i++)

	{	

		if(vectopcionesmenu[i]==0)

		document.getElementById(i+1).style.display ="none";

	}

}

function operacion(opcion)

{

	if(opcion==1)

	{

		document.getElementById('oper').style.display ="none";

		document.getElementById('nombre').value ="";

		document.getElementById('loginu').value ="";

		document.getElementById('password').value ="";

		document.getElementById('perfil').value ="";

		document.getElementById('email').value ="";

		

		document.getElementById('opcion').value =opcion;

		 chequear();

 		document.getElementById('button').value ="Guardar";

		 

//		document.getElementById('oper').value ="";

//		document.getElementById('oper').value ="";		

		

	}

	else if(opcion==2)

	{

		document.getElementById('oper').style.display ="";

		document.getElementById('opcion').value =opcion;

 		document.getElementById('button').value ="Editar";

	}

	else if(opcion==3)

	{

		document.getElementById('oper').style.display ="";

		document.getElementById('opcion').value =opcion;

		document.getElementById('button').value ="Eliminar";

	}

	

}

function recargar()

{

	document.frmDatos.method="get";

	document.frmDatos.submit();

}

function checkearmenu2(cadena)

{

	vectopcionesmenu=cadena.split('-');

	for (i=0;i<vectopcionesmenu.length;i++)

	{	

		if(vectopcionesmenu[i]==0)

		document.frmDatos.checkbox[i].checked =0;

		else

		document.frmDatos.checkbox[i].checked =1;

	}

}

//funcion para validar campos de laplantilla creasusuario

function verificarcampos()

{	

	cont=5;

	if(Trim(document.getElementById('nombre').value) =="")

	{

		document.getElementById('nombre').style.background="red";

		document.getElementById('nombre').value =Trim(document.getElementById('nombre').value);

		cont=cont-1;

	}

	else

	{

		document.getElementById('nombre').style.background="";

		document.getElementById('nombre').value =Trim(document.getElementById('nombre').value);

	}

	if( Trim(document.getElementById('loginu').value) =="")

	{

		document.getElementById('loginu').style.background="red";

		document.getElementById('loginu').value =Trim(document.getElementById('loginu').value);

		cont=cont-1;

	}

	else

	{

		document.getElementById('loginu').style.background="";	

		document.getElementById('loginu').value =Trim(document.getElementById('loginu').value);

	}

	if( Trim(document.getElementById('password').value) =="")

	{

		document.getElementById('password').style.background="red";

		document.getElementById('password').value =Trim(document.getElementById('password').value);

		cont=cont-1;		

	}

	else

	{

		document.getElementById('password').style.background="";

		document.getElementById('password').value =Trim(document.getElementById('password').value);

	}

	if( Trim(document.getElementById('perfil').value) =="")

	{

		document.getElementById('perfil').style.background="red";

		document.getElementById('perfil').value =Trim(document.getElementById('perfil').value);

		cont=cont-1;		

	}

	else

	{

		document.getElementById('perfil').style.background="";	

		document.getElementById('perfil').value =Trim(document.getElementById('perfil').value);

	}

	if( Trim(document.getElementById('email').value) =="" ||  valEmail(document.getElementById('email').value)==false)

	{

		document.getElementById('email').style.background="red";

		document.getElementById('email').value =Trim(document.getElementById('email').value);

		cont=cont-1;		

	}

	else

	{

		document.getElementById('email').style.background="";	

		document.getElementById('email').value =Trim(document.getElementById('email').value);

	}

	

	if(cont==5)

	{

		return 1;

	}

	else

	{

		return 0;

	}	

}

//funcion para validar espacios 

function Trim( str )

{

	var resultStr = "";

	

	resultStr = TrimLeft(str);

	resultStr = TrimRight(resultStr);

	

	return resultStr;

}

//funcion para validar espacios por izquierda

function TrimLeft( str )

{

	var resultStr = "";

	var i = len = 0;

	// Return immediately if an invalid value was passed in

	if (str+"" == "undefined" || str == null)	

		return null;

	// Make sure the argument is a string

	str += "";

	if (str.length == 0) 

		resultStr = "";

	else {	

  		// Loop through string starting at the beginning as long as there

  		// are spaces.

//	  	len = str.length - 1;

		len = str.length;

		

  		while ((i <= len) && (str.charAt(i) == " "))

			i++;

   	// When the loop is done, we're sitting at the first non-space char,

 		// so return that char plus the remaining chars of the string.

  		resultStr = str.substring(i, len);

  	}

  	return resultStr;

}

//funcion para validar espacios por derecha

function TrimRight( str )

{

	var resultStr = "";

	var i = 0;

	// Return immediately if an invalid value was passed in

	if (str+"" == "undefined" || str == null)	

		return null;

	// Make sure the argument is a string

	str += "";

	

	if (str.length == 0) 

		resultStr = "";

	else {

  		// Loop through string starting at the end as long as there

  		// are spaces.

  		i = str.length - 1;

  		while ((i >= 0) && (str.charAt(i) == " "))

 			i--;

 			

 		// When the loop is done, we're sitting at the last non-space char,

 		// so return that char plus all previous chars of the string.

  		resultStr = str.substring(0, i + 1);

  	}  	

  	return resultStr;  	

}

//funcion para validar correo

function valEmail(valor)

{

	re  = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/; 

    if(!re.exec(valor))

	{

        return false;

    }else

	{

        return true;

    }

}

function vermodulo(valor)

{

	if(valor==0)

	{

		document.getElementById('idmodulo').style.display ="none";

		document.getElementById('seccion').style.display ="";

		document.getElementById('tiposubseccion').value="0";

		

	}

	else if(valor==1)

	{

		document.getElementById('idmodulo').style.display ="";

		document.getElementById('seccion').style.display ="none";

		document.getElementById('tiposubseccion').value="1";

	}

}



function verificarcamposdiv(opc)

{	

	if(opc==1)

	{

		cont=6;

		cont2=6;

		vec=new Array ('nombredivision','estructuradivision','descripciondivision','nombre','ancho','alto');

//		vec=new Array ('nombredivision','estructuradivision','nombre','ancho','alto');

	}

	else

	{

		cont=3;

		cont2=3;

		vec=new Array ('nombredivision','estructuradivision','descripciondivision');

	}	

	for (i=0;i<vec.length;i++)

	{

		if(Trim(document.getElementById(vec[i]).value)=="")

		{

			document.getElementById(vec[i]).style.background="red";

			document.getElementById(vec[i]).value =Trim(document.getElementById(vec[i]).value);

			cont=cont-1;

		}

		else

		{

			document.getElementById(vec[i]).style.background="";

			document.getElementById(vec[i]).value =Trim(document.getElementById(vec[i]).value);

		}					

	}

	if(cont==cont2)

	{

		return 1;

	}

	else

	{

		return 0;

	}	

}

function OnOff(campo,valor,elemento)

{

	cadena=document.getElementById(elemento).value;

	if(document.getElementById(campo).checked)

	{

		cadena=valor+","+cadena;

	}

	else

	{	

		VectorCadena=cadena.split(',');

		cadena="";

		for($i=0;$i<VectorCadena.length;$i++)

		{

			if(VectorCadena[$i]!=valor && VectorCadena[$i]!="")

			{

				cadena+=VectorCadena[$i]+",";

			}

		}

	}

	if(cadena.substr(cadena.length-1,cadena.length)==",")

	{

		cadena=cadena.substr(0,cadena.length-1);

	}				

	document.getElementById(elemento).value=cadena;

}

/*function crearcategoriadescargas()

{

	cadena="listarcategoriasdescargas.php";

	secondwindow=open(cadena,'Editar','height=300,width=580,scrollbars=yes,directories=NO,location=NO,alwaysRaised');

}

*/

function popupcrearcategoriadescargas(Identificador_Descargas_Categoria)

{

	cadena="listarcategoriasdescargas.php?Identificador_Descargas_Categoria="+Identificador_Descargas_Categoria;

	secondwindow=open(cadena,'Editar','height=180,width=600,scrollbars=yes,directories=NO,location=NO,alwaysRaised');

}



function crearcategoriasdescargas()

{

	document.frmdatos.action='crearcategoriasdescargas.php';

	document.frmdatos.submit();		

}



function popupeditarcategoriasdescargas(Identificador_Descargas_categoria,nombre)

{

	var cadena="";

	document.getElementById('identificadorcategoriasdescargas').value=Identificador_Descargas_categoria;	

	document.getElementById('Nombre').value=nombre;	

//	secondwindow=open(cadena,'Editar','height=10,width=400,scrollbars=no,directories=NO,location=NO,alwaysRaised');

}

function eliminarcategoriasdescargas(Identificador_Descargas_categoria)

{

	if(confirm("Realmente desea eliminar la categoria"))

	{

		document.getElementById('identificadorcategoriasdescargas').value=Identificador_Descargas_categoria;

		document.frmdatos.action='eliminarcategoriasdescargas.php';

		document.frmdatos.submit();			

	}	

}



function editarcategoriasdescargas(valor)

{

	if(valor==0){cargar();setTimeout("salir()",4500);}	

}



function creararchivodescargas(Identificador_Descargas_categoria)

{

	document.getElementById('identificadorcategoriasdescargas').value=Identificador_Descargas_categoria;	

	document.frmdatos.action='creararchivodescargas.php';

	document.frmdatos.submit();	

}



function popupeditararchivodescargas(Identificador_Descargas_Categoria,Identificador_Descargas)

{

	var cadena="";

	cadena="editararchivodescargas.php?iddescargascategoria="+Identificador_Descargas_Categoria+"&iddescargas="+Identificador_Descargas;

	secondwindow=open(cadena,'Editar','height=200,width=600,scrollbars=no,directories=NO,location=NO,alwaysRaised');

    secondwindow.moveTo(150,120);

}



function editardescargas(valor)

{

	if(valor==0){cargar();setTimeout("salir()",4500);}	

}

function eliminararchivosdescargas(Identificador_Descargas_Categoria,Identificador_Descargas)

{

	document.getElementById('identificadorcategoriasdescargas').value=Identificador_Descargas_Categoria;	

	document.getElementById('identificadordescargas').value=Identificador_Descargas;		

	document.frmdatos.action='eliminararchivodescargas.php';

	document.frmdatos.submit();	

}

function descargar(nombre)

{

	document.getElementById('descarga').value=nombre;	

	document.frmdatos.action='descarga.php';

	document.frmdatos.submit();	

}

function descargarpru(nombre)

{

	document.getElementById('descarga').value=nombre;	

	document.frmdatospru.action='descarga.php';

	document.frmdatospru.submit();	

}





function descargardesc(nombre)

{

	document.getElementById('descarga').value=nombre;	

	document.frmdatosdesc.action='administrador/descargas/descarga.php';

	document.frmdatosdesc.submit();	

}



function descargar2(nombre)
{
    if(!document.getElementById('descarga')){
        objInput = document.createElement("input");
        objInput.setAttribute('type','hidden');
        objInput.setAttribute('id','descarga');
        objInput.setAttribute('name','descarga');
        objInput.value = nombre;
        document.frmdatos[0].appendChild(objInput);
        document.frmdatos[0].action='administrador/descargas/descarga.php';
	    document.frmdatos[0].submit();
        return false;
    }
	document.getElementById('descarga').value=nombre;
	document.frmdatos.action='administrador/descargas/descarga.php';
	document.frmdatos.submit();	
}

function eliminarusuariodescargas(Identificador_Descargas_Usuario)

{

	document.getElementById('identificadordescargasusuario').value=Identificador_Descargas_Usuario;	

	document.frmdatos.action='eliminarusuariodescargas.php';

	document.frmdatos.submit();	

}



function popupcrearusuariodescargas(Identificador_Descargas_Usuario)

{

	var cadena="";

	cadena="editarusuariodescargas.php?iddescargasusuario="+Identificador_Descargas_Usuario;

	secondwindow=open(cadena,'Editar','height=400,width=550,scrollbars=no,directories=NO,location=NO,alwaysRaised');

    secondwindow.moveTo(150,120);

}

function guardarusuariodescargas()

{

	valusuario=ValidaCampo('usuario');

	valclave=ValidaCampo('clave');

	if(valusuario==1 && valclave==1)

	{

		sexo=document.getElementById('sexo').value;

		

		$(document).ready(

					function()

					{	

				$.post("ajaxguardarusuariodescargas.php",{nombre:$("#nombre").val(),usuario:$("#usuario").val(),clave:$("#clave").val(),perfil:$("#perfil").val(),iddescargasusuario:$("#iddescargasusuario").val(),correo:$("#correo").val(),direccion:$("#direccion").val(),barrio:$("#barrio").val(),ciudad:$("#ciudad").val(),telefono:$("#telefono").val(),sexo:sexo},

									function(data)

									{ 																			

										//$("#subseccion").html(data);							

										//alert("Datos Editados Correctamente");

										if(data=="")

										{

											cargar_pagina();	

										}

										else

										{

											alert(data);	

										}

									}

								);						

					}

		);

	}

	else

	{

		alert("Por favor verifique loa campos de Login y Clave ya que posee caracteres que no son permitidos");		

	}

}

var temp=1;

function seltodos()

{	

	if(temp==1)

	{

		temp=0;

		n=document.frmdatos.checkboxd.length;

		m=document.frmdatos.checkboxa.length;

		if(n>1)

		{

			for (i=0;i<n;i++)		  

			{

				  document.frmdatos.checkboxd[i].checked=1 ;		 

			}

		}

		else{document.frmdatos.checkboxd.checked=1;}

		if(m>1)

		{

			for (i=0;i<m;i++)

			{

				  document.frmdatos.checkboxa[i].checked=1 ;		 

			}		

		}

		else{ document.frmdatos.checkboxa.checked=1;}

	}		

	else

	{

		temp=1;

		if(n>1)

		{

			for (i=0;i<n;i++)		  

			{

				  document.frmdatos.checkboxd[i].checked=0 ;		 

			}

		}

		else{document.frmdatos.checkboxd.checked=0;}

		if(m>1)

		{

			for (i=0;i<m;i++)

			{

				  document.frmdatos.checkboxa[i].checked=0 ;		 

			}		

		}

		else{ document.frmdatos.checkboxa.checked=0;}

	}

}



function enviarmensajemiembros()

{		

	n=document.frmdatos.checkboxd.length;

	if(n==null){n=1;}

	m=document.frmdatos.checkboxa.length;

	if(m==null){m=1;}

	

	cada="";

	cadd="";

	if(n>1)

	{

		for (i=0;i<n;i++)

		{

		  if(document.frmdatos.checkboxd[i].checked)

		  {

			  cadd=cadd+document.frmdatos.checkboxdd[i].value+"-";

		  }

		}

	}

	else

	{ 

		   if(document.frmdatos.checkboxd.checked==true)

		   {

			  cadd=cadd+document.frmdatos.checkboxdd.value+"-";			  

			}

	}

	

	if(m>1)

	{

		for (i=0;i<m;i++)

		{

		  if(document.frmdatos.checkboxa[i].checked)

		  {

			  cada=cada+document.frmdatos.checkboxaa[i].value+"-";			

		  }

		}

	}

	else

	{ 

		    if(document.frmdatos.checkboxa.checked==true)

		   {			 

			  cada=cada+document.frmdatos.checkboxaa.value+"-";			  	

		   }

	}	

	if(cada.substr(cada.length-1,cada.length)=="-")

	{

		cada=cada.substr(0,cada.length-1);

	}

	if(cadd.substr(cadd.length-1,cadd.length)=="-")

	{

		cadd=cadd.substr(0,cadd.length-1);

	}

	document.getElementById('cadenausudescargas').value=cadd;

//	document.getElementById('cadenausualmacenes').value=cada;

	document.getElementById('cadenausualmacenes').value="";

	document.frmdatos.action='guardaenviarmensajes.php';

	document.frmdatos.submit();	

}



function eliminaralmacenmensaje(Id_Almacen_Mensaje)

{

	if(confirm("Realmente desea eliminar este mensaje"))

	{

		document.getElementById('idalmacenmensaje').value=Id_Almacen_Mensaje;	

		document.frmdatos.action='eliminaralmacenmensaje.php';

		document.frmdatos.submit();	

	}

}

function popupalmacenmensaje(codigo_De_Almacen_Mensaje,Id_Almacen_Perfil_Mensaje,Id_Almacen_Mensaje)

{

	var cadena="";

	cadena="editaralmacenmensaje.php?codigodealmacenmensaje="+codigo_De_Almacen_Mensaje+"&Idalmacenperfilmensaje="+Id_Almacen_Perfil_Mensaje+"&Id_Almacen_Mensaje="+Id_Almacen_Mensaje;

	secondwindow=open(cadena,'Editar','height=300,width=420,scrollbars=no,directories=NO,location=NO,alwaysRaised');

    secondwindow.moveTo(150,120);	

}

function crearusuariodescargas()

{

	document.frmdatos.action='crearusuariodescargas.php';

	document.frmdatos.submit();	

}





function actualizardatos()

{

		$(document).ready(

				function()

				{				

					$.post("administrador/descargas/ajaxeditarusuarios.php",{},

								function(data)

								{ 										

									$("#subseccion").html(data);										

								}

							);						

				}

		);	

}

function centromensajeria()

{

	

	$(document).ready(

				function()

				{				

					$.post("administrador/descargas/ajaxmensajes.php",{},

								function(data)

								{ 										

									$("#subseccion").html(data);										

								}

							);						

				}

		);	

}


function cargaridioma(valor)
{
	document.getElementById('idioma').value=valor;
}
function verificar2()
{
	//alert(document.getElementById('usu').value);
	usu1=document.getElementById('usucliente').value;
	cla1=document.getElementById('clacliente').value;
	idioma1=document.getElementById('idioma').value;
	
	if(usu1!="" && cla1!="")
	{	//conteo(2);
		$(document).ready(
				function()
				{				
					$.post("verificar/verifica2.php",{usuario:usu1,clave:cla1,idioma:idioma1},
								function(data)
								{ 	
									//document.getElementById('usu').value="";
									//document.getElementById('cla').value="";									
									if(data==2)
									{
										/*document.getElementById('usu').value="";
										document.getElementById('cla').value="";*/
										alert("Ingrese un usuario y clave validos");										
									}									
									else
									{
										//data="En proceso";
										scrollBy(0,550);		

										$("#subseccion").html(data);	
										document.getElementById('front').style.display ="none";		
										document.getElementById('bannerflash').style.display ="none";
										document.getElementById('bannerflashinterno').style.display ="";	
									}
								}
							);						
				}
		);	
	}
}
function actualizardatos2()

{

	valclave=ValidaCampo('clave2');

	if(valclave==1)

	{

		$(document).ready(

						function()

						{				

							$.post("administrador/descargas/ajaxeditarusuariosguardar.php",{nombre:$("#nombre").val(),usuario:$("#usuario2").val(),clave:$("#clave2").val(),correo:$("#correo").val(),direccion:$("#direccion").val(),barrio:$("#barrio").val(),ciudad:$("#ciudad").val(),telefono:$("#telefono").val()},

										function(data)

										{ 	

											//alert(data);	

											//$("#subseccion").html(data);

											alert("Los datos se guardaron satisfactoriamente");

											verificar2()

										}

									);						

						}

				);

	}

	else

	{

		alert("Por favor verifique el campo de Clave ya que posee caracteres que no son permitidos");		

	}

}



function enviarmensaje()

{	

	$(document).ready(

				function()

				{				

					$.post("administrador/descargas/ajaxmensajesguardar.php",{asunto:$("#asunto").val(),mensaje:$("#mensaje").val(),idmensaje:$("#idmensaje").val()},

								function(data)

								{ 																			

									//$("#subseccion").html(data);

									alert("Los datos se guardaron satisfactoriamente");

									centromensajeria();

								}

							);						

				}

		);

}

function eliminamensaje(valor)

{

	if(confirm("Realmente desea eliminar este mensaje"))

	{

		$(document).ready(

					function()

					{				

						$.post("administrador/descargas/ajaxmensajeseliminar.php",{idmensaje:valor},

									function(data)

									{ 																			

										//$("#subseccion").html(data);

										//alert(data);

										alert("Los datos se eliminaron satisfactoriamente");

										centromensajeria();

									}

								);						

					}

			);

	}

}



function verdescargas(Identificador_Descargas_Categoria)

{

	$(document).ready(

				function()

				{				

					$.post("administrador/descargas/ajaxdescargas.php",{Identificador_Descargas_Categoria:Identificador_Descargas_Categoria},

								function(data)

								{ 										

									$("#subseccion").html(data);										

								}

							);						

				}

		);	

}



function cargarflash1(divisiones)

{



	$(document).ready(

				function()

				{						

					vectdiv=divisiones.split(',');

					var n=vectdiv.length;

					for(i=1;i<=n;i++)

					{	

						var rango_superior = 10;  

						var rango_inferior = 5;  

						var aleatorio = Math.random()

						while(aleatorio>rango_inferior && aleatorio<rango_superior)

						{

							aleatorio = Math.random();

						}

						$.post("funciones/ajaxcargarflash.php",{Opcion:i,divisiones:divisiones},

									function(data)

									{ 

										vetdata=data.split(',');

										dato=vetdata[0];

										opc=vetdata[1];

										id="#flash1";

										$(id).html(data);							

									}

								);						

					}			

				}

	);					

}

function cargarflash2(divisiones)

{



	$(document).ready(

				function()

				{						

					vectdiv=divisiones.split(',');

					var n=vectdiv.length;

					for(i=1;i<=n;i++)

					{	

						var rango_superior = 10;  

						var rango_inferior = 5;  

						var aleatorio = Math.random()

						while(aleatorio>rango_inferior && aleatorio<rango_superior)

						{

							aleatorio = Math.random();

						}

						$.post("funciones/ajaxcargarflash.php",{Opcion:i,divisiones:divisiones},

									function(data)

									{ 

										vetdata=data.split(',');

										dato=vetdata[0];

										opc=vetdata[1];

										id="#flash2";

										$(id).html(data);							

									}

								);						

					}			

				}

	);					

}



function cargarflash3(divisiones)

{



	$(document).ready(

				function()

				{						

					vectdiv=divisiones.split(',');

					var n=vectdiv.length;

					for(i=1;i<=n;i++)

					{	

						var rango_superior = 10;  

						var rango_inferior = 5;  

						var aleatorio = Math.random()

						while(aleatorio>rango_inferior && aleatorio<rango_superior)

						{

							aleatorio = Math.random();

						}

						$.post("funciones/ajaxcargarflash.php",{Opcion:i,divisiones:divisiones},

									function(data)

									{ 

										vetdata=data.split(',');

										dato=vetdata[0];

										opc=vetdata[1];

										id="#flash3";

										$(id).html(data);							

									}

								);						

					}			

				}

	);					

}

function conteo(division)

{

	/*$.post("funciones/ajaxconteo.php",{division:division},

		function(data)

		{ 

//		alert("hizo clic");

		}

	);*/			

	//alert(division);

}

function contar(Conteo_Imamaster)

{

		alert("El numero tolal  de clic echos en el baner son de "+ Conteo_Imamaster);	

}

temestado=1

function ocultar()

{

/*	if(temestado==1)

	{	

		document.getElementById('flash1').style.display ="none";

		document.getElementById('flash2').style.display ="none";

		temestado=0;		

	}

	else

	{

		document.getElementById('flash1').style.display ="";

		document.getElementById('flash2').style.display ="";

		temestado=1;				

	}*/

}



function popupeditarfondoestilos(Id_Fondo_Estilo)

{

	var cadena="";

	cadena="editarfondoestilos.php?idfondoestilo="+Id_Fondo_Estilo;

	secondwindow=open(cadena,'Editar','height=220,width=580,scrollbars=no,directories=NO,location=NO,alwaysRaised');

    secondwindow.moveTo(150,120);

}

function editarfondoestilo(valor)

{

	if(valor==0){cargar();setTimeout("salir()",4500);}	

}





function eliminarfondoestilos(Id_Fondo_Estilo)

{

	if(confirm("Realmente desea eliminar esta imagen de estilo "))

	{

		document.frmdatos.action='eliminarfondoestilos.php';

		document.getElementById('Identificador_Fondo_Estilo').value=Id_Fondo_Estilo;

		document.frmdatos.submit();			

	}	

}



function popupverfondoestilos(Id_Fondo_Estilo)

{

	var cadena="";

	cadena="vereditarfondoestilos.php?idfondoestilo="+Id_Fondo_Estilo;

	secondwindow=open(cadena,'Editar','height=400,width=430,scrollbars=no,directories=NO,location=NO,alwaysRaised');

    secondwindow.moveTo(150,120);	

}

function cargarestilosfondo()

{			

	$(document).ready(

				function()

				{				

					$.post("administrador/fondos_estilos/ajax_estilos.php",{},

								function(data)

								{ 

									$("#estilofondo").html(data);										

								}

							);						

				}

	);	

}

function regusuarios()

{

alert("aqui va el lamado al modulo de usuarios");	

}



function frontal()

{



document.getElementById('DIV6-7').style.display ="";	

$(document).ready(

				function()

				{				

					$.post("funciones/ajaxfront.php",{},

								function(data)

								{ 																			

								$("#subseccion").html(data);									

								}

							);						

				}

	);	

}



function imagenes()

{

cadena="http://www.dynamikahosting.com/colombo/FCKeditor/FCKeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=http://www.dynamikahosting.com/colombo/FCKeditor/FCKeditor/editor/filemanager/connectors/php/connector.php";

secondwindow=open(cadena,'Editar','height=500,width=800,scrollbars=no,directories=NO,location=NO,alwaysRaised');

}



function salida()

{

/*	cadena='index.php?est='+1;

	secondwindow=open(cadena,'Editar','');*/

//	document.frmdatospru.target='_blanck';

	document.frmdatospru.action='index.php';

	document.frmdatospru.submit();	

//	window.close()

}

function recargarsecc()

{	

	iddivision=document.getElementById('division').value;

	document.frmdatos.method='get';

	document.frmdatos.action='listaseccion.php?iddivision='+iddivision;

	document.frmdatos.submit();	

}



function NoticiasFrontEnlace(valor,n)

{

	for(i=0;i<n;i++)

	{			

		if(valor==i)

		{

			document.getElementById('not'+i).style.display ="";								

		}

		else

		{

			document.getElementById('not'+i).style.display ="none";								

		}

	}

}



function creaitem()

{

	document.frmdatos.action='crearitemmenu.php';

	document.frmdatos.submit();		

}



function popupeditaritemmenu(Id_Menu)

{

	var cadena="";

	cadena="editarmenu.php?Id_Menu="+Id_Menu;

	secondwindow=open(cadena,'Editar','height=150,width=430,scrollbars=no,directories=NO,location=NO,alwaysRaised');

    secondwindow.moveTo(150,120);	



}



function eliminaritemmenu(Id_Menu)

{

	document.getElementById('Id_Menu').value=Id_Menu;

	document.frmdatos.action='eliminarmenu.php';

	document.frmdatos.submit();	

}



function editarmenu()

{	

	estado="0";

	if(document.getElementById('estado_0').checked)

	{

		estado="0";	

	}

	else if(document.getElementById('estado_1').checked)

	{

		estado="1";	

	}

	$(document).ready(

				function()

				{	

					$.post("ajaxeditarmenu.php",{estado:estado,nombre:$("#nombre").val(),tipo:$("#tipo").val(),Id_Menu:$("#Id_Menu").val()},

								function(data)

								{ 																			

								//$("#subseccion").html(data);							

								//alert("Datos Editados Correctamente");

								//alert(data);

								cargar_pagina();

								}

							);						

				}

	);					

}



function nivelmenu(Id_Menu,Ord_Menu,Tipo_Menu,Opcion)

{

	document.frmdatos.action='nivelmenu.php';

	document.getElementById('Ord_Menu').value=Ord_Menu;

	document.getElementById('Id_Menu').value=Id_Menu;

	document.getElementById('opcion').value=Opcion;

	document.getElementById('Tipo_Menu').value=Tipo_Menu;

	document.frmdatos.submit();		

}



function activarcliente(valor)

{	

	if(valor==1)

	{

		document.getElementById('datos').style.display ="";	

		document.getElementById('mensajeria').style.display ="none";		

		document.getElementById('subseccion').style.display ="none";		

		document.getElementById('noticia').style.display ="none";		

		document.getElementById('chat').style.display ="none";			

	}

	if(valor==2)

	{

		document.getElementById('datos').style.display ="none";	

		document.getElementById('mensajeria').style.display ="";		

		document.getElementById('subseccion').style.display ="none";		

		document.getElementById('noticia').style.display ="none";		

		document.getElementById('chat').style.display ="none";			

	}

	if(valor==3)

	{

		document.getElementById('datos').style.display ="none";	

		document.getElementById('mensajeria').style.display ="none";		

		document.getElementById('subseccion').style.display ="";		

		document.getElementById('noticia').style.display ="none";		

		document.getElementById('chat').style.display ="none";			

	}

	if(valor==4)

	{

		document.getElementById('datos').style.display ="none";	

		document.getElementById('mensajeria').style.display ="none";		

		document.getElementById('subseccion').style.display ="none";		

		document.getElementById('noticia').style.display ="";		

		document.getElementById('chat').style.display ="none";			

	}

	if(valor==5)

	{

		document.getElementById('datos').style.display ="none";	

		document.getElementById('mensajeria').style.display ="none";		

		document.getElementById('subseccion').style.display ="none";		

		document.getElementById('noticia').style.display ="none";		

		document.getElementById('chat').style.display ="";			

	}

}

function buscadoratras(palabras,Idioma)

{

//	palabra=document.getElementById('busqueda').value;

//	alert(palabra);

	$(document).ready(

				function()

				{				

					$.post("xmod_noticias/ajaxbuscarnoticiascliente.php",{palabras:palabras,Idioma:Idioma},

								function(data)

								{ 	

									$("#subseccion").html(data);

								}

							);						

				}

	);	

}
function cambiaridioma()
{
	valoridioma=document.getElementById('ididioma').value;	
	if(valoridioma==1)
	{
		document.frmdatosidioma.action='index.php?Idioma='+valoridioma;
		document.frmdatosidioma.submit();	
	}
	else
	{
		document.frmdatosidioma.action='index.php?Idioma='+valoridioma;
		document.frmdatosidioma.submit();	
	}
}

function desechek(j)
{
	for (i=0;i<document.frmdatos.acceso.length;i++)
	{
		if(j==0 )
		{	
			if(i!=0)
			{
			 	document.frmdatos.acceso[i].checked=false;  
			}
		}
		else
		{
			document.frmdatos.acceso[0].checked=false;  
		}
	}		
}


function guardarsubseccion()
{	
	var cad="";
	for (i=0;i<document.frmdatos.acceso.length;i++)
	{
	  if(document.frmdatos.acceso[i].checked)
	  {
		  cad=cad+document.frmdatos.acceso[i].value+"-";
	  }
	}
	cad=cad.substring(0,cad.length-1)
	if(cad=="")
	{
		document.getElementById('cadenachk').value="0";				
	}
	else
	{
		document.getElementById('cadenachk').value=cad;		
	}	
	document.frmdatos.action='guardarsubseccion.php';
	document.frmdatos.submit();	
}
function iniciar()
{
	document.getElementById('frontx').style.display ="";	
	setTimeout("parar()",2000);		 
}  
function parar()
{ 
	document.getElementById('frontx').style.display ="none";			
}

