﻿function showdiv(objname,t,a,linkname,classname,more,url){
for (i=1;i<a+1;i++){
document.getElementById(objname+i).style.display="none";
document.getElementById(linkname+i).className="";
}
if(document.getElementById(objname+t)){document.getElementById(objname+t).style.display="block";}
if(document.getElementById(linkname+t)){document.getElementById(linkname+t).className=classname;}
if(more!=""){
if(document.getElementById(more)){document.getElementById(more).href=url;}	
}
}
function printsetup(){
wb.execwb(8,1);     
}     
function printpreview(){     
wb.execwb(7,1);     
}
var Marquee;
function Marquee()
{
	this.ID = document.getElementById(arguments[0]);
	if(!this.ID)
	{
		this.ID = -1;
		return;
	}
	this.Direction = this.Width = this.Height = this.DelayTime = this.WaitTime = this.CTL = this.StartID = this.Stop = this.MouseOver = 0;
	this.Step = 1;
	this.Timer = 30;
	this.DirectionArray = {"top":0 , "up":0 , "bottom":1 , "down":1 , "left":2 , "right":3};
	if(typeof arguments[1] == "number" || typeof arguments[1] == "string")this.Direction = arguments[1];
	if(typeof arguments[2] == "number")this.Step = arguments[2];
	if(typeof arguments[3] == "number")this.Width = arguments[3];
	if(typeof arguments[4] == "number")this.Height = arguments[4];
	if(typeof arguments[5] == "number")this.Timer = arguments[5];
	if(typeof arguments[6] == "number")this.DelayTime = arguments[6];
	if(typeof arguments[7] == "number")this.WaitTime = arguments[7];
	if(typeof arguments[8] == "number")this.ScrollStep = arguments[8];
	this.ID.style.overflow = this.ID.style.overflowX = this.ID.style.overflowY = "hidden";
	this.ID.noWrap = true;
	this.IsNotOpera = (navigator.userAgent.toLowerCase().indexOf("opera") == -1);
	if(arguments.length >= 7)this.Start();
}

