function imgInit(imgName) {
  var i;  var j;
  
  if(!window.actImages) window.actImages = new Object();

  if(document.getElementById) window.actImages[imgName] = document.getElementById(imgName);
  else if(document.images)  window.actImages[imgName] = document.images[imgName];
  else if(document.all) window.actImages[imgName] = document.all[imgName];
  else if(document[imgName])  window.actImages[imgName] = document[imgName];
  
  window.actImages[imgName+'_'] = new Image();
  window.actImages[imgName+'_'].src = window.actImages[imgName].src;
  
  i = window.actImages[imgName].src.lastIndexOf('.'); if(i == -1) i = window.actImages[imgName].src.length;
  for(j=1; j<arguments.length; j++) {
    window.actImages[imgName+arguments[j]] = new Image();
    window.actImages[imgName+arguments[j]].src = window.actImages[imgName].src.substring(0, i) + arguments[j] + window.actImages[imgName].src.substring(i);
  }
}

function imgAct(imgName) {
  var i;
  
  if(!window.actImages) window.actImages = new Object();
  if(!window.actImages[imgName]) {
    if(document.getElementById) window.actImages[imgName] = document.getElementById(imgName);
    else if(document.images)  window.actImages[imgName] = document.images[imgName];
    else if(document.all) window.actImages[imgName] = document.all[imgName];
    else if(document[imgName])  window.actImages[imgName] = document[imgName];
  }
  if(window.actImages[imgName]) {
    if(!window.actImages[imgName+'_']) {
      window.actImages[imgName+'_'] = new Image();
      window.actImages[imgName+'_'].src = window.actImages[imgName].src;
      
      if(arguments.length > 1) {
        if(!window.actImages[imgName+arguments[1]]) {
          window.actImages[imgName+arguments[1]] = new Image();
          
          i = window.actImages[imgName].src.lastIndexOf('.'); if(i == -1) i = window.actImages[imgName].src.length;
          window.actImages[imgName+arguments[1]].src = window.actImages[imgName].src.substring(0, i) + arguments[1] + window.actImages[imgName].src.substring(i);
        }
        window.actImages[imgName].src = window.actImages[imgName+arguments[1]].src;
      }
    }
    else {
      if(arguments.length > 1) {
        if(!window.actImages[imgName+arguments[1]]) {
          window.actImages[imgName+arguments[1]] = new Image();
          
          i = window.actImages[imgName].src.lastIndexOf('.'); if(i == -1) i = window.actImages[imgName].src.length;
          window.actImages[imgName+arguments[1]].src = window.actImages[imgName].src.substring(0, i) + arguments[1] + window.actImages[imgName].src.substring(i);
        }
        window.actImages[imgName].src = window.actImages[imgName+arguments[1]].src;
      }
      else  window.actImages[imgName].src = window.actImages[imgName+'_'].src;
    }
  }
}

function Lastest(url, win) { 
  var x = (screen.width - 566)/2;
  var y = (screen.height - 600)/2;
  var opt = "left=" + x + ",top=" + y + ",width=539,height=430,scrollbars=yes";
  window.open(url, win, opt); 
}

function openwin(url){
    popupWindow = window.open(url,'NewsWindow','directories=no,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,titlebar=no,toolbar=no,width=520,height=500');
		popupWindow.opner = window;
		popupWindow.focus();
}

function openwin1(url){
    popupWindow = window.open(url,'NewsWindow','directories=no,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,titlebar=no,toolbar=no,width=635,height=500');
		popupWindow.opner = window;
		popupWindow.focus();
}


topMenu.Registry = []
topMenu.aniLen = 150
topMenu.hideDelay = 250
topMenu.minCPUResolution = 10

// constructor
function topMenu(id, dir, left, top, width, height)
{
	this.ie  = document.all ? 1 : 0
	this.ns4 = document.layers ? 1 : 0
	this.dom = document.getElementById ? 1 : 0

	if (this.ie || this.ns4 || this.dom) {
		this.id			 = id
		this.dir		 = dir
		this.orientation = dir == "left" || dir == "right" ? "h" : "v"
		this.dirType	 = dir == "right" || dir == "down" ? "-" : "+"
		this.dim		 = this.orientation == "h" ? width : height
		this.hideTimer	 = false
		this.aniTimer	 = false
		this.open		 = false
		this.over		 = false
		this.startTime	 = 0

		// global reference to this object
		this.gRef = "topMenu_"+id
		eval(this.gRef+"=this")

		// add this menu object to an internal list of all menus
		topMenu.Registry[id] = this

		var d = document

                var strCSS = '<style type="text/css">';
                strCSS += '#' + this.id + 'Container { visibility:hidden; '
		strCSS += 'left:' + left + 'px; '
		strCSS += 'top:' + top + 'px; '
		strCSS += 'overflow:hidden; z-index:10000; }'
		strCSS += '#' + this.id + 'Container, #' + this.id + 'Content { position:absolute; '
		strCSS += 'width:' + width + 'px; '
		strCSS += 'height:' + height + 'px; '
		strCSS += 'clip:rect(0 ' + width + ' ' + height + ' 0); '
		strCSS += '}'
                strCSS += '</style>';

                d.write(strCSS)

		this.load()
	}
}

