");img.attr("style", "height:100px;width: 100px");img.attr("src", e.target.result);dvPreview.append(img)};reader.readAsDataURL(file[0])}else{alert(file[0].name + " no es un archivo de imagen v�lido.");dvPreview.html("");return false}})}else{alert("Su navegador de internet es antiguo y no soporta el envio de imagenes. Actualize su navegador e intente nuevamente.")}})});$('#clear').on("click", function (){$('#files.thumbnail').parent().remove();$('#dvPreview').hide();$('#fileupload').val("");$(this).hide()});$(function(){$("#send-image").on('click', function(e){e.preventDefault();$("#fileupload:hidden").trigger('click')})});$('.company-gallery-photo').click(function(){event.preventDefault();var title = $(this).attr("title");var img = $(this).attr('data-img-url');$('#modal-company-photos .modal-title').html(title);$('#modal-company-photos .modal-body img').attr('src', img)});$("#rating-comment").rating({clearCaption: "", starCaptions:{1: "", 2: "", 3: "", 4: "", 5: ""}, starCaptionClasses:{1: "text-danger", 2: "text-warning", 3: "text-info", 4: "text-primary", 5: "text-success"},});function LikeActionComment(id, empresa, action){event.preventDefault();$.ajax({url: "/ajax/likeActionComment", type: 'POST', dataType: "json", data:'comment='+id+'&empresaId='+empresa+'&action='+action, success: function(result){if (action == 'like'){$("#like-total-" + id).html(' (' + result.totalLike + ')');$("#unlike-total-" + id).html(' (' + result.totalUnlike + ')');if (result.remove != true){$('#like-link-' + id).css('color', '#5CB85C')}else{$('#like-link-' + id).css('color', '#868686');$('#unlike-link-' + id).css('color', '#868686')}}else{$("#like-total-" + id).html(' (' + result.totalLike + ')');$("#unlike-total-" + id).html(' (' + result.totalUnlike + ')');if (result.remove != true){$('#unlike-link-' + id).css('color', '#FF4D4D')}else{$('#unlike-link-' + id).css('color', '#868686');$('#like-link-' + id).css('color', '#868686')}}}})}function Unlogged(){event.preventDefault();$(".btn-facebook").attr("href", '/entrar-con-facebook');$(".frm-actions").val('comment|');$('#myModal').modal('show')}function likeUnlogged(){event.preventDefault();$(".btn-facebook").attr("href", '/entrar-con-facebookcomment');$(".frm-actions").val('comment|comment');$('#myModal').modal('show')}function commentUnlogged(){event.preventDefault();$("#comment-btn").html(' Iniciar sesi�n...');$('#comment-area').prop('disabled', true);$(".btn-facebook").attr("href", '/entrar-con-facebookcomment/');$(".frm-actions").val('comment|comment/');$('#myModal').modal('show')}function callCompanyUnlogged(){event.preventDefault();$(".btn-facebook").attr("href", '/entrar-con-facebookcallCompany');$(".frm-actions").val('callCompany|callCompany/');$('#myModal').modal('show')}function showTextReply(idTextArea){event.preventDefault();$('#comment-' + idTextArea).toggle()}$(document).ready(function(){var optionsComment ={target: '#commentForm', beforeSubmit: commentLoading, success: commentResponse, dataType: 'json'};var optionsComment2 ={success: commentResponse, beforeSubmit: commentLoading, dataType: 'json'};var messageDirect ={success: directSuccess, beforeSubmit: directLoading, dataType: 'json'};$('#commentForm').ajaxForm(optionsComment);$('form.commentFormReply').ajaxForm(optionsComment2);$('#messageDirect').ajaxForm(messageDirect);$('#commentForm').ajaxForm(optionsComment);function directSuccess (responseText, statusText, xhr, $form){$('#direct-mensagem').prop('disabled', false);$("#direct-btn").html('Enviar mensaje');$("#direct-btn").prop('disabled', false);$('#direct-nome').prop('disabled', false);$('#direct-email').prop('disabled', false);$('#direct-telefone').prop('disabled', false);if (responseText.status == 0){swal("Oops...", responseText.text, "error")}if (responseText.status == 1){swal("Buen trabajo!", responseText.text, "success");$('#direct-mensagem').val(" ");$('#direct-nome').val('');$('#direct-email').val('');$('#direct-telefone').val('');$('#modal-company-message').modal('toggle')}}function directLoading(formData, jqForm, options){$('#direct-mensagem').prop('disabled', true);$("#direct-btn").html(' Espere...');$("#direct-btn").prop('disabled', true);$('#direct-nome').prop('disabled', true);$('#direct-email').prop('disabled', true);$('#direct-telefone').prop('disabled', true)}function commentResponse(responseText, statusText, xhr, $form){$('#comment-area').prop('disabled', false);$("#comment-btn").html(' Comentar');$("#comment-btn").prop('disabled', false);$('.comment-reply-text-area').prop('disabled', false);$(".btn-reply-footer").html('Responder');$(".btn-reply-footer").prop('disabled', false);if (responseText.status == 0){sweetAlert("Oops...", responseText.erro, "error")}if (responseText.status == 1){swal("Buen trabajo!", "Su comentario fue agregado con exito!", "success");$("#comment-area").val('');if (responseText.isReplay){$('#'+responseText.isReplay).append(responseText.msg).find('#'+responseText.isReplay).hide().fadeIn("slow");$('.comment-reply-text-area').val('');$('.comment-reply').hide()}else{$(".comment-list").prepend(responseText.msg).find(".row:first").hide().fadeIn("slow")}$("#clear").click();$('#rating-comment').rating('reset')}if (responseText.status == 2){$(".btn-facebook").attr("href", '/entrar-con-facebookcomment/' + responseText.msg);$(".frm-actions").val('comment|comment/' + responseText.msg);$('#myModal').modal('show')}}function commentLoading(formData, jqForm, options){$('#comment-area').prop('disabled', true);$("#comment-btn").html(' Espere...');$("#comment-btn").prop('disabled', true);$('.comment-reply-text-area').prop('disabled', true);$(".btn-reply-footer").html(' Espere...');$(".btn-reply-footer").prop('disabled', true)}});function scrollToAnchor(aid){var aTag = $("a[name='"+ aid +"']");$('html,body').animate({scrollTop: aTag.offset().top},'slow')}function callMyCompanyJs(id){swal({title: "Tiene certeza que desea asumir esta emisora?", text: "", type: "info", showCancelButton: true, closeOnConfirm: false, showLoaderOnConfirm: true,}, function(){$.ajax({url: "/ajax/assumirEmpresa", type: 'POST', dataType: "json", data:'org='+id, success: function(result){if (result.success == 0){swal({title: "Error", text:result.msg, type: "error"})}else{swal({title: "Emisora asumida!", text: result.msg, type: "success"}, function(){window.location.href = "/registrar-emisora/"+id+"/1/"})}}})})}function reportComment(id){event.preventDefault();swal({title: "Reportar comentario", text: "Por favor, explique en pocas palabras el motivo por el cual este comentario es inapropriado:", type: "input", showCancelButton: true, closeOnConfirm: false, animation: "slide-from-top", inputPlaceholder: "Motivo"}, function(inputValue){if (inputValue === false) return false;if (inputValue === ""){swal.showInputError("Por favor, ingrese el motivo");return false}$.ajax({url: "/ajax/reportComment", type: 'POST', dataType: "json", data:'comment='+id+'&text='+inputValue, success: function(result){if (result.success == 1){swal("Gracias!", "Un miembro de nuestro equipo analizara su denuncia.", "success")}}})})}function forgotPassword(){$('#myModal').modal('toggle');event.preventDefault();swal({title: "Olvid� su contrase�a? ", text: "Por favor, digite su email y haga clic en enviar. Enviaremos el procedimento para cambiar su contrase�a:", type: "input", showCancelButton: true, closeOnConfirm: false, animation: "slide-from-top", inputPlaceholder: "email@ejemplo.com"}, function(inputValue){if (inputValue === false) return false;if (inputValue === ""){return false}$.ajax({url: "/ajax/forgotPassword", type: 'POST', dataType: "json", data:'username='+inputValue, success: function(result){if (result.success == 'error'){swal.showInputError(result.msg);return false}else{swal("�xito!", result.msg, result.success)}}})})}function newOportunity(){swal("", "Para registar o alterar una oportunidad de empleo, escoja la empresa y haga clic en 'Alterar Oportunidades de Empleo'")}function singnupBtn(){event.preventDefault();$('#singnup').click()}