$(function() {
var menu_small = 0;
$(window).scroll(function () {
var scroll_pos = $(window).scrollTop();
if(scroll_pos>160 && menu_small == 0){
$("#whitePan").animate({opacity:1});
menu_small = 1;
}
if(scroll_pos<161 && menu_small == 1){
$("#whitePan").animate({opacity:0});
menu_small = 0;
}
});
$(".linkdetalleev").click(function(e){
e.preventDefault();
var url=$(this).attr("href");
$("#eventos").hide();
$("#eventodetalle").html('
0){
$('.parallax-window').parallax();
$('.parallax-window-min').parallax();
}
if ($("#carruselpremios").length>0){
$("#carruselpremios").owlCarousel({
items:1,
autoplay:true,
loop:true
});
}
if ($("#googleMap").length>0){
var myCenter=new google.maps.LatLng(20.706083,-103.371875);
function initialize()
{
var mapProp = {
center:myCenter,
zoom:18,
mapTypeId:google.maps.MapTypeId.HYBRID,
scrollwheel: false
};
var map=new google.maps.Map(document.getElementById("googleMap"),mapProp);
}
google.maps.event.addDomListener(window, 'load', initialize);
}
if ($("#grid-gallery").length>0){
new CBPGridGallery( document.getElementById( 'grid-gallery' ) );
new CBPGridGallery( document.getElementById( 'grid-gallery2' ) );
new CBPGridGallery( document.getElementById( 'grid-gallery3' ) );
new CBPGridGallery( document.getElementById( 'grid-gallery4' ) );
new CBPGridGallery( document.getElementById( 'grid-gallery9' ) );
new CBPGridGallery( document.getElementById( 'grid-gallery5' ) );
new CBPGridGallery( document.getElementById( 'grid-gallery6' ) );
new CBPGridGallery( document.getElementById( 'grid-gallery7' ) );
new CBPGridGallery( document.getElementById( 'grid-gallery8' ) );
$("#grid-gallery").lightGallery({selector:'.imglg',download:false,thumbnail:false,appendSubHtmlTo:''});
$("#grid-gallery2").lightGallery({selector:'.imglg',download:false,thumbnail:false,appendSubHtmlTo:''});
$("#grid-gallery3").lightGallery({selector:'.imglg',download:false,thumbnail:false,appendSubHtmlTo:''});
$("#grid-gallery4").lightGallery({selector:'.imglg',download:false,thumbnail:false,appendSubHtmlTo:''});
$("#grid-gallery5").lightGallery({selector:'.imglg',download:false,thumbnail:false,appendSubHtmlTo:''});
$("#grid-gallery6").lightGallery({selector:'.imglg',download:false,thumbnail:false,appendSubHtmlTo:''});
$("#grid-gallery7").lightGallery({selector:'.imglg',download:false,thumbnail:false,appendSubHtmlTo:''});
$("#grid-gallery8").lightGallery({selector:'.imglg',download:false,thumbnail:false,appendSubHtmlTo:''});
$("#grid-gallery9").lightGallery({selector:'.imglg',download:false,thumbnail:false,appendSubHtmlTo:''});
}
if ($("#changepassword").length>0){
$(".input-lg").bind("propertychange change keyup input paste",function(){
var ucase = new RegExp(/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])[0-9a-zA-Z]{8,}$/);
var uemail = new RegExp(/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/);
var cad = $("#password1").val();
var cademail = $("#email1").val();
if(cademail.match(uemail) ){
$("#echar").removeClass("glyphicon-remove");
$("#echar").addClass("glyphicon-ok");
$("#echar").css("color","#00A41E");
}else{
$("#echar").removeClass("glyphicon-ok");
$("#echar").addClass("glyphicon-remove");
$("#echar").css("color","#FF0004");
}
if(cad.length >= 8 && cad.match(ucase) ){
$("#8char").removeClass("glyphicon-remove");
$("#8char").addClass("glyphicon-ok");
$("#8char").css("color","#00A41E");
}else{
$("#8char").removeClass("glyphicon-ok");
$("#8char").addClass("glyphicon-remove");
$("#8char").css("color","#FF0004");
}
if(cad == $("#password2").val()){
$("#pwmatch").removeClass("glyphicon-remove");
$("#pwmatch").addClass("glyphicon-ok");
$("#pwmatch").css("color","#00A41E");
}else{
$("#pwmatch").removeClass("glyphicon-ok");
$("#pwmatch").addClass("glyphicon-remove");
$("#pwmatch").css("color","#FF0004");
}
if ($("#8char").hasClass("glyphicon-ok") && $("#pwmatch").hasClass("glyphicon-ok") && $("#echar").hasClass("glyphicon-ok") ){
$("#btnsend").prop("disabled",false);
} else {
$("#btnsend").prop("disabled",true);
}
});
}
if ($("#changepassword2").length>0){
$(".input-lg").bind("propertychange change keyup input paste",function(){
var ucase = new RegExp(/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])[0-9a-zA-Z]{8,}$/);
var uemail = new RegExp(/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/);
var cad = $("#contrasena1").val();
var cademail = $("#email").val();
if(cademail.match(uemail) ){
$("#echar").removeClass("glyphicon-remove");
$("#echar").addClass("glyphicon-ok");
$("#echar").css("color","#00A41E");
}else{
$("#echar").removeClass("glyphicon-ok");
$("#echar").addClass("glyphicon-remove");
$("#echar").css("color","#FF0004");
}
if(cad.length >= 8 && cad.match(ucase) ){
$("#8char").removeClass("glyphicon-remove");
$("#8char").addClass("glyphicon-ok");
$("#8char").css("color","#00A41E");
}else{
$("#8char").removeClass("glyphicon-ok");
$("#8char").addClass("glyphicon-remove");
$("#8char").css("color","#FF0004");
}
if(cad == $("#contrasena2").val()){
$("#pwmatch").removeClass("glyphicon-remove");
$("#pwmatch").addClass("glyphicon-ok");
$("#pwmatch").css("color","#00A41E");
}else{
$("#pwmatch").removeClass("glyphicon-ok");
$("#pwmatch").addClass("glyphicon-remove");
$("#pwmatch").css("color","#FF0004");
}
});
}
if ($("#passwordForm").length>0){
$(".input-lg").bind("propertychange change keyup input paste",function(){
var ucase = new RegExp(/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])[0-9a-zA-Z]{8,}$/);
var uemail = new RegExp(/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/);
var cad = $("#password1").val();
if(cad.length >= 8 && cad.match(ucase) ){
$("#8char").removeClass("glyphicon-remove");
$("#8char").addClass("glyphicon-ok");
$("#8char").css("color","#00A41E");
}else{
$("#8char").removeClass("glyphicon-ok");
$("#8char").addClass("glyphicon-remove");
$("#8char").css("color","#FF0004");
}
if(cad == $("#password2").val()){
$("#pwmatch").removeClass("glyphicon-remove");
$("#pwmatch").addClass("glyphicon-ok");
$("#pwmatch").css("color","#00A41E");
}else{
$("#pwmatch").removeClass("glyphicon-ok");
$("#pwmatch").addClass("glyphicon-remove");
$("#pwmatch").css("color","#FF0004");
}
if ($("#8char").hasClass("glyphicon-ok") && $("#pwmatch").hasClass("glyphicon-ok") ){
$("#btnsend").prop("disabled",false);
} else {
$("#btnsend").prop("disabled",true);
}
});
}
$("#appsheader__cerrar").click(function(e){
e.preventDefault();
$("#appsheader").hide('slow');
});
});
$(document).on('click', '.modal-backdrop', function (event) {
bootbox.hideAll()
});
function alerta(msg, title1){
bootbox.alert({
message: msg,
title: title1,
buttons: {
ok:{
label: 'Aceptar',
className: 'btn-success'
}
},
callback: function (result) {
}
});
}
function dialogo(msg, title1){
bootbox.dialog({
message: msg,
title: title1
});
}
function nomostrar(cual){
$.ajax({
url:"sections/nomostrar.php?cual="+cual,
success:function(resp){
}
});
}
$(document).ready(function() {
$('#lightgallery').lightGallery({
pager: true
});
});
/* Acciones Nueva sección Fundación */
$(document).ready(function() {
if ($("#slide-testimonios").length>0){
$('#slide-testimonios').owlCarousel({
loop: false,
margin: 10,
nav: true,
navText: [
"",
""
],
autoplay: true,
autoplayHoverPause: true,
responsive: {
0: {
items: 1
},
600: {
items: 2
},
1000: {
items: 3
},
1200: {
items: 4
}
}
});
}
if ($("#slide-quienes-somos").length>0){
$('#slide-quienes-somos').owlCarousel({
animateOut: 'fadeOut',
animateIn: 'fadeIn',
navigation : false, // Show next and prev buttons
slideSpeed : 300,
paginationSpeed : 400,
nav: false,
controls: true,
items : 1,
loop:true,
autoplay: false,
dotsContainer: '#carousel-custom-dots',
responsive:{
0: {
},
600: {
},
1000: {
},
1200: {
navigation : true,
nav: true,
navText: ["",""],
}
}
});
$("#carousel-custom-dots .owl-dot").click(function(){
// scroll
$('html, body').animate({
scrollTop: ($('#slide-quienes-somos').offset().top *1) - (150)
}, 1000);
});
}
if ($("#modal-testimonios").length>0){
$("#modal-testimonios").on("hidden.bs.modal",function(){
$("#iframeYoutube").attr("src","#");
});
}
});
function youtube_parser(url){
var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/;
var match = url.match(regExp);
return (match&&match[7].length==11)? match[7] : false;
}
function changeVideo(vId){
var iframe=document.getElementById("iframeYoutube");
iframe.src="https://www.youtube.com/embed/"+vId;
$("#modal-testimonios").modal("show");
}
function changeVideodist(vId){
if(vId.indexOf("youtu")!=-1 && vId.length>3){
var iframe=document.getElementById("iframeYoutube");
iframe.src="https://www.youtube.com/embed/"+youtube_parser(vId);
$("#modal-testimonios").modal("show");
}
}