var gbl_pais = "mx";
var gbl_registro_id=0;
var gbl_sRutaF="";
function fIni(gbl_idRegistro){
	gbl_registro_id= gbl_idRegistro;
}
function fRutaP(sValor){
	gbl_sRutaF=sValor;
}
function fMenu(uiValor,sPath){
	//alert(uiValor);
	//alert(sPath);
	
	switch(uiValor) {
		case 0:
			//salir del sistema
			
			break;
		case 1:
			sParametro = "";
			document.pantalla.action = "mision.php"+sParametro;
			document.pantalla.submit();
			break;
		case 2:
			sParametro = "";
			document.pantalla.action = "vision.php"+sParametro;
			document.pantalla.submit();
			break;
		case 3:
			sParametro = "";
			document.pantalla.action = "valores.php"+sParametro;
			document.pantalla.submit();
			break;
		case 4:
			sParametro = "";
			document.pantalla.action = "objetivos.php"+sParametro;
			document.pantalla.submit();
			break;
		case 5:
			sParametro = "";
			document.pantalla.action = "consultores_financieros.php"+sParametro;
			document.pantalla.submit();
			break;
		case 6:
			sParametro = "";
			document.pantalla.action = "estudios_proyectos.php"+sParametro;
			document.pantalla.submit();
			break;
		case 7:
			sParametro = "";
			document.pantalla.action = "corretaje_inmobiliario.php"+sParametro;
			document.pantalla.submit();
			break;
		case 8:
			sParametro = "";
			document.pantalla.action = "gestion_tramitologia.php"+sParametro;
			document.pantalla.submit();
			break;
	}
}
function fIrPantalla(sPantalla,uiTarget){
	if (sPantalla!=0){
		if (uiTarget==1){
			window.open(sPantalla);
		}else{
			document.pantalla.action = sPantalla;
			document.pantalla.submit();
		}
	}
}
function fHome(sValor){
	document.pantalla.action = sValor;
	document.pantalla.submit();
}
function fMisMaquinas(idRegsitro){
	sParametro = "gbl_registro_id="+idRegsitro;
	document.pantalla.action = "registro-maquinas.php?"+sParametro;
	document.pantalla.submit();
}

String.prototype.reemplazar = function(termino1, termino2) {
	var temp_array = this.split(termino1);
	var new_cadena = "";
	for (var k = 0; k<temp_array.length; k++) {
		new_cadena += temp_array[k]+""+termino2;
	}
	new_cadena = new_cadena.substring(0, new_cadena.length-termino2.length);
	return new_cadena;
};
function fLogin(){
	fPopUp_v2('#divPopUp_v2_global','a.btnDemo','login.php',300,160,true);
}
function fPopUpCerrar(){
	//alert("cerra!!");
	jQuery(document).ready(function($) {
		$.modal.close();
	});
}
function fDesloguear(){
	gbl_registro_id=0;
	sParametro="";
	document.pantalla.action = "lib/login_desloguear.php"+sParametro;
	document.pantalla.submit();
}
function registro_login_user2(){
	
	sUsuario= document.getElementById("cmpUsuarioP").value;
	sContrasena= document.getElementById("cmpContrasenaP").value;
	
	sParametro = "?sUsuario="+sUsuario;
	sParametro += "&sContrasena="+sContrasena;
		
	sURL= "lib/login_usuario.php"+sParametro;
	Spry.Utils.loadURL("POST", sURL, true, registro_login_user2_update, { postData: ""});
		
	

}

function registro_login_user2_update(req){
	var resoponseDatos = eval(req.xhRequest.responseText);
	uiMsg = parseInt(resoponseDatos[0]);
	sMsg = resoponseDatos[1];
	idRegsitro = resoponseDatos[2];
	//alert(sMsg);
	if (uiMsg){
		fPopUpCerrar();
		sParametro = "gbl_registro_id="+idRegsitro;
		document.pantalla.action = "registro-maquinas.php?"+sParametro;
		document.pantalla.submit();
	}else{
		alert(sMsg);
	}
}
function fCargandoPantalla(sDiv,sDivValor){
	
	if(Spry.$(sDiv)!=null)Spry.Utils.setInnerHTML(sDiv,sDivValor);
}

String.prototype.reemplazar = function(termino1, termino2) {
	var temp_array = this.split(termino1);
	var new_cadena = "";
	for (var k = 0; k<temp_array.length; k++) {
		new_cadena += temp_array[k]+""+termino2;
	}
	new_cadena = new_cadena.substring(0, new_cadena.length-termino2.length);
	return new_cadena;
};



