function totalOrder() {}

totalOrder.init = function()
{
	var div = document.createElement("div");
	div.innerHTML = "<div style='position:absolute;width:626px;height:394px;background-color:white;border:3px #CBE7FF solid;display:none;left:0px;top:0px;'></div>";
	
	totalOrder.mainDiv = div.childNodes[0];
	
	var sb = new Array;
	sb.push ("<div id='eventTotalOrderDiv' onmousedown='totalOrder.fDragging(this, event, true);'><table width=100% border=0 cellspacing=0 cellpadding=0 style='background:url(/images/hqwt/zxTop.jpg) repeat-x;'><tr>");
	sb.push ("<td id='titleTD' width=560 height=21 ><span id='totalOrder_title' style='padding-left:5px;font-size:12px;font-weight:bold;'></span></td>");
	sb.push ("<td align=right style='padding-right:5px;'><img id='minButton' onclick='totalOrder.Min()' src='/images/hqwt/small_A.jpg' style='cursor:hand;'> <img src='/images/hqwt/close_a.gif' onmouseover=\"this.src='/images/hqwt/close_b.gif'\" onmouseout=\"this.src='/images/hqwt/close_a.gif'\" onmousedown=\"this.src='/images/hqwt/close_c.gif'\" onmouseup=\"this.src='/images/hqwt/close_b.gif'\"  border=0 onclick='totalOrder.hiddenDiv()' style='cursor:hand;' /></td></tr></table></div>");
	sb.push ("<table border=0 cellspacing=0 cellpadding=0  ><tr><td ><iframe id='totalOrderIframe' src='about:blank' width=620 height=374 frameborder=0 scrolling='no' marginheight=0 marginwidth=0></iframe></td></tr></table>");
	totalOrder.mainDiv.innerHTML = sb.join("");
	
	document.body.appendChild (totalOrder.mainDiv);
}

totalOrder.fDragging = function (obj, e, limit)
{ 
    if(!e) e=window.event;
    
    
    obj=totalOrder.mainDiv;
    var x=parseInt(obj.style.left); 
    var y=parseInt(obj.style.top); 
     
    var x_=e.clientX-x; 
    var y_=e.clientY-y; 
     
    if(document.addEventListener)
    { 
        document.addEventListener('mousemove', inFmove, true); 
        document.addEventListener('mouseup', inFup, true); 
    } 
    else if(document.attachEvent)
    { 
        document.attachEvent('onmousemove', inFmove); 
        document.attachEvent('onmouseup', inFup); 
    } 
     
    
    inFstop(e);     
    inFabort(e) 
    
    
    function inFmove(e)
    { 
        var evt; 
        if(!e)e=window.event; 
         
        if(limit)
        { 
            var op=obj.parentNode; 
            var opX=parseInt(op.style.left); 
            var opY=parseInt(op.style.top); 
             
            if((e.clientX-x_)<0)
            {
                return false; 
            }
            else if((e.clientX-x_+obj.offsetWidth+opX)>(opX+op.offsetWidth))
            {
                return false;
            }
             
            if(e.clientY-y_<0){
                return false; 
            }
            else if((e.clientY-y_+obj.offsetHeight+opY)>(opY+op.offsetHeight)){
                return false; 
            }
        } 
         
        obj.style.left=e.clientX-x_+'px'; 
        obj.style.top=e.clientY-y_+'px'; 
         
        inFstop(e); 
    } // shawl.qiu script 
    
    function inFup(e)
    { 
        var evt; 
        if(!e)e=window.event; 
         
        if(document.removeEventListener)
        { 
            document.removeEventListener('mousemove', inFmove, true); 
            document.removeEventListener('mouseup', inFup, true); 
        }
         else if(document.detachEvent)
        { 
            document.detachEvent('onmousemove', inFmove); 
            document.detachEvent('onmouseup', inFup); 
        } 
         
        inFstop(e); 
    } // shawl.qiu script 

    function inFstop(e)
    { 
        if(e.stopPropagation) return e.stopPropagation(); 
        else return e.cancelBubble=true;             
    } // shawl.qiu script 
    
    function inFabort(e)
    { 
        if(e.preventDefault) return e.preventDefault(); 
        else return e.returnValue=false; 
    } // shawl.qiu script 
} 


totalOrder.mouseDownDiv = function()
{
	var div = totalOrder.mainDiv;
	var evt = BrowserCompatible.getEvent();
	
  if(div && evt && evt.button == 1)
  {
		totalOrder.status = "dragger";
		totalOrder.draggerLeft = BrowserCompatible.getEventX(evt);
		totalOrder.draggerTop = BrowserCompatible.getEventY(evt);
		div.style.cursor = "move";
		div.setCapture ();
	}
}

totalOrder.mouseUpDiv = function()
{
	var div = totalOrder.mainDiv;
	var evt = BrowserCompatible.getEvent();
  
  if(div && evt)
  {
		div.releaseCapture ();
		totalOrder.status = "normal";
		div.style.cursor = "default";
	}
}

