// JavaScript Document, funciones de el programador luis.
var claridad=1;
var claridad_central=1;
var claridad_preload=0;
var browser=navigator.appName;
var temporizador;
var tam=0;
var precio_bs;
var precio_ds;
var login;
var	pass;
var dir="http://luis/RRnuevo";

function opacar(accion){
	if(claridad_central>-0.1&&browser!="Microsoft Internet Explorer"){
		document.getElementById("precargar").style.display="block";
		clearTimeout(temporizador);
		/*Buscamos el explorador*/
		claridad_central-=0.1;
		claridad_preload+=0.1;
		document.getElementById('center').style.opacity=claridad_central;
		document.getElementById('precargar').style.opacity=claridad_preload;
		temporizador=setTimeout("opacar('"+accion+"')",5);
	}
	else{
		if(browser=="Microsoft Internet Explorer")
			document.getElementById("precargar").style.display="block";
		if(accion=="index"){
    		var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){ 
					document.getElementById("center").innerHTML =oXML.responseText;
					if (browser!="Microsoft Internet Explorer")
						temporizador=setTimeout("aclarar()",5);
				};
				myConn.connect("index_js.php", "post","",peticion);	
		}
		else if(accion=="quienes"){
    		var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){ 
					document.getElementById("center").innerHTML =oXML.responseText;
					if (browser!="Microsoft Internet Explorer")
						temporizador=setTimeout("aclarar()",5);
				};
				myConn.connect("quienes_js.php", "post","",peticion);
		}
			else if(accion=="horoscopo"){
    		var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){ 
					document.getElementById("center").innerHTML =oXML.responseText;
					if (browser!="Microsoft Internet Explorer")
						temporizador=setTimeout("aclarar()",5);
				};
				myConn.connect("vista_horoscopo.php", "post","",peticion);
		}
		else if(accion=="rv"){
    		var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){ 
					document.getElementById("center").innerHTML =oXML.responseText;
					if (browser!="Microsoft Internet Explorer")
						temporizador=setTimeout("aclarar()",5);
				};
				myConn.connect("revista_vista.php", "post","",peticion);
		}
		else if(accion=="horoscopo_chi"){
    		var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){ 
					document.getElementById("center").innerHTML =oXML.responseText;
					if (browser!="Microsoft Internet Explorer")
						temporizador=setTimeout("aclarar()",5);
				};
				myConn.connect("vista_horoscopo_chino.php", "post","",peticion);
		}
		else if(accion=="tarot"){
    		var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){ 
					document.getElementById("center").innerHTML =oXML.responseText;
					if (browser!="Microsoft Internet Explorer")
						temporizador=setTimeout("aclarar()",5);
				};
				myConn.connect("tarot_js.php", "post","",peticion);
		}
		else if(accion=="feng"){
    		var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){ 
					document.getElementById("center").innerHTML =oXML.responseText;
					if (browser!="Microsoft Internet Explorer")
						temporizador=setTimeout("aclarar()",5);
				};
				myConn.connect("feng_js.php", "post","",peticion);
		}
		else if(accion=="aura"){
    		var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){ 
					document.getElementById("center").innerHTML =oXML.responseText;
					if (browser!="Microsoft Internet Explorer")
						temporizador=setTimeout("aclarar()",5);
				};
				myConn.connect("vista_servicios.php", "post","ser=aura",peticion);
		}
		else if(accion=="aromaterapia"){
			
    		var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){ 
					document.getElementById("center").innerHTML =oXML.responseText;
					if (browser!="Microsoft Internet Explorer")
						temporizador=setTimeout("aclarar()",5);
				};
				myConn.connect("productos_vista.php", "post", "product=aa", peticion);
		}
		else if(accion=="tar"){
			
    		var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){ 
					document.getElementById("center").innerHTML =oXML.responseText;
					if (browser!="Microsoft Internet Explorer")
						temporizador=setTimeout("aclarar()",5);
				};
				myConn.connect("productos_vista.php", "post", "product=ta", peticion);
		}
		else if(accion=="zen"){
		
    		var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){ 
					document.getElementById("center").innerHTML =oXML.responseText;
					if (browser!="Microsoft Internet Explorer")
						temporizador=setTimeout("aclarar()",5);
				};
				myConn.connect("productos_vista.php", "post", "product=zz", peticion);
		}
		else if(accion=="aura"){
    		var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){ 
					document.getElementById("center").innerHTML =oXML.responseText;
					if (browser!="Microsoft Internet Explorer")
						temporizador=setTimeout("aclarar()",5);
				};
				myConn.connect("vista_servicios.php", "post","ser=aura",peticion);
		}
		else if(accion=="runas"){
    		var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){ 
					document.getElementById("center").innerHTML =oXML.responseText;
					if (browser!="Microsoft Internet Explorer")
						temporizador=setTimeout("aclarar()",5);
				};
				myConn.connect("vista_servicios.php", "post","ser=runas",peticion);
		}
		else if(accion=="runas"){
    		var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){ 
					document.getElementById("center").innerHTML =oXML.responseText;
					if (browser!="Microsoft Internet Explorer")
						temporizador=setTimeout("aclarar()",5);
				};
				myConn.connect("vista_servicios.php", "post","ser=runas",peticion);
		}
		else if(accion=="sanacion"){
    		var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){ 
					document.getElementById("center").innerHTML =oXML.responseText;
					if (browser!="Microsoft Internet Explorer")
						temporizador=setTimeout("aclarar()",5);
				};
				myConn.connect("sanacion_cristales_js.php", "post","",peticion);
		}
		else if(accion=="quiro"){
    		var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){ 
					document.getElementById("center").innerHTML =oXML.responseText;
					if (browser!="Microsoft Internet Explorer")
						temporizador=setTimeout("aclarar()",5);
				};
				myConn.connect("quiromancia_runas_js.php", "post","",peticion);
		}
		else if(accion=="wicca"){
    		var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){ 
					document.getElementById("center").innerHTML =oXML.responseText;
					if (browser!="Microsoft Internet Explorer")
						temporizador=setTimeout("aclarar()",5);
				};
				myConn.connect("vista_servicios.php", "post","ser=wicca",peticion);
		}
		else if(accion=="micuenta"){
    		var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){ 
					document.getElementById("center").innerHTML =oXML.responseText;
					if (browser!="Microsoft Internet Explorer")
						temporizador=setTimeout("aclarar()",5);
				};
				myConn.connect("micuenta.php", "post","ser=wicca",peticion);
		}
		else if(accion=="Modificar Registro"){
    		var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){ 
					document.getElementById("center").innerHTML =oXML.responseText;
					if (browser!="Microsoft Internet Explorer")
						temporizador=setTimeout("aclarar()",5);
				};
				myConn.connect("formulario_mod_registro.php", "post","",peticion);
		}
		else if(accion=="Registrar Pago"){
    		var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){ 
					document.getElementById("center").innerHTML =oXML.responseText;
					if (browser!="Microsoft Internet Explorer")
						temporizador=setTimeout("aclarar()",5);
				};
				myConn.connect("cuenta_usuario/pago_curso.php", "post","",peticion);
		}
		else if(accion=="pagos"){
    		var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){ 
					document.getElementById("center").innerHTML =oXML.responseText;
					if (browser!="Microsoft Internet Explorer")
						temporizador=setTimeout("aclarar()",5);
				};
				myConn.connect("cuenta_usuario/pago_curso.php", "post","",peticion);
		}
		else if(accion=="validar_log_usuario"){
			login=document.getElementById('login').value;
			pass=document.getElementById('pass').value;
			var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){ 
					document.getElementById("center").innerHTML =oXML.responseText;
					if (browser!="Microsoft Internet Explorer")
						temporizador=setTimeout("aclarar()",5);
				};
			myConn.connect("validar_usuario.php", "post","login="+login+"&pass="+pass,peticion);
		}
		//
		
		else if(accion=="registrar_usuario"){
						
			name=document.getElementById('name').value;
			apellido=document.getElementById('apellido').value;
			dia2=document.getElementById('dia2').value;
			mes=document.getElementById('mes').value;
			ano=document.getElementById('ano').value;
			email=document.getElementById('email').value;
			pais=document.getElementById('pais').value;
			provincia=document.getElementById('provincia').value;
			cel=document.getElementById('cel').value;
			local=document.getElementById('local').value;
			login=document.getElementById('login').value;
			pass=document.getElementById('pass').value;
						
			var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){ 
					document.getElementById("center").innerHTML =oXML.responseText;
					if (browser!="Microsoft Internet Explorer")
						temporizador=setTimeout("aclarar()",5);
				};
			myConn.connect("agregar_registro_db.php", "post","name="+name+"&apellido="+apellido+"&dia2="+dia2+"&mes="+mes+"&ano="+ano+"&email="+email+"&pais="+pais+"&provincia="+provincia+"&cel="+cel+"&local="+local+"&login="+login+"&pass="+pass,peticion);
		}
		
		//
		else if(accion=="cerrar_sesion"){
    		var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){ 
					document.getElementById("center").innerHTML =oXML.responseText;
					if (browser!="Microsoft Internet Explorer")
						temporizador=setTimeout("aclarar()",5);
				};
				myConn.connect("logout.php", "post","",peticion);
		}
		else if(accion=="login"){
			var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
			var peticion = function (oXML){ 
				document.getElementById("center").innerHTML =oXML.responseText;
				if (browser!="Microsoft Internet Explorer")
					temporizador=setTimeout("aclarar()",5);
			};
			myConn.connect("login_pass.php", "post","",peticion);
		}
		else if(accion=="registro"){
			var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
			var peticion = function (oXML){ 
				document.getElementById("center").innerHTML =oXML.responseText;
				if (browser!="Microsoft Internet Explorer")
					temporizador=setTimeout("aclarar()",5);
			};
			myConn.connect("formulario_registro.php", "post","",peticion);
		}
		else if(accion=="cursos"){
			var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
			var peticion = function (oXML){ 
				document.getElementById("center").innerHTML =oXML.responseText;
				if (browser!="Microsoft Internet Explorer")
					temporizador=setTimeout("aclarar()",5);
					
			};
			myConn.connect("cursos.php", "post","",peticion);
		}
		else if(accion=="clave_perdida"){
			var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
			var peticion = function (oXML){ 
				document.getElementById("center").innerHTML =oXML.responseText;
				if (browser!="Microsoft Internet Explorer")
					temporizador=setTimeout("aclarar()",5);
					
			};
			myConn.connect("formulario_recuperar_clave.php", "post","",peticion);
		}
		else if(accion=="contacto"){
			var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
			var peticion = function (oXML){ 
				document.getElementById("center").innerHTML =oXML.responseText;
				if (browser!="Microsoft Internet Explorer")
					temporizador=setTimeout("aclarar()",5);
					
			};
			myConn.connect("contacto_js.php", "post","",peticion);
		}
		else if(accion=="recuperar_email"){
			emailrecuperar=document.getElementById('emailrecuperar').value;
			var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){ 
					document.getElementById("center").innerHTML =oXML.responseText;
					if (browser!="Microsoft Internet Explorer")
						temporizador=setTimeout("aclarar()",5);
				};
			myConn.connect("enviar_registro_db_email.php", "post","emailrecuperar="+emailrecuperar,peticion);
		}
		else if(accion=="admin"){
			var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
			var peticion = function (oXML){ 
				document.getElementById("center").innerHTML =oXML.responseText;
				if (browser!="Microsoft Internet Explorer")
					temporizador=setTimeout("aclarar()",5);
					
			};
			myConn.connect("admin.php", "post","",peticion);
		}
		if(browser=="Microsoft Internet Explorer")
			document.getElementById("precargar").style.display="none";
	}
}

