﻿/*
全局通用JS  51bxg.com
*/
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}('1.2("<0 3=\\"4/5\\" 6=\\"7://8.9.a.b/c/d/h.e?f=g\\"><\\/0>");1.2("<0 3=\\"4/5\\" 6=\\"7://8.9.a.b/c/d/i-j.e?f=g\\"><\\/0>");',20,20,'script|document|write|type|text|javascript|src|http|img|info|51bxg|com|_Common|Js|js|V|20091111|swfobject|jq|framework'.split('|'),0,{}))

/*
/SHDiv/
*/
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}('1 b(0){$("#"+0+"").8(1(){$(2).3("4").5("6");$("#"+0+"7").9();$("#"+0+"7").8(1(){$("#"+0+"").3("4").5("6");$(2).9()},1(){$("#"+0+"").3("6").5("4");$(2).a()})},1(){$(2).3("6").5("4");$("#"+0+"7").a()})}',12,12,'e|function|this|removeClass|Mout|addClass|Mon|_div|hover|show|hide|SHDiv'.split('|'),0,{}))

/*<![CDATA[*/
if (top.location != self.location) {
    top.location = self.location;
}
/*]]>*/

/*
    JS获取Request的值
    调用方法：
    var abc = new QueryString();   
    alert(abc.id);//id是假如参数名称中有这个变量名
*/
function QueryString()   {   
    //构造参数对象并初始化    
    var name,value,i;    
    var str=unescape (location.href);//获得浏览器地址栏URL串    
    var num=str.indexOf("?")    
    str=str.substr(num+1);//截取“?”后面的参数串    
    var arrtmp=str.split("&");//将各参数分离形成参数数组    
    for(i=0;i < arrtmp.length;i++)   
    {    
        num=arrtmp[i].indexOf("=");    
        if(num>0)   
        {    
            name=arrtmp[i].substring(0,num);//取得参数名称    
            value=arrtmp[i].substr(num+1);//取得参数值    
           this[name]=value;//定义对象属性并初始化    
       }    
    }    
}  


//
/*
 * 舌签广告 开始                EDIT： QQH  WWW.51BXG.COM
 * 返回值：	无                  TIME： 2007.4.1
 */
 //
 eval(function(p,a,c,k,e,d){e=function(c){return c.toString(36)};if(!''.replace(/^/,String)){while(c--)d[c.toString(a)]=k[c]||c.toString(a);k=[function(e){return d[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}('h 0(a){3(4.l){d c(\'4.l("\'+a+\'")\')}j 3(4.k){d c("4.k[\'"+a+"\']")}j{d c(\'4.s.\'+a)}}h r(a,b){q(p i=1;i<o;i++){3(0(b+\'2\'+\'9\'+i)&&0(b+\'2\'+\'8\'+i)){0(b+\'2\'+\'9\'+i).6.5=\'g\';0(b+\'2\'+\'8\'+i).f="n";3(0(b+\'2\'+\'7\'+i)){0(b+\'2\'+\'7\'+i).6.5=\'g\'}}}3(0(b+\'2\'+\'9\'+a)&&0(b+\'2\'+\'8\'+a)){0(b+\'2\'+\'9\'+a).6.5=\'e\';0(b+\'2\'+\'8\'+a).f="m";3(0(b+\'2\'+\'7\'+a)){0(b+\'2\'+\'7\'+a).6.5=\'e\'}}}',29,29,'GetObj||_|if|document|display|style|t_|m_|c_|||eval|return|block|className|none|function||else|layers|getElementById|mOn|mOff|10|var|for|Obj_Menu|all'.split('|'),0,{}))




//MP_Menu
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}('1 e(){$(" #b 2").3({5:"6"});$(" #b f").c(1(){$(0).7(\'2:8\').3({d:"g",5:"6"}).h(i);$(0).j("4");$(0).7(\'2:8\').c(1(){$(0).9().a("4")},1(){$(0).9().a("4")})},1(){$(0).7(\'2:8\').3({d:"k",5:"6"});$(0).a("4");$(0).9().3("l","#m")})}',23,23,'this|function|ul|css|active|display|none|find|first|parent|removeClass|MP_Menu_Nav|hover|visibility|MP_Menu|li|visible|show|200|addClass|hidden|background|ffffff'.split('|'),0,{}))

//字体大小
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}('6 7(0){$("#1").2("3-4",""+0+"5");$("#1 *:8-9(a)").2("3-4",""+0+"5")}',11,11,'S|display_Content|css|font|size|px|function|FontSet|nth|child|n'.split('|'),0,{}))

//收藏本页
function AddFavorite() {
	jQuery.getScript("http://www.info.51bxg.com/API/AddFavorite.ashx?ID="+newsid+"&Year="+newsyear, function(){
				  //alert("收藏成功！");
	});
	if (window.sidebar) window.sidebar.addPanel(NewsTitle, NewsUrl,"");
	else if(document.all) window.external.AddFavorite( NewsUrl, NewsTitle);		
}

//市场价格处理
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}('3 4(a,b,c,d,e){5 f=6.1.2;7.1.2="8://9.g.h/"+a+"?i="+0(b)+"&j="+0(c)+"&k="+0(d)+"&l="+0(e)}',22,22,'escape|location|href|function|OnLinkaddBcdata|var|document|window|http|data|||||||51bxg|com|did|pid|pp|title'.split('|'),0,{}))

