/*******************************************************************************
/* 瀏覽器判斷
*******************************************************************************/
var isDOM = document.getElementById ? 1 : 0;
var isIE  = document.all ? 1 : 0;
var isNS4 = (navigator.appName=='Netscape' && !isDOM) ? 1 : 0;
var isIE4 = (isIE && !isDOM) ? 1 : 0;
var isDyn = (isDOM||isIE||isNS4);
/*******************************************************************************
/* 浮動訊息欄顯示
*******************************************************************************/
var MyFloatImg = {
    theTop    : 0,
    theLeft   : 0,
    theHeight : 0,
    theWidth  : 0,
    //初始訊息欄//
    initFloatImg : function(headText)
    {
        var body       = document.getElementsByTagName("body")[0];
        var img        = document.createElement("img");
        //set div attribute//
        img.id           = "floatimg";
        img.className    = "floatimg";
        img.src          = "http://www.eztour.com.tw/images/floatimg/50x150.gif";
        img.style.width  = "50px";
        img.style.height = "150px";
        img.onclick = function(){
            window.top.location.href = "http://www.eztour.com.tw/card/sinopac/i_090312.php";
        }
        
        img.onmouseover = function(){
            (isIE) ? img.style.cursor = 'hand' : img.style.cursor = 'pointer' ;
            //img.src = "http://www.eztour.com.tw/images/floatimg/150x150_060914.gif";
            //img.style.width  = "150px";
            //img.style.height = "150px";
            //MyFloatImg.setLocation();
        }
        
        img.onmouseout = function(){
            img.src = "http://www.eztour.com.tw/images/floatimg/50x150.gif";
            img.style.width  = "50px";
            img.style.height = "150px";
            MyFloatImg.setLocation();
        }
        if(isIE)
        {
            img.style.position = "absolute";
        }
        else
        {
            img.style.position = "fixed";
        	this.theTop    = self.pageYOffset;
        	this.theLeft   = self.pageXOffset;
            this.theHeight = self.innerHeight;
            this.theWidth  = self.innerWidth;
            img.style.top  = (this.theTop + (this.theHeight/2)) + "px";
            img.style.left = (this.theLeft + this.theWidth - 170) + "px";
        }
        //dom//
        body.appendChild(img);
    },
    //設定位置//
    setLocation: function()
    {
        var floatimg = document.getElementById('floatimg');
        if(isIE)
        {
        	this.theTop    = document.body.scrollTop;
        	this.theLeft   = document.body.scrollLeft;
            this.theHeight = document.body.clientHeight;
            this.theWidth  = document.body.clientWidth;
            var ImgHeight  = floatimg.offsetHeight;
            var ImgWidth   = floatimg.offsetWidth;
            floatimg.style.top  = (this.theTop + (this.theHeight/2)) + "px";
            floatimg.style.left = (this.theLeft + this.theWidth - ImgWidth - 20) + "px";
        }
    }
};
/*******************************************************************************
/* 
*******************************************************************************/
function ShowFloatImg()
{
    MyFloatImg.initFloatImg();
    MyFloatImg.setLocation();
}
/*******************************************************************************
/* 
*******************************************************************************/
window.document.body.onscoll = function()
{
    MyFloatImg.setLocation();
}

window.onresize = function()
{
    MyFloatImg.setLocation();
}

window.onload = function()
{
    ShowFloatImg();
    setInterval(MyFloatImg.setLocation,100);
}
