﻿/// <reference name="jQuery.intellisense.js"/>

$(function() {

    if ($("body a[href*='login']").size() > 0) {

        $.getJSON("http://www.ednchina.com/js/islogin.ashx?jsoncallback=?", function(data) {

            if (data[0].IsLogin == false) {
                loadCss("http://www.ednchina.com/js/jquery/fancybox/jquery.fancybox-1.2.6.css");
                $.getScript("http://www.ednchina.com/js/jquery/fancybox/jquery.easing.1.3.js", function() {
                    $.getScript("http://www.ednchina.com/js/jquery/fancybox/jquery.fancybox-1.2.6.js", function() {

                        $("body a[href*='login']").each(function() {
                        alert($(this).attr("href"));
                            $(this).attr("href", "http://space.ednchina.com/member/ajaxlogin.aspx?iframe");
                            $(this).fancybox({
                                'padding': 0,
                                'hideOnContentClick': false,
                                'frameWidth': 375,
                                'frameHeight': 185
                            });
                        });

                    });
                });
            }
        });
    };
});

function loadCss(file) {
    var head = $('head');
    $("<link/>").attr({ href: file, type: 'text/css', rel: 'stylesheet' }).appendTo(head);

}