function fIrDiv(sDiv){
	//alert(sDiv);
	//location.href="#"+sDiv;
	location.href=sDiv;
}


function fAlert(sValor){
	alert(sValor);	
}

function fCallGaleria(uiTipo,uiValor){
	sContenido = "?id_registro="+uiValor;
	if (uiTipo==1){
		sTabla="tbl_galeria_fotos";
	}else if (uiTipo==2){
		sTabla="tbl_galeria_videos";
	}else {
		sTabla="n/d";
	}
	sContenido += "&sTabla="+sTabla;
	sContenido += "&sRutaF="+gbl_sRutaF;
	sUrl = gbl_sRutaF + "lib/galeria_js.php"+sContenido;
	//alert(sUrl);
	Spry.Utils.loadURL("POST", sUrl, true, fCallGaleriaUpdate, { postData: sContenido, headers: { "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8" }});
}

function fCallGaleriaUpdate(req){
	var resoponseDatos = eval(req.xhRequest.responseText);
	uiMsg = parseInt(resoponseDatos[0]);
	sMsg = resoponseDatos[1];
	images = resoponseDatos[2];
	titles = resoponseDatos[3];
	descriptions = resoponseDatos[4];
	
	var arrImages = new Array();
	arrImages = images.split(',');
	
	var arrTitles = new Array();
	arrTitles = titles.split(',');
	
	var arrDescriptions = new Array();
	arrDescriptions = descriptions.split(',');

	//alert(arrImages[0]);
	
	/**/
	$(document).ready(function(){
		//images = ['imagenes/cursoeventos_borrar.png','imagenes/cursoeventos_borrar.png','imagenes/cursoeventos_borrar.png'];
		//titles = ['Title 1','Title 2','Title 3'];
		//descriptions = ['Description 1','Description 2','Description 3']
		//arrImages = images;
		//arrTitles = titles;
		//arrDescriptions = descriptions;
		//alert(images);
		
		$.prettyPhoto.open(arrImages,arrTitles,arrDescriptions);
	});
	
	
}




function fGuardarArch(uiValor,sPath){
	//alert(uiValor);
	sContenido = "?uiId="+uiValor;
	
		
	sURL= sPath+"lib/descargar_arch.php"+sContenido;
	window.open(sURL);
	//Spry.Utils.loadURL("POST", sURL, true, fGuardarImg_update, { postData: ""});

}
function fCategoria(uiValor){
	//alert(uiValor);
	sParametro = "?ref="+uiValor;
	document.pantalla.action = "categorias.php"+sParametro;
	document.pantalla.submit();
}


function fDescargas(sPath){
		sParametro="";
		document.pantalla.action = sPath + "descargas.php"+sParametro;
		document.pantalla.submit();
	
}
function fVideosPopUp(uiValor,sPath){
	uiW=790;
	uiH=490;
	sContenido = "?uiId="+uiValor;
	sContenido += "&sPath="+sPath;
	sUrl = "video.php"+sContenido;
	//alert(sUrl);
	fPopUp_v2('#ventana','a.btnDemo',sUrl,uiW,uiH,true);
	
	
}

function fVideosPopUp2(uiValor,sPath){
	sContenido = "?id_registro="+uiValor;
	sContenido += "&sPath="+sPath;
	sUrl = sPath + "lib/video.php"+sContenido;
	//alert(sUrl);
	Spry.Utils.loadURL("POST", sUrl, true, fVideosPopUp2Update, { postData: sContenido, headers: { "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8" }});
}

function fVideosPopUp2Update(req){
	var resoponseDatos = eval(req.xhRequest.responseText);
	uiMsg = parseInt(resoponseDatos[0]);
	sMsg = resoponseDatos[1];
	images = resoponseDatos[2];
	titles = resoponseDatos[3];
	descriptions = resoponseDatos[4];
	
	var arrImages = new Array();
	arrImages = images.split(',');
	
	var arrTitles = new Array();
	arrTitles = titles.split(',');
	
	var arrDescriptions = new Array();
	arrDescriptions = descriptions.split(',');

	//alert(arrImages[0]);
	
	/**/
	$(document).ready(function(){
		//images = ['imagenes/cursoeventos_borrar.png','imagenes/cursoeventos_borrar.png','imagenes/cursoeventos_borrar.png'];
		//titles = ['Title 1','Title 2','Title 3'];
		//descriptions = ['Description 1','Description 2','Description 3']
		//arrImages = images;
		//arrTitles = titles;
		//arrDescriptions = descriptions;
		//alert(images);
		
		$.prettyPhoto.open(arrImages,arrTitles,arrDescriptions);
	});
	
	
}

