﻿// JavaScript Document
var t = n = count = j = 0;
$(function()
{
	/*Banner下面的标签效果 start*/
		//$(".highlight_wrapper div").css("cursor","pointer");
		$(".highlight_wrapper div").hover(function(){
			$(this).removeClass().addClass("highlight_tab");
			
			/*if($.browser.msid && $.browser.version==ie6 ){
				DD_belatedPNG.fix('.highlight_tab,.highlight_tabdivider');
				}*/
			},function(){
				$(this).removeClass().addClass("highlight_tabdivider");
				});
		/*Banner下面的标签效果 end*/
		
		/*首页头条新闻切换 start*/
		$("#indexNewsScorollBox").cycle({fx: 'fade' });
		/*首页头条新闻切换 end*/
		
		/*专家观点*/
		$(".ViewOpen").hide();
		$(".View").hover(function(){
	timeout = setTimeout("showViewContent()",90);
	},function(){
		clearTimeout(timeout);
		$(".ViewOpen").fadeOut("fast");});
	
	/*Banner切换效果 start*/
	$("#bannerul").show();

	$(".banners").hide().eq(0).show();

	count = $("#bannerul li").size();
	$(".bannerimg a").css("display","none");
	$(".bannerimg a:first-child").css("display","block");
	$("#bannerul li:first-child").css({ "background": "#FAD428" }).siblings().css({ "background": "#c9cacc" });
	$("#bannerul li").mouseover(function()
	{
		var i = $("#bannerul li").index(this);

		n = i;

		if (i >= count) return;
		
		var bannerli = $(this);

		tmout = setTimeout(function(){$(".bannerimg a").filter(":visible").fadeOut(600);
		$(".bannerimg a").filter(":visible").parent().children().eq(i).fadeIn(1000);bannerli.css({ "background": "#FAD428" }).siblings().css({ "background": "#c9cacc" });},200);		

	});

	$("#bannerul li").mouseout(function(){clearTimeout(tmout);});
	$("#bannerul li").click(function()
	{
		var i = $("#bannerul li").index(this);

		n = i;

		if (i >= count) return;
		$(".bannerimg a").fadeOut(600);
		$(".bannerimg a").parent().children().eq(i).fadeIn(1000);
		$(this).css({ "background": "#FAD428" }).siblings().css({ "background": "#c9cacc" });

	});


	t = setInterval("showAuto()", 15000);
	$(".bannerimg").hover(function() { clearInterval(t) }, function() { t = setInterval("showAuto()", 15000); });
	
	$("#bannerul ul li").hover(function() { clearInterval(t) }, function() { t = setInterval("showAuto()", 15000); });
	
	$("#navgation>ul>li").hover(function() { clearInterval(t) }, function() { t = setInterval("showAuto()", 15000); });

	/*$("#navgation>ul>li").mouseover(function(){ clearInterval(t); });
	$("#navgation>ul>li").mouseout(function(){t = setInterval("showAuto()", 4000); });
	
	$("#navgation>ul>li>a").mouseover(function(){ clearInterval(t); });
	$("#navgation>ul>li>a").mouseout(function(){t = setInterval("showAuto()", 4000); });
	
	$("#navgation").mouseover(function(){ clearInterval(t); });
	$("#navgation").mouseout(function(){t = setInterval("showAuto()", 4000); });

	$("#navgation>ul>li>div").mouseover(function(){ clearInterval(t); });
	$("#navgation>ul>li>div").mouseout(function(){t = setInterval("showAuto()", 4000); });*/



});

function showAuto()
{
	n = n >= (count - 1) ? 0 : n + 1;
	$("#bannerul li").eq(n).trigger('click');
}

function showViewContent(){
	if ($.browser.msie && ($.browser.version == 6.0))
		{
			$(".ViewOpen").css("top","-10px");
		}
		if ($.browser.msie && ($.browser.version == 7.0))
		{
			$(".ViewOpen").css("top","-10px");
		}
		if ($.browser.msie && ($.browser.version == 8.0))
		{
			$(".ViewOpen").css("top","-10px");
		}
	
	$(".ViewOpen").fadeIn("fast");
}

function getposition(obj)
{
	var r = new Array();
	r['x'] = obj.offsetLeft;
	r['y'] = obj.offsetTop;
	while (obj = obj.offsetParent)
	{
		r['x'] += obj.offsetLeft;
		r['y'] += obj.offsetTop;
	}
	return r;
}


