function loadHtml(url,id){
	url=url+"?number="+Math.random();
	jQuery.ajax({
	 type:"GET",
	 url:url,
	 dataType:"html",
	 success: function(data){
		 jQuery("#"+id).html(data);
	} 
	}); 
}

//侧边加载cur
function loadHtml2(url,id,text){
	url=url+"?number="+Math.random();
	jQuery.ajax({
	 type:"GET",
	 url:url,
	 dataType:"html",
	 success: function(data){
		 jQuery("#"+id).html(data);
		 set_class('#sub_nav li','cur',text); 
	} 
	}); 
}

//海报加载cur
function loadHtml3(url,id){
	url=url+"?number="+Math.random();
	jQuery.ajax({
	 type:"GET",
	 url:url,
	 dataType:"html",
	 success: function(data){
		 jQuery("#"+id).html(data);
		 tabs_tide({tab:'#number span',div_pre:'pic',stop:'#number,.pic',action:'mouseover',show:1,auto:true,interval:3});
	} 
	}); 
}

function set_class(li,cur,text){  
 var name=li; 
 text=jQuery.trim(text);
  jQuery(name).each(function(){
    var li_text=jQuery.trim(jQuery(this).text()+"");
   if(li_text==text){
       jQuery(this).addClass(cur);
  }
});
}

/*******
tab:切换的标签
div_pre:'tab' 切换的div前缀，默认为tab div规则 <div id="tab1"></div><div id="tab2"></div>
cur:'cur' 当前样式
action:'click' 单击切换，mouseover:悬停切换
show:第几个
*******/
function tabs_tide(o){
		o=jQuery.extend({
			tab:null,
			cur:'cur',
			prev:null,
			next:null,
			stop:null,
			auto: false,
			action:'click',
			div_pre:'tab',
			show:null,
			interval:1
		},o||{});

	var $obj=jQuery(o.tab);//所用标签
	var len=$obj.length;//个数
	var divs="";
	var c=1;
	var interval;
	for(n=1;n<=len;n++){n==1?divs+="#"+o.div_pre+n:divs+=",#"+o.div_pre+n;};
	function showDiv($num){
		$obj.removeClass(o.cur);
		jQuery(divs).hide();
		jQuery($obj.get($num-1)).addClass(o.cur);
		jQuery("#"+o.div_pre+$num).show();	
	}

	if(o.action=='click'){
		$obj.each(function(i){		
			jQuery(this).click(function(){
				c=i+1;showDiv(c);	
			});
		});
	}else{
		$obj.each(function(i){		
			jQuery(this).hover(function(){
				c=i+1;showDiv(c);
			},function(){});
		});
	}

	if(o.show){
		c=o.show;showDiv(c);
	}

	if(o.next){
		jQuery(o.next).click(function(){
				c++;c>len?c=1:c;showDiv(c);	
			});
	}

	if(o.prev){
		jQuery(o.prev).click(function(){
				c--;c<=0?c=len:c;showDiv(c);		
			});
	}

	if(o.auto){
		interval=setInterval(function() {
					c++;c>len?c=1:c;showDiv(c);	
				}, o.interval*1000);
	}
	
	if(o.auto){
		if(o.stop){
				jQuery(o.stop).mouseover(function(){
				 clearInterval(interval);
				}).mouseout(function(){
					  interval=setInterval(function() {
						c++;c>len?c=1:c;showDiv(c);	
					}, o.interval*1000);
				});
			}
	}
}


		$(function(){
			var name = $('#ad');  //滚动广告的ID
			function showad(time){
					setTimeout(function(){
						$(name).show();},time);
				}
			function hidead(time){
					setTimeout(function(){
						$(name).hide();},time);
				}
			$('#close').click(function(){
					$(name).hide();
				});
			showad(100); //页面加载完毕多久后显示广告
			//hidead(31000); //页面加载完毕多久后关闭广告
			function scrollad(){
					var offset = $(window).height() - $(name).height() + $(document).scrollTop();
					$(name).animate({top:offset},{duration:800,queue:false});
				}	
			scrollad();
			$(window).scroll(scrollad);
		});