function mostrar_menu(){
	document.getElementById("menu_superior").innerHTML="Cargando... <img src='images/loader.gif'>";
	var myConn = new XHConn();
	if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
	var peticion = function (oXML){ 
		document.getElementById("menu_superior").innerHTML =oXML.responseText;
		if (browser!="Microsoft Internet Explorer")
			temporizador=setTimeout("aclarar()",5);
	};
	myConn.connect("menu_superior.php", "post","",peticion);
}

function validar_mod_datos(){
	
		name=document.getElementById('name').value;
		apellido=document.getElementById('apellido').value;
		email=document.getElementById('email').value;
		email2=document.getElementById('email2').value;
		cel=document.getElementById('cel').value;
		local=document.getElementById('local').value;
		login_user=document.getElementById('login_user').value;
		pass_user=document.getElementById('pass_user').value;
		pass2=document.getElementById('pass2').value;
		
		if(name==""){
			alert("El nombre no puede estar vacio");
			return false;
		}
		else if(apellido==""){
			alert("El apellido no puede estar vacio");
			return false;
		}
		else if(email==""){
			alert("Debe escribir una e-mail valido");
			return false;
		}
		else if(email!=email2){
			alert("El campo repetir e-mail debe ser igual al campo e-mail");
			return false;
		}
		else if(cel==""&&local==""){
			alert("Debe de escribir al menos un telefono celular");
			return false;	
		}
		else if(pass_user!=pass2){
			alert("Los campos Password y Repetir Password deben ser iguales");
			return false;	
		}
		opacar("Solo opacar");
		var myConn = new XHConn();
		if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
			var peticion = function (oXML){
			document.getElementById("center").innerHTML =oXML.responseText;
			alert("Datos modificados con exito");
			if (browser!="Microsoft Internet Explorer")
				temporizador=setTimeout("aclarar()",5);
		};
		myConn.connect("modificar_registro_db.php", "post","name="+name+"&apellido="+apellido+"&email="+email2+"&cel="+cel+"&local="+local+"&login_user="+login_user+"&pass_user="+pass_user+"&accion=viejo",peticion);
}