function fRegistro(){
	bPasa = true;
	

	if(document.pantalla.cmpUser.value == "" && bPasa == true) {
		alert("Por favor complete los campos antes de enviar la informaci\u00F3nn.");
		document.pantalla.cmpUser.focus();
		bPasa = false;
	}
	if(document.pantalla.cmpNombre.value == "" && bPasa == true) {
		alert("Por favor complete los campos antes de enviar la informaci\u00F3nn.");
		document.pantalla.cmpNombre.focus();
		bPasa = false;
	}
	if(document.pantalla.cmpApellidos.value == "" && bPasa == true) {
		alert("Por favor complete los campos antes de enviar la informaci\u00F3nn.");
		document.pantalla.cmpApellidos.focus();
		bPasa = false;
	}
	
	if(document.pantalla.cbDia.value == 0 && bPasa == true) {
		alert("Por favor complete los campos antes de enviar la informaci\u00F3nn.");
		bPasa = false;
	}
	if(document.pantalla.cbMes.value == 0 && bPasa == true) {
		alert("Por favor complete los campos antes de enviar la informaci\u00F3nn.");
		bPasa = false;
	}
	if(document.pantalla.cbAno.value == 0 && bPasa == true) {
		alert("Por favor complete los campos antes de enviar la informaci\u00F3nn.");
		bPasa = false;
	}
	if(document.pantalla.cmpContrasena.value == "" && bPasa == true) {
		alert("Por favor complete los campos antes de enviar la informaci\u00F3nn.");
		document.pantalla.cmpContrasena.focus();
		bPasa = false;
	}
	if(document.pantalla.cmpContrasena2.value == "" && bPasa == true) {
		alert("Por favor complete los campos antes de enviar la informaci\u00F3nn.");
		document.pantalla.cmpContrasena2.focus();
		bPasa = false;
	}
	if(document.pantalla.cmpContrasena.value != document.pantalla.cmpContrasena2.value && bPasa == true) {
		alert("La contrase\u00f1a no es la misma favor verificar");
		document.pantalla.cmpContrasena2.focus();
		bPasa = false;
	}
	
	if(document.pantalla.cmpMail.value == "" && bPasa == true) {
		alert("Por favor complete los campos antes de enviar la informaci\u00F3nn.");
		document.pantalla.cmpMail.focus();
		bPasa = false;
	}
	
	if (bPasa){
		sContenido = "?cmpUser="+document.pantalla.cmpUser.value;
		sContenido += "&cmpNombre="+document.pantalla.cmpNombre.value;
		sContenido += "&cmpApellidos="+document.pantalla.cmpApellidos.value;
		sContenido += "&cbDia="+document.pantalla.cbDia.value;
		sContenido += "&cbMes="+document.pantalla.cbMes.value;
		sContenido += "&cbAno="+document.pantalla.cbAno.value;
		sContenido += "&cbSexo="+document.pantalla.cbSexo.value;
		sContenido += "&cmpPais="+document.pantalla.cmpPais.value;
		sContenido += "&cmpEstado="+document.pantalla.cmpEstado.value;
		sContenido += "&cmpCiudad="+document.pantalla.cmpCiudad.value;
		sContenido += "&cmpContrasena="+document.pantalla.cmpContrasena.value;
		sContenido += "&cmpMail="+document.pantalla.cmpMail.value;
		sContenido += "&cmpComentarios="+document.pantalla.cmpComentarios.value;
		
		sURL= "lib/registro.php"+sContenido;
		Spry.Utils.loadURL("POST", sURL, true, fRegistro_update, { postData: ""});
		
	}
}
function fRegistro_update(req){
	var resoponseDatos = eval(req.xhRequest.responseText);
	uiMsg = parseInt(resoponseDatos[0]);
	sMsg = resoponseDatos[1];
	alert(sMsg);
	if (uiMsg){
		fMenu(1);
		//fLimpiarForm();
		//fConsultarRegistro();
	}
	
}
function fLoginSesion(idRegistro,sUsuario,sMail,uiRecordar,sPass){
	fMenu(1);
}
function fLoginSesion2(idRegistro,sUsuario,sMail,uiRecordar,sPass){
	gbl_idRegistro=idRegistro;
	gbl_sUsuario=sUsuario;
	gbl_sMail=sMail;
	fPopUpCerrar();
	
	
	
	//sSwfName = thisMovie("menu");
	//alert(sSwfName);
	thisMovie("menu").fCall_JS_AS(gbl_idRegistro,gbl_sUsuario,gbl_sMail);
	
	
	sSwfName = thisMovie("galeria_fotos_reg_2");
	//alert(sSwfName);
	if (sSwfName!=undefined){
		//alert("entro2");
		thisMovie("galeria_fotos_reg_2").fCall_JS_AS2(gbl_idRegistro,gbl_sUsuario,gbl_sMail);
	}
	
	sSwfName = thisMovie("galeria_videos_reg_2");
	//alert(sSwfName);
	if (sSwfName!=undefined){
		//alert("entro2");
		thisMovie("galeria_videos_reg_2").fCall_JS_AS2(gbl_idRegistro,gbl_sUsuario,gbl_sMail);
	}
	
	
	//alert(uiRecordar);
	if(uiRecordar==1){
		fAgregarCookie(sUsuario,sPass);
	}
}


