﻿
/*index.html图片切换*/
var t = n = count = 0;   
jQuery().ready(
function()
{   
	count = jQuery("#play_list a").size();
	jQuery("#play_text li:first-child").css({"font-weight":"bold"}); 
	jQuery("#play_list a").hide().eq(0).show();
	jQuery("#play_text li").click(
	function() 
	{   
		//var i = jQuery(this).text() - 1;  
		var i = jQuery("#play_text li").index(this);
		n = i;   
		if (i >= count) return; 
		
		jQuery("#play_list a").filter(":visible").hide().parent().children().eq(i).show();   
		jQuery(this).css({"font-weight":"bold"}).siblings().css({"font-weight":"normal"});   
	}); 
	
	t = setInterval("showAuto()", 7000); 
	
	jQuery("#play").hover(
	function()
	{
		clearInterval(t)
	}, 
	function()
	{
		t = setInterval("showAuto()", 7000);
	});   
});   

function showAuto()   
{
	
	n = n >= (count - 1) ? 0 : n + 1;   
	jQuery("#play_text li").eq(n).trigger('click');
}   

/*newspaper图片切换*/
var t_news = n_news = count_news = 0; 
jQuery().ready(
function()
{   
	count_news = jQuery("#play_news_list a").size();
	jQuery("#play_news_text li:first-child").css({"font-weight":"bold","background-position":"left top","color":"#ddf3fb"}); 
	jQuery("#play_news_list a").hide().eq(0).show();
	jQuery("#play_news_text li").click(
	function() 
	{   
		//var i = jQuery(this).text() - 1;  
		var i = jQuery("#play_news_text li").index(this);
		n = i;   
		if (i >= count_news) return; 
		
		jQuery("#play_news_list a").filter(":visible").fadeOut(500).parent().children().eq(i).fadeIn(1000);   
		jQuery(this).css({"font-weight":"bold","background-position":"left top","color":"#ddf3fb"}).siblings().css({"font-weight":"normal","background-position":"right top","color":"#72bed8"});   
	}); 
	
	t_news = setInterval("showAuto_news()", 5000); 
	jQuery("#play_news").hover(
	function()
	{
		clearInterval(t_news)
	}, 
	function()
	{
		t_news = setInterval("showAuto_news()", 5000);
	});   
}); 

function showAuto_news()   
{
	n_news = n_news >= (count_news - 1) ? 0 : n_news + 1;   
	jQuery("#play_news_text li").eq(n_news).trigger('click');
	
} 







//内页弹出层
jQuery().ready(
function()
{
	var width;
	var height;
	var top;
	var left;

	height=jQuery("body").height();
	
	jQuery("#sn_pop_up").bind("click",
				function()
				{
					jQuery(".pop_up").fadeOut();
					jQuery(this).fadeOut();
				});
	jQuery(".close_ico").bind("click",
				function()
				{
					jQuery("#sn_pop_up").fadeOut();
					jQuery(".pop_up").fadeOut();
				});

	
	jQuery('.sky_sn').click(
		function()
		{
			top=(document.documentElement.clientHeight-jQuery(".pop_up").height())/2;
			left=(document.documentElement.clientWidth-jQuery(".pop_up").width())/2;
			
			top=(top>0?top:0)+jQuery().scrollTop();
			left=(left>0?left:0)+jQuery().scrollLeft();


			jQuery("#sn_pop_up").css({
					"filter":"Alpha(Opacity=50)",
					"height":height,
					"width":document.body.clientWidth+"px"					
					}).fadeIn();
			jQuery(".pop_up").eq(jQuery('.sky_sn').index(this)).css({
							 "left":left+"px"							 
							 }).fadeIn();
			/*判断如果top与div的高度和，大于页面高度，居底对其*/
			if(top+jQuery(".pop_up").eq(jQuery('.sky_sn').index(this)).height()>document.body.clientHeight)
			{
				jQuery(".pop_up").eq(jQuery('.sky_sn').index(this)).css({"bottom":"0"});
			}
			else
			{
				jQuery(".pop_up").eq(jQuery('.sky_sn').index(this)).css({"top":top+"px"});
			}		
			
			return false;
		});
});



//免费体验
jQuery().ready(
function()
{
	var width;
	var height;
	var top;
	var left;
	
	height=jQuery("body").height();
	jQuery(".try_close").click(function(){
		jQuery("#try_bg").css("display","none");
		jQuery("#try_box").css("display","none");
	})
	jQuery("#try_bg").bind("click",
				function()
				{
					jQuery("#try_box").fadeOut();
					jQuery(this).fadeOut();
				});
	
	
	jQuery(".try").click(
		function()
		{		
			jQuery(".pop_up").hide();jQuery("#sn_pop_up").hide();//新加与治疗方案配合作用
			top=(document.documentElement.clientHeight-jQuery("#try_box").height())/2;
			left=(document.documentElement.clientWidth-jQuery("#try_box").width())/2;
			
			top=(top>0?top:0)+jQuery().scrollTop();
			left=(left>0?left:0)+jQuery().scrollLeft();
			
			
			jQuery("#try_bg").css({
					"filter":"Alpha(Opacity=50)",
					"height":height,
					"width":document.body.clientWidth+"px"					
					}).fadeIn();
			
			
			jQuery("#try_box").css({
							 "left":left+"px"							 
							 }).fadeIn();
			/*判断如果top与div的高度和，大于页面高度，居底对其*/
			if(top+jQuery("#try_box").height()>document.body.clientHeight)
			{
				jQuery("#try_box").css({"bottom":"0"});
			}
			else
			{
				jQuery("#try_box").css({"top":top+"px"});
			}		
			
			return false;
			
		});
							 
});

//免费咨询
jQuery().ready(
function()
{
	var width;
	var height;
	var top;
	var left;
	
	height=jQuery("body").height();
	
	jQuery("#mfzf_go_bg").bind("click",
				function()
				{
					jQuery(".mfzf_go").fadeOut();
					jQuery(this).fadeOut();
				});
	
	
	jQuery(".free").click(
		function()
		{		
			
			top=(document.documentElement.clientHeight-jQuery(".mfzf_go").height())/2;
			left=(document.documentElement.clientWidth-jQuery(".mfzf_go").width())/2;
			
			top=(top>0?top:0)+jQuery().scrollTop();
			left=(left>0?left:0)+jQuery().scrollLeft();
			
			
			jQuery("#mfzf_go_bg").css({
					"filter":"Alpha(Opacity=50)",
					"height":height,
					"width":document.body.clientWidth+"px"					
					}).fadeIn();
			
			
			jQuery(".mfzf_go").css({
							 "left":left+"px"							 
							 }).fadeIn();
			/*判断如果top与div的高度和，大于页面高度，居底对其*/
			if(top+jQuery(".mfzf_go").height()>document.body.clientHeight)
			{
				jQuery(".mfzf_go").css({"bottom":"50px"});
			}
			else
			{
				jQuery(".mfzf_go").css({"top":top+"px"});
			}		
			
			return false;
			
		});
	jQuery(".mfzf_close").click(function(){
		jQuery("#mfzf_go_bg").css("display","none");
		jQuery(".mfzf_go").css("display","none");
	})
});
	
