$(function(){
showMenu();
setNavStyle();
})



$(function(){	
							
		    $(window).scroll(function(){
									  
							   	var QQ_State=getCookie("QQ_State");
						
								
								
								if($("#qq").is(":animated"))
								{
							//$("#qq").stop(true);
								}
							
								if(QQ_State==2)
								{
									
									$("#qq").css("top",$(window).height()+$(window).scrollTop()-30)
								
								
								}
								else
								{
								
									var top=$(window).scrollTop()+100;
									$("#qq").animate({top:top},{duration:5,easing:"linear",queue:true})
								}
								
								
									  
									  })
			
			$("#qq #qqTop #qq_hide").click(function(){ 
													$(this).parent().parent().hide()
													 setCookie("QQ_State","0");
													 $(this).hide()
													 $("#qq_open").show()
													
													})
			
			$("#qq #qqTop #qq_open").click(function(){ 
														$(this).parent().parent().css("top",$(window).scrollTop()+100)
														 setCookie("QQ_State","1");
														 $(this).hide()
													    $("#qq_small").show()
													     $("#qqBody").show()
														$("#qqFooter").show()
														}
														
													)
			
			
			$("#qq #qqTop #qq_small").click(function(){ 
													 
													 $(this).parent().parent().animate({ 
																					   top:$(window).height()-$(this).height() -10 +$(window).scrollTop()
																					   },200,function(){
																						   
																						     setCookie("QQ_State","2");
																						      $("#qq_small").hide()
																						      $("#qqBody").hide()
																						      $("#qqFooter").hide()
													                                         $("#qq_open").show()
																						     
																						     
																																	   })
													 
													 })
			
		   })
//____________________________






function showMenu() 
{

$("#SideCategory .sideContent ul li").each(function(){

$(this).bind("click",
function(){ 
	$("ul",$(this)).toggle();
		
			})
}
)
CategoryId=$("#hd_CategoryId").attr("title");
if(CategoryId!="0")
{

 $("#SideCategory .sideContent ul li[ret="+CategoryId+"]").find("ul").show();

  
 
}
}


function setNavStyle()
{
var CategoryId=$("#hd_CategoryId").attr("title");
if(CategoryId==0)
{

 }
 else
 {
 $("#header  #Nav ul li").removeClass("Current");
$("#header  #Nav ul li a[href$="+CategoryId+".html]").parent().addClass("Current");
 
 }
 
}


//是否已经安装QQ
  function qqInstalled() {
      try {
            new ActiveXObject("QQ.QQAPI");
            return true;
      }
      catch (e) {
       alert("您还没有安装QQ");
            return false;
      }
  }
  //是否已经MSN
function messengerInstalled() {
      try {
            new ActiveXObject("MSNMessenger.P4QuickLaunch");
            return true;
      }
      catch (e) {
      alert("您还没有安装MSN");
      this.href="#";
            return false;
      }
  }






//等比缩小图片
function DrawImage(ImgD,FitWidth,FitHeight){
     var image=new Image();
     image.src=ImgD.src;
     if(image.width>0 && image.height>0){
         if(image.width/image.height>= FitWidth/FitHeight){
             if(image.width>FitWidth){
                 ImgD.width=FitWidth;
                 ImgD.height=(image.height*FitWidth)/image.width;
             }else{
                 ImgD.width=image.width; 
                ImgD.height=image.height;
             }
         }
          else{
             if(image.height>FitHeight){
                 ImgD.height=FitHeight;
                 ImgD.width=(image.width*FitHeight)/image.height;
             }else{
                 ImgD.width=image.width; 
                ImgD.height=image.height;
             } 
        }
     }
 }



//操作COOKIE
function  setCookie(name,value)  
 {  
     var Days = 30;   //此cookie将被保存30天  
     var exp = new Date(); 
     exp.setTime(exp.getTime() + Days*24*60*60*1000);  
     document.cookie = name + "=" + escape(value) 
		+ ";expires=" + exp.toGMTString();  
 }  
 function getCookie(name)  
 {  
     var arr,reg=new RegExp("(^|)"+name+"=([^;]*)(;|$)");  
     if(arr=document.cookie.match(reg))
	return unescape(arr[2]);  
     else
	return null;  
 }  
 function delCookie(name)  
 {  
     var exp = new Date();  
     exp.setTime(exp.getTime() - 1);  
     var cval=getCookie(name);  
     if(cval!=null) {
	document.cookie= name + "="+cval
		+";expires="+exp.toGMTString();
	}
 }


