//导航的脚本
$(function(){
		$("div.nav ul li:has(div)").hover(function(){
		$(this).addClass('nav_light');
		$(this).children("div").stop(true,true).slideDown(400);
			},function(){
			$(this).removeClass('nav_light');
			$(this).children("div").stop(true,true).slideUp("fast");
			});
		$("div.nav ul li:has(ul)").hover(function(){
		$(this).addClass('nav_light');
		$(this).children("ul").stop(true,true).slideDown(400);
			},function(){
			$(this).removeClass('nav_light');
			$(this).children("ul").stop(true,true).slideUp("fast");
			});
		var $tab_li = $('div.tab_green_nav dl dd')
		  $tab_li.hover(function(){
								 $(this).addClass('green_light').siblings().removeClass('green_light');
								 var index = $tab_li.index(this);
								 $('div.tab_green_box > div').eq(index).show().siblings().hide();
								 }).hover(function(){
									 $(this).addClass('green_hover');
									 },function(){
										 $(this).removeClass('green_hover');
										 });
		  var $pro_tab_li = $('div.pro_tab_nav ul li')
		  $pro_tab_li.click(function(){
								 $(this).addClass('pro_light').siblings().removeClass('pro_light');
								 var index = $pro_tab_li.index(this);
								 $('div.pro_tab_box > div').eq(index).show().siblings().hide();
								 }).hover(function(){
									 $(this).addClass('pro_hover');
									 },function(){
										 $(this).removeClass('pro_hover');
										 });
		
});
//下拉框
function search_show(){
	document.getElementById("search_on").style.display = "";
}
function search_none(){
	document.getElementById("search_on").style.display = "none";
}

function setSearchKey(showId, valueId, showStr, valueStr){
	document.getElementById(showId).innerText =	showStr;	//for IE
	document.getElementById(showId).textContent = showStr;	//for FF
	document.getElementById(valueId).value = valueStr;
}

$(function(){
	$('.down_btn').click(function(){
		var $topnum = parseInt($('.dongtai_list ul').css('top'));
		if($topnum == -176) { return false }
		if($('.dongtai_list ul').is(':animated')) { return false }
		$('.dongtai_list ul').animate({top:$topnum-22},500);
	});
	$('.top_btn').click(function(){
		var $topnum = parseInt($('.dongtai_list ul').css('top'));
		if($topnum == 0) { return false }
		if($('.dongtai_list ul').is(':animated')) { return false }
		$('.dongtai_list ul').animate({top:$topnum+22},500);
	});
	$('.gray_down_btn').click(function(){
		var $topnum = parseInt($('.gray_round_list div').css('top'));
		if($topnum == -1200) { return false }
		if($('.gray_round_list div').is(':animated')) { return false }
		$('.gray_round_list div').animate({top:$topnum-120},500);
	});
	$('.gray_top_btn').click(function(){
		var $topnum = parseInt($('.gray_round_list div').css('top'));
		if($topnum == 0) { return false }
		if($('.gray_round_list div').is(':animated')) { return false }
		$('.gray_round_list div').animate({top:$topnum+120},500);
	});
	$('.pro_down_btn').click(function(){
		var $topnum = parseInt($('.hot_pro_list div').css('top'));
		if($topnum == -1600) { return false }
		if($('.hot_pro_list div').is(':animated')) { return false }
		$('.hot_pro_list div').animate({top:$topnum-160},500);
	});
	$('.pro_top_btn').click(function(){
		var $topnum = parseInt($('.hot_pro_list div').css('top'));
		if($topnum == 0) { return false }
		if($('.hot_pro_list div').is(':animated')) { return false }
		$('.hot_pro_list div').animate({top:$topnum+160},500);
	});
	$('.arrow_right').click(function(){
		var $topnum = parseInt($('.galleryContainer div').css('left'));
		if($topnum == -1600) { return false }
		if($('.galleryContainer div').is(':animated')) { return false }
		$('.galleryContainer div').animate({left:$topnum-75},500);
	});
	$('.arrow_left').click(function(){
		var $topnum = parseInt($('.galleryContainer div').css('left'));
		if($topnum == 0) { return false }
		if($('.galleryContainer div').is(':animated')) { return false }
		$('.galleryContainer div').animate({left:$topnum+75},500);
	});

})

var activeImage = false;
function showImage(imbObj){
	if(activeImage){
		activeImage.style.filter = 'alpha(opacity=50)';    
		activeImage.style.opacity = 0.5;
	}    
	imbObj.style.filter = 'alpha(opacity=100)';
	imbObj.style.opacity = 1;    
	activeImage = imbObj;    
}
function swapImage(imbSrc){
	document.getElementById("swapBigImg").src = imbSrc;
}

function newsThumb(current) {
	for(i = 1; i <= 14; i++){
		if(i == current) {
			document.getElementById("newsThumb" + i).style.display = "block";
		}
		else {
			if(document.getElementById("newsThumb" + i)){
				document.getElementById("newsThumb" + i).style.display = "none";
			}
		}
	}
}

function checkContact(form) {
	if(form.contactName.value == '') {
		alert('请输入您的称呼！');
		form.contactName.focus();
		return false;
	}
	if(form.contactPhone.value == '') {
		alert('请输入您的电话！');
		form.contactPhone.focus();
		return false;
	}
	if(form.contactContent.value == '') {
		alert('请输入留言内容！');
		form.contactContent.focus();
		return false;
	}
	return true;
}