/**************************************************************
代码整理：懒人图库　 ＊珍惜他人劳动，转载请自觉注明出处
**************************************************************/
var is_home_tx_show = false;
var div_home_tx = document.getElementById("home_tx");
var div_home_tx_in = document.getElementById("home_tx_in");
var home_tx_img = document.getElementById("home_tx_img");
var img_w=home_tx_img.width;
var img_h=home_tx_img.height;
var stepms = 10;
var hidetime=15//默认30
var showtime=15//默认30
var imghight=img_h//显示高度
div_home_tx_in.style.top=eval("-"+img_h);
div_home_tx_in.style.height=img_h;
function home_tx_show(){
	home_tx_stepshow();
}
function home_tx_stepshow(){
	var curHeight = parseInt(div_home_tx.offsetHeight);
	if(curHeight>=imghight){
		is_home_tx_show = true;
	}else{
		div_home_tx.style.height = (curHeight + 4) + "px";
		div_home_tx_in.style.top = (parseInt(div_home_tx_in.style.top)+4)+"px";
		window.setTimeout(home_tx_stepshow,showtime);
	}
}
function home_tx_hide(){
	if(is_home_tx_show){
		home_tx_stephide()
	}else{
		window.setTimeout(home_tx_stephide,1200);
	}
}

function home_tx_stephide(){
	var curHeight = parseInt(div_home_tx.style.height);
	if(curHeight<=0){
		is_home_tx_show = false;
	}else{
		try{
			div_home_tx.style.height = (curHeight - 4) + "px";
    		div_home_tx_in.style.top = (parseInt(div_home_tx_in.style.top)-4)+"px";
    		window.setTimeout(home_tx_stephide,hidetime);
		} catch(e) {}
	}
}

function SImage(callback)
{
    var img = new Image();
    this.img = img;
    var appname = navigator.appName.toLowerCase();
    if (appname.indexOf("netscape") == -1)
    {
       //ie
        img.onreadystatechange = function () {
            if (img.readyState == "complete")
            {
                callback(img);
            }
        };
    } else {
       //firefox
        img.onload = function () {
            if (img.complete == true)
            {
                callback(img);
            }
        }
    }
}

SImage.prototype.get = function (url)
{
    this.img.src = url;
}

var img = new SImage(icall);
img.get("images/s.jpg");

function icall(obj)
{
    if(window.addEventListener){
	window.addEventListener("load",home_tx_show,false);
}else{
	window.attachEvent("onload",home_tx_show);
}

}


