﻿// JavaScript Document
var t = n = count = j = 0;
$(function()
{
    /*Banner切换效果 start*/
    $("#bannerul").show();

    $(".banners").hide().eq(0).show();

    count = $("#bannerul li").size();
    $(".bannerimg span:first-child").show();
    $("#bannerul li:first-child").css({ "background": "#fd6418","filter":"alpha(opacity=90)" }).siblings().css({ "background": "#ffffff","filter":"alpha(opacity=60)" });
    $("#bannerul li").click(function()
    {
	    var i = $("#bannerul li").index(this);

	    n = i;

	    if (i >= count) return;
		
	    var bannerli = $(this);

	    tmout = setTimeout(function(){$(".bannerimg span").filter(":visible").fadeOut(400).parent().children().eq(i).fadeIn(1000);bannerli.css({ "background": "#fd6418","filter":"alpha(opacity=90)" }).siblings().css({ "background": "#ffffff","filter":"alpha(opacity=60)" });},200);		
    

    });

    //$("#bannerul li").mouseout(function(){clearTimeout(tmout);});


    //$("#bannerul li").click(function()
//	{
//		var i = $("#bannerul li").index(this);
//
//		n = i;
//
//		if (i >= count) return;
//		$(".bannerimg span").fadeOut(400).parent().children().eq(i).fadeIn(1000);
//		$(this).css({ "background": "#b66442" }).siblings().css({ "background": "#b7c3d2" });
//
//	});


    t = setInterval("showAuto()", 8000);
    //$(".bannerimg").hover(function() { clearInterval(t) }, function() { t = setInterval("showAuto()", 8000); });
	
    $("#bannerul ul li").hover(function() { clearInterval(t) }, function() { t = setInterval("showAuto()", 8000); });

    $("#navgation>ul>li>a").click(function(){ clearInterval(t); });
    //$("#navgation>ul>li>a").mouseout(function(){t = setInterval("showAuto()", 8000); });

    $("#navgation>ul>li>div").click(function(){ clearInterval(t); });
    //$("#navgation>ul>li>div").mouseout(function(){t = setInterval("showAuto()", 8000); });



});

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;
}


