﻿//首页加载初始化函数
function index_init()
{
    fullScreen();
    page_init();
    setFriendLink();
}
//一级导航页初始化函数
function page_init()
{   
    return;     
    setInterval("document.getElementById('time').innerHTML = new Date().toLocaleString() + '  ' + unescape('星期' + '日一二三四五六'.charAt(new Date().getDay()));",500);
}
/*屏蔽邮件菜单*/
function document.oncontextmenu(){event.returnValue=false}
//设置全屏显示
function fullScreen()
{
    try{
        window.moveTo(0,0);
    }catch(e){}
    
    if (document.all)
    {
        try{window.resizeTo(screen.availWidth,screen.availHeight);}
        catch(e){}
    }
    else if (document.layers || document.getElementById) 
    {
        if (window.outerHeight < screen.availHeight || 
            window.outerWidth < screen.availWidth)
        {
            window.outerHeight = screen.availHeight;
            window.outerWidth = screen.availWidth;
        }
    }
}
function SetWinHeight(objid)
{
    var obj = document.getElementById(objid);
    var win = obj;
    if(document.all)
    {
        if (document.getElementById)
        {
            if (win && !window.opera)
            {
                if (win.contentDocument && win.contentDocument.body.offsetHeight)
                win.height = win.contentDocument.body.offsetHeight;
                else if(win.Document && win.Document.body.scrollHeight)
                win.height = win.Document.body.scrollHeight;
            }
        }
        return;
    }
    var frm = obj;
    var subWeb = document.frames ? document.frames[obj.id].document : frm.contentDocument; 
    if(frm != null && subWeb != null) 
    { 
        frm.style.height="0px";//初始化一下,否则会保留大页面高度
        frm.style.height = subWeb.documentElement.scrollHeight+"px"; 
        frm.style.width = subWeb.documentElement.scrollWidth+"px"; 
        subWeb.body.style.overflowX="auto";
        subWeb.body.style.overflowY="auto";
    }
}
function SetWinWidth(objid)
{
    var obj = document.getElementById(objid);
    var win = obj;
    if(document.all)
    {
        if (document.getElementById)
        {
            if (win && !window.opera)
            {
                if (win.contentDocument && win.contentDocument.body.offsetWidth)
                win.width = win.contentDocument.body.offsetWidth;
                else if(win.Document && win.Document.body.scrollWidth)
                win.width = win.Document.body.scrollWidth;
            }
        }
        return;
    }
    var frm = obj;
    var subWeb = document.frames ? document.frames[obj.id].document : frm.contentDocument; 
    if(frm != null && subWeb != null) 
    { 
        frm.style.height="0px";//初始化一下,否则会保留大页面高度
        frm.style.height = subWeb.documentElement.scrollWidth+"px"; 
        frm.style.width = subWeb.documentElement.scrollWidth+"px"; 
        subWeb.body.style.overflowX="auto";
        subWeb.body.style.overflowY="auto";
    } 
}
//设置友情链接信息
function setFriendLink()
{
    var friendLink = document.getElementById("friendLink");
    friendLink.innerHTML = '<a href="http://www.top-tea.com/">茶叶信息网</a>' +
                            ' | <a href="http://www.cn-tea.net/" target="_blank">中国名茶网</a>' +
                            ' | <a href="http://www.china-tea.org/" target="_blank">中国茶叶网</a>'+
                            ' | <a href="http://www.diettea.cn/" target="_blank">中国减肥茶</a>' +
                            ' | <a href="http://www.teaxxg.com/" target="_blank">茶叶信息港</a>';
}
//关于我们
function self_introduction()
{
    var xMax = screen.width;
    var yMax = screen.height;
    var xOffset = (xMax - 480) / 2;
    var yOffset = (yMax - 260) / 2;
    window.open("http://www.top-tea.com/contact.htm", null, "height=260, width=480, resizable=no, help=no, scroll=no, top=" + yOffset + ", left=" + xOffset);
}
//注册会员
function register_member()
{
    window.open("http://www.top-tea.com/index.htm");
}
//会员服务
function serve_toMember()
{
    window.open("http://www.top-tea.com/index.htm");
}
//免费发布
function add_freeInfo()
{
    window.open("http://www.top-tea.com/index.htm");
}