totalOrder.mouseMoveDiv = function()
{
	var div = totalOrder.mainDiv;
	var evt = BrowserCompatible.getEvent();
	
	if (div && totalOrder.status == "dragger")
	{
		var x = BrowserCompatible.getEventX(evt) - parseInt(totalOrder.draggerLeft);
		var y = BrowserCompatible.getEventY(evt) - parseInt(totalOrder.draggerTop);
		
		totalOrder.draggerLeft = BrowserCompatible.getEventX(evt);
		totalOrder.draggerTop = BrowserCompatible.getEventY(evt);
		
		var left = parseInt(div.style.left)+x;
		var top = parseInt(div.style.top)+y;
		
		if(left < 0) left = 0;
		if(top < 0) top = 0;
		if(left > (parseInt(document.body.clientWidth) - 180)) left = parseInt(document.body.clientWidth) - 600;
		if(top > (parseInt(document.body.clientHeight) - 230)) top = parseInt(document.body.clientHeight) - 500
		
		div.style.left = left;
		div.style.top  = top;
	}
}

totalOrder.Min=function ()
{
    totalOrder.mainDiv.style.width = "160px";
    totalOrder.mainDiv.style.height = "21px";
    document.getElementById ("totalOrderIframe").width = 0;
    document.getElementById ("totalOrderIframe").height = 0;
    document.getElementById ("titleTD").width = 110;
    
    if (navigator.appName.indexOf("Microsoft") != -1) 
    {
      totalOrder.mainDiv.style.left = 2;
      totalOrder.mainDiv.style.top  = document.body.clientHeight-25;
    }
    else
    {
      totalOrder.mainDiv.style.left = 2;
      totalOrder.mainDiv.style.top  = document.body.clientHeight-29;
    }
    document.getElementById ("minButton").src="/images/hqwt/big_A.jpg";
    document.getElementById ("minButton").onclick=totalOrder.Max;
}

totalOrder.Max = function ()
{
    totalOrder.mainDiv.style.width = "626px";
    totalOrder.mainDiv.style.height = "394px";
    
    if (navigator.appName.indexOf("Microsoft") != -1) 
      document.getElementById ("totalOrderIframe").width = 620;
    else
      document.getElementById ("totalOrderIframe").width = 625;
    
    document.getElementById ("totalOrderIframe").height = 374;
    document.getElementById ("titleTD").width = 560;
    totalOrder.mainDiv.style.left = (parseInt(document.body.clientWidth) - 600)/2;
	  totalOrder.mainDiv.style.top  = (parseInt(document.body.clientHeight) - 500)/2;
	  document.getElementById ("minButton").src="/images/hqwt/small_A.jpg";
    document.getElementById ("minButton").onclick=totalOrder.Min;
}

totalOrder.displayDiv = function (keyValue)
{
	
	if(keyValue=="81")
	{
	    document.getElementById ("totalOrder_title").innerHTML = "综合排名-上证A股";
	    document.getElementById ("totalOrderIframe").src ="key8x.jsp?key=81";
	}
  else if(keyValue=="82")
  {
      document.getElementById ("totalOrder_title").innerHTML = "综合排名-上证B股";
      document.getElementById ("totalOrderIframe").src ="key8x.jsp?key=82";
  }
  else if(keyValue=="83")
  {
    document.getElementById ("totalOrder_title").innerHTML = "综合排名-深证A股";
    document.getElementById ("totalOrderIframe").src ="key8x.jsp?key=83";
  }
  else if(keyValue=="84")
  {
    document.getElementById ("totalOrder_title").innerHTML = "综合排名-深证B股";
    document.getElementById ("totalOrderIframe").src ="key8x.jsp?key=84";
  }
  else if(keyValue=="85")
  {
    document.getElementById ("totalOrder_title").innerHTML = "综合排名-上证债券";
    document.getElementById ("totalOrderIframe").src ="key8x.jsp?key=85";
  }
  else if(keyValue=="86")
  {
    document.getElementById ("totalOrder_title").innerHTML = "综合排名-深证债券";
    document.getElementById ("totalOrderIframe").src ="key8x.jsp?key=86";
  }
  else if(keyValue=="87")
  {
    document.getElementById ("totalOrder_title").innerHTML = "综合排名-沪深A股";
    document.getElementById ("totalOrderIframe").src ="key8x.jsp?key=87";
  }
  else if(keyValue=="88")
  {
    document.getElementById ("totalOrder_title").innerHTML = "综合排名-沪深B股";
    document.getElementById ("totalOrderIframe").src ="key8x.jsp?key=88";
  }
  else if(keyValue=="89")
  {
    document.getElementById ("totalOrder_title").innerHTML = "综合排名-中小企业";
    document.getElementById ("totalOrderIframe").src ="key8x.jsp?key=89";
  }
  
  
  document.getElementById ("minButton").src="/images/hqwt/small_A.jpg";
  document.getElementById ("minButton").onclick=totalOrder.Min;
  
  if (navigator.appName.indexOf("Microsoft") != -1) 
    document.getElementById ("totalOrderIframe").width = 620;
  else
    document.getElementById ("totalOrderIframe").width = 625;
  
  document.getElementById ("totalOrderIframe").height = 374;
  totalOrder.mainDiv.style.width="626px";
  totalOrder.mainDiv.style.height="394px";
  totalOrder.mainDiv.style.left = (parseInt(document.body.clientWidth) - 600)/2;
	totalOrder.mainDiv.style.top  = (parseInt(document.body.clientHeight) - 500)/2;
	totalOrder.mainDiv.style.display = "";
}

totalOrder.hiddenDiv = function()
{
	totalOrder.mainDiv.style.display = "none";
	document.getElementById ("totalOrderIframe").src="";
	//document.getElementById ("totalOrderIframe").src = "about:blank";
}