
//
/*全局通用JS
//51bxg.com
*/
//
document.write("<script type=\"text/javascript\" src=\"http://img.51bxg.com/51/common/js/swfobject.js?V=20090601\"></script>");
document.write("<script type=\"text/javascript\" src=\"http://img.51bxg.com/2009/js/jq-framework.js?V=20090601\"></script>");


//
/*
 * 舌签广告 开始                EDIT： QQH  WWW.51BXG.COM
 * 返回值：	无                  TIME： 2007.4.1
 */
 //
function GetObj(objName){
			if(document.getElementById){
				return eval('document.getElementById("' + objName + '")');
			}else if(document.layers){
				return eval("document.layers['" + objName +"']");
			}else{
				return eval('document.all.' + objName);
			}
}
function Obj_Menu(index,divname){
			for(var i=1;i<10;i++){/* 最多支持9个标签 */
				if(GetObj(divname+'_'+'c_'+i)&&GetObj(divname+'_'+'m_'+i)){
					GetObj(divname+'_'+'c_'+i).style.display = 'none';
					GetObj(divname+'_'+'m_'+i).className = "mOff";
				}
			}
			if(GetObj(divname+'_'+'c_'+index)&&GetObj(divname+'_'+'m_'+index)){
				GetObj(divname+'_'+'c_'+index).style.display = 'block';
				GetObj(divname+'_'+'m_'+index).className = "mOn";			
				//alert(divmenu)
			}
}




//
/* */
//
function SHDiv(e) {
    $("#" + e + "").hover(function() {
        $(this).removeClass("Mout").addClass("Mon"); $("#" + e + "_div").show();
        $("#" + e + "_div").hover(function() {
            $("#" + e + "").removeClass("Mout").addClass("Mon"); $(this).show();
        }, function() {
            $("#" + e + "").removeClass("Mon").addClass("Mout"); $(this).hide();
        });
    }, function() {
        $(this).removeClass("Mon").addClass("Mout"); $("#" + e + "_div").hide();
    });
}

//内容页面缩放文字大小
function FontSet(size) {
    $("#display_Content").css("font-size", "" + size + "px");
    $("#display_Content *:nth-child(n)").css("font-size", "" + size + "px");
}
function delHtmlTag(str)
{
  return str.replace(/<\/?.+?>/g,"");//去掉所有的html标记
} 

    
//内容页面收藏本页
function AddFavorite() {
//    if (document.all) {
//        window.external.addFavorite($("#News_url").val(), $("#News_title").val());
//    }
//    else if (window.sidebar) {
//        window.sidebar.addPanel($("#News_title").val(), $("#News_url").val(), "");
//    }

    window.external.AddFavorite(document.location.href, document.title)
    
    
}




/*---------------新闻的相关资讯-------------------  */
function ReturnXGnews(newsid,keyword,applay,countnum, htmltype, type,divid)
{  
  var Serial_news=newsid;
  var KeyWords_news=keyword;
  var Apply=applay;
  var CountNum=countnum;
  var HtmlType=htmltype;
  var type=type;
   
   $.ajax({
       
           url: "/loaddata/returnxgzx.aspx",
           data: "Serial_news="+Serial_news+"&KeyWords_news="+KeyWords_news+"&Apply="+Apply+"&CountNum="+CountNum+"&HtmlType="+HtmlType+"&type="+type,
           cache:false,
           error:function(e){
          // alert("服务器忙或操作过于频繁！");
       },
        
       success: function(msg){
          
          //$("#loadingxgzx").hide();
          $("#"+divid+" ul").html(msg);
       }
 
      });



}

/* 首页url curve */
function curveurl(url,parme)
{
   parme=escape(parme);
   
   window.open(url+"&propety_text="+parme);
}



///自适应图片大小
function DrawImage(FitWidth,FitHeight){
  if(document.getElementById('display_Content'))
  {
   $("#display_Content img").each(function()  {
    if($(this).attr("width")>680)
    {
     var image=new Image();
     image.src=$(this).attr("src");
     if(image.width>0 && image.height>0){
         if(image.width/image.height>= FitWidth/FitHeight){
             if(image.width>FitWidth){
                 $(this).attr("width",FitWidth);
                 $(this).attr("height",(image.height*FitWidth)/image.width);
             }else{
                 $(this).attr("width",image.width); 
                 $(this).attr("width",image.height); 
             }
         } else{
             if(image.height>FitHeight){
                 $(this).attr("height",FitHeight);
                 $(this).attr("widht",(image.width*FitHeight)/image.height)
               
             }else{
                 $(this).attr("width",image.width); 
                 $(this).attr("width",image.height); 
             } 
        }
     }
    }
     });
   }
 }

 //分页跳转
 function PagerJMP() {
     $("#pager_jmp_btn").click(function() {
         pageValue = $("#pager_jmp_text").val();
         window.location.href = '?Page=' + pageValue;
     });
 }

