﻿ var Sys = {};
 var ua = navigator.userAgent.toLowerCase();
 var s;
   (s = ua.match(/msie ([\d.]+)/)) ? Sys.ie = s[1] :
   (s = ua.match(/firefox\/([\d.]+)/)) ? Sys.firefox = s[1] :
   (s = ua.match(/chrome\/([\d.]+)/)) ? Sys.chrome = s[1] :
   (s = ua.match(/opera.([\d.]+)/)) ? Sys.opera = s[1] :
   (s = ua.match(/version\/([\d.]+).*safari/)) ? Sys.safari = s[1] : 0;
 // if (Sys.ie) document.write('IE: ' + Sys.ie);
 // if (Sys.firefox) document.write('Firefox: ' + Sys.firefox);
 // if (Sys.chrome) document.write('Chrome: ' + Sys.chrome);
 // if (Sys.opera) document.write('Opera: ' + Sys.opera);
 //if (Sys.safari) document.write('Safari: ' + Sys.safari);
var icq100 ={};
icq100.Interaction = function(pic_adid,sjtjid,width,height){
	  var pic_adobj;
      var sjtjobj;
	  var sjtjid_str;
	  var pic_adobj_str;
	  this.sjtjid_str = sjtjid;
	  this.pic_adobj_str  = pic_adid;
	  this.pic_adobj =  document.getElementById(pic_adid);
	  this.sjtjobj =  document.getElementById(sjtjid);
	    
		
		
	  var bot_to_topvalue;
      this.bot_to_topvalue =  height;
	  this.Getbot_to_topvalue = function() { return this.bot_to_topvalue; };
	  
	  //jQuery("#"+sjtjid+" .num > li").css({ width: btuwidth,height:btuheight});
	  //jQuery("#"+sjtjid+" .num > li").css("font-size",parseInt(btuwidth)-2 );
	
	  jQuery("#"+ this.sjtjid_str+" .slidertitle li").css("width",width);//宽度全部根据设置调整为指定宽度
	            
	  //jQuery("#"+ this.sjtjid_str+" .slidertitle").css("bottom",(10+parseInt(btuheight)));
				
	  this.getpic_adobjcss = function() { return this.pic_adobj.style; };
	  this.getpic_adobjcss().width = width;
	  this.getpic_adobjcss().height = height;
      this.getsjtjobjcss = function() { return this.sjtjobj.style; }; 
	  this.getsjtjobjcss().width = width;
	  this.getsjtjobjcss().height = height;
};
icq100.Interaction.prototype= {   
        init: function() {  
		    jQuery("#"+ this.sjtjid_str+" .slider")[0].style.top="0px";
	        var len  = jQuery("#"+ this.sjtjid_str+" .num > li").length;
		    jQuery("#"+ this.sjtjid_str+" .num li").each(function(){
                jQuery(this)[0].indexI = parseInt(jQuery(this)[0].innerHTML);
				jQuery(this)[0].innerHTML = "" ;
				
     
            });
	        var index = 0;
	        var adTimer;
			var fobj = this;
	        jQuery("#"+ this.sjtjid_str+" .num li").mouseover(function(){		
		        fobj.showImg(this.indexI-1);
	         }).eq(0).mouseover();	
	        
	        jQuery("#"+ this.pic_adobj_str+" .ad").hover(function(){
			          clearInterval(adTimer);
		       },function(){
			    adTimer = setInterval(function(){
				//alert(index);
			    fobj.showImg(index);
				index++;
				//alert(index);
				if(index==len){index=0;}
			  } , 3000);
	         }).trigger("mouseleave");
	     },
      showImg: function(index) {      //动态加入表单  
	           
				 var plvalue  = "-"+(parseInt(this.Getbot_to_topvalue())*index)+"px";
                 jQuery("#"+ this.sjtjid_str+" .slider")[0].style.top = plvalue;
				 //原滚动版
		         //jQuery("#"+ this.sjtjid_str+" .slider").stop(true,false).animate({top : -parseInt(this.Getbot_to_topvalue())*index},1000);
	             //原滚动版
		         jQuery("#"+ this.sjtjid_str+" .num li").removeClass("on")
			      .eq(index).addClass("on");
				  
				 jQuery("#"+ this.sjtjid_str+" .slidertitle li").removeClass("on")
				 .eq(index).addClass("on");
              
	     }
};
icq100.TagsClass = function(){   
	    var tigs; //有可能存在多个控制的情况，所以用数组
        this.tigs = new Array();//Tags样式也存在数组中，防止有独特标签，样式会与其他标签不一样的情况，所以就不统一写到构造函数里,方便扩展
        this.Gettigs = function() { return this.tigs; };
        this.Settigs = function(newValues) { this.tigs = newValues; };
		
		var chekindex;
		this.chekindex = 0;
		
		this.Getchekindex = function() { return this.chekindex; };
        this.Setchekindex = function(newValues) { this.chekindex = newValues; };
		
		
		var deindex; //有可能存在多个控制的情况，所以用数组
		
        this.deindex = 0;
		if(arguments.length > 0)
		{
			this.deindex = parseInt(arguments[0]);
		}
	    this.Getdeindex = function() { return this.deindex; };
        this.Setdeindex = function(newValues) { this.deindex = newValues; };
		
	  
};
icq100.TagsClass.prototype= {
	    addtigs:function(arr)
		{
			 this.Gettigs().push(arr);
		},
		init: function() {  
		     for (i = 0; i < this.Gettigs().length; i++) {
				  var fobj = this;
			      var tag_c = jQuery("#" + this.Gettigs()[i][0])[0];
				  var blockclass = this.Gettigs()[i][2];
				  var noneclass = this.Gettigs()[i][3];
		
				  //alert(tag_c.innerHTML);
				  var content_c = jQuery("#" + this.Gettigs()[i][1])[0];
				  
				  if(i==this.Getdeindex())
				  {
					  
					  tag_c.className = blockclass;
					  content_c.style.display = "block";
					  this.Setchekindex(this.Getdeindex()); 
				  }
				  else
				  {
					   tag_c.className = noneclass;
					   content_c.style.display = "none"; 
				  }
				
			      tag_c.index = i;
				  tag_c.fobj = this;
				  tag_c.onmouseover = function(){ //
				      
					   this.fobj.Setchekindex(this.index);
					   this.fobj.blandnone();
				       //this.className = blockclass;
					   //this.contentobj.style.display = "block";
				  }; 
				  tag_c.onmouseout = function(){
					  
					   //this.fobj.Setchekindex(0);
					   //this.fobj.blandnone();
					   //this.className = noneclass;
					   //this.contentobj.style.display = "none"; 
					  

				  }
			 }
		},
	    blandnone:function()
		{   

			var indexvalue = this.Getchekindex();
			
			for (i = 0; i < this.Gettigs().length; i++) {
			     
				 if(indexvalue == i)
				 {
		           
				    jQuery("#" + this.Gettigs()[i][0])[0].className = this.Gettigs()[i][2];
		            jQuery("#" + this.Gettigs()[i][1])[0].style.display ="block"; 
				 }
				 else
				 {
					jQuery("#" + this.Gettigs()[i][0])[0].className = this.Gettigs()[i][3];
				    jQuery("#" + this.Gettigs()[i][1])[0].style.display ="none"; 
				 }
			}
		}
		
		
};
icq100.slidersObjClass = function(id){ 
        var topslider;
        topslider = document.getElementById(id);
		
		icq100.slidersClass.names[icq100.slidersClass.names.length] = topslider;
		
		topslider.timer = 10;
		topslider.status = 0;
		topslider.statr = 0;
		topslider.step= 10;
		topslider.startopa = 80;
		topslider.startopa2 = 0.6;
		topslider.intervalid = null;//循环定时的id
		topslider.i = 0;//循环的计数器
		topslider.style.width = "430px";//设置目标div的宽度
        topslider.style.height = "58px";//设置目标div的高度
		if (Sys.ie)
		{
		   topslider.style.filter = "Alpha(opacity=80)";//设置目标div的透明度为初始透明
		}
		if (Sys.firefox)
		{
		   topslider.style.opacity = "0.6";//设置目标div的透明度为初始透明
		}
		topslider.show = function(){
		     if (this.status==0)//检查状态是否已经展开
             {
                 this.statr =1;
				 var ulListChild =null;
				
			     var idstr = this.id;
			     var index =  idstr.indexOf('_');
				 var idvalue = idstr.substring(index+1)-1;
				
				  for (i = 0; i < icq100.slidersClass.names.length; i++) {
					  
					  if(icq100.slidersClass.names[i].id==this.id)
					  {
					     continue;
				      }
					
					 //document.getElementById("topsliderTitle_"+(i+1)).style.display ="block"; 
					  //document.getElementById("topsliderContent_"+(i+1)).style.display ="none"; 
					  icq100.slidersClass.names[i].parentNode.className ="";
					  
				  }
				 this.parentNode.className = "current";
				 //document.getElementById("topsliderTitle_"+(idvalue+1)).style.display ="none"; 
			     //document.getElementById("topsliderContent_"+(idvalue+1)).style.display ="block";
                  
			
				 this.intervalid = window.setInterval("icq100.slidersClass.names["+idvalue+"].cycle()",this.timer);//设置动作循环

             }
		};
		topslider.hide = function(){
			
		    if (this.status==1)//检查状态是否已经展开
            {
				 this.statr = 1;
				
				 var idstr = this.id;
			     var index =  idstr.indexOf('_');
				 var idvalue = idstr.substring(index+1)-1;
				 
                 this.intervalid = window.setInterval("icq100.slidersClass.names["+idvalue+"].decycle()",this.timer);//设置动作循环

            }
		};
		topslider.cycle = function(){
			
			
			if (Sys.ie)
		    {
		      var opa = this.style.filter.split("=")[1].split(")")[0];//获取目标div的透明度数值
			
              var opastep = Math.round(((100 - Number(opa)) / this.step)+2.5);//计算每步增加的透明度
			  
              var nopa = Number(opa) + Number(opastep);//当前透明度
			  
              if (nopa>100){
				    this.style.filter = "Alpha(opacity=100)";
			   }else{
				    this.style.filter = "Alpha(opacity=" + String(nopa) + ")";
			   }//给div透明度赋值
		    }
			if (Sys.firefox)
		    {
		      var opa = this.style.opacity;//获取目标div的透明度数值
			
              var opastep = ((1 - parseFloat(opa)) / this.step)+0.025;//计算每步增加的透明度
			  
			 
              var nopa = parseFloat(opa) + parseFloat(opastep);//当前透明度
			   
			  
			    
              if (nopa>1){
				    this.style.opacity = "1";
			   }else{
				   
				    this.style.opacity = String(nopa);
			   }//给div透明度赋值
		    }
			
			  var opx = this.style.height.split("px")[0];
			  
              var pxstep = Math.round((121/ this.step)+0.5);
              var npx = Number(opx) + Number(pxstep);
			
              if (npx>=121){
				  
				  this.style.height = "121px";
				  }else{
					 
					  this.style.height = String(npx) + "px";}
			this.i++ //计数器+1
            if (this.i>(this.step-1)){window.clearInterval(this.intervalid);this.i=0;this.status=1;this.statr = 0; 
			} //循环完毕，清除循环定时
		};
		topslider.decycle = function() //单步循环动作
        {
			if (Sys.ie)
		    {
              var opa = this.style.filter.split("=")[1].split(")")[0];
              var opastep = Math.round(((100 - Number(opa)) / this.step)+2.5)*2;
              var nopa = Number(opa) - Number(opastep);//当前透明度
             if (nopa<this.startopa){
				 this.style.filter = 'Alpha(opacity=' + this.startopa + ')';
				 }else{
					 this.style.filter = 'Alpha(opacity=' + String(nopa) + ')';
				}//给div透明度赋值

			 }
			 
			if (Sys.firefox)
		    {
		      var opa = this.style.opacity;//获取目标div的透明度数值
			
              var opastep =  (1 - parseFloat(opa)) / this.step+0.25 ;
			  
			  
              var nopa = parseFloat(opa) - parseFloat(opastep);//当前透明度
			  
              if (nopa<this.startopa2){
				     this.style.opacity = this.startopa2;
				 }else{
					 this.style.opacity = String(nopa);
				}//给div透明度赋值

		    }
			 
               var opx = this.style.height.split("px")[0];
               var pxstep = Math.round((121 / Math.round(this.step*0.5))+0.5);
               var npx = Number(opx) - Number(pxstep);
               if (Math.abs(npx)<=58)
			   {
				    this.style.height = "58px";
				  }else{
					 
					  this.style.height = String(npx) + "px";}
  

             this.i++ //计数器+1
             if (this.i>(Math.round(this.step*0.5)-1)){
				 window.clearInterval(this.intervalid);this.i=0;this.status=0;this.statr = 0;
				 } //循环完毕，清除循环定时
         };
		topslider.onclick = function(e){
			
			    
				//if((icq100.slidersClass.bigstatus == false) || (icq100.slidersClass.bigstatus2 == false))
				//{   
				
				 //   for (i = 0; i < icq100.slidersClass.names.length; i++) {
				//	 if(icq100.slidersClass.names[i].id!=this.id)
					// {
					//   icq100.slidersClass.names[i].style.height = "37px";
					//   window.clearInterval(icq100.slidersClass.names[i].intervalid);icq100.slidersClass.names[i].i=0;icq100.slidersClass.names[i].status=1;
					 //  icq100.slidersClass.bigstatus = true;
				     //  icq100.slidersClass.bigstatus2 = true;
					// }
					// else
					// {  
					    
					//	return;
					//  }
				//	}
					
				//}
			
			    // 
				//  icq100.slidersClass.bigstatus2 = false;
			 	//  for (i = 0; i < icq100.slidersClass.names.length; i++) {
				//	  
					//  if(icq100.slidersClass.names[i].id==this.id)
					//  {
					//     continue;
				  //    }
					
					//  if( icq100.slidersClass.names[i].status==1)
					//  {
					//	icq100.slidersClass.bigstatus = false;
					//	icq100.slidersClass.names[i].hide();
						
					//  }
					
				//  }
				 
				
				  
			     //this.show();
			
				
			
			 
		},
		topslider.onmouseover= function(e){
		      
			        if(this.statr==1)
					{
						return;
					}
				
				    for (i = 0; i < icq100.slidersClass.names.length; i++) {
						
						
						 if(icq100.slidersClass.names[i].id!=this.id)
					     {
							 if(icq100.slidersClass.names[i].statr==1)
							 {
								 window.clearInterval(icq100.slidersClass.names[i].intervalid);
							     icq100.slidersClass.names[i].style.height = "58px";
								 icq100.slidersClass.names[i].status=0;
								 icq100.slidersClass.names[i].statr = 0;
								 icq100.slidersClass.names[i].i=0;
							 }
							 else
							 {
							   icq100.slidersClass.names[i].hide();
							 }
						
						
					     }
						
					
					}
				
			         this.show();
				 
				
				  
			    
			
		}
	    return topslider;
};
icq100.slidersClass = function(){ 
  
         icq100.slidersObjClass("topslider_1");
		 icq100.slidersObjClass("topslider_2");
		 icq100.slidersObjClass("topslider_3");
			
};