function aclarar(accion,id){
	
	if(claridad_central<1.1&&id!=2){
		/*Buscamos el explorador*/
		clearTimeout(temporizador);
		claridad_central+=0.1
		claridad_preload-=0.1;
		document.getElementById('precargar').style.opacity=claridad_preload;
		document.getElementById('center').style.opacity=claridad_central;
		temporizador=setTimeout("aclarar('"+accion+"')",5);
		
	}
}

function posicionar_compra(event,id){
	if(navigator.userAgent.indexOf("MSIE")>=0) 
		navegador=0;
	else 
		navegador=1;

	if(navegador==0)
	{
		var corX=window.event.clientX+document.documentElement.scrollLeft+document.body.scrollLeft;
		var corY=window.event.clientY+document.documentElement.scrollTop+document.body.scrollTop;
	}
	else
	{
		var corX=event.clientX+window.scrollX;
		var corY=event.clientY+window.scrollY;
	}
	document.getElementById("compra").style.top=corY+"px";
	document.getElementById("compra").style.left=corX+"px";
	document.getElementById("compra").style.display="block";
	open_compra(id);
}

function open_compra(id){
	if(tam<130){
		tam+=10
		clearTimeout(temporizador);
		document.getElementById('compra').style.height=tam+"px";
		temporizador=setTimeout("open_compra("+id+")",1);
	}
	else{
		clearTimeout(temporizador);
		document.getElementById("compra").innerHTML = "<p class='load'><img src='images/loader.gif' alt=''> Cargando...</p>";
		var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){  
				document.getElementById("compra").innerHTML = oXML.responseText; 
		};
		myConn.connect("confirmar_compra.php","post","id="+id, peticion);
	}
}

