﻿initPage();
function initPage() {
    detectIE6();
    var pWidth = $("body").width();
    var aWidth = $(".AjaxProgress").width();
    $(".AjaxProgress").css("left", (pWidth - aWidth) / 2);
    $(document).ready(function() {
        $(".AjaxBox").css("visibility", "hidden");
        //alert('test');
        //attachAlertEvent("Are you sure ?");
    });
}

function ShowConfirm(sender) {
    $(sender).bind("click", function(event) {
        event.preventDefault();
        event.stopImmediatePropagation();
        $.prompt("Are you sure ?", { buttons: { Ok: true, Cancel: false }, submit: function(v, m, f) {
            if (!v)
                $.prompt.close();
            else {
                var $tar = $(event.target);
                eval($tar.attr("href"));
            }
        }
        });
    });
}
//function attachAlertEvent(message) {
//    $("input[ShowAlert='true']").css({ 'border': 'solid 1px red' });
//    $("input[ShowAlert='true']").each(function() {
//        var click = new String($(this).attr("onclick"));
//        //click = $(this).attr("onclick");
//        $(this).removeAttr("onclick");
//        $(this).bind("click", function(e) {
//            e.preventDefault();
//            e.stopImmediatePropagation();
//            $.prompt(message, { buttons: { Ok: true, Cancel: false }, submit: function(v, m, f) {
//                if (!v)
//                    $.prompt.close();
//                else {
//                    var tar = e.target;
//                    var code = new String(click.slice(click.indexOf('{') + 1, click.lastIndexOf('}')));
//                    code = code.replace('return false;', '');
//                    var codeArray = code.split(';');
//                    //                    alert(codeArray.length);
//                    //                    for (i = 0; i < codeArray.length; i++) {
//                    //                        alert(codeArray[i]);
//                    //                        eval(codeArray[i]);
//                    //                    }
//                    //code += ";alert('test')"
//                    //alert(code); eval("alert('test');alert('test 2')");
//                    $(tar).unbind("click");
//                    $(tar).trigger("click", click);
//                    alert(click);
//                    //$(tar).attr("onclick", click);
//                    //$.prompt.close();
//                    //attachAlertEvent(message);
//                }
//            }
//            });
//        });
//    });
//    $("a[ShowAlert='true']").bind("click", function(event) {
//        event.preventDefault();
//        event.stopImmediatePropagation();
//        $.prompt(message, { buttons: { Ok: true, Cancel: false }, submit: function(v, m, f) {
//            if (!v)
//                $.prompt.close();
//            else {
//                var $tar = $(event.target);
//                eval($tar.attr("href"));
//            }
//        }
//        });
//    });
//}
function ShowHide(target) { $(target).toggle("slow"); }

function removeCSS(parentId) {
    $("#" + parentId + ">*").css({});
}
function detectIE6() {
    if ($.browser.msie) {
        if ($.browser.version == "6.0") {
            window.open("http://85.185.102.98/", "_blank", "resizable = yes ", "");
        }
    }
}
function Anthem_PreCallback() {
    //var pHeight = $("body").height();
    //alert(pHeight);(pHeight-aHeight) / 2
    //$(".AjaxProgress").css("top", "20%");
    $(".AjaxBox").css("visibility", "visible");
    //alert();
}
function Anthem_PostCallBack() {
    //alert('test');
    $(".AjaxBox").css("visibility", "hidden");
}
