﻿var _json_base = eval(document.getElementById('hidden_json_base').value);
Ext.onReady(function(){
    Ext.BLANK_IMAGE_URL = _json_base.ExtBlankUrl;
    Ext.useShims = true;
});
function myp2c_ToHome2(sUrl)
{
    var sId = 'id_iframe_'+new Date().getTime();
    myp2c_ShowHome2('<iframe id=\''+sId+'\' style=\'width:100%;height:600px;border:0px;margin:0px;padding:0px;\' frameborder=\'0\' src=\'\'></iframe>');
    document.getElementById(sId).src = sUrl;
}
function myp2c_ShowHome2(sHtml)
{
    var home2 = document.getElementById('myp2c_id_main_home2');
    home2.innerHTML = '<div class=\'div_more\' href=\'javascript:void(0);\' onclick=\'myp2c_ShowHome1();\'><a>&gt;&gt;返回&nbsp;</a></div>'+sHtml;
    home2.style.display = 'block';
    document.getElementById('myp2c_id_main_home1').style.display = 'none';
}
function myp2c_ShowHome1()
{
    var home2 = document.getElementById('myp2c_id_main_home2');
    home2.innerHTML = '';
    home2.style.display = 'none';
    document.getElementById('myp2c_id_main_home1').style.display = 'block';
}

function myp2c_LoadAd()
{
    myp2c_LoadAdHtml('domain');
    myp2c_LoadAdHtml('app');
}
function myp2c_LoadAdHtml(sAdType)
{
    Ext.Ajax.request({
        url:_json_base.SourcePath+'/index_pc_ajax.ashx',
        params:{
            action:'GetAdHtml',
            AppId:_json_base.AppId,
            AdType:sAdType
        },
        method:'POST',
        success:function(rp, rq){
            if(rp.responseText != '')
            {
                var div = null;
                if(sAdType == 'domain')
                {
                    div = document.getElementById('myp2c_id_main_ad_domain');
                }
                else if(sAdType == 'app')
                {
                    div = document.getElementById('myp2c_id_main_ad_app');
                }
                if(div)
                {
                    div.style.display='block';
                    div.innerHTML = rp.responseText;
                }
            }
        }
    });
}
function myp2c_DoAppStat()
{
    Ext.Ajax.request({
        url:_json_base.SourcePath+'/index_pc_ajax.ashx',
        params:{
            action:'DoAppStat',
            AppId:_json_base.AppId
        },
        method:'POST',
        success:function(rp, rq){
            //
        }
    });
}


/***模块管理接口*********************/
function myp2c_ManageSkinModuleContent(btn, sSkinModuleId)
{
    myp2c_OpenDlg(btn, '管理模块内容', 640, 480, _json_base.path_mc_home_manage.replace('{SkinModuleId}', sSkinModuleId));
}

function myp2c_ReloadModuleHtml(sSkinModuleId)
{/*导入连接模块*/
    var sDivId = 'myp2c_sm_div_'+sSkinModuleId;
    if(document.getElementById(sDivId))
    {
        new Ext.Updater(sDivId).update({
            url:'/_home/index_pc_ajax.ashx',
            params: {action:'GetModuleHtml',AppId:_json_base.AppId,SkinModuleId:sSkinModuleId,a:_json_base.a},
            text:'载入中...',
            scripts:true,
            timeout:60
        });
    }
}


