$(document).ready(function(){ $('#text_editor_textarea').keyup(function() { max_chars = 555; current_value = $('#text_editor_textarea').val(); current_length = current_value.length; remaining_chars = max_chars-current_length; $('#counter_number').html(remaining_chars); if(remaining_chars<=55){ $('#counter_number').css('color', 'red'); } else { $('#counter_number').css('color', 'yellow'); } }); $('#smileCFviet').hide(); $('a#clicktime').click(function() { $('#smileCFviet').toggle(300); }); $('a.poplight[href^=#]').click(function() { var popID = $(this).attr('rel'); var popURL = $(this).attr('href'); //Pull Query & Variables from href URL var query= popURL.split('?'); var dim= query[1].split('&'); var popWidth = dim[0].split('=')[1]; $('#' + popID).fadeIn().css({ 'width': Number( popWidth ) }).prepend('Close'); var popMargTop = ($('#' + popID).height() + 80) / 2; var popMargLeft = ($('#' + popID).width() + 80) / 2; $('#' + popID).css({ 'margin-top' : -popMargTop, 'margin-left' : -popMargLeft }); //Fade in Background $('body').append('
'); $('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn(); return false; }); //Close Popups and Fade Layer $('a.close, #fade').live('click', function() { $('#fade , .popup_block').fadeOut(function() { $('#fade, a.close').remove(); }); //fade them both out return false; }); });