
var GGsliceContent=function(config)
{
this.config=config;
this.startPlay=false;this.init()
};
GGsliceContent.prototype={init:function()
{

document.write('<div id="'+this.config.id+'" style="margin:auto;overflow:hidden;width:'+this.config.source.width+'px;"></div>');


/* 初始化函数，新建一个层*/

document.getElementById(this.config.id).innerHTML='<a href="'+this.config.url+'" target="_blank"><img src="'+this.config.source.src+'" border="0" width="'+this.config.source.width+'" height="'+this.config.source.height+'" /></a>'/* 设置广告形式为图片，设置图片源及宽、高度*/

var me=this
},
execute:function()
{
var me=this;if(this.startPlay==true)
{
me.sliceDown(me.config.min);
setTimeout(function()
{
me.sliceUp(me.config.max);
document.getElementById(me.config.id).onmouseover=function()
{
clearTimeout(me.setTime);
me.sliceDown(me.curHeight())
};
document.getElementById(me.config.id).onmouseout=function()
{
clearTimeout(me.setTime);
me.sliceUp(me.curHeight())}},this.config.time*1000)
}
else
{
document.getElementById(me.config.id).style.height=this.config.min;/* 设置图片初始化高度为最小值*/
document.getElementById(me.config.id).onmouseover=function()
{
clearTimeout(me.setTime);
me.sliceDown(me.curHeight())/* 当鼠标在图片上时执行sliceDown函数*/
};
document.getElementById(me.config.id).onmouseout=function()
{
clearTimeout(me.setTime);
me.sliceUp(me.curHeight())/* 当鼠标离开时，执行sliceUp函数*/
}
}
},
sliceUp:function(i)/*展开函数，参数为i */
{
var me=this;
if(i>this.config.min)/* 当i大于最小值，展开*/
{
i=i-6;/*数字 6可以修改，数字越大，展开收缩越快*/
document.getElementById(this.config.id).style.height=i+"px";/* 设置图层高度*/
this.setTime=setTimeout(function()
{me.sliceUp(i)},15)/* 设置函数循环间隔时间，15可修改，越小效果越平滑*/
}
else{}
},
sliceDown:function(i)
{
var me=this;
document.getElementById(this.config.id).style.display="";
if(i<this.config.max)
{
i=i+6;/*数字 6可以修改，数字越大，展开收缩越快*/
document.getElementById(this.config.id).style.height=i+"px";/* 设置图层高度*/
this.setTime=setTimeout(function(){me.sliceDown(i)},15)/* 设置函数循环间隔时间，15可修改，越小效果越平滑*/
}
else{}
},
curHeight:function()
{
return parseInt(document.getElementById(this.config.id).style.height)
}
}



