function ezshopad(positionid) {
this.id = positionid;
this.adid = 0;
this.adtype = "";
this.adname = "";
this.adcontent = "";
this.paddingleft = 0;
this.paddingtop = 0;
this.width = 0;
this.height = 0;
this.ishitcount = "y";
this.scroll = "n";
this.uploadfilepath = "";
this.url = "";
this.siteid = 0;
this.showad = showadcontent;
this.start = dostart;
}
var delta = 0.08
var zcmsad_collection = [];
function showadcontent() {
var content = this.adcontent;
var str = "";
var align = "";
var x = "";
var y = "";
var ad = eval('(' + content + ')');
if (this.adtype == "image") {
for (var i = 0; i < ad.images.length; i++) {
str = "";
align = "";
if (i % 2 == 0) {
x = this.paddingleft;
align = "right";
} else {
x = "document.documentelement.clientwidth-" + (this.paddingleft + this.width);
align = "left";
}
y = this.paddingtop;
str += "
";
document.write(str);
additem("zcmsad_" + this.adid + "_" + i, x, y);
}
} else if (this.adtype == "flash") {
document.write(" ");
for (var i = 0; i < ad.images.length; i++) {
str = "";
align = "";
if (i % 2 == 0) {
x = this.paddingleft;
align = "right";
} else {
x = "document.documentelement.clientwidth-" + (this.paddingleft + this.width);
align = "left";
}
y = this.paddingtop;
str += "";
str += "
";
str += "
";
str += "
";
document.write(str);
additem("zcmsad_" + this.adid + "_" + i, x, y);
}
}
}
function additem(id, x, y) {
var newitem = {};
newitem.object = document.getelementbyid(id);
newitem.x = x;
newitem.y = y;
zcmsad_collection[zcmsad_collection.length] = newitem;
}
function dostart(scroll) {
var le = 0;
var he = 0;
for (var i = 0; i < zcmsad_collection.length; i++) {
he = 0;
var followobj_x = (typeof (zcmsad_collection[i].x) == 'string' ? eval(zcmsad_collection[i].x) : zcmsad_collection[i].x);
var followobj_y = (typeof (zcmsad_collection[i].y) == 'string' ? eval(zcmsad_collection[i].y) : zcmsad_collection[i].y);
le = le + followobj_x;
he = he + followobj_y;
}
zcmsad_collection[zcmsad_collection.length-1].object.style.left = le + "px";
zcmsad_collection[zcmsad_collection.length-1].object.style.top = he + "px";
setinterval("play(\"" + scroll + "\")", 10);
}
function play(scroll) {
for (var i = 0; i < zcmsad_collection.length; i++) {
var followobj = zcmsad_collection[i].object;
var followobj_x = (typeof (zcmsad_collection[i].x) == 'string' ? eval(zcmsad_collection[i].x) : zcmsad_collection[i].x);
var followobj_y = (typeof (zcmsad_collection[i].y) == 'string' ? eval(zcmsad_collection[i].y) : zcmsad_collection[i].y);
if (followobj.offsetleft != (document.documentelement.scrollleft + followobj_x)) {
var dx = (document.documentelement.scrollleft + followobj_x - followobj.offsetleft) * delta;
dx = (dx > 0 ? 1 : -1) * math.ceil(math.abs(dx));
followobj.style.left = (followobj.offsetleft + dx) + "px";
} else {
if (scroll == "n") {
continue;
}
}
if (followobj.offsettop != (document.documentelement.scrolltop + followobj_y)) {
var dy = (document.documentelement.scrolltop + followobj_y - followobj.offsettop) * delta;
dy = (dy > 0 ? 1 : -1) * math.ceil(math.abs(dy));
followobj.style.top = (followobj.offsettop + dy) + "px";
}
}
}