/*
 *   jqbytz.js     2009-04-09
 *   author : 蹄子 
 *   http://www.sbiao360.com
 */
/**
 * Tab切换类库
 */
TabClass = function (config)
{
	this.tabName	= config.tabName;	//Tab的名称前缀
	this.cntName	= config.cntName;	//Tab的内容前缀
	this.number		= config.number;	//Tab的个数
	this.tabShowCls = config.tabShowCls;//活动的Tab的Class
	if (config.tabHiddenCls)
		this.tabHiddenCls = config.tabHiddenCls;//非活动的Tab的Class
	else
		this.tabHiddenCls = '';
	if (config.cntShowCss)
		this.cntShowCss	= config.cntShowCss;//非活动的Tab的内容的样式
	else
		this.cntShowCss	= 'block';

	this.show = function(index){
		for (var i=0; i<this.number; i++) {
			if (i!=index) {
				$('#'+this.tabName+'_'+i).removeClass(this.tabShowCls);
				if (this.tabHiddenCls)
					$('#'+this.tabName+'_'+i).addClass(this.tabHiddenCls);
				$('#'+this.cntName+'_'+i).css('display', 'none');
			}
			else {
				if (this.tabHiddenCls)
					$('#'+this.tabName+'_'+i).removeClass(this.tabHiddenCls);
				$('#'+this.tabName+'_'+i).addClass(this.tabShowCls);
				$('#'+this.cntName+'_'+i).css('display', this.cntShowCss);
			}
		}
	}
}

// Special ver for Index Map hot point switch
TabClassMap = function (config)
{
	this.tabName	= config.tabName;	//Tab的名称前缀
	this.cntName	= config.cntName;	//Tab的内容前缀
	this.number		= config.number;	//Tab的个数
	this.tabShowCls = config.tabShowCls.split("@");//活动的Tab的Class,多个用@分割
	if (config.tabHiddenCls)
		this.tabHiddenCls = config.tabHiddenCls
	else
		this.tabHiddenCls = '';
	if (config.cntShowCss)
		this.cntShowCss	= config.cntShowCss;//非活动的Tab的内容的样式
	else
		this.cntShowCss	= 'block';

	this.show = function(index){
		for (var i=0; i<this.number; i++) {
			if (i!=index) {
				$('#'+this.tabName+'_'+i).removeClass(this.tabShowCls[0]);
				$('#'+this.tabName+'_'+i).removeClass(this.tabShowCls[1]);
				if (this.tabHiddenCls)
					$('#'+this.tabName+'_'+i).addClass(this.tabHiddenCls);
				$('#'+this.cntName+'_'+i).css('display', 'none');
			}
			else {
				if (this.tabHiddenCls)
					$('#'+this.tabName+'_'+i).removeClass(this.tabHiddenCls);
				var tab_str = $('#'+this.tabName+'_'+i).text();
				var tab_str_len = tab_str.length;
				var templen = tab_str_len;
				for(var j=0;j<tab_str_len;j++)
				{
					var rstr=escape(tab_str.substring(j,j+1));
					if (rstr.substring(0,2)=="%u")
					{
						templen++;
					}
				}
				if(templen > 6)
					$('#'+this.tabName+'_'+i).addClass(this.tabShowCls[1]);
				else
					$('#'+this.tabName+'_'+i).addClass(this.tabShowCls[0]);
				$('#'+this.cntName+'_'+i).css('display', this.cntShowCss);
			}
		}
	}
}

//资讯中心折叠切换效果
function expit(id){
for(i=0;i<7;i++){
document.getElementById("expcon"+i).style.display = "none";
document.getElementById("exbtn"+i).className = "qyzs_nor";
}
document.getElementById("expcon"+id).style.display = "block";
document.getElementById("exbtn"+id).className = "qyzs_down";
}
//资讯中心滚动公告效果
function AutoScroll(obj){
        $(obj).find("ul:first").animate({
                marginTop:"-32px"
        },1000,function(){
                $(this).css({marginTop:"0px"}).find("li:first").appendTo(this);
        });
}
$(document).ready(function(){
setInterval('AutoScroll("#news_adtext")',3500)
});