function resetFCK(field, value){
    // CODE RESETTING FCK HERE
}


function fVerRegPopUp(uiValor){
	//alert(uiValor);
	uiW=900;
	uiH=550;
	sContenido = "?uiId="+uiValor;
	//sContenido += "&sPath="+sPath;
	sUrl = "registro.php"+sContenido;
	//alert(sUrl);
	fPopUp_v2('#ventana','a.btnDemo',sUrl,uiW,uiH,true);
}
function fVerRegPopUpSuscripcion(){
	
	uiW=570;
	uiH=330;
	sContenido = "";
	//sContenido += "&sPath="+sPath;
	sUrl = "suscripcion.php"+sContenido;
	//alert(sUrl);
	fPopUp_v2('#ventana','a.btnDemo',sUrl,uiW,uiH,true);
}
function fRegImg(sValor){
	//alert(sValor);
	sContenido = "<img src=\"medios/"+sValor+"\" width=\"415\" height=\"270\">";	
	fCargandoPantalla("divImagen",sContenido)
}

function fVerRegistroCat(uiValor){
	if (uiValor==0){
		sParametro = "";
	}else{
		sParametro = "?cat="+uiValor;
	}
	
	document.pantalla.action = "bienes_raices.php"+sParametro;
	document.pantalla.submit();
}

function fVerRegistroB(uiIdCat,uiPrecio1,uiPrecio2,uiLugar){
	
	sParametro = "?r=1";
	
	if (uiIdCat!=0){
		sParametro += "&cat="+uiIdCat;
	}
	if (uiPrecio1!=0){
		sParametro += "&precio1="+uiPrecio1;
	}
	if (uiPrecio2!=0){
		sParametro += "&precio2="+uiPrecio2;
	}
	if (uiLugar!=0){
		sParametro += "&lugar="+uiLugar;
	}
	
	document.pantalla.action = "bienes_raices.php"+sParametro;
	document.pantalla.submit();
}




function fCallGaleriaIni(){
	//alert("entro");
	jQuery.noConflict(); 
	var $ = jQuery;
	$(document).ready(function(){
		$(".gallery a[rel^='prettyPhoto']").prettyPhoto({theme:'facebook'});
	});
}

function fNoticias(sValor){
	window.open(sValor);
}
function fHacerContacto(){
	Spry.$('divPantalla1').style.display='none';
	Spry.$('divPantalla2').style.display='block';
}
function fVerRegPopUpP1(){
	//alert(uiValor);
	uiW=900;
	uiH=550;
	sContenido = "";
	//sContenido += "&sPath="+sPath;
	sUrl = "servicios1.php"+sContenido;
	//alert(sUrl);
	fPopUp_v2('#ventana','a.btnDemo',sUrl,uiW,uiH,true);
}
function fNoticiasCambiaImagen(sValor){
	
	sGenera = "<img src=\"medios/menu_noticias/archivo/"+sValor+"\" width=\"160\" height=\"370px\" />";
	fCargandoPantalla("divMN_Imagen", sGenera);
	//alert(sGenera);
}
function fBuscar(sPalabra,uiTipo){
	
	sPalabra = document.getElementById("cmpBuscar").value;
	uiTipo = 1;
	if (sPalabra != ""){
		//alert(sPalabra);
		sParametro = "?cmpPalabras="+sPalabra;
		
		if (uiTipo==1){
			document.pantalla.action = "buscador.php"+sParametro;
		}else{
			document.pantalla.action = "../../../buscador.php"+sParametro;
		}
		
		document.pantalla.submit();
		
	}
}