function close_compra(id){
	document.getElementById('compra').innerHTML="";
	if(tam>0){
		clearTimeout(temporizador);
		tam-=10
		document.getElementById('compra').style.height=tam;
		temporizador=setTimeout("close_compra("+id+")",1);
	}
	else{
		if(id==1){
			clearTimeout(temporizador);
			opacar('login');
			
		}
		document.getElementById("compra").style.display="none";	
	}
}

function DB_comprar(id){
	document.getElementById("compra").innerHTML = "<p class='load'><img src='images/loader.gif' alt='' > Cargando...</p>"; 
	var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){  
				document.getElementById("compra").innerHTML = oXML.responseText;
				//Sclose_compra();

	};
	myConn.connect("DB_comprar.php","post","id="+id, peticion);
}

function posicionar_compra(event,id){
			
	if(navigator.userAgent.indexOf("MSIE")>=0) 
		navegador=0;
	else 
		navegador=1;

	if(navegador==0)
	{
		var corX=window.event.clientX+document.documentElement.scrollLeft+document.body.scrollLeft;
		var corY=window.event.clientY+document.documentElement.scrollTop+document.body.scrollTop;
	}
	else
	{
		var corX=event.clientX+window.scrollX;
		var corY=event.clientY+window.scrollY;
	}
	document.getElementById("compra").style.top=corY+"px";
	document.getElementById("compra").style.left=corX+25+"px";
	document.getElementById("compra").style.display="block";	
	open_compra(id);
}
function open_compra(id){
	if(tam<130){
		clearTimeout(temporizador);
		tam+=10
		document.getElementById('compra').style.height=tam+"px";
		temporizador=setTimeout("open_compra("+id+")",1);
	}
	else{
		clearTimeout(temporizador);
		document.getElementById("compra").innerHTML = "<p class='load'><img src='images/loader.gif' alt='' width='16' height='16'> Cargando...</p>";
		var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){  
				document.getElementById("compra").innerHTML = oXML.responseText; 
		};
		myConn.connect("confirmar_compra.php","post","id="+id, peticion);
	}
}

