﻿ $(function(){

   hiConfig = {
            sensitivity: 1,
            interval: 1, 
            timeout: 1, 
            over: function() {
                var x=$(this).offset().left-$("#menu_bar ul").offset().left;
       $("#menu_bar span").animate({left:x+"px",top:'0px'},300);      
        }, // function = onMouseOver callback (REQUIRED)
        out: function() {} // function = onMouseOut callback (REQUIRED)
  }
   $("#menu_bar li").hoverIntent(hiConfig)

$("div[id*='listbox']").hover(

		function(){$(this).animate({"margin-top":"-10px"},200)},

		function(){$(this).animate({"margin-top":"0px"},200);}

	);

	var tmp=$("div[id*='listbox']").eq(0).children("img").attr("src");

	//鼠标点击过程

	$("div[id*='listbox']").click(function(){

		  if(parseInt($(this).css("z-index"))<=3){

			  var curZindex = parseInt($(this).css("z-index"));

			  //通过z-index差计算该层需要经过几次轮换效果置顶，

			  var  fntimes = 4-curZindex;

			  //对于当前处于第一位的图片点击无效果.

			  $(document).everyTime(300,function(){

				  $("div[id*='listbox']").each(function(){

					  if(parseInt($(this).css("z-index"))==4){$(this).css("z-index","1");}

					  else{$(this).css("z-index",""+(parseInt($(this).css("z-index"))+1)+"");}

					  $(this).css("margin-top","0px");

					  $(this).animate({"margin-left":((4-parseInt($(this).css("z-index")))*29)+"px"},300);

				  });

			  },fntimes);

		  }

	  });

setInterval(function(){

	$("div[id*='listbox']").each(function(){

				if(parseInt($(this).css("z-index"))==4){$(this).css("z-index","1");}

				else{$(this).css("z-index",""+(parseInt($(this).css("z-index"))+1)+"");}

				$(this).animate({"margin-left":((4-parseInt($(this).css("z-index")))*29)+"px"},300);

			});

},5000);



})
 
 function slideToggle(){
$("#divObj").slideToggle(2000);//窗帘效果的切换,点一下收,点一下开,参数可以无,参数说明同上
}               
        function GetHostRate(isid)
        {         
            var hostrate = document.getElementById("lb_hostrate");
            var cusmoertrate = document.getElementById("lb_cusmoertrate");
            var tdcid = document.getElementById("tdcusmoerrateid");
            var tdhid = document.getElementById("tdhostrateid");
            var hostnum = document.getElementById("<%= lb_hostnum.ClientID%>");
            var cusmnum = document.getElementById("<%= lb_CustomerNum.ClientID %>");
            
//            if(isid==1)
//            {
//                hostnum.innerHTML = (parseInt(hostnum.innerHTML)+1).toString();
//                var _mstype = index.UpdatePublicityNum(1); 
//                if(_mstype.value=="1")
//                {
//                    alert("谢谢您的参与");
//                }else if(_mstype.value=="2")
//                {
//                    alert("您已投票");
//                }
//            }
//            else if(isid==2)
//            {
//                cusmnum.innerHTML = (parseInt(cusmnum.innerHTML)+1).toString();
//                var _mstype = index.UpdatePublicityNum(2); 
//                if(_mstype.value=="1")
//                {
//                    alert("谢谢您的参与");
//                }else if(_mstype.value=="2")
//                {
//                    alert("您已投票");
//                }
//            }
            var sumnum = parseInt(hostnum.innerHTML) +parseInt(cusmnum.innerHTML);
            
            if(parseInt(hostnum.innerHTML)==0)
            {
                tdhid.width="50%";
            }
            if(parseInt(cusmnum.innerHTML)==0)
            {
                tdcid.width="50%";
            }
            if(parseInt(hostnum.innerHTML)!=0 && parseInt(cusmnum.innerHTML)!=0)
            {
                var h1 = (parseInt(hostnum.innerHTML)/sumnum)*100;
                var c1 = (parseInt(cusmnum.innerHTML)/sumnum)*100; 
                tdhid.width=h1+"%";
                tdcid.width=c1+"%";
            }      
            
        }