function fSucripciones(){
	
	sMail = document.getElementById("cmpSuscribete").value;
	bPasa = true;
	if (sMail ==""){
		bPasa = false;
	}
	if (sMail =="escribe tu email"){
		bPasa = false;
	}
	
	if (bPasa){
		//alert("entro");
		sContenido = "?nombre="+sMail;
		sURL= "admin/lib/menu_suscripciones/agregar.php"+sContenido;
		Spry.Utils.loadURL("POST", sURL, true, fSucripciones_update, { postData: ""});
	}
}
function fSucripciones_update(req){
	var resoponseDatos = eval(req.xhRequest.responseText);
	uiMsg = parseInt(resoponseDatos[0]);
	sMsg = resoponseDatos[1];
	alert(sMsg);
	if (uiMsg){
		document.getElementById("cmpSuscribete").value="escribe tu email";
	}
	
}
var gbl_curso_id;
var gbl_arhivoWeb;
function fCursoMsg(curso_id,arhivoWeb){
	//alert(curso_id);
	//alert(arhivoWeb);
	gbl_curso_id = curso_id;
	gbl_arhivoWeb = arhivoWeb;
	bPasa = true;
	if (document.getElementById("cmp1").value =="" && bPasa){
		alert("Por favor complete los campos antes de enviar la informaci\u00F3nn.");
		bPasa = false;
	}
	if (document.getElementById("cmp2").value =="" && bPasa){
		alert("Por favor complete los campos antes de enviar la informaci\u00F3nn.");
		bPasa = false;
	}
	
	if (bPasa){
		//alert("entro");
		sContenido = "?nombre="+document.getElementById("cmp1").value ;
		sContenido += "&mail="+document.getElementById("cmp2").value ;
		sContenido += "&curso_id="+gbl_curso_id ;
		
		sDato= document.getElementById("cmp3").value;
		sDato = sDato.reemplazar("\n\r", "|enter/|");
		sDato = sDato.reemplazar("\r", "|enter/|");
		sDato = sDato.reemplazar("\n", "|enter/|");
		sContenido += "&comentarios="+sDato;
		
		sURL= "../../admin/lib/curso_mensaje/agregar.php"+sContenido;
		Spry.Utils.loadURL("POST", sURL, true,fCursoMsg_update, { postData: ""});
	}
}
function fCursoMsg_update(req){
	var resoponseDatos = eval(req.xhRequest.responseText);
	uiMsg = parseInt(resoponseDatos[0]);
	sMsg = resoponseDatos[1];
	alert(sMsg);
	if (uiMsg){
		document.pantalla.action = gbl_arhivoWeb+"?ref="+gbl_curso_id;
		document.pantalla.submit();
	}
	
}
function fSolicitarCurso(idCurso){
	//alert(idCurso);
	uiW=600;
	uiH=310;
	sUrl = "../../solicitar_curso.php?idCurso="+idCurso;
	//alert(sUrl);
	fPopUp_v2('#ventana','a.btnDemo',sUrl,uiW,uiH,true);
}
function fSolicitarCurso2(){
	
	
	bPasa = true;
	if (document.getElementById("curso_cmp1").value =="" && bPasa){
		alert("Por favor complete los campos antes de enviar la informaci\u00F3nn.");
		bPasa = false;
	}
	if (document.getElementById("curso_cmp2").value =="" && bPasa){
		alert("Por favor complete los campos antes de enviar la informaci\u00F3nn.");
		bPasa = false;
	}
	if (bPasa){
		sContenido = "?nombre="+document.getElementById("curso_cmp1").value ;
		sContenido += "&mail="+document.getElementById("curso_cmp2").value ;
		sContenido += "&archivo1="+document.getElementById("curso_archivo1").value ;
		
		sDato= document.getElementById("curso_cmp3").value;
		sDato = sDato.reemplazar("\n\r", "|enter/|");
		sDato = sDato.reemplazar("\r", "|enter/|");
		sDato = sDato.reemplazar("\n", "|enter/|");
		sContenido += "&comentarios="+sDato;
		sContenido += "&curso_nombre="+document.getElementById("curso_nombre").value;
		
		sURL= "../../lib/mail_solicitar_curso.php"+sContenido;
		Spry.Utils.loadURL("POST", sURL, true,fSolicitarCurso2_update, { postData: ""});
		
	}
}
function fSolicitarCurso2_update(req){
	var resoponseDatos = eval(req.xhRequest.responseText);
	uiMsg = parseInt(resoponseDatos[0]);
	sMsg = resoponseDatos[1];
	alert(sMsg);
	if (uiMsg){
		document.getElementById("curso_cmp1").value ="";
		document.getElementById("curso_cmp2").value ="";
		document.getElementById("curso_cmp3").value ="";
	}
	
}