icq100.slidersClass.prototype= {
     init:function()
		{   
		   icq100.slidersClass.names[0].style.width="430px";
		   icq100.slidersClass.names[1].style.width="430px";
		   icq100.slidersClass.names[2].style.width="430px"
           
		   icq100.slidersClass.names[0].show();
		   icq100.slidersClass.names[1].style.height="58px";
		   icq100.slidersClass.names[2].style.height="58px";

		}
};

icq100.slidersClass.names = new Array();

icq100.ImgScroll = function(){   
	    var tigs; //有可能存在多个控制的情况，所以用数组
        this.tigs = new Array();//Tags样式也存在数组中，防止有独特标签，样式会与其他标签不一样的情况，所以就不统一写到构造函数里,方便扩展
        this.Gettigs = function() { return this.tigs; };
        this.Settigs = function(newValues) { this.tigs = newValues; };
		
		var chekindex;
		this.chekindex = 0;
		
		this.Getchekindex = function() { return this.chekindex; };
        this.Setchekindex = function(newValues) { this.chekindex = newValues; };
	  
};
//未做通用性
icq100.ImgScroll.prototype= {
	    addtigs:function(arr)
		{  
			 this.Gettigs().push(arr);
		},
		init: function() {  
		
		     for (i = 0; i < this.Gettigs().length; i++) {
				 

				  var tag_c = jQuery("#rf_b"+(i+1))[0];
				  var tag_c2 = jQuery("#rf_t"+(i+1))[0];
				  
				   tag_c.style.display ="block";
				   tag_c2.style.display = "none";
				   tag_c.innerHTML = this.Gettigs()[i][0];
				   tag_c2.innerHTML = this.Gettigs()[i][0];
				   
				  if(i==0)
				  {
				   tag_c.parentNode.style.backgroundImage="url("+this.Gettigs()[i][1]+")";
				  }
				   
				  // alert(tag_c.parentNode.style.backgroundImage);
				   
				   tag_c.parentNode.onclick=function(){
					   
					   window.open(this.Gettigs()[i][2]);

                    }; 
                 
				  tag_c.fobj = this;
				  tag_c2.fobj =this;
				  tag_c.index = i;
				  tag_c2.index = i;
				  tag_c.turl = this.Gettigs()[i][2];
				  tag_c2.turl = this.Gettigs()[i][2];
				 // alert(this.Gettigs()[i][2]);
				   tag_c.imgurl = this.Gettigs()[i][1];
				  tag_c2.imgurl = this.Gettigs()[i][1];
				  tag_c.onmouseover = function(){ //
				      
					 
					
					   this.fobj.blandnone(this.index,this.turl,this.imgurl);
				       //this.className = blockclass;
					   //this.contentobj.style.display = "block";
				  }; 
				  tag_c2.onmouseover = function(){
					 
                     
					   this.fobj.blandnone2(this.index,this.turl,this.imgurl);
				  }
			 }
			 
			 
		},
	    blandnone:function(indexid,turl,imgurl)
		{   
            
		   
		
			for (i = 0; i < this.Gettigs().length; i++) {
			     
				
				  var tag_c = jQuery("#rf_b"+(i+1))[0];
				  var tag_c2 = jQuery("#rf_t"+(i+1))[0];
				  
				 if(indexid == i)
				 {	
				   
					  tag_c.style.display ="none";
				      tag_c2.style.display = "block";
					  
					
		              tag_c.parentNode.style.backgroundImage="url("+imgurl+")";
				      tag_c.parentNode.onclick=function(){
					   
					      window.open(tag_c.turl);

                    }; 
				 }
				
			}
		},
		blandnone2:function(indexid,turl,imgurl)
		{   
            
			
			for (i = 0; i < this.Gettigs().length; i++) {
			     
			
				  var tag_c = jQuery("#rf_b"+(i+1))[0];
				  var tag_c2 = jQuery("#rf_t"+(i+1))[0];
				  
				 if(indexid == i)
				 {
					 
					  tag_c.style.display ="block";
				      tag_c2.style.display = "none";
					  
					
		              tag_c.parentNode.style.backgroundImage="url("+imgurl+")";
				      tag_c.parentNode.onclick=function(){
					   
					     window.open(tag_c.turl);

                    }; 
				 }
				 				
			}
		}
		
		
};



	      