topMenu.prototype.load = function() {
	var d = document
	var lyrId1 = this.id + "Container"
	var lyrId2 = this.id + "Content"
	var obj1 = this.dom ? d.getElementById(lyrId1) : this.ie ? d.all[lyrId1] : d.layers[lyrId1]
	if (obj1) var obj2 = this.ns4 ? obj1.layers[lyrId2] : this.ie ? d.all[lyrId2] : d.getElementById(lyrId2)
	var temp

	if (!obj1 || !obj2) window.setTimeout(this.gRef + ".load()", 100)
	else {
		this.container	= obj1
		this.menu		= obj2
		this.style		= this.ns4 ? this.menu : this.menu.style
		this.homePos	= eval("0" + this.dirType + this.dim)
		this.outPos		= 0
		this.accelConst	= (this.outPos - this.homePos) / topMenu.aniLen / topMenu.aniLen 

		// set event handlers.
		if (this.ns4) this.menu.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT);
		this.menu.onmouseover = new Function("topMenu.showMenu('" + this.id + "')")
		this.menu.onmouseout = new Function("topMenu.hideMenu('" + this.id + "')")

		//set initial state
		this.endSlide()
	}
}
	
topMenu.showMenu = function(id)
{
	var reg = topMenu.Registry
	var obj = topMenu.Registry[id]
	
	if (obj.container) {
		obj.over = true

		// close other menus.
		for (menu in reg) if (id != menu) topMenu.hide(menu)

		// if this menu is scheduled to close, cancel it.
		if (obj.hideTimer) { reg[id].hideTimer = window.clearTimeout(reg[id].hideTimer) }

		// if this menu is closed, open it.
		if (!obj.open && !obj.aniTimer) reg[id].startSlide(true)
	}
}

topMenu.hideMenu = function(id)
{
	// schedules the menu to close after <hideDelay> ms, which
	// gives the user time to cancel the action if they accidentally moused out
	var obj = topMenu.Registry[id]
	if (obj.container) {
		if (obj.hideTimer) window.clearTimeout(obj.hideTimer)
		obj.hideTimer = window.setTimeout("topMenu.hide('" + id + "')", topMenu.hideDelay);
	}
}

topMenu.hide = function(id)
{
	var obj = topMenu.Registry[id]
	obj.over = false

	if (obj.hideTimer) window.clearTimeout(obj.hideTimer)
	
	// flag that this scheduled event has occured.
	obj.hideTimer = 0

	// if this menu is open, close it.
	if (obj.open && !obj.aniTimer) obj.startSlide(false)
}

topMenu.prototype.startSlide = function(open) {
	this[open ? "onactivate" : "ondeactivate"]()
	this.open = open
	if (open) this.setVisibility(true)
	this.startTime = (new Date()).getTime()	
	this.aniTimer = window.setInterval(this.gRef + ".slide()", topMenu.minCPUResolution)
}

topMenu.prototype.slide = function() {
	var elapsed = (new Date()).getTime() - this.startTime
	if (elapsed > topMenu.aniLen) this.endSlide()
	else {
		var d = Math.round(Math.pow(topMenu.aniLen-elapsed, 2) * this.accelConst)
		if (this.open && this.dirType == "-")		d = -d
		else if (this.open && this.dirType == "+")	d = -d
		else if (!this.open && this.dirType == "-")	d = -this.dim + d
		else										d = this.dim + d

		this.moveTo(d)
	}
}

topMenu.prototype.endSlide = function() {
	this.aniTimer = window.clearTimeout(this.aniTimer)
	this.moveTo(this.open ? this.outPos : this.homePos)
	if (!this.open) this.setVisibility(false)
	if ((this.open && !this.over) || (!this.open && this.over)) {
		this.startSlide(this.over)
	}
}

topMenu.prototype.setVisibility = function(bShow) { 
	var s = this.ns4 ? this.container : this.container.style
	s.visibility = bShow ? "visible" : "hidden"
}
topMenu.prototype.moveTo = function(p) { 
	this.style[this.orientation == "h" ? "left" : "top"] = this.ns4 ? p : p + "px"
}
topMenu.prototype.getPos = function(c) {
	return parseInt(this.style[c])
}

// events
topMenu.prototype.onactivate		= function() { }
topMenu.prototype.ondeactivate	= function() { }










// DEFINING INSTANCES OF MENU
new topMenu("menu1", "down", 281, 40, 160, 130)
new topMenu("menu2", "down", 346, 40, 140, 130)
new topMenu("menu3", "down", 430, 40, 140, 130)
new topMenu("menu4", "down", 430, 40, 140, 130)
new topMenu("menu5", "down", 430, 40, 140, 130)
new topMenu("menu6", "down", 430, 40, 140, 130)
new topMenu("menu7", "down", 691, 40, 140, 78)
new topMenu("menu8", "down", 771, 40, 140, 130)

function openWin(theURL,winName,features) {
  window.open(theURL,winName,features);
}