function fSolicitarCursoPP(idCurso){
	//alert(idCurso);
	uiW=600;
	uiH=400;
	sUrl = "../../solicitar_cursopp.php?idCurso="+idCurso;
	//alert(sUrl);
	fPopUp_v2('#ventana','a.btnDemo',sUrl,uiW,uiH,true);
}

function fSolicitarCursoPP2(){
	
	
	bPasa = true;
	if (document.getElementById("curso_cmp1").value =="" && bPasa){
		alert("Por favor complete los campos antes de enviar la informaci\u00F3nn.");
		bPasa = false;
	}
	if (document.getElementById("curso_cmp2").value =="" && bPasa){
		alert("Por favor complete los campos antes de enviar la informaci\u00F3nn.");
		bPasa = false;
	}
	if (document.getElementById("curso_cmp3").value =="" && bPasa){
		alert("Por favor complete los campos antes de enviar la informaci\u00F3nn.");
		bPasa = false;
	}
	if (document.getElementById("curso_cmp4").value =="" && bPasa){
		alert("Por favor complete los campos antes de enviar la informaci\u00F3nn.");
		bPasa = false;
	}
	if (document.getElementById("curso_cmp5").value =="" && bPasa){
		alert("Por favor complete los campos antes de enviar la informaci\u00F3nn.");
		bPasa = false;
	}
	if (document.getElementById("curso_cmp6").value =="" && bPasa){
		alert("Por favor complete los campos antes de enviar la informaci\u00F3nn.");
		bPasa = false;
	}
	if (document.getElementById("curso_cmp7").value =="" && bPasa){
		alert("Por favor complete los campos antes de enviar la informaci\u00F3nn.");
		bPasa = false;
	}
	if (document.getElementById("curso_cmp8").value =="" && bPasa){
		alert("Por favor complete los campos antes de enviar la informaci\u00F3nn.");
		bPasa = false;
	}
	if (document.getElementById("curso_cmp9").value =="" && bPasa){
		alert("Por favor complete los campos antes de enviar la informaci\u00F3nn.");
		bPasa = false;
	}
	if (document.getElementById("curso_cmp10").value =="" && bPasa){
		alert("Por favor complete los campos antes de enviar la informaci\u00F3nn.");
		bPasa = false;
	}
	
	if (bPasa){
		sContenido = "?nombre="+document.getElementById("curso_cmp1").value ;
		sContenido += "&apellidos="+document.getElementById("curso_cmp2").value ;
		sContenido += "&edad="+document.getElementById("curso_cmp3").value ;
		sContenido += "&estudios="+document.getElementById("curso_cmp4").value ;
		sContenido += "&direccion="+document.getElementById("curso_cmp5").value ;
		sContenido += "&colonia="+document.getElementById("curso_cmp6").value ;
		sContenido += "&ciudad="+document.getElementById("curso_cmp7").value ;
		sContenido += "&pais="+document.getElementById("curso_cmp8").value ;
		sContenido += "&telefono="+document.getElementById("curso_cmp9").value ;
		sContenido += "&mail="+document.getElementById("curso_cmp10").value ;
		sContenido += "&idCurso="+document.getElementById("curso_id").value ;
		
		sContenido += "&curso_nombre="+document.getElementById("curso_nombre").value;
		sContenido += "&curso_precio="+document.getElementById("curso_precio").value;
		
		sURL= "../../lib/mail_compra_paypal.php"+sContenido;
		Spry.Utils.loadURL("POST", sURL, true,fSolicitarCursoPP2_update, { postData: ""});
		
	}
}
function fSolicitarCursoPP2_update(req){
	var resoponseDatos = eval(req.xhRequest.responseText);
	uiMsg = parseInt(resoponseDatos[0]);
	sMsg = resoponseDatos[1];
	alert(sMsg);
	if (uiMsg){
		document.getElementById("curso_cmp1").value ="";
		document.getElementById("curso_cmp2").value ="";
		document.getElementById("curso_cmp3").value ="";
		document.getElementById("curso_cmp4").value ="";
		document.getElementById("curso_cmp5").value ="";
		document.getElementById("curso_cmp6").value ="";
		document.getElementById("curso_cmp7").value ="";
		document.getElementById("curso_cmp8").value ="";
		document.getElementById("curso_cmp9").value ="";
		document.getElementById("curso_cmp10").value ="";
	}
	
}





