function dropin(id) {
	if (typeof id == 'object') {
		id.start();
	} else {
		eval(id + ".start();");
	}
}

function bouncein(id) {
	if (typeof id == 'object') {
		id.bounce();
	} else {
		eval(id + ".bounce();");
	}
}

// Drop-in content box
// Remark: only support DOM
function Dropin(id) {
	this.id = false;
	if (!id || !document.getElementById || !document.getElementById(id)) return false;
	this.id = new String(id);
	this.bouncelimits = 8; // must be divisible by 8
	this.ie = document.all;
	this.crossobj = null;
	this.dropstart = null;
	this.bouncestart = null;
	return true;
}

Dropin.prototype.init = function() {
	if (!this.id) return;
	this.crossobj = document.getElementById(this.id).style;
	var scroll_top = (this.ie? this.truebody().scrollTop: window.pageYOffset);
	this.crossobj.top = (scroll_top - 250) + 'px';
	this.crossobj.visibility = 'visible';
	this.dropstart = window.setInterval("dropin(" + this.id + ")", 50);
};

Dropin.prototype.start = function() {
	if (!this.id) return;
	var scroll_top = (this.ie? this.truebody().scrollTop: window.pageYOffset);
	if (parseInt(this.crossobj.top) < 80 + scroll_top) {
		this.crossobj.top = (parseInt(this.crossobj.top) + 40) + 'px';
	} else {
		window.clearInterval(this.dropstart);
		this.bouncestart = window.setInterval("bouncein(" + this.id + ")", 50);
	}
};

Dropin.prototype.bounce = function() {
	if (!this.id) return;
	this.crossobj.top = (parseInt(this.crossobj.top) - this.bouncelimit) + 'px';
	this.bouncelimit += 8;
	this.bouncelimit *= -1;
	if (this.bouncelimit == 0) window.clearInterval(this.bouncestart);
};

Dropin.prototype.dismiss = function() {
	document.getElementById(this.id).innerHTML = '';
	if (this.bouncestart) window.clearInterval(this.bouncestart);
	this.crossobj.visibility = 'hidden';
};

Dropin.prototype.truebody = function() {
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function get_cookie(name) {
	var search = name + "=";
	var returnvalue = "";
	if (document.cookie.length > 0) {
		var offset = document.cookie.indexOf(search);
		if (offset != -1) {
			offset += search.length;
			end = document.cookie.indexOf(";", offset);
			if (end == -1) end = document.cookie.length;
			returnvalue = unescape(document.cookie.substring(offset, end));
		}
	}
	return returnvalue;
}