Marquee.prototype.Start = function()
{
	if(this.ID == -1)return;
	if(this.WaitTime < 800)this.WaitTime = 800;
	if(this.Timer < 20)this.Timer = 20;
	if(this.Width == 0)this.Width = parseInt(this.ID.style.width);
	if(this.Height == 0)this.Height = parseInt(this.ID.style.height);
	if(typeof this.Direction == "string")this.Direction = this.DirectionArray[this.Direction.toString().toLowerCase()];
	this.HalfWidth = Math.round(this.Width / 2);
	this.HalfHeight = Math.round(this.Height / 2);
	this.BakStep = this.Step;
	this.ID.style.width = this.Width + "px";
	this.ID.style.height = this.Height + "px";
	if(typeof this.ScrollStep != "number")this.ScrollStep = this.Direction > 1 ? this.Width : this.Height;
	var templateLeft = "<table cellspacing='0' cellpadding='0' style='border-collapse:collapse;display:inline;'><tr><td noWrap=true style='white-space: nowrap;word-break:keep-all;'>MSCLASS_TEMP_HTML</td><td noWrap=true style='white-space: nowrap;word-break:keep-all;'>MSCLASS_TEMP_HTML</td></tr></table>";
	var templateTop = "<table cellspacing='0' cellpadding='0' style='border-collapse:collapse;'><tr><td>MSCLASS_TEMP_HTML</td></tr><tr><td>MSCLASS_TEMP_HTML</td></tr></table>";
	var msobj = this;
	msobj.tempHTML = msobj.ID.innerHTML;
	if(msobj.Direction <= 1)
	{
		msobj.ID.innerHTML = templateTop.replace(/MSCLASS_TEMP_HTML/g,msobj.ID.innerHTML);
	}
	else
	{
		if(msobj.ScrollStep == 0 && msobj.DelayTime == 0)
		{
			msobj.ID.innerHTML += msobj.ID.innerHTML;
		}
		else
		{
			msobj.ID.innerHTML = templateLeft.replace(/MSCLASS_TEMP_HTML/g,msobj.ID.innerHTML);
		}
	}
	var timer = this.Timer;
	var delaytime = this.DelayTime;
	var waittime = this.WaitTime;
	msobj.StartID = function(){msobj.Scroll()}
	msobj.Continue = function()
				{
					if(msobj.MouseOver == 1)
					{
						setTimeout(msobj.Continue,delaytime);
					}
					else
					{	clearInterval(msobj.TimerID);
						msobj.CTL = msobj.Stop = 0;
						msobj.TimerID = setInterval(msobj.StartID,timer);
					}
				}

	msobj.Pause = function()
			{
				msobj.Stop = 1;
				clearInterval(msobj.TimerID);
				setTimeout(msobj.Continue,delaytime);
			}

	msobj.Begin = function()
		{
			msobj.ClientScroll = msobj.Direction > 1 ? msobj.ID.scrollWidth / 2 : msobj.ID.scrollHeight / 2;
			if((msobj.Direction <= 1 && msobj.ClientScroll <= msobj.Height + msobj.Step) || (msobj.Direction > 1 && msobj.ClientScroll <= msobj.Width + msobj.Step))			{
				msobj.ID.innerHTML = msobj.tempHTML;
				delete(msobj.tempHTML);
				return;
			}
			delete(msobj.tempHTML);
			msobj.TimerID = setInterval(msobj.StartID,timer);
			if(msobj.ScrollStep < 0)return;
			msobj.ID.onmousemove = function(event)
						{
							if(msobj.ScrollStep == 0 && msobj.Direction > 1)
							{
								var event = event || window.event;
								if(window.event)
								{
									if(msobj.IsNotOpera)
									{
										msobj.EventLeft = event.srcElement.id == msobj.ID.id ? event.offsetX - msobj.ID.scrollLeft : event.srcElement.offsetLeft - msobj.ID.scrollLeft + event.offsetX;
									}
									else
									{
										msobj.ScrollStep = null;
										return;
									}
								}
								else
								{
									msobj.EventLeft = event.layerX - msobj.ID.scrollLeft;
								}
								msobj.Direction = msobj.EventLeft > msobj.HalfWidth ? 3 : 2;
								msobj.AbsCenter = Math.abs(msobj.HalfWidth - msobj.EventLeft);
								msobj.Step = Math.round(msobj.AbsCenter * (msobj.BakStep*2) / msobj.HalfWidth);
							}
						}
			msobj.ID.onmouseover = function()
						{
							if(msobj.ScrollStep == 0)return;
							msobj.MouseOver = 1;
							clearInterval(msobj.TimerID);
						}
			msobj.ID.onmouseout = function()
						{
							if(msobj.ScrollStep == 0)
							{
								if(msobj.Step == 0)msobj.Step = 1;
								return;
							}
							msobj.MouseOver = 0;
							if(msobj.Stop == 0)
							{
								clearInterval(msobj.TimerID);
								msobj.TimerID = setInterval(msobj.StartID,timer);
							}
						}
		}
	setTimeout(msobj.Begin,waittime);
}