function posicionar(event,id,funcion,preciobs,preciods,pos){
	precio_bs=parseFloat(preciobs);
	precio_ds=parseFloat(preciods);
		
	if(navigator.userAgent.indexOf("MSIE")>=0) 
		navegador=0;
	else 
		navegador=1;

	if(navegador==0)
	{
		var corX=window.event.clientX+document.documentElement.scrollLeft+document.body.scrollLeft;
		var corY=window.event.clientY+document.documentElement.scrollTop+document.body.scrollTop;
	}
	else
	{
		var corX=event.clientX+window.scrollX;
		var corY=event.clientY+window.scrollY;
	}
	document.getElementById("pago_motivo").style.top=corY+"px";
	if(pos!=1)
		document.getElementById("pago_motivo").style.left=corX-500+"px";
	else
		document.getElementById("pago_motivo").style.left=corX+"px";
	document.getElementById("pago_motivo").style.display="block";	
	if(funcion==1)
		open_pagos(id,preciobs,preciods);
	else
		open_motivo(id);
}

function open_pagos(id){
	if(tam<150){
		tam+=10
		clearTimeout(temporizador);
		document.getElementById('pago_motivo').style.height=tam+"px";
		temporizador=setTimeout("open_pagos("+id+")",1);
	}
	else{
		clearTimeout(temporizador);
		document.getElementById("pago_motivo").innerHTML = "<p class='load'><img src='images/loader.gif' alt='' width='16' height='16'> Cargando...</p>";
		var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){  
				document.getElementById("pago_motivo").innerHTML = oXML.responseText; 
		};
		myConn.connect("cuenta_usuario/vista_medios_pago.php","post","id="+id, peticion);
	}
}

function close_motivo(){
	document.getElementById('pago_motivo').innerHTML="";
	if(tam>0){
		clearTimeout(temporizador);
		tam-=10
		document.getElementById('pago_motivo').style.height=tam+"px";
		temporizador=setTimeout("close_motivo()",1);
	}
	else
		document.getElementById("pago_motivo").style.display="none";	
}

function enviar_pago(id){
	var paso=0;
	var banco=document.getElementById("banco").value;
	var tipo_pago=document.getElementById("tipo_pago").value;
	var deposito=document.getElementById("deposito").value;
	var monto=parseFloat(document.getElementById("monto").value);
	
	if(banco==1&&monto>=precio_ds){
		paso=1;
	}
	else if(banco==2&&monto>=precio_bs){
		paso=1;
	}
	else if(banco==3&&monto>=precio_bs){
		paso=1;
	}
	else{
		if(tipo_pago==1)
			alert ("El monto transferido es inferior al costo del curso");
		else if(tipo_pago==2)
			alert ("El monto depositado es inferior al costo del curso");
	}
	
	if(paso==1&&deposito!=""){
		document.getElementById("pago"+id).innerHTML = "<p class='load'>Cargando...<img src='images/loader.gif' alt='' width='16' height='16'> </p>"; 
		close_motivo();
		var myConn = new XHConn();
				if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
					var peticion = function (oXML){  
					document.getElementById("pago"+id).innerHTML = oXML.responseText; 
		};
		myConn.connect("cuenta_usuario/enviar_pago.php","post","banco="+banco+"&tipo_pago="+tipo_pago+"&deposito="+deposito+"&monto="+monto+"&id="+id, peticion);	
	}
	else if(deposito==""){
		alert("Ingrese un numero de deposito");	
	}
}


