﻿var English_Hint_setTimeId;
var English_Hint_flag = "up";
var English_Hint_i = -4;
var English_Hint_des_left;
var English_Hint_des_top;
var English_Hint_sou_top;


// 网站温馨提示
// 获得 td 的高度
function English_Hint_DIV_onLoad(div_id,td_id)
{
	var isShow = document.getElementById("input_English_Hint_isShow").value;
	if(isShow == "N")
	{
		return;	
	}
	
	var tdHeight = document.getElementById(td_id).offsetHeight;
	var pageSize = getPageSize();
	var pageWidth = pageSize[2];
	var pageHeight = pageSize[3];
	English_Hint_des_left = pageWidth - 320;
	English_Hint_des_top = pageHeight - tdHeight - 45 - 2;
	
	document.getElementById(div_id).style.left = English_Hint_des_left + "px";
	document.getElementById(div_id).style.top = pageHeight + "px";
	
	var obj = document.getElementById("English_Hint_DIV");
	var topArray = obj.style.top.split("px");
	English_Hint_sou_top = parseInt(topArray[0]);
	
	start_English_Hint();
	
	// 滚动条事件
	window.onscroll=function()
	{
		var msgObj = document.getElementById("English_Hint_DIV");
		msgObj.style.top = English_Hint_des_top + getScrollTop() + "px";
	}
}
	
// 关闭网站温馨提示 DIV
function English_Hint_DIV_onClose(id)
{
    document.getElementById(id).style.display = "none";
}

function start_English_Hint()
{
	var obj = document.getElementById("English_Hint_DIV");
	
	if(English_Hint_flag == "up")
	{
		if(English_Hint_sou_top > English_Hint_des_top + getScrollTop())
		{
			English_Hint_sou_top += English_Hint_i;
			obj.style.top = English_Hint_sou_top + getScrollTop() + "px";
			English_Hint_setTimeId=setTimeout("start_English_Hint()",15);
		}
		else
		{
			clearTimeout(English_Hint_setTimeId);
			obj.style.top = English_Hint_des_top + getScrollTop() + "px";
			English_Hint_flag = "down";
			English_Hint_i = 4;
		
		}
	}
}

//---------------------------------------------------------------------------------------------------------------------------




//取窗口滚动条高度 
function getScrollTop()
{
    var scrollTop=0;
    if(document.documentElement&&document.documentElement.scrollTop)
    {
        scrollTop=document.documentElement.scrollTop;
    }
    else if(document.body)
    {
        scrollTop=document.body.scrollTop;
    }
    return scrollTop;
}



// getPageSize函数返回一个数组，前两个是整个页面的宽度和高度，后两个是页面窗口的宽度和高度
function getPageSize() 
{
    var xScroll, yScroll;
    if (window.innerHeight && window.scrollMaxY)
    {
        xScroll = document.body.scrollWidth;
        yScroll = window.innerHeight + window.scrollMaxY;
    } 
    else if (document.body.scrollHeight > document.body.offsetHeight) 
    {
        xScroll = document.body.scrollWidth;
        yScroll = document.body.scrollHeight;
    } 
    else 
    {
        xScroll = document.body.offsetWidth;
        yScroll = document.body.offsetHeight;
    }
    var windowWidth, windowHeight;
    if (self.innerHeight) 
    {
        windowWidth = self.innerWidth;
        windowHeight = self.innerHeight;
    } 
    else if (document.documentElement && document.documentElement.clientHeight) 
    {
        windowWidth = document.documentElement.clientWidth;
        windowHeight = document.documentElement.clientHeight;
    } 
    else if (document.body) 
    {
        windowWidth = document.body.clientWidth;
        windowHeight = document.body.clientHeight;
    }
    if (yScroll < windowHeight) 
    {
        pageHeight = windowHeight;
    } 
    else 
    {
        pageHeight = yScroll;
    }
    if (xScroll < windowWidth) 
    {
        pageWidth = windowWidth;
    } 
    else 
    {
        pageWidth = xScroll;
    }
    arrayPageSize = new Array(pageWidth, pageHeight, windowWidth, windowHeight);
    return arrayPageSize;
}




