// only allow specific extensions var exts = "jpg|jpeg|gif|png|bmp|tiff|pdf|txt|zip|rar|doc|docx|xls|xlsx|ppt|pptx"; var exts1 = "jpg|jpeg|gif|png|bmp|tiff"; function checkExtension(value) { if(value=="")return true; var re = new RegExp("^.+\.("+exts+")$","i"); if(!re.test(value)) { alert("Tipo de Archivo no Permitido: \n" + "Solo se permiten: "+exts.replace(/\|/g,',')+" \n\n"); return false; } return true; } function checkExtension1(value) { if(value=="")return true; var re = new RegExp("^.+\.("+exts1+")$","i"); if(!re.test(value)) { alert("Tipo de Archivo no Permitido: \n" + "Solo se permiten: "+exts1.replace(/\|/g,',')+" \n\n"); return false; } return true; } $(document).ready(function(){ $('#id_pais').val($('#id_codpais').val()); $('#id_pais').change(function(){ if ($(this).val()) { $('#id_codpais').val($(this).val()); var urldir = 'includes/searchprovince.php?pais=' + $('#id_codpais').val(); $('#id_provincia').load(urldir); } var delay = 300; setTimeout(function() { if ($('#id_provincia').val()){ $('#id_provincia').val($('#id_codprovincia').val()); } }, delay); }); $('#id_pais').trigger('change'); $('#id_provincia').val(''); $('#id_pais1').change(function(){ if ($(this).val()) { $('#id_provincia1').empty(); var urldir = 'includes/searchprovince.php?pais=' + $('#id_pais1').val(); $('#id_provincia1').load(urldir); $('#id_provincia1').focus(); } }); //show the progress bar only if a file field was clicked var show_bar = 0; $('input[type="file"]').click(function(){ show_bar = 1; }); //show iframe on form submit //$("#upload-form").submit(function(){ // if (show_bar === 1) { // $('#progress-frame').show(); // function set () { // $('#progress-frame').attr('src','progress-frame.php?up_id='); // } // setTimeout(set); // } //}); // Toggle private content $(".btn").click(function(){ $(this).next( "#myDIV" ).toggle(600); //$(this).next( "#myDIV" ).next(".pinput").show(); }); // profile image $("#profileImage").click(function(e) { $("#imageUpload").click(); }); function fasterPreview( uploader ) { if ( uploader.files && uploader.files[0] ){ $('#profileImage').attr('src', window.URL.createObjectURL(uploader.files[0]) ); } } $('div#attachfiles').on("change", "input:file", function () { var tamanoArchivo = (this.files[0].size); var tamanoPermitido = ((10*1024)*1024); if (tamanoArchivo > tamanoPermitido){ alert("El tamaño del Documento supera el máximo permitido de 10 Mb"); $(this).val(""); false; } if (checkExtension($(this).val())===false){ $(this).val(""); } }); $('div#attachgal').on("change", "input:file", function () { var tamanoArchivo = (this.files[0].size); var tamanoPermitido = ((10*1024)*1024); if (tamanoArchivo > tamanoPermitido){ $(this).val(""); alert("El tamaño de la Foto supera el máximo permitido de 10 Mb"); false; }else { if (checkExtension1($(this).val())===false){ $(this).val(""); } } }); $('#imageUpload').change(function () { var tamanoArchivo = (this.files[0].size); var tamanoPermitido = ((10*1024)*1024); if (tamanoArchivo > tamanoPermitido){ $(this).val(""); alert("El tamaño de la Foto supera el máximo permitido de 10 Mb"); false; }else { if (checkExtension1($(this).val())===false){ $(this).val(""); }else{ fasterPreview( this ); } } }); $(".showgal").click(function(){ $(this).next( "#galeria1").toggle(600); }); // Toggle galery content $(".btn").click(function(){ $(this).next( "#galeria").toggle(600); }); $(function() { $('.panel-image img.panel-image-preview').on('click', function(e) { $(this).closest('.panel-image').toggleClass('hide-panel-body'); }); }); // Toggle profile Password $(".btn").click(function(){ $(this).next( "#showpass").toggle(600); }); // Toggle profile PIN $(".btn").click(function(){ $(this).next( "#showpin").toggle(600); }); $('#newmembers').on("focus", "select.permisosdropd", function () { if (this.options.length == 0) { var urldir = '/includes/bringFamPermissions.php'; $(this).load(urldir); } }); $('#newmembers').on("focus", "select.relationing", function () { if (this.options.length == 0) { var urldir1 = '/includes/bringFamRelations.php'; $(this).load(urldir1); } }); $('#id_familyform').on("change", "input", function(){ var x=$(this).val(); var z=0; $("input").each(function(){ var y=$(this).val(); if(x==y){ z=z+1; } }); if(z>1){ alert("Valor Duplicado"); $(this).val(""); $(this).focus(); } }); $('#id_editfamilyform').on("change", "input[type=text]", function(){ var x=$(this).val(); var z=0; $("input").each(function(){ var y=$(this).val(); if(x==y){ z=z+1; } }); if(z>1){ alert("Valor Duplicado"); $(this).val(""); $(this).focus(); } }); $('#id_editfamilyform').on("change", "input[type=email]", function(){ var x=$(this).val(); var z=0; $("input").each(function(){ var y=$(this).val(); if(x==y){ z=z+1; } }); if(z>1){ alert("Valor Duplicado"); $(this).val(""); $(this).focus(); } }); $('#id_tipo1').click(function(){ $('#id_flia').removeAttr("disabled"); $("#id_flia").focus(); }); $('#id_tipo2').click(function(){ $('#id_flia').attr("disabled","disabled"); $("#id_flia").val($("#target option:first").val()); }); $('#listcal').on('click', 'tbody tr', function(event) { $('#id_event').val($(this).find('td:first').text()); var urldir2 = 'includes/bringEvent.php?event=' + $('#id_event').val(); $('#eventData').empty(); $('#eventData').load(urldir2); $('#myModal').show(); }); $('#id_chkcorreos').click(function(){ var ckbox = $('#id_chkcorreos'); if (ckbox.is(':checked')) { $('#id_correos').removeAttr("disabled"); $("#id_correos").focus(); }else{ $('#id_correos').attr("disabled","disabled"); $("#id_correos").val(""); } }); $('#id_flia').change(function(){ $("#destiny").empty(); var urldir3 = 'includes/bringFamMembers.php?id=' + $('#id_flia').val(); $('#destiny').load(urldir3); }); $('#id_futmessform input:checkbox').click(function(){ updateStatus(); }); $('#id_futmessform').on('click', 'input:checkbox', function(event) { updateStatus(); }); }); var next_id = 0; function _add_more() { var max_number = document.getElementById('maxfiles').value*1; var adjuntos = document.getElementById('adjuntos').value*1; var txt= ""; var filedel=""; if ((adjuntos*1)>=(max_number)) { alert("Alcanzó el Máximo de 5 Documentos!"); return; } next_id=next_id+1; var next_div=next_id; filedel= "dvFile"+next_div; txt ="
"; $("#attachfiles").append(txt); e=$('#adjuntos').val(); e=e*1+1; $('#adjuntos').val(e); } function removeElement(elementId) { // Removes an element from the document var element = document.getElementById(elementId); element.remove(); e=$('#adjuntos').val(); e=e*1-1; $('#adjuntos').val(e); } function _add_more1() { var adjuntos = document.getElementById('adjuntos').value*1; var max_number1 = document.getElementById('maxfiles').value*1; var txt= ""; var filedel=""; if ((adjuntos*1)>=(max_number1)){ alert("Alcanzó el Máximo de 10 Fotos!"); return; } next_id=next_id+1; var next_div=next_id; filedel= "dvFile"+next_div; var txt =""; $("#attachgal").append(txt); e=$('#adjuntos').val(); e=e*1+1; $('#adjuntos').val(e); } function _add_more2() { if (next_id>=max_number1) { alert("Alcanzó el Máximo de 10 Fotos!"); return; } next_id=next_id+1; preview_id=next_id-1; var next_div=next_id+1; var txt = "