function fContacto(){
	document.pantalla.action = "contacto.php";
	document.pantalla.submit();
}

function fIrCurso(sValor){
	//alert(sValor);
	window.location.href=sValor;
}

function fVerHorarios(idCurso){
	//alert(idCurso);
	uiW=500;
	uiH=350;
	sUrl = "../../solicitar_horarios.php?idCurso="+idCurso;
	//alert(sUrl);
	fPopUp_v2('#ventana','a.btnDemo',sUrl,uiW,uiH,true);
}


function fSolicitarinformacion(){
	
	
	bPasa = true;
	if (document.getElementById("cmp1").value =="" && bPasa){
		alert("Por favor complete los campos antes de enviar la informaci\u00F3nn.");
		bPasa = false;
	}
	if (document.getElementById("cmp2").value =="" && bPasa){
		alert("Por favor complete los campos antes de enviar la informaci\u00F3nn.");
		bPasa = false;
	}
	if (bPasa){
		sContenido = "?nombre="+document.getElementById("cmp1").value ;
		sContenido += "&mail="+document.getElementById("cmp2").value ;
		sContenido += "&enteraste="+document.getElementById("cmp3").value ;
		sContenido += "&nombre_reg="+document.getElementById("nombre_reg").value ;
		
		sDato= document.getElementById("cmp4").value;
		sDato = sDato.reemplazar("\n\r", "|enter/|");
		sDato = sDato.reemplazar("\r", "|enter/|");
		sDato = sDato.reemplazar("\n", "|enter/|");
		sContenido += "&comentarios="+sDato;
				
		sURL= "../../lib/mail_solicitar_informacion.php"+sContenido;
		Spry.Utils.loadURL("POST", sURL, true,fSolicitarinformacion_update, { postData: ""});
		
	}
}
function fSolicitarinformacion_update(req){
	var resoponseDatos = eval(req.xhRequest.responseText);
	uiMsg = parseInt(resoponseDatos[0]);
	sMsg = resoponseDatos[1];
	alert(sMsg);
	if (uiMsg){
		document.getElementById("cmp1").value ="";
		document.getElementById("cmp2").value ="";
		document.getElementById("cmp4").value ="";
	}
	
}

function fMaestro(idMaestro){
	//alert(idCurso);
	uiW=500;
	uiH=350;
	sUrl = "../../maestro.php?idMaestro="+idMaestro;
	//alert(sUrl);
	fPopUp_v2('#ventana','a.btnDemo',sUrl,uiW,uiH,true);
}
function fMaestro2(idMaestro){
	//alert(idCurso);
	uiW=500;
	uiH=350;
	sUrl = "../../maestro_linea.php?idMaestro="+idMaestro;
	//alert(sUrl);
	fPopUp_v2('#ventana','a.btnDemo',sUrl,uiW,uiH,true);
}


//inscripciones ===================================================

function fInscripcion_LimpiarForm(){
	document.getElementById("cmp1").value = "";
	document.getElementById("cmp2").value = "";
	document.getElementById("cmp3").value = "";
	document.getElementById("cmp4").value = "";
	document.getElementById("cmp5").value = "";
	document.getElementById("cmp6").value = "";
	document.getElementById("cmp7").value = "";
	document.getElementById("cmp8").value = "";
	document.getElementById("cmp9").value = "";
	document.getElementById("cmp10").value = "";
	document.getElementById("cmp11").value = "";
	document.getElementById("cmp12").value = "";
	document.getElementById("cmp13").value = "";
	
	document.getElementById("chk1").checked =false;
	document.getElementById("chk2").checked =false;
	
	document.getElementById("cmpImage1").value = "";
	document.getElementById("cmpImageDb1").value = "";
}