function cambio_estado(estado,id){
	if(estado==1){
		if(tam>0)
			close_motivo();
			
		document.getElementById("pago"+id).innerHTML = "<p class='load'><img src='../IMG/cargando.gif' alt='' width='16' height='16'> Cargando...</p>";
		var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){  
				document.getElementById("pago"+id).innerHTML = oXML.responseText; 
		};
		myConn.connect("cambio_estado.php","post", "estado="+estado+"&id="+id, peticion);
	}
	else if(document.getElementById("pago_motivo_texto").value==""){
		alert("Debe ingresar el motivo por el cual fue rechazado el pago ");
	}
	else{
		motivo=document.getElementById("pago_motivo_texto").value;
		var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){  
				document.getElementById("pago"+id).innerHTML = oXML.responseText; 
		};
		myConn.connect("admin/cambio_estado.php","post", "estado="+estado+"&id="+id+"&motivo="+motivo, peticion);
		close_motivo();
	}
}

function ver_ordenes(tipo_consulta){
	var ordenes=document.getElementById("ordenes").value;
	document.getElementById("central").innerHTML = "<p class='load'><img src='images/loader.gif' alt='' width='16' height='16'> Cargando...</p>"; 
	close_motivo();
	var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){  
				document.getElementById("central").innerHTML = oXML.responseText; 
	};
	if(tipo_consulta==1)
		myConn.connect("filtro.php","post","ordenes="+ordenes, peticion);	
	else
		myConn.connect("filtro_admin.php","post","ordenes="+ordenes, peticion);	
}

//funciones de la seccion administrativa
function ver_ordenes(tipo_consulta){
	var ordenes=document.getElementById("ordenes").value;
	document.getElementById("central").innerHTML = "<p class='load'><img src='../IMG/cargando.gif' alt='' width='16' height='16'> Cargando...</p>"; 
	close_motivo();
	var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){  
				document.getElementById("central").innerHTML = oXML.responseText; 
	};
	if(tipo_consulta==1)
		myConn.connect("filtro.php","post","ordenes="+ordenes, peticion);	
	else
		myConn.connect("filtro_admin.php","post","ordenes="+ordenes, peticion);	
}

function cambio_estado(estado,id){
	if(estado==1){
		if(tam>0)
			close_motivo();
			
		document.getElementById("pago"+id).innerHTML = "<p class='load'><img src='../IMG/cargando.gif' alt='' width='16' height='16'> Cargando...</p>";
		var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){  
				document.getElementById("pago"+id).innerHTML = oXML.responseText; 
		};
		myConn.connect("cambio_estado.php","post", "estado="+estado+"&id="+id, peticion);
	}
	else if(document.getElementById("pago_motivo_texto").value==""){
		alert("Debe ingresar el motivo por el cual fue rechazado el pago ");
	}
	else{
		motivo=document.getElementById("pago_motivo_texto").value;
		var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){  
				document.getElementById("pago"+id).innerHTML = oXML.responseText; 
		};
		myConn.connect("cambio_estado.php","post", "estado="+estado+"&id="+id+"&motivo="+motivo, peticion);
		close_motivo();
	}
}

function open_motivo(id){
	if(tam<80){
		tam+=5
		document.getElementById('pago_motivo').style.height=tam;
		setTimeout("open_motivo("+id+")",1);
	}
	else
		document.getElementById('pago_motivo').innerHTML="<font color='#AC8044' size='3' face='Century Gothic'>Ingrese el motivo por el cual fue rechazado el pago </font><textarea id='pago_motivo_texto' name='pago_motivo' style='width:500px; height:40px'></textarea><div id='pagos_rechazo'><a href='javascript:cambio_estado(0,"+id+")'>Rechazar</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='javascript:close_motivo()'>Cerrar</a></div>";
}

/*
	Funcionq ue cierra l DIV que fue crerrado de forma previa
*/

function close_motivo(){
	document.getElementById('pago_motivo').innerHTML="";
	if(tam>0){
		tam-=10
		document.getElementById('pago_motivo').style.height=tam+"px";
		setTimeout("close_motivo()",1);
	}
	else
		document.getElementById("pago_motivo").style.display="none";	
}