Marquee.prototype.Scroll = function()
{
	switch(this.Direction)
	{
		case 0:
			this.CTL += this.Step;
			if(this.CTL >= this.ScrollStep && this.DelayTime > 0)
			{
				this.ID.scrollTop += this.ScrollStep + this.Step - this.CTL;
				this.Pause();
				return;
			}
			else
			{
				if(this.ID.scrollTop >= this.ClientScroll)
				{
					this.ID.scrollTop -= this.ClientScroll;
				}
				this.ID.scrollTop += this.Step;
			}
		break;

		case 1:
			this.CTL += this.Step;
			if(this.CTL >= this.ScrollStep && this.DelayTime > 0)
			{
				this.ID.scrollTop -= this.ScrollStep + this.Step - this.CTL;
				this.Pause();
				return;
			}
			else
			{
				if(this.ID.scrollTop <= 0)
				{
					this.ID.scrollTop += this.ClientScroll;
				}
				this.ID.scrollTop -= this.Step;
			}
		break;

		case 2:
			this.CTL += this.Step;
			if(this.CTL >= this.ScrollStep && this.DelayTime > 0)
			{
				this.ID.scrollLeft += this.ScrollStep + this.Step - this.CTL;
				this.Pause();
				return;
			}
			else
			{
				if(this.ID.scrollLeft >= this.ClientScroll)
				{
					this.ID.scrollLeft -= this.ClientScroll;
				}
				this.ID.scrollLeft += this.Step;
			}
		break;

		case 3:
			this.CTL += this.Step;
			if(this.CTL >= this.ScrollStep && this.DelayTime > 0)
			{
				this.ID.scrollLeft -= this.ScrollStep + this.Step - this.CTL;
				this.Pause();
				return;
			}
			else
			{
				if(this.ID.scrollLeft <= 0)
				{
					this.ID.scrollLeft += this.ClientScroll;
				}
				this.ID.scrollLeft -= this.Step;
			}
		break;
	}
}
/*
 * Copyright (c) 2006, www.never-online.net! Inc. All rights reserved.
 * web       : http://www.never-online
 * author    : never-online, BlueDestiny
 * version   : 0.10.0 
 * browser   : IE 6.0, Opera 9.01, Mozilla 1.5
 * history   : simulateSelect v0.1  -- batch simulate select, only in IE browser.
 *             this version neverCombox RC1 -- batch simulate select, can be run in IE, Opera, and Mozilla
 *                                         can be editable select
 */ 


function $(objID) { 
  return document.getElementById(objID); 
}
function addEvent(w, e, f) {
  if (document.all) {
    w.attachEvent(('on'+e), f);
  } else {
    w.addEventListener(e, f, false);
  }
}
function Offset(e)
{
  var t = e.offsetTop;
  var l = e.offsetLeft;
  var w = e.offsetWidth;
  var h = e.offsetHeight-1;

  while(e=e.offsetParent)
  {
    t+=e.offsetTop;
    l+=e.offsetLeft;
  }
  return {
    top : t,
    left : l,
    width : w,
    height : h
  }
}
var browser = {};

browser.isMozilla = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined') && (typeof HTMLDocument!='undefined');
browser.isIE = window.ActiveXObject ? true : false;
browser.isOpera = (navigator.userAgent.toLowerCase().indexOf("opera")!=-1);

