// 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', delay: -3000, timeout: 10000 });
    $("#indexNoticeScorollBox").cycle({ fx: 'fade', delay: -3000, timeout: 10000 });
    /*首页头条新闻切换 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:first-child").show();
    $("#bannerul li:first-child").css({ "background": "#004d9b" }).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(400).parent().children().eq(i).fadeIn(1000); bannerli.css({ "background": "#4c789d" }).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(400).parent().children().eq(i).fadeIn(1000);

        $(this).css({ "background": "#4c789d" }).siblings().css({ "background": "#c9cacc" });

    });


    t = setInterval("showAuto()", 4000);
    $(".bannerimg").hover(function () { clearInterval(t) }, function () { t = setInterval("showAuto()", 4000); });

    $("#bannerul ul li").hover(function () { clearInterval(t) }, function () { t = setInterval("showAuto()", 4000); });

    $("#navgation>ul>li>a").mouseover(function () { clearInterval(t); });
    $("#navgation>ul>li>a").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;
}

/*首页切换JS--Start--*/
$(document).ready(function () {

    $(".InProducts_text h2").mouseover(function () {
        $(".Pop1").hide();
        $(this).parent().parent().children("div:first").fadeIn(600);
    });
    $(".InProducts_pic").mouseout(function () {
        $(".Pop1").hide();
    });
    var i = 1;
    $(".Pop1").hover(function () {
        if (i % 2 == 0) {
            $(this).fadeOut(400);
        }
        i++;
    });

    function showpic(objid, state) {
        $(objid + " .InProductsPop").css("display", state);
    }
    /*系列里的产品效果*/
    var pig1index = 1;
    var pig1count = $("#Product_Sorll a").size();

    $("#pig1imgleft").click(function () {
        if (pig1index > 1) { pig1index--; }
        else { pig1index = pig1count; }
        for (x = 1; x <= pig1count; x++) {
            if (x == pig1index) {
                $("#pig1sp" + x).css("display", "");
                $("#pig1img" + x).css("display", "");
            }
            else {
                $("#pig1sp" + x).css("display", "none");
                $("#pig1img" + x).css("display", "none");
            }
        }
    });

    $("#pig1imgright").click(function () {
        if (pig1index < pig1count) { pig1index++; }
        else { pig1index = 1; }
        for (x = 1; x <= pig1count; x++) {
            if (x == pig1index) {
                $("#pig1sp" + x).css("display", "");
                $("#pig1img" + x).css("display", "");
            }
            else {
                $("#pig1sp" + x).css("display", "none");
                $("#pig1img" + x).css("display", "none");
            }
        }
    });

    var pig2index = 1;
    var pig2count = $("#Sorll_Products2 a").size();

    $("#pig2imgleft").click(function () {
        if (pig2index > 1) { pig2index--; }
        else { pig2index = pig2count; }
        for (x = 1; x <= pig2count; x++) {
            if (x == pig2index) {
                $("#pig2sp" + x).css("display", "");
                $("#pig2img" + x).css("display", "");
            }
            else {
                $("#pig2sp" + x).css("display", "none");
                $("#pig2img" + x).css("display", "none");
            }
        }
    });

    $("#pig2imgright").click(function () {
        if (pig2index < pig2count) { pig2index++; }
        else { pig2index = 1; }
        for (x = 1; x <= pig2count; x++) {
            if (x == pig2index)
            { $("#pig2sp" + x).css("display", ""); $("#pig2img" + x).css("display", ""); }
            else
            { $("#pig2sp" + x).css("display", "none"); $("#pig2img" + x).css("display", "none"); }
        }
    });

    var pig3index = 1;
    var pig3count = $("#Sorll_Products2 a").size();
    $("#pig3imgleft").click(function () {
        if (pig3index > 1) { pig3index--; }
        else { pig3index = pig3count; }
        for (x = 1; x <= pig3count; x++) {
            if (x == pig3index)
            { $("#pig3sp" + x).css("display", ""); }
            else
            { $("#pig3sp" + x).css("display", "none"); }
        }
    });

    $("#pig3imgright").click(function () {
        if (pig3index < pig3count) { pig3index++; }
        else { pig3index = 1; }
        for (x = 1; x <= pig3count; x++) {
            if (x == pig3index)
            { $("#pig3sp" + x).css("display", ""); $("#pig3img" + x).css("display", ""); }
            else
            { $("#pig3sp" + x).css("display", "none"); $("#pig3img" + x).css("display", "none"); }
        }
    });

});
function GetSetType(imgurl, imgobjid,url) {
    document.getElementById(imgobjid).src = "UploadImg/" + imgurl;
    if (imgobjid == "Imgset1type") { document.getElementById("Imaset1type_a").src = "UploadImg/" + imgurl;document.getElementById("Imaset1type_a").href = url; }
    else if (imgobjid == "Imgset2type") { document.getElementById("Imaset2type_a").src = "UploadImg/" + imgurl; document.getElementById("Imaset2type_a").href = url; }
    else if (imgobjid == "Imgset3type") { document.getElementById("Imaset3type_a").src = "UploadImg/" + imgurl; document.getElementById("Imaset3type_a").href = url; }
}
setInterval("$(\"#pig1imgright\").click();", 5000);
setInterval("$(\"#pig2imgright\").click();", 5000);
setInterval("$(\"#pig3imgright\").click();", 5000);
/*首页切换JS--End--*/