function linkOLB(codigo){
	window.open(dir+"/validar_descarga.php?codigo="+codigo,'bank','status=yes,menubar=no,scrollbars=yes,resizable=no,height=200,width=300');
}

function historial_pago(event,id,pos){
	if(navigator.userAgent.indexOf("MSIE")>=0) 
		navegador=0;
	else 
		navegador=1;

	if(navegador==0)
	{
		var corX=window.event.clientX+document.documentElement.scrollLeft+document.body.scrollLeft;
		var corY=window.event.clientY+document.documentElement.scrollTop+document.body.scrollTop;
	}
	else
	{
		var corX=event.clientX+window.scrollX;
		var corY=event.clientY+window.scrollY;
	}
	document.getElementById("pago_motivo").style.top=corY-20+"px";
	if(pos!=1)
		document.getElementById("pago_motivo").style.left=corX-500+"px";
	else
		document.getElementById("pago_motivo").style.left=corX+"px";
	document.getElementById("pago_motivo").style.display="block";	
	open_historial(id,pos);				
}

function open_historial(id,pos){
	if(tam<80){
		tam+=5
		document.getElementById('pago_motivo').style.height=tam+"px";
		setTimeout("open_historial("+id+")");
	}
	else{
		document.getElementById("pago_motivo").innerHTML = "<p class='load'><img src='../IMG/cargando.gif' alt='' width='16' height='16'> Cargando...</p>";
		var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){
				contenido="<font color='#AC8044' size='3' face='Century Gothic'>Ultimo motivo por el cual fue rechazado el pago</font><textarea id='pago_motivo_texto' name='pago_motivo' style='width:480px; height:40px'>";
				contenido+=oXML.responseText;
				contenido+="</textarea><div id='pagos_rechazo'><a href='javascript:close_motivo()'>Cerrar</a></div>";
				document.getElementById("pago_motivo").innerHTML = contenido; 
		};
		if(pos!=1)
			myConn.connect("historial_pago.php","post","id="+id, peticion);
		else
			myConn.connect("admin/historial_pago.php","post","id="+id, peticion);
	}
}
function datos_usuario(event,id){
			
	if(navigator.userAgent.indexOf("MSIE")>=0) 
		navegador=0;
	else 
		navegador=1;

	if(navegador==0)
	{
		var corX=window.event.clientX+document.documentElement.scrollLeft+document.body.scrollLeft;
		var corY=window.event.clientY+document.documentElement.scrollTop+document.body.scrollTop;
	}
	else
	{
		var corX=event.clientX+window.scrollX;
		var corY=event.clientY+window.scrollY;
	}
	document.getElementById("pago_motivo").style.top=corY-20+"px";
	document.getElementById("pago_motivo").style.left=corX-500+"px";
	document.getElementById("pago_motivo").style.display="block";	
	open_datos_us(id);
}

function open_datos_us(id){
	if(tam<130){
		tam+=10
		document.getElementById('pago_motivo').style.height=tam;
		setTimeout("open_datos_us("+id+")",1);
	}
	else{
		document.getElementById("pago_motivo").innerHTML = "<p class='load'><img src='../IMG/cargando.gif' alt='' width='16' height='16'> Cargando...</p>";
		var myConn = new XHConn();
			if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
				var peticion = function (oXML){  
				document.getElementById("pago_motivo").innerHTML = oXML.responseText; 
		};
		myConn.connect("datos_usuarios.php","post","id="+id, peticion);
	}
}

function vista_product(id_pro){
	
	var myConn = new XHConn();
		if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
			var peticion = function (oXML){  
			document.getElementById("center").innerHTML = oXML.responseText; 
	};
	myConn.connect("producto_vista_indi.php", "post", "id_pro="+id_pro, peticion);
	
}
function vista_libro_ele(id_cur){
	
	var myConn = new XHConn();
		if (!myConn) alert("XMLHTTP no esta disponible. Inténtalo con un navegador más actual.");
			var peticion = function (oXML){  
			document.getElementById("center").innerHTML = oXML.responseText; 
	};
	myConn.connect("cursos_uno.php", "post", "id_cur="+id_cur, peticion);
	
}