///****888888
///对cookie 进行处理
///**************

function delCookie(name){//为了删除指定名称的cookie，可以将其过期时间设定为一个过去的时间
   var date = new Date();
   
   date.setTime(date.getTime() - 10000);
   document.cookie = name + "=a; expires=" + date.toGMTString();
}



 
//写入 cookies 方法
function setCookie(name, value, expires, path, domain) {
    var Then = new Date() 
    Then.setTime(Then.getTime() + 60*1000*60*24*expires ) //60秒 
    document.cookie = name + "=" + escape(value) + ((expires) ? "; expires=" + Then.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "");
}

//获取 cookies 方法
function GetCookie(Name) {
    var search = Name + "=";
    var returnvalue = "";
    if (document.cookie.length > 0) {
        offset = document.cookie.indexOf(search);
        if (offset != -1) {
            offset += search.length;
            end = document.cookie.indexOf(";", offset);
            if (end == -1)
                end = document.cookie.length;
            returnvalue = unescape(document.cookie.substring(offset, end));
        }
    }
    return returnvalue;
}


//获取URL参数
function GetQueryString(name) {   
	var reg = new RegExp("(^|&)" + name  + "=([^&]*)(&|$)");   
	var r = window.location.search.substr(1).match(reg);   
	if ( r != null ) return  unescape(r[2]);  return null;
}


/*-----------图片自适应修改大--------------------------*/
var flag=false;
function AutoDrawImage(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;
}
ImgD.alt=image.width+"×"+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;
}
ImgD.alt=image.width+"×"+image.height;
}
}
} 

//价格指数滚动
function AutoScroll(obj){
        $(obj).find("div:first").animate({
                top:"-20px"
        },500,function(){
                $(this).css({top:"0px"}).find("ul:first").appendTo(this);
        });
}


/* 
 修改了滚动 鼠标放上不能停功能
*/
var AutoPlungs={
    _stopTime:3000,
    _obj:"",
    a:"",
    init:function(obj,stime){
       AutoPlungs._obj=obj;
       AutoPlungs._stopTime=parseInt(stime); 
       AutoPlungs.a=setInterval("AutoPlungs.start()", AutoPlungs._stopTime);  
        
    }, 
    start:function(){
       $(AutoPlungs._obj).find("div:first").animate({
                top:"-20px"
        },500,function(){
                $(this).css({top:"0px"}).find("ul:first").appendTo(this);
        }); 
       $(AutoPlungs._obj).bind("mousemove",function(){
         window.clearInterval(AutoPlungs.a);   
       });
       $(AutoPlungs._obj).bind("mouseout",function(){
        window.clearInterval(AutoPlungs.a);   
        AutoPlungs.a= setInterval("AutoPlungs.start()",AutoPlungs._stopTime)   
       });
       
    } 
}