function fInscripcion_AgregarForm(){
	bPasa = true;
	

	if(document.getElementById("cmp1").value == "" && bPasa == true) {
		alert("Por favor complete los campos antes de enviar la informaci\u00F3n.");
		document.getElementById("cmp1").focus();
		bPasa = false;
	}
	if(document.getElementById("cmp2").value == "" && bPasa == true) {
		alert("Por favor complete los campos antes de enviar la informaci\u00F3n.");
		document.getElementById("cmp2").focus();
		bPasa = false;
	}
	if(document.getElementById("cmp3").value == "" && bPasa == true) {
		alert("Por favor complete los campos antes de enviar la informaci\u00F3n.");
		document.getElementById("cmp3").focus();
		bPasa = false;
	}
	if(document.getElementById("cmp4").value == "" && bPasa == true) {
		alert("Por favor complete los campos antes de enviar la informaci\u00F3n.");
		document.getElementById("cmp4").focus();
		bPasa = false;
	}
	if(document.getElementById("cmp5").value == "" && bPasa == true) {
		alert("Por favor complete los campos antes de enviar la informaci\u00F3n.");
		document.getElementById("cmp5").focus();
		bPasa = false;
	}
	if(document.getElementById("cmp6").value == "" && bPasa == true) {
		alert("Por favor complete los campos antes de enviar la informaci\u00F3n.");
		document.getElementById("cmp6").focus();
		bPasa = false;
	}
	if(document.getElementById("cmp7").value == "" && bPasa == true) {
		alert("Por favor complete los campos antes de enviar la informaci\u00F3n.");
		document.getElementById("cmp7").focus();
		bPasa = false;
	}
	if(document.getElementById("cmp11").value == "" && bPasa == true) {
		alert("Por favor complete los campos antes de enviar la informaci\u00F3n.");
		document.getElementById("cmp11").focus();
		bPasa = false;
	}
	if(document.getElementById("cmp12").value == "" && bPasa == true) {
		alert("Por favor complete los campos antes de enviar la informaci\u00F3n.");
		document.getElementById("cmp12").focus();
		bPasa = false;
	}
	if(document.getElementById("cmp13").value == "" && bPasa == true) {
		alert("Por favor complete los campos antes de enviar la informaci\u00F3n.");
		document.getElementById("cmp13").focus();
		bPasa = false;
	}
	
	if (bPasa){
	
	
		sContenido = "?cuatrimestre="+document.getElementById("cb1").value;
		sContenido += "&orientacion="+document.getElementById("cb2").value;
		sContenido += "&nombre="+document.getElementById("cmp1").value;
		sContenido += "&domicilio="+document.getElementById("cmp2").value;
		sContenido += "&colonia="+document.getElementById("cmp3").value;
		sContenido += "&ciudad="+document.getElementById("cmp4").value;
		sContenido += "&telefono="+document.getElementById("cmp5").value;
		sContenido += "&celular="+document.getElementById("cmp6").value;
		sContenido += "&email="+document.getElementById("cmp7").value;
		sContenido += "&empresa="+document.getElementById("cmp8").value;
		sContenido += "&empresa_domicilio="+document.getElementById("cmp9").value;
		sContenido += "&empresa_telefono="+document.getElementById("cmp10").value;
		sContenido += "&padre="+document.getElementById("cmp11").value;
		sContenido += "&padre_telefono="+document.getElementById("cmp12").value;
		sContenido += "&madre="+document.getElementById("cmp13").value;
		sContenido += "&boucher="+document.getElementById("cmpImage1").value;
		
		uiOp1 = document.getElementById("chk1").checked;
		//alert(uiOp1);
		if (uiOp1){
			sContenido += "&opcion1=X - ";
		}else{
			sContenido += "&opcion1=N/D - ";
		}
		
		uiOp2 = document.getElementById("chk2").checked;
		//alert(uiOp2);
		if (uiOp2){
			sContenido += "&opcion2=X - ";
		}else{
			sContenido += "&opcion2=N/D - ";
		}
		
		
		sURL= "../../lib/pdf_inscripcion.php"+sContenido;
		Spry.Utils.loadURL("POST", sURL, true, fInscripcion_AgregarForm_update, { postData: ""});
	}
}

function fInscripcion_AgregarForm_update(req){
	var resoponseDatos = eval(req.xhRequest.responseText);
	uiMsg = parseInt(resoponseDatos[0]);
	sMsg = resoponseDatos[1];
	alert(sMsg);
	if (uiMsg){
		fInscripcion_LimpiarForm();
	}
	
}

function fUploadImage(sCarpeta,uiValor){
	cmpForm1="cmpImage"+uiValor;
	cmpForm2="cmpImageDb"+uiValor;
	
	cmpImageDb = document.getElementById("cmpImageDb"+uiValor).value;
	if (cmpImageDb==""){
		cmpImageDb="n/d";
	}
	URL = "../../admin/upload_file.php?folder="+sCarpeta+"&cmpImageDb="+cmpImageDb+"&cmpForm1="+cmpForm1+"&cmpForm2="+cmpForm2;
	window.open(URL, 'upload_archivo', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300,left = 240,top = 212');
}
//inscripciones ===================================================

fCallGaleriaIni();