function neverCombox() { with(this)
{
  // Custom Variables.
  this.debug = false;
  this.height = 18;
  this.width = null;
  this.number = null;
  this.edit = false;
  this.onchange = null;


  // System Variables.
  this._ctlIDs = [];
  this._offsets = {};
  this._this = this;
  this._value = null;
  this._onchangeArgs = [];
  this._ctlStyle = "ctlSelect";
  this._selStyle = "selected";
  this._unselStyle = "unselected";
  this._arowStyle = "arow";
  this._eltprefix = "e__";
  this._iptprefix = "i__";
  this._wprprefix = "w__";
  this._arwprefix = "a__";

  this.chkWrapper = function(ctlSelID) { with(this)
  {
    if (!$(_wprprefix+ctlSelID))
    {
      var mWrapper = _this.buildWrapper(ctlSelID, _offsets.ctlSelID);
      this.addOptions(ctlSelID);
    } else {
      var mWrapper = $(_wprprefix+ctlSelID);
    }
    return mWrapper;
  }};

  this.buildWrapper = function(ctlSelID, ctlOffset) { with(this)
  {
    var mWrapper, mWOffsets;
    mWOffsets = Offset($(_iptprefix+ctlSelID)); // real offset
    mWrapper = document.createElement("DIV");
    document.body.appendChild(mWrapper);
    mWrapper.style.position = "absolute";
    mWrapper.style.display = "none";
    mWrapper.setAttribute("id", _wprprefix+ctlSelID);
    //mWrapper.className = _ctlStyle;
    mWrapper.style.left = mWOffsets.left +'px';
    mWrapper.style.top = (parseInt(mWOffsets.top) + parseInt(mWOffsets.height)) +'px';
    if (number)
    {
      mWrapper.style.height = (height * number) +'px';
      mWrapper.style.overflow = "auto";
    }
    function checkMouseDown(evt) {
      var el = window.event?event.srcElement:evt.target;
      if( el.id.indexOf(_eltprefix+ctlSelID)>-1 || 
      el.id.indexOf(_iptprefix+ctlSelID)>-1 || 
      el.id.indexOf(_wprprefix+ctlSelID)>-1 || 
      el.id.indexOf(_arwprefix+ctlSelID)>-1 )
      {
        return;
      }
      $(_wprprefix+ctlSelID).style.display="none";
      $(_iptprefix+ctlSelID).className = _ctlStyle
    }
      // register event, need event manager
    addEvent(document,'mousedown',checkMouseDown);
    return mWrapper;
  }};

  this.addOption = function(ctlSelID, text, value, idx) { with(this)
  {
    var nWrapper;
    var ctlObj = $(ctlSelID);
    var iptObj = $(_iptprefix+ctlSelID);
    var mWrapper = $(_wprprefix+ctlSelID);

    nWrapper = document.createElement("DIV");
    mWrapper.appendChild(nWrapper);
    nWrapper.setAttribute("id", nWrapper.id = _eltprefix+ctlSelID+idx);
    nWrapper.style.cursor = "default";
    nWrapper.innerHTML = nWrapper.title = text;
    nWrapper.style.height = height+'px';
    nWrapper.setAttribute("ctlValue", value);

    nWrapper.onmouseover = function()
    {
      for (var j=0; j<mWrapper.childNodes.length; j++) 
      {
        if (mWrapper.childNodes[j]==this) mWrapper.childNodes[j].className = _selStyle; 
        else mWrapper.childNodes[j].className = _unselStyle; 
      }
    };
    nWrapper.onselectstart = nWrapper.onclick = function()
    {
      iptObj.value = this.innerHTML;
      iptObj.setAttribute("ctlValue", this.getAttribute("ctlValue"));
      mWrapper.style.display = "none";
      //iptObj.className = _selStyle;
      if (onchange && _value != iptObj.value)
      {
        onchange.apply(this,_onchangeArgs);
        _value = iptObj.value;
      }
      event.returnValue = false;
    };

    return nWrapper;
  }};

  this.addOptions = function(ctlSelID) { with(this)
  {
    var ctlObj = $(ctlSelID);
    var mWrapper = $(_wprprefix+ctlSelID);
    for (var i=0; i<ctlObj.length; i++)
    {
      nWrapper = _this.addOption(ctlSelID, ctlObj[i].text, ctlObj[i].value, i)
      if (ctlObj[i].value==_this.getValue(ctlSelID)) 
      { 
        nWrapper.className = _selStyle; 
      } else { 
        nWrapper.className = _unselStyle; 
      }
    }
  }};

  this.simulates = function() { with(this)
  {
    var ret=false;
    for (var i=0; i<_ctlIDs.length; i++)
    ret=_this.simulate(_ctlIDs[i]);
    return ret;
  }};
  this.simulate = function(ctlSelID) { with (this)
  {
    var ctlOffset;
    var iptObj, arwObj, ctlObj; 
    
    ctlObj = $(ctlSelID);
    ctlOffset = Offset(ctlObj);

    iptObj = document.createElement("INPUT");
    arwObj = document.createElement("INPUT");
    arwObj.type = "button";
    arwObj.setAttribute("id", _arwprefix+ctlSelID);
    //Mozilla and Opera browser do not support "Webdings" fontfamily
    if (browser.isIE) {//arwObj.value = "▼";
      arwObj.value = "6";
      arwObj.style.fontFamily = "Webdings";
    } else {
      arwObj.value = "⊿";
    }
    arwObj.style.width = height +'px';
    arwObj.onclick = function()
    {
      this.blur();
      _this.expand(ctlSelID);
    };
    if (!edit)
    {
      iptObj.onclick = iptObj.onselectstart = function()
      {
        _this.expand(ctlSelID);
        event.returnValue = false; 
      }
    }
    iptObj.setAttribute("id", _iptprefix+ctlSelID);
    iptObj.title = arwObj.title = "click expand options";
    iptObj.style.cursor = arwObj.style.cursor = "pointer";
	iptObj.style.border="0px";
    iptObj.className = _ctlStyle;
    arwObj.className = _arowStyle;
    iptObj.style.width = (parseInt(width) || ctlObj.offsetWidth) +'px';
    if (height) iptObj.style.height = arwObj.style.height = height+'px';
    
    for (var i=0; i<ctlObj.length; i++)
    {
      if (ctlObj[i].defaultSelected)
      {
        iptObj.value = _value = ctlObj[i].text;
        iptObj.setAttribute("ctlValue", ctlObj[i].value);
        break;
      }
    }

    if (!_value)
    {
      iptObj.value = _value = ctlObj[0].text;
      iptObj.setAttribute("ctlValue", ctlObj[0].value);
    }

    if (!edit) iptObj.readOnly=true;

    if (!$(_arwprefix+ctlSelID)) ctlObj.parentNode.insertBefore(arwObj, ctlObj.nextSibling||null);
    if (!$(_iptprefix+ctlSelID)) ctlObj.parentNode.insertBefore(iptObj, ctlObj.nextSibling||null);
    if (!debug) ctlObj.style.display = 'none';
    _offsets.ctlSelID = ctlOffset;
    iptObj.style.height = height +'px';
    if (parseInt(iptObj.offsetHeight)>height) {
      arwObj.style.height = iptObj.offsetHeight;
    }

    return true;
  }};
  //return this;
}};