function ifocus()
{
    var pics="", links="", texts="";
    for(var i=1; i<imag.length; i++){pics=pics+("|"+imag[i]);links=links+("|"+link[i]);texts=texts+("|"+text[i]);}
    pics=pics.substring(1);links=links.substring(1);texts=texts.substring(1);
    var focus_width=497;
    var focus_height=327;
    var text_height=0;//标题高度
    var swf_height=focus_height+text_height;
    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="'+ focus_width +'" height="'+ swf_height +'">');
    document.write('<param name="allowScriptAccess" value="sameDomain">');
    document.write('<param name="movie" value="images/focus.swf">');
    document.write('<param name="quality" value="high">');
    document.write('<param name="bgcolor" value="#FFFFFF">');
    document.write('<param name="menu" value="false">');
    document.write('<param name=wmode value="opaque">');
    document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
    document.write('<embed src="images/focus.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#FFFFFF" quality="high" width="'+ focus_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">');
    document.write('</object>');
}

function showFlash()
{
     var swf_config = "|2|||0xFFFFFF|0xFF6600||4|3|1|_blank"
    var swf_width=497;
    var swf_height=327;

     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="/images/bcastr.swf?bcastr_xml_url=/data.xml"><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="/images/bcastr.swf?bcastr_xml_url=/data.xml" 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" wmode="transparent"/>');
     document.write('</object>');
}


        $(function(){
		   
		  
		    	$("#RcNt .title").bind("mouseover",function(dom){
																			 
																			 //alert("ok");
																		var index=$("#RcNt .title").removeClass("current_tab").addClass("con_tab").index($(this));
																		$(this).addClass("current_tab").removeClass("con_tab")
																	
															 $("#RcNc ul").hide()
															$($("#RcNc ul").get(index)).show()			
																			 })
		   
		   })
		   
		    $(function(){
		   
		  
		    	$("#mRcN .title").bind("mouseover",function(dom){
																			 
																			 //alert("ok");
																		var index=$("#mRcNt .title").removeClass("current_tab").addClass("con_tab").index($(this));
																		$(this).addClass("current_tab").removeClass("con_tab")
																	
															 $("#mRcNc ul").hide()
															$($("#mRcNc ul").get(index)).show()			
																			 })
		   
		   })
		   
		   
		   
		   		    $(function(){
		   
		  
		    	$("#sCTitle li").bind("mouseover",function(dom){
																			 
																			 //alert("ok");
															var index=$("#sCTitle li").removeClass("current_tab").addClass("con_tab").index($(this));
															$(this).addClass("current_tab").removeClass("con_tab")
																	
																	
															 $("#sCCont dt").hide()
															 
															$($("#sCCont dt").get(index)).show()
															
																	
																			 })
		   
		   })
		   
		   
		   
function scrollL(obj,obj1,obj2){

var d=document.getElementById(obj);
var d1=document.getElementById(obj1);
var d2=document.getElementById(obj2);
var speed3=25;//速度数值越大速度越慢
d2.innerHTML=d1.innerHTML;
function Marquee(){
if(d2.offsetWidth-d.scrollLeft<=0)
d.scrollLeft-=d1.offsetWidth;
else{
d.scrollLeft++
}
}
var MyMar=setInterval(Marquee,speed3)
d.onmouseover=function() {clearInterval(MyMar)}
d.onmouseout=function() {MyMar=setInterval(Marquee,speed3)}
}


function swf_obj(src,w,h,swfid){
	swf_html = '';
	swf_html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+w+'" height="'+h+'" id="'+swfid+'" align="middle">';
	swf_html += '<param name="allowScriptAccess" value="always">';
	swf_html += '<param name="movie" value="'+src+'">';
	swf_html += '<param name="quality" value="high">';
	swf_html += '<param name="bgcolor" value="#FFFFFF">';
	swf_html += '<param name="wmode" value="transparent">';
	swf_html += '<embed src="'+src+'" quality="high" bgcolor="#FFFFFF" width="'+w+'" height="'+h+'" name="'+swfid+'" align="middle" allowScriptAccess="always" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">';
	swf_html += '</object>';
	document.write(swf_html);
}