$(document).ready(function(){
//$("#bsortsTab2 li").hover(function(){$(this).addClass("info1_tab1");});
//$("#tab_info1header_0").hover(function(){$(".info1_tab1").addClass("info1_tab");});
//$(".main_c_info h1 a:first").css("margin","0");
//$(".main_c_info h1 a:last").css("margin-left","7px");
$(".topmenu li").hover(function() {
$(this).addClass("topmenu_sel");
}, function() {
$(this).removeClass("topmenu_sel");
});

$("#bsortsTab1 li").hover(function() {
$(this).addClass("lihover1");
}, function() {
$(this).removeClass("lihover1");
});
$("#bsortsTab3 li").hover(function() {
$(this).addClass("lihover1");
}, function() {
$(this).removeClass("lihover1");
});
$("#bsortsTab2 li").each(function(i){this.style.background=['#EEFAFF','#FFFFEB'][i%2]});

$(".main_charge_service li").hover(function() {
$(this).addClass("charge_service_hover");
}, function() {
$(this).removeClass("charge_service_hover");
});
$(".main_free_service li").hover(function() {
$(this).addClass("free_service_hover");
}, function() {
$(this).removeClass("free_service_hover");
});
//左边信息前三个li的样式
$("#binfoTab1 li").eq(0).addClass("info1_li1");
$("#binfoTab1 li").eq(1).addClass("info1_li2");
$("#binfoTab1 li").eq(2).addClass("info1_li3");
$("#binfoTab2 li").eq(0).addClass("info1_li1");
$("#binfoTab2 li").eq(1).addClass("info1_li2");
$("#binfoTab2 li").eq(2).addClass("info1_li3");
//高级搜索特效
$(".expert_s_submit").hover(function() {
$(this).addClass("expert_s_submit_pop");
}, function() {
$(this).removeClass("expert_s_submit_pop");
});
$(".search_e_list_inf").hover(function() {
$(this).addClass("search_e_list_inf_hover");
}, function() {
$(this).removeClass("search_e_list_inf_hover");
});
/*开放信息换色*/
$(".search_expert_list_open").each(function(i){this.style.background=['#EEFAFF','#ffffff'][i%2]});
$(".opentablist tr:even").css("background","#F0F0F6")
//高级搜索input取值
//$("#search_val").val("hahaahah")
//document.getElementById("search_valshow").innerHTML = box_dom;
//$("#search_val").html(box_dom);
//$("#search_valshow").html($("#search_val").val("hahaahah"));

//高级搜索下拉框改变时显示另外的下拉框
$("#search_hide_select").change(function(){ //事件發生
$('option:selected', this).each(function(){  //印出選到多個值   
//  alert(this.value);
//  var selectopt = new Array("招标公告", "招标预告", "中标公示"); 
 if(this.value=='0'| this.value=='1'| this.value=='2'){
  $("#search_hide_span").css('display','')}
  else{
	  $("#search_hide_span").css('display','none')
	  };
});

});
/*分页跳至顶部*/
//$(".search_expert_page a").each(function(){
//var oldhref = $(this).attr('href'); 
//$(this).attr('href',oldhref+'#top');
//});
$(".search_expert_page a").click(function(){
parent.scroll(0,0);
});

});
/*多样式tab*/
function changTab(x)
 {
	for (i=1;i<3 ;i++ )
	{
		document.getElementById('infotab'+i).className='info_tab_sel'+i+x;
		/*alert('n'+i+x)*/
		document.getElementById('binfoTab'+i).style.display="none";
	}
	document.getElementById('infotab'+x).className='info_tab_sel'+x;
	document.getElementById('binfoTab'+x).style.display="block";
//document.getElementById("text").innerHTML=document.getElementById('tab'+x).innerHTML

 }
 function changTab1(x)
 {
	for (i=1;i<3 ;i++ )
	{
		document.getElementById('canlentab'+i).className='canlen_tab_sel'+i+x;
		document.getElementById('bcanlenTab'+i).style.display="none";
	}
	document.getElementById('canlentab'+x).className='canlen_tab_sel'+x;
	document.getElementById('bcanlenTab'+x).style.display="block";
 }
  function changTab2(x)
 {
	for (i=1;i<4 ;i++ )
	{
		document.getElementById('sortstab'+i).className='sorts_tab_sel'+i+x;
		document.getElementById('bsortsTab'+i).style.display="none";
	}
	document.getElementById('sortstab'+x).className='sorts_tab_sel'+x;
	document.getElementById('bsortsTab'+x).style.display="block";
 }
//招标机构展示滚动
function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

$(document).ready(function() {
    $('#mycarousel').jcarousel({
        auto: 5,
        wrap: 'last',
        initCallback: mycarousel_initCallback
    });
});