var checkUrl = window.location.href; //获取当前页面路径名称
var isHomePage = checkUrl.indexOf('?'); //检查是否是首页
var adInterPath = "MapNavigate.aspx"; //设置地图路径
var ifHeight = 0; //声明临时变量储存Iframe的高度
var iframeHeight = 750; //Iframe默认高度683
var itvalAdd; //声明一个变量存储计时器Interval增加
var itvalSub; //声明一个变量存储计时器Interval减少

if (isHomePage == -1)
{
//给ID为mapDiv的Div标签内加入Iframe标签
document.getElementById('mapDiv').innerHTML = '<IFRAME id="interstitialframe" width=900 height=' + iframeHeight + ' noresize scrolling=no frameborder=0 marginheight=0 marginwidth=0></IFRAME>';
//给Iframe标签设置Src属性
document.getElementById('interstitialFrame').src = adInterPath;
//显示地图的Div标签
function showdiv()
{
    document.getElementById('mapDiv').style.display = "block";
}
//隐藏地图的Div标签
function hidediv()
{
    document.getElementById('mapDiv').style.display = "none";
}
//初始化时显示Div并设置定时关闭
function initdiv()
{
    showdiv();
    setTimeout("hidediv()", 2000);
}
//首页初始化设置定时打开Div
function initHomepage()
{
    setTimeout("initdiv()", 2000);
}
//Iframe增加高度 默认每次增加10个象素
function heightAdd()
{
    if (ifHeight < iframeHeight)
    {
        document.getElementById('interstitialFrame').height = ifHeight;
        ifHeight = ifHeight + 10;
    }
    else
    {
        stopAdd();
    }
}
//调用Iframe增加高度开始
function startAdd()
{
    stopSub(); //首先停止Iframe减少高度的计时器
    stopAdd(); //停止Iframe增加高度的计时器
    showdiv(); //显示Div
    if (ifHeight < iframeHeight)
    {
        itvalAdd = setInterval('heightAdd()', 1); //默认以1毫秒为单位
    }
}
//停止Iframe增加高度的计时器
function stopAdd()
{
    clearInterval(itvalAdd);
}
//Iframe减少高度
function heightSub()
{
    if (ifHeight == 0)
    {
        stopSub();
        hidediv();
    }
    else
    {
        ifHeight = ifHeight - 10;
        document.getElementById('interstitialFrame').height = ifHeight;
    }
}
//调用Iframe减少高度开始
function startSub()
{
    stopAdd(); //首先停止Iframe增加高度的计时器
    stopSub(); //停止Iframe减少高度的计时器
    if (ifHeight > 0)
    {
        itvalSub = setInterval('heightSub()', 1);
    }
    else
    {
        hidediv();
    }
}
//停止Iframe减少高度的计时器
function stopSub()
{
    clearInterval(itvalSub);
}
//地图开关
function mapSwitch()
{
    if (document.getElementById('mapDiv').style.display == "none")
    {
        startAdd();
    }
    else
    {
        startSub();
    }
}
    //调用首页初始化
    initHomepage();
}