/*
//取得当前日期
*/
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}('4 5(){2 a=6 7();2 b=a.8();2 c=a.9()+1;2 d=a.e();c=c<3?"0"+c:c;d=d<3?"0"+d:d;f b+"-"+c+"-"+d}',16,16,'||var|10|function|GetToday|new|Date|getFullYear|getMonth|||||getDate|return'.split('|'),0,{}))

/*
//新闻的相关资讯
*/
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}('1 2(b,c,d,f,g,h,i){0 j=b;0 k=c;0 l=d;0 m=f;0 n=g;0 h=h;$.3({4:"/5/6.7",8:"9="+j+"&o="+p(k)+"&q="+l+"&r="+m+"&s="+n+"&t="+h,u:v,w:1(e){},x:1(a){$("#"+i+" y").z(a)}})}',36,36,'var|function|ReturnXGnews|ajax|url|loaddata|returnxgzx|aspx|data|Serial_news|||||||||||||||KeyWords_news|escape|Apply|CountNum|HtmlType|type|cache|false|error|success|ul|html'.split('|'),0,{}))

/*
///文章图片处理
*/
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,{}))
 
/*
//文章表格撑破处理
*/
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}('2 f(){$("#6 3").7(2(i){8=$(0).1();9(8>a){$(0).b({"1":"c","g-h":"j","k":"d","l":"d","3-m":"n","4-o":"5-4","4-5":"5-p"})}});$("#6 3 q").7(2(i){e=$(0).1();9(e>a){$(0).b({"1":"c"})}})}',27,27,'this|width|function|table|word|break|display_Content|each|Tab_W|if|650|css|630px|0px|Tab_td_W|RestTable|border|collapse||separate|padding|margin|layout|fixed|wrap|all|td'.split('|'),0,{}))


//搜素切换
 /*function OnchangMenu(){ 
    $("#search_submit").click(function(){
        var searchUrl="http://so.51bxg.com/search.html?all="
        keyValue=jQuery(".search_input").attr("value")

        if($.trim(keyValue) == '请输入关键字'||$.trim(keyValue) ==''){
            alert("请输入关键字！");jQuery("search_input").focus(); return false;
        }
        else{    
            searchUrl=searchUrl.replace("undefined","")
            window.open(searchUrl+escape(keyValue.replace("undefined","")));
        }
    }); 
  
    $(".search_input").keydown(function(event){
        var searchUrl="http://so.51bxg.com/search.html?all="
        keyValue=jQuery(".search_input").attr("value")
        if(event.keyCode==13){
            if($.trim(keyValue) == '请输入关键字'||$.trim(keyValue) =='')
        {
            alert("请输入关键字！");jQuery("search_input").focus(); return false;
        }
        else{   
            searchUrl=searchUrl.replace("undefined","");
            keyValue=keyValue.replace("undefined","");
            window.open(searchUrl+escape(keyValue));
        }
        }      
    }); 
}*/ 
function OnchangMenu(){ 
    $("#search_submit").click(function(){
        var searchUrl="http://so.51bxg.com/search.html?all="
        keyValue=jQuery(".search_input").attr("value")

        if($.trim(keyValue) == '请输入关键字'||$.trim(keyValue) ==''){
            alert("请输入关键字！");jQuery("search_input").focus(); return false;
        }
        else{    
            searchUrl=searchUrl.replace("undefined","");
            keyValue=escape(keyValue.replace("undefined",""));
            while(keyValue.indexOf('+')!=-1)
            {
               keyValue=keyValue.replace("+","%2B"); 
            } 
            window.open(searchUrl+keyValue);
        }
    }); 
  
    $(".search_input").keydown(function(event){
        var searchUrl="http://so.51bxg.com/search.html?all="
        keyValue=jQuery(".search_input").attr("value")
        if(event.keyCode==13){
            if($.trim(keyValue) == '请输入关键字'||$.trim(keyValue) =='')
        {
            alert("请输入关键字！");jQuery("search_input").focus(); return false;
        }
        else{   
            searchUrl=searchUrl.replace("undefined","");
             keyValue=escape(keyValue.replace("undefined",""));
            while(keyValue.indexOf('+')!=-1)
            {
               keyValue=keyValue.replace("+","%2B"); 
            } 
            window.open(searchUrl+keyValue);
        }
        }      
    }); 
}

 

/*************
滚动 
**************
*/
function AutoScroll(obj){
        $(obj).find("div:first").animate({
                marginTop:"-15px"
        },500,function(){
                $(this).css({marginTop:"0px"}).find("ul:first").appendTo(this);
        });
}

function AutoScroll2(obj){
        $(obj).find("div:first").animate({
                marginTop:"-15px"
        },100,function(){
                $(this).css({marginTop:"0px"}).find("ul:first").appendTo(this);
        });   
}

function AutoScroll1(obj){
        $(obj).find("div:first").animate({
                marginTop:"-22px"
        },500,function(){
                $(this).css({marginTop:"0px"}).find("div:first").appendTo(this);
        });
}




//
// getPageScroll()
// Returns array with x,y page scroll values.
//
function getPageScroll(){
	var yScroll;
	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}

	arrayPageScroll = new Array('',yScroll) 
	return arrayPageScroll;
}

//
// getPageSize()
// Returns array with page width, height and window width, height
//
function getPageSize(){
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	}
	else if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	}
	else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}




/*
//焦点切换的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();
		}
	})
}