function eventBufferObject() {
	this.buffer = [];
	this.add = function(func) {
		this.buffer[this.buffer.length] = func;
	}
	this.load = function() {
		for (var x = 0; x < this.buffer.length; x++) {
			if (typeof(this.buffer[x]) == "string") {
				eval(this.buffer[x])
			} else {
				this.buffer[x]();
			}
		}
	}
}
// init event buffer
var loadBuffer = new eventBufferObject();

function get(id) {return document.getElementById(id);}
// common js
common_js = function() {
	this.commonGen = document.getElementById("commonGen");
	this.js_gethq = document.getElementById("js_gethq");
	this.commonContainer = document.getElementById("commonContainer");
	this.rollOver = [];
}



// Load Quote/Company Info
common_js.prototype.showInfo = function(who,symbol,type) {
	this.eleOffset = who;
	this.symbol = symbol;
	if (type) {this.type = type;} else {this.type = '';}
	this.infoID = window.setTimeout("common.showInfoTime();",300);
}
common_js.prototype.showInfoTime = function() {
	if (this.symbol) {
		var x = 0;
		var y = 0;
		while (this.eleOffset.offsetParent != null) {
			x += this.eleOffset.offsetLeft;
			y += this.eleOffset.offsetTop;
			this.eleOffset = this.eleOffset.offsetParent;
		}
	
		x += this.eleOffset.offsetLeft + 30;
		y += this.eleOffset.offsetTop + 12;
		
		this.commonContainer.style.pixelTop = y - 10;
		this.commonContainer.style.pixelLeft = x - 28;
		this.commonContainer.style.display = 'block';

		this.commonContainer.innerHTML = '<div class="iWin">ÕýÔÚ²éÑ¯...</div>';
		if (this.rollOver[this.symbol]) {
			this.commonContainer.innerHTML = this.rollOver[this.symbol];
		} else {
			js_gethq.setAttribute("src",'http://61.135.134.33/jshq.php?code='+this.symbol);
		}
	}
}
common_js.prototype.closeInfo = function(symbol) {
	window.clearTimeout(this.infoID);
	this.commonContainer.style.display = 'none';
}
// Adds the common js object
loadBuffer.add("common = new common_js()");

// Initializes all onload event
onload = function() {loadBuffer.load();}


// two wrappers
function showInfo(who,symbol,type){
	
	try {common.showInfo(who,symbol,type);} catch(e) {}
}
function closeInfo(symbol){
	try {common.closeInfo(symbol);} catch(e) {}
}

function removeSpecialChar(str, pattern){
	while (str.indexOf(pattern)!= -1){
		str=str.substring(0,str.indexOf(pattern))+str.substring(str.indexOf(pattern)+1,str.length);
	}
	return str;
}

function   mouse_outlayer(name){  
	try   
	{  
	window.status   =   window.event.toElement.tagName;  
	if(window.event.toElement.tagName   ==   "BODY" || window.event.toElement.tagName   ==   "P" || window.event.toElement.tagName   ==   "DIV")  
	document.all(name).style.visibility="hidden";   
	}catch(e){}
}    

function   mouse_closelayer(name){  
	try   
	{  
	document.all(name).style.visibility="hidden";   
	}catch(e){}
}    

function   showlayer(){     
	try   
	{  
	document.all(name).style.visibility="visible";     
	}catch(e){}
}

function   showImg(){     
	try   
	{  
	document.write('<a href="http://business.sohu.com" target="_blank"><IMG SRC="http://photocdn.sohu.com/20061218/Img247105488.gif" WIDTH="16" HEIGHT="16" BORDER="0"></a>');
	}catch(e){}
}
