jQuery(document).ready(function ($) {
    $('#videoinfo .more').click(function () {
        $('#videoinfo #desc').height($('#videoinfo #desc-content').height());
        return false
    });
    $('#facebook-comment iframe').contents().find('.composer').css('background', 'none');
    var params = {
        bgcolor: "#000000",
        wmode: "transparent"
    };
    $('.playerchap').live('click', function () {
        $('.status').show();
        $('.playing').removeClass('playing');
        $.ajax({
            type: "POST",
            url: "/player.php?time=" + new Date().getTime(),
            cache: false,
            data: "url=" + $(this).attr('rel'),
            success: function (html) {
                $('#playerview').html(html);
                $('.status').hide();
                return false
            }
        });
        $(this).addClass('playing');
        return false
    })
});

function checkIMDB(id, name, year) {
    jQuery('#imdbcheck_' + id).html('<img src="/wp-content/themes/films/images/ajax-loader.gif" />');
    jQuery.ajax({
        type: "POST",
        url: "/rate.php?time=" + new Date().getTime(),
        cache: false,
        data: "act=imdb&ID=" + id + "&name=" + name + "&year=" + year,
        success: function (html) {
            if (html != 'error') {
                jQuery('#imdbcheck_' + id).html(html)
            } else {
                jQuery('#imdbcheck_' + id).html('Không l&#7845;y &#273;&#432;&#7907;c!')
            }
        }
    })
}
jQuery(document).ready(function () {
    jQuery('#loginbutton').click(function () {
        jQuery(this).addClass('clicked');
        jQuery('#ax_login_form').slideDown();
    });
    
    jQuery('#loginbutton.clicked').click(function(){
          jQuery(this).removeClass('clicked');
          jQuery('#ax_login_form').slideUp();
    });
    
    jQuery('.forgotten').live("click", function () {
        jQuery('#ax_login_form').hide();
        jQuery('#ax_lost_user_form').hide();
        jQuery('#ax_lost_password_form').show()
    });
    jQuery('.forgotuser').live("click", function () {
        jQuery('#ax_login_form').hide();
        jQuery('#ax_lost_user_form').show();
        jQuery('#ax_lost_password_form').hide()
    });
    jQuery('#boxsignin').live("click", function () {
        jQuery.fancybox.close();
        jQuery('.button_login').addClass('clicked');
        jQuery('#ax_login_form').show()
    });
    jQuery(".button_register").fancybox({
        'hideOnContentClick': false,
        'padding': 5,
        'width': 600,
        'onStart': function () {
            jQuery('.messages').hide();
            jQuery('#ax_login_form').hide();
            jQuery('.clicked').removeClass('clicked');
            jQuery('#register_box').show();
            jQuery('iframe.youtube-player').hide()
        },
        'onClosed': function () {
            jQuery('#register_box').hide();
            jQuery('iframe.youtube-player').show()
        }
    });
    jQuery('form.ax_form').submit(function () {
        var thisform = this;
        jQuery.ajax({
            type: 'POST',
            url: jQuery(thisform).attr('action'),
            data: jQuery(thisform).serialize(),
            success: function (result) {
                jQuery('ul.errors, ul.messages').remove();
                if (result == 'SUCCESS') {
                    window.location = jQuery(thisform).attr('action')
                } else if (result.substring(8, 0) == 'SUCCESS:') {
                    message = result.substr(8);
                    jQuery('div.ax_form_inner', thisform).prepend('<ul class="messages"><li>' + message + '</li></ul>');
                    jQuery('div.ax_form_inner').unblock()
                } else {
                    jQuery('div.ax_form_inner', thisform).prepend('<ul class="errors"><li>' + result + '</li></ul>');
                    jQuery('div.ax_form_inner').unblock()
                }
                return false
            }
        });
        return false
    });
    jQuery('#pass1').keypress(function () {
        updateStrength(jQuery(this).val())
    });
    jQuery('.close a').live("click", function () {
        jQuery('.clicked').removeClass('clicked');
        jQuery('#ax_login_form').hide();
        jQuery('#ax_lost_user_form').hide();
        jQuery('#ax_lost_password_form').hide();
        return false
    })
});
jQuery(document).ready(function ($) {
    $('.wpfp-link').live('click', function () {
        dhis = $(this);
        wpfp_do_js(dhis, 1);
        if (dhis.hasClass('remove-parent')) {
            dhis.parent("li").fadeOut()
        }
        return false
    })
});

function wpfp_do_js(dhis, doAjax) {
    loadingImg = dhis.prev();
    loadingImg.show();
    beforeImg = dhis.prev().prev();
    beforeImg.hide();
    url = document.location.href.split('#')[0];
    params = dhis.attr('href').replace('?', '') + '&ajax=1';
    if (doAjax) {
        jQuery.get(url, params, function (data) {
            dhis.parent().html(data);
            if (typeof wpfp_after_ajax == 'function') {
                wpfp_after_ajax(dhis)
            }
            loadingImg.hide()
        })
    }
}
function continueExecution() {
    jQuery.fancybox.close();
    window.refresh()
}
var axgetStreng = function (passwd) {
        intScore = 0;
        if (passwd.match(/[a-z]/)) {
            intScore = (intScore + 1)
        }
        if (passwd.length > 6) {
            intScore = (intScore + 5)
        }
        if (passwd.length > 10) {
            intScore = (intScore + 5)
        }
        if (passwd.length > 15) {
            intScore = (intScore + 5)
        }
        if (passwd.match(/[A-Z]/)) {
            intScore = (intScore + 5)
        }
        if (passwd.match(/\d+/)) {
            intScore = (intScore + 5)
        }
        if (passwd.match(/(\d.*\d.*\d)/)) {
            intScore = (intScore + 5)
        }
        if (passwd.match(/[!,@#$%^&*?_~]/)) {
            intScore = (intScore + 5)
        }
        if (passwd.match(/([!,@#$%^&*?_~].*[!,@#$%^&*?_~])/)) {
            intScore = (intScore + 5)
        }
        if (passwd.match(/[a-z]/) && passwd.match(/[A-Z]/)) {
            intScore = (intScore + 2)
        }
        if (passwd.match(/\d/) && passwd.match(/\D/)) {
            intScore = (intScore + 2)
        }
        if (passwd.match(/[a-z]/) && passwd.match(/[A-Z]/) && passwd.match(/\d/) && passwd.match(/[!,@#$%^&*?_~]/)) {
            intScore = (intScore + 2)
        }
        return intScore
    }
