/************************************************/
function Logear_Usuario()
{
	var vacio="<b>Error(es) encontrado(s):</b><br>";
	Usuario=document.getElementById('usuarioP').value;
	if(Usuario=="")
		vacio+="&nbsp;<b>&#8226;</b>&nbsp;&nbsp;Usuario esta vac&iacute;o<BR>";
	Clave=document.getElementById('claveP').value;
	if(Clave=="")
		vacio+="&nbsp;<b>&#8226;</b>&nbsp;&nbsp;Clave de acceso esta vac&iacute;a"
	if(Usuario!="" && Clave!="")
		Ejecutar(Clave, Usuario);
	else
		MsgBox('msgbox/Error.png', 'DATOS ERRONEOS',vacio, '2');
		//prompt2('../msgbox/Error.png', 'DATOS ERRONEOS',vacio, '1');
}
function validarProveedor()
{
	var control=0;
	if(document.getElementById('razon_social').value=="")
	{
		document.getElementById('razon_social').className="formCC";
		document.getElementById('C1').className="CECR";
		document.getElementById('C1').innerHTML=" * Requerido";
		document.getElementById('razon_social').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('razon_social').className="form";
		document.getElementById('C1').className="Estilo2";
		document.getElementById('C1').innerHTML=" *";
	}
	if(document.getElementById('nit').value=="")
	{
		document.getElementById('nit').className="formCC";
		document.getElementById('C2').className="CECR";
		document.getElementById('C2').innerHTML=" * Requerido";
		document.getElementById('nit').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('nit').className="form";
		document.getElementById('C1').className="Estilo2";
		document.getElementById('C1').innerHTML=" *";
		advAJAX.setDefaultParameters({
		//onInitialization : function(obj){prompt1('images/ad.jpg', 'CONECTANDO','Conectando con nuestra base de datos', 'myfunction');},
		onLoading : function(obj){MsgBox('msgbox/Info.png', 'REGISTRANDO','Comparando informaci&oacute;n con nuestra base de datos', '4');},
		onSuccess : function(obj){
			Eliminar();
			if(obj.responseText==10)
			{
				document.getElementById('nit').className="formCC";
				document.getElementById('C2').className="CECR";
				document.getElementById('C2').innerHTML=" * Ya esta registrado";
				document.getElementById('nit').focus();
				return true;
				control++;
			}
			else
			{
				document.getElementById('nit').className="form";
				document.getElementById('C2').className="Estilo2";
				document.getElementById('C2').innerHTML=" *";
			}
			},
		onError : function(obj){Eliminar();MsgBox('msgbox/Error.png', 'ERROR',"Imposible conectar con la base de datos", '2');}
		});
		advAJAX.get({ url: "lib/php_admin.php?VerificaNit="+document.getElementById('nit').value, tag: "Estado" });
		advAJAX.setDefaultParameters({});
	}
	if(document.getElementById('rut').value=="")
	{
		document.getElementById('rut').className="formCC";
		document.getElementById('C3').className="CECR";
		document.getElementById('C3').innerHTML=" * Requerido";
		document.getElementById('rut').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('rut').className="form";
		document.getElementById('C3').className="Estilo2";
		document.getElementById('C3').innerHTML=" *";
	}
	if(document.getElementById('ciu').value=="")
	{
		document.getElementById('ciu').className="formCC";
		document.getElementById('C4').className="CECR";
		document.getElementById('C4').innerHTML=" * Requerido";
		document.getElementById('ciu').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('ciu').className="form";
		document.getElementById('C4').className="Estilo2";
		document.getElementById('C4').innerHTML=" *";
	}
	if(document.getElementById('telefono').value=="")
	{
		document.getElementById('telefono').className="formCC";
		document.getElementById('C5').className="CECR";
		document.getElementById('C5').innerHTML=" * Requerido";
		document.getElementById('telefono').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('telefono').className="form";
		document.getElementById('C5').className="Estilo2";
		document.getElementById('C5').innerHTML=" *";
	}
	if(document.getElementById('direccion').value=="")
	{
		document.getElementById('direccion').className="formCC";
		document.getElementById('C6').className="CECR";
		document.getElementById('C6').innerHTML=" * Requerido";
		document.getElementById('direccion').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('direccion').className="form";
		document.getElementById('C6').className="Estilo2";
		document.getElementById('C6').innerHTML=" *";
	}
	if(document.getElementById('ciudad').value=="")
	{
		document.getElementById('ciudad').className="formCC";
		document.getElementById('C7').className="CECR";
		document.getElementById('C7').innerHTML=" * Requerido";
		document.getElementById('ciudad').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('ciudad').className="form";
		document.getElementById('C7').className="Estilo2";
		document.getElementById('C7').innerHTML=" *";
	}
	if(document.getElementById('email').value=="")
	{
		document.getElementById('email').className="formCC";
		document.getElementById('C8').className="CECR";
		document.getElementById('C8').innerHTML=" * Requerido";
		document.getElementById('email').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('email').className="form";
		document.getElementById('C8').className="Estilo2";
		document.getElementById('C8').innerHTML=" * Requerido";
	}
	if(document.getElementById('aniofundacion').value=="")
	{
		document.getElementById('aniofundacion').className="formCC";
		document.getElementById('C9').className="CECR";
		document.getElementById('C9').innerHTML=" * Requerido";
		document.getElementById('aniofundacion').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('aniofundacion').className="form";
		document.getElementById('C9').className="Estilo2";
		document.getElementById('C9').innerHTML=" *";
	}
	if(document.getElementById('aniosexperiencia').value=="")
	{
		document.getElementById('aniosexperiencia').className="formCC";
		document.getElementById('C10').className="CECR";
		document.getElementById('C10').innerHTML=" * Requerido";
		document.getElementById('aniosexperiencia').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('aniosexperiencia').className="form";
		document.getElementById('C10').className="Estilo2";
		document.getElementById('C10').innerHTML=" *";
	}
	if(document.getElementById('personacontacto').value=="")
	{
		document.getElementById('personacontacto').className="formCC";
		document.getElementById('C11').className="CECR";
		document.getElementById('C11').innerHTML=" * Requerido";
		document.getElementById('personacontacto').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('personacontacto').className="form";
		document.getElementById('C11').className="Estilo2";
		document.getElementById('C11').innerHTML=" *";
	}
	if(document.getElementById('proveedorodinsa').value=="")
	{
		document.getElementById('proveedorodinsa').className="formCC";
		document.getElementById('C12').className="CECR";
		document.getElementById('C12').innerHTML=" * Requerido";
		document.getElementById('proveedorodinsa').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('proveedorodinsa').className="form";
		document.getElementById('C12').className="Estilo2";
		document.getElementById('C12').innerHTML=" *";
	}
	if(document.getElementById('descripcion').value=="")
	{
		document.getElementById('descripcion').className="formCC";
		document.getElementById('C13').className="CECR";
		document.getElementById('C13').innerHTML=" * Requerido";
		document.getElementById('descripcion').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('descripcion').className="form";
		document.getElementById('C13').className="Estilo2";
		document.getElementById('C13').innerHTML=" *";
	}
	if(document.getElementById('regimen').value=="")
	{
		document.getElementById('regimen').className="formCC";
		document.getElementById('C14').className="CECR";
		document.getElementById('C14').innerHTML=" * Requerido";
		document.getElementById('regimen').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('regimen').className="form";
		document.getElementById('C14').className="Estilo2";
		document.getElementById('C14').innerHTML=" *";
	}
	if(document.getElementById('contribuyente').value=="")
	{
		document.getElementById('contribuyente').className="formCC";
		document.getElementById('C15').className="CECR";
		document.getElementById('C15').innerHTML=" * Requerido";
		document.getElementById('contribuyente').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('contribuyente').className="form";
		document.getElementById('C15').className="Estilo2";
		document.getElementById('C15').innerHTML=" *";
	}
	if(document.getElementById('autoretenedor').value=="")
	{
		document.getElementById('autoretenedor').className="formCC";
		document.getElementById('C16').className="CECR";
		document.getElementById('C16').innerHTML=" * Requerido";
		document.getElementById('autoretenedor').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('autoretenedor').className="form";
		document.getElementById('C16').className="Estilo2";
		document.getElementById('C16').innerHTML=" *";
	}
	if(document.getElementById('codigoactividad').value=="")
	{
		document.getElementById('codigoactividad').className="formCC";
		document.getElementById('C17').className="CECR";
		document.getElementById('C17').innerHTML=" * Requerido";
		document.getElementById('codigoactividad').focus();
		return true;
		control++;
		
	}
	else
	{
		document.getElementById('codigoactividad').className="form";
		document.getElementById('C17').className="Estilo2";
		document.getElementById('C17').innerHTML=" *";
	}
	if(document.getElementById('tarifaica').value=="")
	{
		document.getElementById('tarifaica').className="formCC";
		document.getElementById('C18').className="CECR";
		document.getElementById('C18').innerHTML=" * Requerido";
		document.getElementById('tarifaica').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('tarifaica').className="form";
		document.getElementById('C18').className="Estilo2";
		document.getElementById('C18').innerHTML=" *";
	}
	if(document.getElementById('capitaltrabajo').value=="")
	{
		document.getElementById('capitaltrabajo').className="formCC";
		document.getElementById('C19').className="CECR";
		document.getElementById('C19').innerHTML=" * Requerido";
		document.getElementById('capitaltrabajo').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('capitaltrabajo').className="form";
		document.getElementById('C19').className="Estilo2";
		document.getElementById('C19').innerHTML=" *";
	}
	

	/*function resultadoUpload(estado, file) {

    var link = '<br /><br /><a href="upload3.php">Subir Archivo</a> - <a href="verArchivos.php">Ver Imagenes</a>';

    if (estado == 0) var mensaje = 'El Archivo <a href="archs/' + file + '" target="_blank">' + file + '</a> se ha subido al servidor correctamente' + link;
    if (estado == 1) var mensaje = 'Error ! - El Archivo no llego al servdor' + link;
    if (estado == 2) var mensaje = 'Error ! - Solo se permiten Archivos tipo Imagen' + link;
    if (estado == 3) var mensaje = 'Error ! - No se pudo copiar Archivo. Posible problema de permisos en server' + link;

    document.getElementById('formUpload').innerHTML=mensaje;
    }*/

	if(control==0)
	{
		document.proveedor.submit();
	}
}
function VMD()
{
	var control=0;
	if(document.getElementById('razon_social').value=="")
	{
		document.getElementById('razon_social').className="formCC";
		document.getElementById('C1').className="CECR";
		document.getElementById('C1').innerHTML=" * Requerido";
		document.getElementById('razon_social').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('razon_social').className="form";
		document.getElementById('C1').className="Estilo2";
		document.getElementById('C1').innerHTML=" *";
	}
	if(document.getElementById('rut').value=="")
	{
		document.getElementById('rut').className="formCC";
		document.getElementById('C3').className="CECR";
		document.getElementById('C3').innerHTML=" * Requerido";
		document.getElementById('rut').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('rut').className="form";
		document.getElementById('C3').className="Estilo2";
		document.getElementById('C3').innerHTML=" *";
	}
	if(document.getElementById('ciu').value=="")
	{
		document.getElementById('ciu').className="formCC";
		document.getElementById('C4').className="CECR";
		document.getElementById('C4').innerHTML=" * Requerido";
		document.getElementById('ciu').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('ciu').className="form";
		document.getElementById('C4').className="Estilo2";
		document.getElementById('C4').innerHTML=" *";
	}
	if(document.getElementById('telefono').value=="")
	{
		document.getElementById('telefono').className="formCC";
		document.getElementById('C5').className="CECR";
		document.getElementById('C5').innerHTML=" * Requerido";
		document.getElementById('telefono').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('telefono').className="form";
		document.getElementById('C5').className="Estilo2";
		document.getElementById('C5').innerHTML=" *";
	}
	if(document.getElementById('direccion').value=="")
	{
		document.getElementById('direccion').className="formCC";
		document.getElementById('C6').className="CECR";
		document.getElementById('C6').innerHTML=" * Requerido";
		document.getElementById('direccion').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('direccion').className="form";
		document.getElementById('C6').className="Estilo2";
		document.getElementById('C6').innerHTML=" *";
	}
	if(document.getElementById('ciudad').value=="")
	{
		document.getElementById('ciudad').className="formCC";
		document.getElementById('C7').className="CECR";
		document.getElementById('C7').innerHTML=" * Requerido";
		document.getElementById('ciudad').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('ciudad').className="form";
		document.getElementById('C7').className="Estilo2";
		document.getElementById('C7').innerHTML=" *";
	}
	if(document.getElementById('email').value=="")
	{
		document.getElementById('email').className="formCC";
		document.getElementById('C8').className="CECR";
		document.getElementById('C8').innerHTML=" * Requerido";
		document.getElementById('email').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('email').className="form";
		document.getElementById('C8').className="Estilo2";
		document.getElementById('C8').innerHTML=" * Requerido";
	}
	if(document.getElementById('aniofundacion').value=="")
	{
		document.getElementById('aniofundacion').className="formCC";
		document.getElementById('C9').className="CECR";
		document.getElementById('C9').innerHTML=" * Requerido";
		document.getElementById('aniofundacion').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('aniofundacion').className="form";
		document.getElementById('C9').className="Estilo2";
		document.getElementById('C9').innerHTML=" *";
	}
	if(document.getElementById('aniosexperiencia').value=="")
	{
		document.getElementById('aniosexperiencia').className="formCC";
		document.getElementById('C10').className="CECR";
		document.getElementById('C10').innerHTML=" * Requerido";
		document.getElementById('aniosexperiencia').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('aniosexperiencia').className="form";
		document.getElementById('C10').className="Estilo2";
		document.getElementById('C10').innerHTML=" *";
	}
	if(document.getElementById('personacontacto').value=="")
	{
		document.getElementById('personacontacto').className="formCC";
		document.getElementById('C11').className="CECR";
		document.getElementById('C11').innerHTML=" * Requerido";
		document.getElementById('personacontacto').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('personacontacto').className="form";
		document.getElementById('C11').className="Estilo2";
		document.getElementById('C11').innerHTML=" *";
	}
	if(document.getElementById('proveedorodinsa').value=="")
	{
		document.getElementById('proveedorodinsa').className="formCC";
		document.getElementById('C12').className="CECR";
		document.getElementById('C12').innerHTML=" * Requerido";
		document.getElementById('proveedorodinsa').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('proveedorodinsa').className="form";
		document.getElementById('C12').className="Estilo2";
		document.getElementById('C12').innerHTML=" *";
	}
	if(document.getElementById('descripcion').value=="")
	{
		document.getElementById('descripcion').className="formCC";
		document.getElementById('C13').className="CECR";
		document.getElementById('C13').innerHTML=" * Requerido";
		document.getElementById('descripcion').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('descripcion').className="form";
		document.getElementById('C13').className="Estilo2";
		document.getElementById('C13').innerHTML=" *";
	}
	if(document.getElementById('regimen').value=="")
	{
		document.getElementById('regimen').className="formCC";
		document.getElementById('C14').className="CECR";
		document.getElementById('C14').innerHTML=" * Requerido";
		document.getElementById('regimen').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('regimen').className="form";
		document.getElementById('C14').className="Estilo2";
		document.getElementById('C14').innerHTML=" *";
	}
	if(document.getElementById('contribuyente').value=="")
	{
		document.getElementById('contribuyente').className="formCC";
		document.getElementById('C15').className="CECR";
		document.getElementById('C15').innerHTML=" * Requerido";
		document.getElementById('contribuyente').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('contribuyente').className="form";
		document.getElementById('C15').className="Estilo2";
		document.getElementById('C15').innerHTML=" *";
	}
	if(document.getElementById('autoretenedor').value=="")
	{
		document.getElementById('autoretenedor').className="formCC";
		document.getElementById('C16').className="CECR";
		document.getElementById('C16').innerHTML=" * Requerido";
		document.getElementById('autoretenedor').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('autoretenedor').className="form";
		document.getElementById('C16').className="Estilo2";
		document.getElementById('C16').innerHTML=" *";
	}
	if(document.getElementById('codigoactividad').value=="")
	{
		document.getElementById('codigoactividad').className="formCC";
		document.getElementById('C17').className="CECR";
		document.getElementById('C17').innerHTML=" * Requerido";
		document.getElementById('codigoactividad').focus();
		return true;
		control++;
		
	}
	else
	{
		document.getElementById('codigoactividad').className="form";
		document.getElementById('C17').className="Estilo2";
		document.getElementById('C17').innerHTML=" *";
	}
	if(document.getElementById('tarifaica').value=="")
	{
		document.getElementById('tarifaica').className="formCC";
		document.getElementById('C18').className="CECR";
		document.getElementById('C18').innerHTML=" * Requerido";
		document.getElementById('tarifaica').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('tarifaica').className="form";
		document.getElementById('C18').className="Estilo2";
		document.getElementById('C18').innerHTML=" *";
	}
	if(document.getElementById('capitaltrabajo').value=="")
	{
		document.getElementById('capitaltrabajo').className="formCC";
		document.getElementById('C19').className="CECR";
		document.getElementById('C19').innerHTML=" * Requerido";
		document.getElementById('capitaltrabajo').focus();
		return true;
		control++;
	}
	else
	{
		document.getElementById('capitaltrabajo').className="form";
		document.getElementById('C19').className="Estilo2";
		document.getElementById('C19').innerHTML=" *";
	}
	
	
	if(control==0)
	{
		document.proveedor.submit();
	}
}
function valida_archivo()
{
		//alert("entra");
		if(document.getElementById('archivo').value!="")
		{
			//alert("nivel 2");
			uploadDir=document.getElementById('archivo').value;
			var trozos = uploadDir.split ('/');
			var nmb_archivo = trozos[trozos.length-1];
			var trozos = nmb_archivo.split ('.');
			var extns = trozos[trozos.length-1];
			//alert("pasa");
			if (extns != 'doc' && extns != 'docx' && extns != 'xls' && extns != 'xlsx' && extns != 'pdf')
			{
				document.getElementById('archivo').className="formCC";
				document.getElementById('C20').className="CECR";
				document.getElementById('C20').innerHTML=" * Solo Word, Excel y Pdf";
				document.getElementById('archivo').value="";
				document.getElementById('archivo').focus();
				return true;
				control++;
			}
			else
			{
				document.getElementById('archivo').className="form";
				document.getElementById('C20').className="Estilo2";
				document.getElementById('C20').innerHTML=" *";
			}
		}
		else
		{
			document.getElementById('archivo').className="form";
			document.getElementById('C20').className="Estilo2";
			document.getElementById('C20').innerHTML=" *";
		}
}
function Validar_CA()
{
	var vacio="<b>Error(es) encontrado(s):</b><br>";
	nombre=document.getElementById('nombre').value;
	email=document.getElementById('email').value;
	usuario=document.getElementById('usuario').value;
	clave1=document.getElementById('clave1').value;
	clave2=document.getElementById('clave2').value;
	control=0;
	if(nombre=="")
	{
		vacio+="&nbsp;<b>&#8226;</b>&nbsp;&nbsp;Nombre esta vac&iacute;o<BR>";
		control++;
	}
	if(email=="")
	{
		vacio+="&nbsp;<b>&#8226;</b>&nbsp;&nbsp;Email esta vac&iacute;o<BR>";
		control++;
	}
	if(usuario=="")
	{
		vacio+="&nbsp;<b>&#8226;</b>&nbsp;&nbsp;Usuario esta vac&iacute;o<BR>";
		control++;
	}
	if(clave1=="" || clave2=="")
	{
		vacio+="&nbsp;<b>&#8226;</b>&nbsp;&nbsp;Clave de acceso y/o confirmacion de clave esta vac&iacute;a"
		control++;
	}
	if(clave1!=clave2)
	{
		vacio+="&nbsp;<b>&#8226;</b>&nbsp;&nbsp;Las claves ingresadas son diferentes"
		control++;
	}
	if(control==0)
		document.entrada.submit();
	else
		MsgBox('msgbox/Error.png', 'DATOS ERRONEOS',vacio, '2');
		//prompt2('../msgbox/Error.png', 'DATOS ERRONEOS',vacio, '1');
}
function Ejecutar(Clave, Usuario)
{
	advAJAX.setDefaultParameters({
	//onInitialization : function(obj){prompt1('images/ad.jpg', 'CONECTANDO','Conectando con nuestra base de datos', 'myfunction');},
	onLoading : function(obj){MsgBox('msgbox/Info.png', 'REGISTRANDO','Comparando informaci&oacute;n con nuestra base de datos', '4');},
	onSuccess : function(obj){
		if(obj.responseText==10)
		{
			Eliminar();
			location.href='modifica_info.php';
		}
		else
		{
			Eliminar();
			MsgBox('msgbox/Error.png', 'ACCESO FALLIDO',"El nombre de usuario o clave no son validos, por favor intentelo de nuevo", '2');
		}
		},
	onError : function(obj){Eliminar();MsgBox('msgbox/Error.png', 'ERROR',"Imposible conectar con la base de datos", '2');}
	});
	advAJAX.get({ url: "lib/php_admin.php?ClaveP="+Clave+"&UsuarioP="+Usuario, tag: "Estado" });
	advAJAX.setDefaultParameters({});
}
function cargar_file()
{
	if(document.getElementById('nit').value!="")
	{
		MsgBox('', '', document.getElementById('nit').value, 5);
	}
	else
	{
		alert("Debe ingresar el Nit primero");
	}
	
}
function MsgBox(promptpicture, prompttitle, message, TipoMSGBox)
{
	/*
		TipoMSGBox=1 - en espera hasta un nuevo evento sin botornes
		TipoMSGBox=2 - Con boton Aceptar para
		TipoMSGBox=4 - en espera de datos del servidr
	*/
	var xScroll, yScroll;
	if (document.body.scrollHeight > document.body.offsetHeight)
	{ // Todos menos el Explorador de Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	}
	else 
	{ // Explorer Mac ... tambi?n trabajo Explorer 6, Mozilla y Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	var windowWidth, windowHeight;
	if (self.innerHeight) 
	{	// Todos menos Explorer ie
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} 
	else if (document.documentElement && document.documentElement.clientHeight) 
	{ // Explorer 6 modo estricto
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} 
	else if (document.body) 
	{ // Otros Exploradores
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}
	// para paginas peque?as con la altura menor a la altura total
	if(yScroll < windowHeight)
	{
		pageHeight = windowHeight;
	} 
	else 
	{
		pageHeight = yScroll;
	}
	// para paginas peque?as con el ancho menor a la altura total
	if(xScroll < windowWidth){
		pageWidth = windowWidth;
	} 
	else 
	{
		pageWidth = xScroll;
	}
	promptbox = document.createElement('div');
	promptbox.setAttribute ('id' , 'prompt');
	document.getElementsByTagName('body')[0].appendChild(promptbox);
	promptbox = eval("document.getElementById('prompt').style");
	//promptbox.display = 'none';
	promptbox.position = 'absolute';
	promptbox.top = '0';
	promptbox.left = '0';
 	promptbox.width = (windowWidth-2)+ 'px';
	promptbox.height = (pageHeight-2) + 'px';
	promptbox.filter='alpha(opacity=65%)';
	promptbox.background="#FDFEFA";
	promptbox.border = 'outset 1 #FF0000';
	/*-------------------contenido-------------------------*/
		if(TipoMSGBox=='1')
		{
		document.getElementById('prompt').innerHTML = '<div style="margin-top:'+((pageHeight/2)-75)+'px; margin-left:'+((windowWidth/2)-260)+'px; border:2px; border-left-style:solid; border-bottom-style:solid; border-right-style:solid; border-top-style:solid; width:500px"><div id="vista_toolbar"><ul><img src="'+promptpicture+'" align="absmiddle" width="26" height="26"><span class="titulomsg">'+prompttitle+'<span></ul></div><div id="bottom_div"><table width="500" cellpadding="0" cellspacing="0"><tr><td class="contenidomsg">'+message+'</td></tr><tr align="center"><td valign="middle" ><img src="msgbox/load1.gif"></td></tr><tr><td valign="bottom">Por favor espere...</td></tr></table></div></div>';
		}
		if(TipoMSGBox=='2')
		{
		document.getElementById('prompt').innerHTML = '<div style="margin-top:'+((pageHeight/2)-75)+'px; margin-left:'+((windowWidth/2)-260)+'px; border:2px; border-left-style:solid; border-bottom-style:solid; border-right-style:solid; border-top-style:solid; width:500px"><div id="vista_toolbar"><ul><img src="'+promptpicture+'" align="absmiddle" width="26" height="26"><span class="titulomsg">'+prompttitle+'<span></ul></div><div id="bottom_div"><table width="500" cellpadding="0" cellspacing="0"><tr><td class="contenidomsg">'+message+'</td></tr></table></div><div id="vista_toolbarB"><ul><li><a class="right" onclick="Eliminar()" href="#"><span>&nbsp;Aceptar&nbsp;</span></a></li></ul></div></div>';
		}
		if(TipoMSGBox=='3')
		{
		//Solo para Logout
		document.getElementById('prompt').innerHTML = '<div style="margin-top:'+((pageHeight/2)-75)+'px; margin-left:'+((windowWidth/2)-260)+'px; border:2px; border-left-style:solid; border-bottom-style:solid; border-right-style:solid; border-top-style:solid; width:500px"><div id="vista_toolbar"><ul><img src="'+promptpicture+'" align="absmiddle" width="26" height="26"><span class="titulomsg">'+prompttitle+'<span></ul></div><div id="bottom_div"><table width="500" cellpadding="0" cellspacing="0"><tr><td class="contenidomsg">'+message+'</td></tr></table></div><div id="vista_toolbarB"><ul><li><a class="right" onclick="location.href=\'logout.php\'" href="#"><span><img src="msgbox/Tips.png" align="absmiddle" width="20" height="20">Aceptar</span></a><a class="right" onclick="Eliminar()" href="#"><span><img src="msgbox/Error.png" align="absmiddle" width="20" height="20">Cancelar</span></a></li></ul></div></div>';
		}
		if(TipoMSGBox=='4')
		{
		//preload
		document.getElementById('prompt').innerHTML = '<div style="margin-top:'+((pageHeight/2)-75)+'px; margin-left:'+((windowWidth/2)-260)+'px; border:2px; border-left-style:solid; border-bottom-style:solid; border-right-style:solid; border-top-style:solid; width:500px"><div id="vista_toolbar"><ul><img src="'+promptpicture+'" align="absmiddle" width="26" height="26"><span class="titulomsg">'+prompttitle+'<span></ul></div><div id="bottom_div"><table width="500" cellpadding="0" cellspacing="0"><tr><td>'+message+'</td></tr><tr align="center"><td valign="middle" ><img src="msgbox/load1.gif"></td></tr><tr><td valign="bottom">Por favor espere...</td></tr></table></div>';
		}
		if(TipoMSGBox=='5')
		{
		//preload
		document.getElementById('prompt').innerHTML = '<div style="margin-top:'+((pageHeight/2)-275)+'px; margin-left:'+((windowWidth/2)-260)+'px; border:2px; border-left-style:solid; border-bottom-style:solid; border-right-style:solid; border-top-style:solid; width:500px;height:500"><iframe src="ubr_file_upload.php?namefileN='+message+'" frameborder="0" width="500" height="200"><form id="formNameid2" method="post" enctype="multipart/form-data" action="imageupload.php" target="iframeid2"><input type="hidden" name="id" value="id2" /><span id="uploaderid2" style="font-family:verdana;font-size:10;">Archivo a Subir: <input name="id2" type="file" value="id2" onchange="return uploadFile(this)" /></span><iframe name="iframeid2" src="imageupload.php" width="400" height="100" style="display:none"> </iframe></form></iframe><div align="right"><input type="button" value="Cerrar" onclick="Eliminar();" /></div></div>';
		}
	document.getElementById("prompt").focus();
}
function Eliminar()
{
	document.body.removeChild(document.getElementById("prompt"));
}
function Salir()
{
	MsgBox('msgbox/Info.png', 'CERRAR SESION', 'Presione ACEPTAR para cerrar sesion o Cancelar para anular la acci&oacute;n', '3')
}
function MsgBoxE(promptpicture, prompttitle, message, TipoMSGBox,ID)
{
	/*
		TipoMSGBox=1 - en espera hasta un nuevo evento sin botornes
		TipoMSGBox=2 - Con boton Aceptar para
		TipoMSGBox=4 - en espera de datos del servidr
	*/
	var xScroll, yScroll;
	if (document.body.scrollHeight > document.body.offsetHeight)
	{ // Todos menos el Explorador de Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	}
	else 
	{ // Explorer Mac ... tambi?n trabajo Explorer 6, Mozilla y Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	var windowWidth, windowHeight;
	if (self.innerHeight) 
	{	// Todos menos Explorer ie
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} 
	else if (document.documentElement && document.documentElement.clientHeight) 
	{ // Explorer 6 modo estricto
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} 
	else if (document.body) 
	{ // Otros Exploradores
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}
	// para paginas peque?as con la altura menor a la altura total
	if(yScroll < windowHeight)
	{
		pageHeight = windowHeight;
	} 
	else 
	{
		pageHeight = yScroll;
	}
	// para paginas peque?as con el ancho menor a la altura total
	if(xScroll < windowWidth){
		pageWidth = windowWidth;
	} 
	else 
	{
		pageWidth = xScroll;
	}
	promptbox = document.createElement('div');
	promptbox.setAttribute ('id' , 'prompt');
	document.getElementsByTagName('body')[0].appendChild(promptbox);
	promptbox = eval("document.getElementById('prompt').style");
	//promptbox.display = 'none';
	promptbox.position = 'absolute';
	promptbox.top = '0';
	promptbox.left = '0';
 	promptbox.width = (windowWidth-2)+ 'px';
	promptbox.height = (pageHeight-2) + 'px';
	promptbox.filter='alpha(opacity=65%)';
	promptbox.background="#FDFEFA";
	promptbox.border = 'outset 1 #FF0000';
	/*-------------------contenido-------------------------*/
		if(TipoMSGBox=='10')
		{
		//Solo para Logout
		document.getElementById('prompt').innerHTML = '<div style="margin-top:'+((pageHeight/2)-75)+'px; margin-left:'+((windowWidth/2)-260)+'px; border:2px; border-left-style:solid; border-bottom-style:solid; border-right-style:solid; border-top-style:solid; width:500px"><div id="vista_toolbar"><ul><img src="'+promptpicture+'" align="absmiddle" width="26" height="26"><span class="titulomsg">'+prompttitle+'<span></ul></div><div id="bottom_div"><table width="500" cellpadding="0" cellspacing="0"><tr><td class="contenidomsg">'+message+'</td></tr></table></div><div id="vista_toolbarB"><ul><li><a class="right" onclick="location.href=\'usuarios_crear_form.php?idEliminar='+ID+'\'" href="#"><span><img src="msgbox/Tips.png" align="absmiddle" width="20" height="20">Aceptar</span></a><a class="right" onclick="Eliminar()" href="#"><span><img src="msgbox/Error.png" align="absmiddle" width="20" height="20">Cancelar</span></a></li></ul></div></div>';
		}
		if(TipoMSGBox=='11')
		{
		//preload
		document.getElementById('prompt').innerHTML = '<div style="margin-top:'+((pageHeight/2)-75)+'px; margin-left:'+((windowWidth/2)-260)+'px; border:2px; border-left-style:solid; border-bottom-style:solid; border-right-style:solid; border-top-style:solid; width:500px"><div id="vista_toolbar"><ul><img src="'+promptpicture+'" align="absmiddle" width="26" height="26"><span class="titulomsg">'+prompttitle+'<span></ul></div><div id="bottom_div"><table width="500" cellpadding="0" cellspacing="0"><tr><td>'+message+'</td></tr><tr align="center"><td valign="middle" ><img src="msgbox/procesando.gif"></td></tr><tr><td valign="bottom">Por favor espere...</td></tr></table></div>';
		}
	document.getElementById("prompt").focus();
}
function Monto_pres(e,caja)
{
	var charCode 
	if (!e) var e = window.event
	if (e.keyCode) charCode = e.keyCode;
	else if (e.which) charCode = e.which;
	if (charCode > 31 && (charCode < 46 || charCode > 57))
	{
		return false
	}
	var dato1=parseInt(document.getElementById('monto').value);
	var dato2=parseInt(document.getElementById('monto_maximo').value);
	if(dato1 > dato2 && document.getElementById('coodeudor1').disabled==true)
	{
		document.getElementById('coodeudor1').disabled=false;
	}
	return true	
}