// public api
neverCombox.prototype.init = function(ctlSelIDs) { with(this)
{
  _this.addCombox(ctlSelIDs);
  this.simulates();
}};

neverCombox.prototype.setStyles = function(ctlStyle, selStyle, unselStyle) { with(this)
{
  _ctlStyle = arguments[0], _selStyle = arguments[1], 
  _unselStyle = arguments[2]; _arowStyle = arguments[3];

}};

neverCombox.prototype.getValue = function(ctlSelID) { with(this)
{
  if ($(_iptprefix+ctlSelID)) return $(_iptprefix+ctlSelID).getAttribute("ctlValue");
  else return null;
}};

neverCombox.prototype.getText = function(ctlSelID) { with(this)
{
  if ($(_iptprefix+ctlSelID)) return $(_iptprefix+ctlSelID).value;
  else return null;
}};

neverCombox.prototype.setOnchangeHandler = function(func) { with(this)
{
  if (typeof(func)!="function")
  return window.alert('never combox setOnchangeHandler handler Error\n\n"' + f.toString() + '" not a function or not initialize before setOnchangeHandler handler method.');
  onchange = f;
  if (arguments.length > 0)
  for (var i=0; i<arguments.length; i++)
  _onchangeArgs[i-1] = arguments[i];
}};

neverCombox.prototype.addItem = function(ctlSelID, text, value) { with(this)
{
  if (!edit) return -1; this.chkWrapper(ctlSelID);
  var ctlObj = $(ctlSelID); if (!ctlObj) return "argument must be has ctlSelID";
  for (var i=0; i<$(ctlSelID).length; i++)
  if ($(ctlSelID)[i].value==value) return window.alert('never combox:\nthis value "' + value + '" has been exists!');
  $(ctlSelID).options.add(new Option(text||value, value, false, false)); this.simulate(ctlSelID);
  if ($(_wprprefix+ctlSelID)) _this.addOption(ctlSelID, text||value, value, $(ctlSelID).length-1);
  return true;
}};

neverCombox.prototype.removeItem = function(ctlSelID, idx) { with(this)
{
  if (!edit) return -1;
  var isremoved = false;
  var ctlObj = $(ctlSelID); if (!ctlObj) return "argument must be has ctlSelID";
  var mWrapper = this.chkWrapper(ctlSelID);
  var iptObj = $(_iptprefix+ctlSelID);
  idx = parseInt(idx); idx<-1?idx=0:(idx>ctlObj.length?idx=ctlObj.length:"");
  for (var j=0; j<mWrapper.childNodes.length; j++) 
  {
    if (idx==j)
    {
      mWrapper.childNodes[j].parentNode.removeChild(mWrapper.childNodes[j]);
      ctlObj.remove(j);
      iptObj.value=(mWrapper.childNodes[j+1])?mWrapper.childNodes[j+1].innerHTML:"";
      var value = (mWrapper.childNodes[j+1])?mWrapper.childNodes[j+1].getAttribute("ctlValue"):"";
      iptObj.setAttribute("ctlValue", value);
      isremoved = true;
    }
  }
  return isremoved;
}};