/*
///文章图片处理
*/
eval(function(p,a,c,k,e,r){e=function(c){return c.toString(a)};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('7 d(b,c){5(e.f(\'8\')){$("#8 g").h(7(){5($(2).3("1")>i){j a=k l();a.9=$(2).3("9");5(a.1>0&&a.4>0){5(a.1/a.4>=b/c){5(a.1>b){$(2).3("1",b);$(2).3("4",(a.4*b)/a.1)}6{$(2).3("1",a.1);$(2).3("1",a.4)}}6{5(a.4>c){$(2).3("4",c);$(2).3("m",(a.1*c)/a.4)}6{$(2).3("1",a.1);$(2).3("1",a.4)}}}}});n()}}',24,24,'|width|this|attr|height|if|else|function|display_Content|src||||RestContent|document|getElementById|img|each|650|var|new|Image|widht|RestTable'.split('|'),0,{}))
 
/*
//文章表格撑破处理
*/
function RestTable(){$("#display_Content table").each(function(i){Tab_W=$(this).width();if(Tab_W>650){$(this).css({"width":"630px","border-collapse":"separate","padding":"0px","margin":"0px","table-layout":"fixed","word-wrap":"break-word","word-break":"break-all"})}});$("#display_Content table td").each(function(i){Tab_td_W=$(this).width();if(Tab_td_W>650){$(this).css({"width":"620px"})}})}




////留言反馈滚动
//function AutoScrollFeedBack(obj){
//          
//        $(obj).find("div:first").animate({
//                top:"-20px"
//        },500,function(){
//                $(this).css({top:"0px"}).find("ul:first").appendTo(this);
//        });
//}


/*
//焦点切换的js 
*/
var Class = {
  create: function() {
	return function() {
	  this.initialize.apply(this, arguments);
	}
  }
}

Object.extend = function(destination, source) {
	for (var property in source) {
		destination[property] = source[property];
	}
	return destination;
}

var TransformView = Class.create();
TransformView.prototype = {
  //容器对象,滑动对象,切换参数,切换数量
  initialize: function(containerflash, slider, parameter, count, options) {
	if(parameter <= 0 || count <= 0) return;
	var oContainer = document.getElementById(containerflash), oSlider = document.getElementById(slider), oThis = this;

	this.Index = 0;//当前索引
	
	this._timer = null;//定时器
	this._slider = oSlider;//滑动对象
	this._parameter = parameter;//切换参数
	this._count = count || 0;//切换数量
	this._target = 0;//目标参数
	
	this.SetOptions(options);
	
	this.Up = !!this.options.Up;
	this.Step = Math.abs(this.options.Step);
	this.Time = Math.abs(this.options.Time);
	this.Auto = !!this.options.Auto;
	this.Pause = Math.abs(this.options.Pause);
	this.onStart = this.options.onStart;
	this.onFinish = this.options.onFinish;
	
	oContainer.style.overflow = "hidden";
	oContainer.style.position = "relative";
	
	oSlider.style.position = "absolute";
	oSlider.style.top = oSlider.style.left = 0;
  },
  //设置默认属性
  SetOptions: function(options) {
	this.options = {//默认值
		Up:			true,//是否向上(否则向左)
		Step:		5,//滑动变化率
		Time:		10,//滑动延时
		Auto:		true,//是否自动转换
		Pause:		2000,//停顿时间(Auto为true时有效)
		onStart:	function(){},//开始转换时执行
		onFinish:	function(){}//完成转换时执行
	};
	Object.extend(this.options, options || {});
  },
  //开始切换设置
  Start: function() {
	if(this.Index < 0){
		this.Index = this._count - 1;
	} else if (this.Index >= this._count){ this.Index = 0; }
	
	this._target = -1 * this._parameter * this.Index;
	this.onStart();
	this.Move();
  },
  //移动
  Move: function() {
	clearTimeout(this._timer);
	var oThis = this, style = this.Up ? "top" : "left", iNow = parseInt(this._slider.style[style]) || 0, iStep = this.GetStep(this._target, iNow);
	
	if (iStep != 0) {
		this._slider.style[style] = (iNow + iStep) + "px";
		this._timer = setTimeout(function(){ oThis.Move(); }, this.Time);
	} else {
		this._slider.style[style] = this._target + "px";
		this.onFinish();
		if (this.Auto) { this._timer = setTimeout(function(){ oThis.Index++; oThis.Start(); }, this.Pause); }
	}
  },
  //获取步长
  GetStep: function(iTarget, iNow) {
	var iStep = (iTarget - iNow) / this.Step;
	if (iStep == 0) return 0;
	if (Math.abs(iStep) < 1) return (iStep > 0 ? 1 : -1);
	return iStep;
  },
  //停止
  Stop: function(iTarget, iNow) {
	clearTimeout(this._timer);
	this._slider.style[this.Up ? "top" : "left"] = this._target + "px";
  }
};

function oninitflash(divid,ulid,movewidth,NumID){

function Each(list, fun){
		for (var i = 0, len = list.length; i < len; i++) { fun(list[i], i); }
	};
	
	var imglength=$("#"+divid+" img").length;
	var objs2 = document.getElementById(NumID).getElementsByTagName("li");
	
	var tv2 = new TransformView(divid, ulid, movewidth, imglength, {
		onStart: function(){ Each(objs2, function(o, i){ o.className = tv2.Index == i ? "on" : ""; }) },//按钮样式
		Up: false
	});
	
	tv2.Start();
	
	Each(objs2, function(o, i){
		o.onmouseover = function(){
			o.className = "on";
			tv2.Auto = false;
			tv2.Index = i;
			tv2.Start();
		}
		o.onmouseout = function(){
			o.className = "";
			tv2.Auto = true;
			tv2.Start();
		}
	})
}

if (top.location != self.location) {
            top.location = self.location;
        }




