﻿//$(function() {
//    var so = new SWFObject("flash/evolution.swf", "evolution", "650", "490", "8", "#FFffff");
//    so.addParam("scale", "noscale");
//    so.addParam("wmode", "opaque");
//    so.addParam("wmode", "transparent");
//    if (gethtmlVersion() != "true") {
//        so.write("flash_content_E");
//    }
//})

$(function() {
    var tempalteID = 0;
    var width = 621;
    var height = 841;
    var left;
    var top;
    var midtop;
    var midleft;
    var winheight;
    var winwidth;
    var isOpen = false;
    $(".link > a > img").css("cursor", "pointer");
    $(".link > a > img").click(function() {
        $(".pop_box").animate({ "opacity": 0 }, 1);
        left = parseInt(Math.ceil($("body").width()) / 2 - (parseInt(width) / 2));
        top =127;
        winheight = parseInt($(document).height());
        midleft = parseInt(document.body.clientWidth) / 2;
        midtop = parseInt($.pageHeight()) + $(document).scrollTop();
        winwidth = parseInt($("body").width());
        $('.closepop').show();
        $(".popAD").show();
        $(".pop_box").attr("style", "height:" + winheight + "px;width:" + winwidth + "px");
        $(".pop_box").animate({ "opacity": 0.5 }, 500);
        $(".pop_cont").attr("style", "top:" + midtop + "px;width:1px;height:1px;left:" + midleft + "px");
        $(".pop_cont").animate({ "width": width, "left": left, "top": top, "height": height, "opacity": 1 }, 500);
        isOpen = true;
    })
    $(".closepop > a").click(function() {
        $(".pop_box").animate({ "opacity": 0 }, 500);
        $(".pop_cont").animate({ "width": 0, "left": midleft, "top": midtop, "height": 0, "opacity": 0 }, 500, function() {
            $(".pop_box").hide();
            $(".pop_cont").hide();
			$('.closepop').hide();
        });
        isOpen = false;
    })
//    $(window).resize(function() {
//        if (isOpen) {
//            var winheight = parseInt($(document).height());
//            var winwidth = parseInt($("body").width());
//            $(".pop_box").attr("style", "top:0px;width:" + winwidth + "px;height:" + winheight + "px;left:0px;opacity:0.5;display:block;filter:alpha(opacity=50);");
//            top = parseInt(($.pageHeight() - height)) + $(document).scrollTop();
//            left = parseInt(Math.ceil($("body").width()) / 2 - (parseInt(width) / 2));
//            $(".pop_cont").attr("style", "top:" + top + "px;width:" + width + "px;height:" + height + "px;left:" + left + "px;opacity:1;display:block;filter:alpha(opacity=100);");
//        }
//    });


})
$.pageWidth = function() {
    return window.innerWidth != null ? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;
}

$.pageHeight = function() {
    return window.innerHeight != null ? window.innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body != null ? document.body.clientHeight : null;
}
