﻿function LoadFlash(url,wmode,width,Height,param)
{ 
document.write(
  '<embed src="' + url + '" FlashVars="'+param+'" wmode=' + wmode +
  ' quality="high" pluginspage=http://www.macromedia.com/go/getflashplayer type="application/x-shockwave-flash" width="' + width + 
  '" height="' + Height + '"></embed>');   
}


function resizepic(o)
{ 
var maxwidth=650;   //定义最大宽度
var maxheight=1200;  //定义最大高度
var a=new Image();
a.src=o.src
if(a.width > maxwidth)
{
  o.style.width=maxwidth;
}
if (a.height> maxheight)
{
  o.style.height=maxheight;
 }
}
//无级缩放图片大小
function bbimg(o)
{;}

var flag=false;

function DrawImage(ImgD,iwidth,iheight){
//参数(图片,允许的宽度,允许的高度)
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0){
flag=true;
if(image.width/image.height>= iwidth/iheight){
if(image.width>iwidth){ 
ImgD.width=iwidth;
ImgD.height=(image.height*iwidth)/image.width;
}else{
ImgD.width=image.width; 
ImgD.height=image.height;
}
}
else{
if(image.height>iheight){ 
ImgD.height=iheight;
ImgD.width=(image.width*iheight)/image.height; 
}else{
ImgD.width=image.width; 
ImgD.height=image.height;
}
}
}
}		
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

function menuhover(menuobj) {
	var links = menuobj.getElementsByTagName("a");
	
	ii=0
	for(i=0; i<links.length; i++) {
		
		links[i].onmouseover = function() {
			for(j=0; j<links.length; j++) {
				if(links[j].className=='here')ii=j;
				links[j].className = '';
			}
			this.className = 'here';
		}
		links[i].onmouseout = function() {
			for(j=0; j<links.length; j++) {
		           links[j].className = '';
				   links[ii].className = 'here';
				}
	}
	}
}

function topmenu () {
	if(!document.getElementById("menu")) return false;
	var menuobj = document.getElementById("menu");
	menuhover(menuobj);
}

function rightmenu () {
	if(!document.getElementById("news_list")) return false;
	var menuobj = document.getElementById("news_list");
	menuhover(menuobj);
}
addLoadEvent(topmenu);
addLoadEvent(rightmenu);