﻿function setCss(a,c){
  var b=document.getElementById(a);	
  if(b){		
	  b.className=c;
	  }
}

/*导航效果*/
$(document).ready(function(){
	$(".navbtn h3").each(function(index){
		$(this).mouseover(function(){
			navOn(index);
			
		});
	})
	$(".menu").mouseover(function(){
		navOff();
	})
	$(".top_2").mouseover(function(){
		navOff();
	})	
	$(".MainBody").mouseover(function(){
		navOff();
	})
	$(".PageBody").mouseover(function(){
		navOff();
	})
})
function navOn(obj){
	$(".navbtn div").each(function(index){
		if(obj==index){
			if($(".navbtn div").eq(obj).css("display")=="none"){
				$(".navbtn div").eq(obj).slideDown();
			}
		}else{
			if($(".navbtn div").eq(index).css("display")!="none"){
				$(".navbtn div").eq(index).slideUp("fast");
			}
		}
	})
}
function navOff(){
	$(".navbtn div").each(function(index){
		if($(this).css("display")!="none"){
			var tt=setTimeout("$('.navbtn div').eq("+index+").slideUp();",10)
		}
	})
}

function DrawImage(MyPic,W,H){
  var flag=false;
  var image=new Image();
  image.src=MyPic.src;
  if(image.width>0 && image.height>0){
    flag=true;
    if(image.width/image.height>= W/H){
      if(image.width>W){
        MyPic.width=W;
        MyPic.height=(image.height*W)/image.width;
      }
	  else{
        MyPic.width=image.width;
        MyPic.height=image.height;
      }
    }
    else{
      if(image.height>H){
        MyPic.height=H;
        MyPic.width=(image.width*H)/image.height;
      }
	  else{
        MyPic.width=image.width;
        MyPic.height=image.height;
      }
    }
  }
}

function Img_swf(swf_width,swf_height)
{
// 0xffffff:文字颜色|1:文字位置|0x0066ff:文字背景颜色|60:文字背景透明度|0xffffff:按键文字颜色|0x0066ff:按键默认颜色|0x000033:按键当前颜色|8:自动播放时间(秒)|2:图片过渡效果|1:是否显示按钮|_blank:打开窗口
    var swf_config;
    swf_config = "0xFFFFFF|2|0x0066ff|60|0xFFFFFF|0xFF6600||4|3|1|_blank"
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ swf_width +'" height="'+ swf_height +'">');
	document.write('<param name="movie" value="/swf/bcastr.swf?bcastr_xml_url=main_advs.asp"><param name="quality" value="high">');
	document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
	document.write('<param name="FlashVars" value="bcastr_config='+swf_config+'">');
	document.write('<embed src="/swf/bcastr.swf?bcastr_xml_url=main_advs.asp" wmode="opaque" FlashVars="bcastr_config='+swf_config+'" menu="false" quality="high" width="'+ swf_width +'" height="'+ swf_height +'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'); 
	document.write('</object>');

}

  <!--
//得到某一元素的绝对位置,不管该元素嵌套在多复杂的位置里
function getElementPos(obj)
{
	var left = 0;
	var top = 0;

	if(obj.x)
	{
		left= obj.x;
		top = obj.y;
	}else if(obj.offsetParent)
	{	
		while(obj.offsetParent)
		{		
			left += obj.offsetLeft;
			top  += obj.offsetTop;
			obj = obj.offsetParent;
		} 
	}

	return [left,top];//封装在一个数组里
}

function showDiv(a,b)
{
	var mydiv = document.getElementById(a);
	var pos = getElementPos(document.getElementById(b));
	mydiv.style.display = "";

	mydiv.style.left = pos[0] - document.getElementById(a).offsetWidth;
	mydiv.style.top = pos[1];
}
function hidDiv(a)
{
	document.getElementById(a).style.display='none';
}
