/* v_14 */
$(document).ready(function(){
    function showid(idname) {
        var isIE = (document.all) ? true : false;
        var isIE6 = isIE && (navigator.appVersion.indexOf("MSIE 6")>-1);
        var newbox = document.getElementById(idname);
        newbox.style.zIndex = "100001";
        newbox.style.display = "block"
        newbox.style.position = !isIE6 ? "fixed" : "absolute";
        newbox.style.top = newbox.style.left = "50%";
        newbox.style.marginTop = -newbox.offsetHeight / 2 + "px";
        newbox.style.marginLeft = -newbox.offsetWidth / 2 + "px";
        var jihualayer = document.createElement("div");
        jihualayer.id = "jihualayer";
        jihualayer.setAttribute('class','jihualayer') ;
        jihualayer.style.width = jihualayer.style.height = "100%";
        jihualayer.style.position = !isIE6 ? "fixed" : "absolute";
        jihualayer.style.top = jihualayer.style.left = 0;
        jihualayer.style.backgroundColor = "#000";
        jihualayer.style.zIndex = "100000";
        jihualayer.style.opacity = "0.6";
        jihualayer.style.display = "none";
        if (isIE) {
            jihualayer.style.filter = "alpha(opacity=30)";
        }
        document.body.appendChild(jihualayer);
        jihualayer.style.display = "block";
        var sel = document.getElementsByTagName("select");
        for (var i = 0; i < sel.length; i++) {
            sel[i].style.visibility = "hidden";
        }
        
        function jihualayer_iestyle() {
            jihualayer.style.width = Math.max(document.documentElement.scrollWidth, document.documentElement.clientWidth) + "px";
            jihualayer.style.height = Math.max(document.documentElement.scrollHeight, document.documentElement.clientHeight) + "px";
        }
        function newbox_iestyle() {
            newbox.style.marginTop = document.documentElement.scrollTop - newbox.offsetHeight / 2 + "px";
            newbox.style.marginLeft = document.documentElement.scrollLeft - newbox.offsetWidth / 2 + "px";
        }
      
        if (isIE6) {
            jihualayer_iestyle()
            newbox_iestyle();
            window.attachEvent("onscroll", function () {
                newbox_iestyle();
            })
            window.attachEvent("onresize", jihualayer_iestyle)
        }
        
        
        $('#vote_alert_x').bind('click', function () {
            newbox.style.display = "none"; 
            jihualayer.style.display = "none"; 
            for (var i = 0; i < sel.length; i++) {
                sel[i].style.visibility = "visible";
            }
        });
        
    }

    var dialogbg    = function(){  showid('thisWinWrapper');   return true; }
    var error_fun  = function(){  showid('thisWinWrapper'); $('#thisWinWrapper').html('<h2 align="center" class="msya">温馨提示</h2><p class="wxx"><a onclick="$(\'#thisWinWrapper\').hide();$(\'.jihualayer\').remove();return false;" href="javascript:;"><img src="http://img1.07073.com/_12img/typeC/x.png"></a></p><div class="thisWinPages"> <p style="font-size:14px; text-align:center">网络异常请<a href="#" onclick="javascript:location.reload();">刷新重试</a></div>'); return false;}
    $('#digvisited1').click(function(){
            if(_login_flag==0)
            {
                json_api_login_form();
                return false;
            }				
            var options = {
                async : false,
                target: '#thisWinWrapper',  // target element(s) to be updated with server response
                success: dialogbg  ,// post-submit callback
                error:error_fun
            };
            $('#gameVotesFrom').ajaxForm(options);
            $('#gameVotesFrom').submit();
            //$('#thisWinWrapper').show();
            return false;
    });
});