	/*
	 *
	 * 2003 - 2020 @ Yal Publicidad - YMS::intalacion
	 * www.yalpublicidad.com
	 * online@yalpublicidad.com
	 *
	 */
	 
// ** Barra de progreso
	function msProgressBar(){
		$pbar = document.getElementById('msProgressBar');
		$pbar.style.margin = '0 auto';
		$pbar.style.border = '1px solid #9acae0';
		$pbar.style.borderRadius = '5px';
		$pbar.style.background = '#badff0';
		$pbar.style.width = '90%';
		$pbar.innerHTML = '<div id="msBar"style="background:#1b96ce;height:24px;width:1%;color:#fff;text-align:right;">1%</div>';
	}
	
	// AJAX ProgressBar
	$pb = {
			ini: function(){
				msProgressBar();
			},
			ajax: function(ajustes){
			
							var Request = new XMLHttpRequest();
							var url = (ajustes.metodo == 'GET') ? ajustes.url + '?' + ajustes.data : ajustes.url;
							
							
							Request.upload.addEventListener("progress", progressHandler, false);
							Request.addEventListener("load", completeHandler, false);
							Request.addEventListener("error", errorHandler, false);
							Request.addEventListener("abort", abortHandler, false);
							
							Request.open(ajustes.metodo, url, true);
							if(ajustes.contenidoTipo != 'undefined') Request.setRequestHeader('Content-Type',ajustes.contenidoTipo);
							
							Request.onreadystatechange = function(){
														if (Request.readyState == 4 && Request.status == 200) {
																	ajustes.suceso(Request.responseText);
														} else if ( Request.status == 200) {
																	ajustes.suceso(Request.responseText);
														} else {
																	ajustes.suceso(Request.status);
														}
												};
							
							if(ajustes.metodo === 'GET') {
										Request.send(null);
									}else{
										Request.send(ajustes.data); //alert('post')
							}
						}	
	}
	
	progressHandler = function(event){
					$estado = document.getElementById('msBar');
					$estado.innerHTML = '';
					//$__("#n_total").innerHTML = "Uploaded "+event.loaded+" bytes of "+event.total;
					if(event.lengthComputable) {
						var percent = (event.loaded / event.total) * 100;
							$estado.style.width = Math.round(percent) + '%';
							$estado.innerHTML = Math.round(percent) + "%";
					}
				}
	completeHandler = function(event){
					$estado = document.getElementById('msBar');
					
					//$respuesta = event.target.responseText;
					$estado.innerHTML = 'espere...';
					$estado.style.width = '100%';
				}
	errorHandler = function(event){
					$estado = document.getElementById('msBar');
					$estado.style.width = '100%';
					$estado.style.background = '#c9c5c3';
					$estado.innerHTML = "Conexión fallida";
				}
	abortHandler = function(event){
					$estado = document.getElementById('msBar');
					$estado.style.width = '100%';
					$estado.style.background = '#c9c5c3';
					$estado.innerHTML = "Conexión abortada";
				}
	
	