﻿    var newspan = document.createElement("span");
    newspan.id = "s_chart";
  // newspan.style.zindex=100;
  // newspan.style.position="absolute";
    document.body.appendChild(newspan);            
    
    Function.prototype.method = function (name, func) {
        this.prototype[name] = func;
        return this;
    };
    function setImg(type, code,time){
        this.v= {};
        this.setvalue('code', code);
        this.setvalue('type', type);
        this.setvalue('time', time);
    }
    setImg.method('setvalue', function(key, value){
        this.v[key]=value;
        return this;
        }
    );
    setImg.method('getValue',function(k){return this.v[k];});
    setImg.method('showImage',function(){
        code = this.getValue('code');
        type = this.getValue('type');
        time = this.getValue('time');
        var _self = this;
        if(code!="--")
        {
                alink = $(type+'_'+code);
                alink.onmouseover = function(evt){
	            _code = _self.getValue('code');
	            _type = _self.getValue('type');
	            var Obj = $('s_chart');

	            e=window.event?window.event:evt;
	            objEvent = e.target || e.srcElement;
	            x = objPosX(objEvent);
	            y = objPosY(objEvent);

	            Obj.style.position="absolute";
	            Obj.style.left=x + "px";
	            Obj.style.top=y + 16 + "px";
	            Obj.style.visibility="visible";
	            Obj.style.zIndex = 10;
    		//	style.zIndex=1
//			            var code_a = _code.substr(0,2);
//			            var code_b = _code.substr(2,6);
	            if(_type == "stock")
	            {

		            var CHART = "";
		            CHART += "<div><img src=\"http://junzhuang.e696.com/images/gongzuo/"+time+".gif\" border=0></div>";     
    			
	            }
	            $('s_chart').innerHTML=CHART;

	            _alink = $('s_chart');
	            _alink.onmouseover = function(){
		            this.style.visibility="visible";
	            };
	            _alink.onmouseout = function(){
		            this.style.visibility="hidden";
	            };
        };
        alink.onmouseout = function(){
            $('s_chart').style.visibility="hidden";
        };
        }
    }
    );

   
    function $(objname){
        return document.getElementById(objname);
    }

    function objPosX(obj){
        var left = 0;
        if (obj.offsetParent) {
            while (obj.offsetParent) {
	            left += obj.offsetLeft;
	            obj = obj.offsetParent;
            }
        } else if (obj.x) eft += obj.x;
        return left;
    }

    function objPosY(obj){
        var top = 0;
        if (obj.offsetParent) {
            while (obj.offsetParent) {
	            top += obj.offsetTop;
	            obj = obj.offsetParent;
            }
        } else if (obj.y) top += obj.y;
        return top;
    }

