
/* 
	author:kwq 
 */
function image(src) {
	this.len = image.arguments.length;
	this.src = src;
	this.border = 0;
	this.width = -1;
	this.height = -1;
	this.title = "";
	if (this.len > 1) {
		this.title = image.arguments[1];
	}
	if (this.len > 2) {
		this.width = image.arguments[2];
	}
	if (this.len > 3) {
		this.height = image.arguments[3];
	}
	this.setTitle = function (title) {
		if (!isNaN(border)) {
			this.title = title;
		}
	};
	this.setBorder = function (border) {
		if (!isNaN(border)) {
			this.border = border;
		}
	};
	this.setWidth = function (w) {
		if (!isNaN(w)) {
			this.width = w;
		}
	};
	this.setHeight = function (h) {
		if (!isNaN(h)) {
			this.height = h;
		}
	};
	this.getHTML = function () {
		var str = "<img";
		if (this.src != "") {
			str += " src=\"";
			str += this.src + "\"";
		}
		if (this.title !="") {
			str += " alt=\"";
			str += this.title + "\"";
		}
		if (this.border > -1) {
			str += " border=\"";
			str += this.border + "\"";
		}
		if (this.width > -1) {
			str += " width=\"";
			str += this.width + "\"";
		}
		if (this.height > -1) {
			str += " height=\"";
			str += this.height + "\"";
		}
		str += ">";
		return str;
	};
}
function href(url, label) {
	this.url = url;
	this.label = label;
	this.target = "_blank";
	this.setTarget = function (t) {
		this.target = t;
	};
	this.getHTML = function () {
		var str = "<a href=\"" + this.url + "\"";
		if (this.target != "") {
			str += " target=\"";
			str += this.target;
			str += "\"";
		}
		str += ">";
		str += this.label;
		str += "</a>";
		return str;
	};
}
function flash(url, width, height) {
	this.url = url;
	this.width = width;
	this.height = height;
	this.setWidth = function (w) {
		if (!isNaN(w)) {
			this.width = w;
		}
	};
	this.setHeight = function (h) {
		if (!isNaN(h)) {
			this.height = h;
		}
	};
	this.getHTML = function () {
		var str = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"";
		str += " codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\"";
		str += " width=\"" + this.width + "\" height=\"" + this.height + "\"";
		str += ">";
		str += "<param name=\"movie\" value=\"" + this.url + "\" />";
		str += "<param name=\"quality\" value=\"high\" />";
		str += "<embed src=\"" + this.url + "\"";
		str += " quality=\"high\"";
		str += " pluginspage=\"http://www.macromedia.com/go/getflashplayer\"";
		str += " type=\"application/x-shockwave-flash\"";
		str += " width=\"" + this.width + "\" height=\"" + this.height + "\"";
		str += "></embed></object>";
		return str;
	};
}
function coupletAD(name) {
	this.delta = 0.015;
	this.name = name;
	this.items = [];
	this.closeB = false;
	this.showClose = true;
	this.setDelta = function (delta) {
		this.delta = delta;
	};
	this.setshowClose = function (showClose) {
		this.showClose = showClose;
	};
	this.addItem = function (id, x, y, w, h, content) {
		var str = "<DIV id=" + id + " style=\"Z-INDEX: 10; POSITION: absolute;  width:" + w + "px; height:" + h + "px;left:" + (typeof (x) == "string" ? eval(x) : x) + ";top:" + (typeof (y) == "string" ? eval(y) : y) + "\">" + content;
		if (this.showClose) {
			str += "<br><br><img src=/images/close.gif onClick=\"" + this.name + ".closeBanner();\">";
		}
		str += "</DIV>";
		document.write(str);
		var newItem = {};
		newItem.object = document.getElementById(id);
		newItem.x = x;
		newItem.y = y;
		this.items[this.items.length] = newItem;
	};
	this.start = function () {
		setInterval(this.name + ".play()", 30);
	};
	this.play = function () {
		if (screen.width <= 800 || this.closeB) {
			for (var i = 0; i < this.items.length; i++) {
				this.items[i].object.style.display = "none";
			}
			clearInterval(this.interval);
			return;
		}
		for (var i = 0; i < this.items.length; i++) {
			var followObj = this.items[i].object;
			var followObj_x = (typeof (this.items[i].x) == "string" ? eval(this.items[i].x) : this.items[i].x);
			var followObj_y = (typeof (this.items[i].y) == "string" ? eval(this.items[i].y) : this.items[i].y);
			if (followObj.offsetLeft != (document.body.scrollLeft + followObj_x)) {
				var dx = (document.body.scrollLeft + followObj_x - followObj.offsetLeft) * this.delta;
				dx = (dx > 0 ? 1 : -1) * Math.ceil(Math.abs(dx));
				followObj.style.left = followObj.offsetLeft + dx;
			}
			if (followObj.offsetTop != (document.body.scrollTop + followObj_y)) {
				var dy = (document.body.scrollTop + followObj_y - followObj.offsetTop) * this.delta;
				dy = (dy > 0 ? 1 : -1) * Math.ceil(Math.abs(dy));
				followObj.style.top = followObj.offsetTop + dy;
			}
			followObj.style.display = "";
		}
	};
	this.closeBanner = function () {
		this.closeB = true;
	};
}
function flowAD(id, content, xPos, yPos) {
	this.interval;
	this.xPos = xPos;
	this.yPos = yPos;
	this.step = 2;
	this.delay = 20;
	this.id = id;
	var str = "<div id=\"ad_" + id + "\" onmouseover=\"javascript:" + id + ".pause_resume();\" onmouseout=\"javascript:" + id + ".pause_resume();\" style=\"position:absolute;\">";
	str += content;
	str += "</div>";
	document.write(str);
	this.obj = document.getElementById("ad_" + id);
	this.width = document.body.clientWidth;
	this.height = document.body.clientHeight;
	this.Hoffset = this.obj.offsetHeight;
	this.Woffset = this.obj.offsetWidth;
	this.yon = 0;
	this.xon = 0;
	this.pause = true;
	this.obj.style.top = this.yPos;
	this.changePos = function () {
		this.obj.style.left = this.xPos + document.body.scrollLeft;
		this.obj.style.top = this.yPos + document.body.scrollTop;
		if (this.yon) {
			this.yPos = this.yPos + this.step;
		} else {
			this.yPos = this.yPos - this.step;
		}
		if (this.yPos < 0) {
			this.yon = 1;
			this.yPos = 0;
		}
		if (this.yPos >= (this.height - this.Hoffset)) {
			this.yon = 0;
			this.yPos = (this.height - this.Hoffset);
		}
		if (this.xon) {
			this.xPos = this.xPos + this.step;
		} else {
			this.xPos = this.xPos - this.step;
		}
		if (this.xPos < 0) {
			this.xon = 1;
			this.xPos = 0;
		}
		if (this.xPos >= (this.width - this.Woffset)) {
			this.xon = 0;
			this.xPos = (this.width - this.Woffset);
		}
	};
	this.start = function () {
		this.obj.visibility = "visible";
		this.interval = setInterval(this.id + ".changePos();", this.delay);
	};
	this.pause_resume = function () {
		if (this.pause) {
			clearInterval(this.interval);
			this.pause = false;
		} else {
			this.interval = setInterval(this.id + ".changePos();", this.delay);
			this.pause = true;
		}
	};
}