neverCombox.prototype.writeItem = function(ctlSelID, idx, text, value) { with(this)
{
  if (!edit) return -1;
  var iswrited = false;
  var ctlObj = $(ctlSelID); if (!ctlObj) return "argument must be has ctlSelID";
  var mWrapper = this.chkWrapper(ctlSelID);
  var iptObj = $(_iptprefix+ctlSelID);
  idx = parseInt(idx); idx<-1?idx=0:(idx>ctlObj.length?idx=ctlObj.length:"");
  for (var j=0; j<mWrapper.childNodes.length; j++) 
  {
    if (idx==j)
    {
      mWrapper.childNodes[j].innerHTML=text;
      mWrapper.childNodes[j].setAttribute("ctlValue", text||value);
      ctlObj.options[j].text=text, ctlObj.options[j].value=text||value;
      iptObj.value=text;
      iptObj.setAttribute("ctlValue", text||value);
      iswrited = true;
    }
  }
  return iswrited;
}};

neverCombox.prototype.getSelectedIndex = function(ctlSelID) { with(this)
{
  var ctlObj = $(ctlSelID); if (!ctlObj) { window.alert("arguments Object must be has ctlSelID"); return -1; }
  var mWrapper = this.chkWrapper(ctlSelID);
  for (var j=0; j<mWrapper.childNodes.length; j++) 
  {
    if (mWrapper.childNodes[j].getAttribute("ctlValue")==_this.getValue(ctlSelID)) 
    return j;
  }
  return -1;
}};

neverCombox.prototype.addCombox = function(ctlSelIDs) { with(this)
{
  if (ctlSelIDs.indexOf(",")>0)
  {
    var aCtlSel = ctlSelIDs.split(",");
    for(var i=0; i<aCtlSel.length; i++)
    _ctlIDs.push(aCtlSel[i]);
  } else { _ctlIDs.push(ctlSelIDs) };
  return 1;
}};


neverCombox.prototype.expand = function(ctlSelID) { with(this)
{
  var mWrapper = this.chkWrapper(ctlSelID);
  var iOffsets = Offset($(_iptprefix+ctlSelID));
	var arwObj = $(_arwprefix+ctlSelID)
  var iptObj = $(_iptprefix+ctlSelID);
  var ctlObj = $(ctlSelID);
  var element;

  iptObj.className = _ctlStyle;
  mWrapper.className = _ctlStyle;
  mWrapper.style.left = iOffsets.left+'px';
  mWrapper.style.top = (iOffsets.top+iOffsets.height)+'px';
	mWrapper.style.width = iptObj.offsetWidth+arwObj.offsetWidth+'px';

  if (mWrapper.style.display=="none")
  {
    for (var i=0; i<ctlObj.length; i++)
    {
      element = $(_eltprefix+ctlSelID+i);
      if (ctlObj[i].value==_this.getValue(ctlSelID) && element) {
        element.className = _selStyle;
      } else if (element) {
        element.className = _unselStyle;
      }
    }
    mWrapper.style.display = "block";
    return true;
  }

  if (mWrapper.style.display=="block")
  {
    mWrapper.style.display = "none";
    //iptObj.className = _selStyle;
    return true;
  }

  return false;
}};

neverCombox.prototype.restore = function(ctlSelID) { with(this)
{
  if ($(ctlSelID).style.display=="none") {
    $(ctlSelID).style.display = "";
    $(_eltprefix+ctlSelID).style.display =
    $(_iptprefix+ctlSelID).style.display =
    $(_wprprefix+ctlSelID).style.display =
    $(_arwprefix+ctlSelID).style.display = "none";
  } else {
    $(ctlSelID).style.display=="none";
    if ($(_eltprefix+ctlSelID)) {
      $(_eltprefix+ctlSelID).style.display =
      $(_iptprefix+ctlSelID).style.display =
      $(_wprprefix+ctlSelID).style.display =
      $(_arwprefix+ctlSelID).style.display = "none";
    }
  }
}};
