/*
 * KDT      		    http://www.kdt.cn 
 * Documents:		all.css
 * Author:			lerroy (lerroystory@gmail.com)
 * Creation Date:	2010-03-16
 * Last Author:		lerroy
 */

//消除所有超链接周围的虚线框
$(function() {
	$('a').focus(function() {
		$(this).blur();
	});
	// $('input[type=button]').focus(function() {
	// $(this).blur();
	// });
});

// 为所有类型为文本型输入框添加获得焦点和失去焦点时候的样式类
$(function() {
	$('input[type=text]').removeClass('focus');
	$('input[type=password]').removeClass('focus');
	$('input[type=text]').focus(function() {
		$(this).addClass('focus');
	});
	$('input[type=password]').focus(function() {
		$(this).addClass('focus');
	});
	$('input[type=text]').blur(function() {
		$(this).removeClass('focus');
	});
	$('input[type=password]').blur(function() {
		$(this).removeClass('focus');
	});
});

$(function() {
	homeChangePic();// 首页banner焦点图
	wetalkChangePic();// 产品大家说
});
// <homeChangePic
function homeChangePic() {

	$('.banner .p_page span').hover(
		function() {
			$(this).addClass('hover');
		},
	
		function() {
			$(this).removeClass('hover');
		}
	);

	var t = n = count = 0;

	count = $('.banner .change_pic div').size();

	$('.banner .change_pic div:not(:first-child)').hide();

	$('.banner .p_page span').click(function() {

		var i = $(this).text() - 1;

		n = i;

		if (i >= count)
			return;

		$('.banner .change_pic div').fadeOut(600);

		$('.banner .change_pic div').eq(i).fadeIn(1600);

		$('.banner .p_page span').removeClass('current');

		$(this).addClass('current');

	});

	t = setInterval(showAuto, 6000);

	function showAuto() {

		n = n >= (count - 1) ? 0 : n + 1;

		$('.banner .p_page span').eq(n).trigger('click');

	}

}

// homeChangePic>

// <wetalk
function wetalkChangePic() {
	var t3 = n3 = count3 = 0;
	count3 = $('.users-saying div').size();
	$('.users-saying div:not(:first-child)').css( {
		'opacity' : '0'
	});
	$('.users-saying .p_page span').click(function() {
		var i3 = $(this).text() - 1;
		n3 = i3;
		if (i3 >= count3)
			return;
		$('.users-saying div').animate( {
			'top' : '20',
			'opacity' : '0'
		}, 400);
		$('.users-saying div').eq(i3).animate( {
			'top' : '0',
			'opacity' : '1'
		}, 600);
		$('.users-saying .p_page span').removeClass('current');
		$(this).addClass('current');
	});

	t3 = setInterval(showAuto3, 6000);
	function showAuto3() {
		n3 = n3 >= (count3 - 1) ? 0 : n3 + 1;
		$('.users-saying .p_page span').eq(n3).trigger('click');
	}

}
// wetalk>

// 产品概况图片查看
$(function() {

	$('#pro_intro .h_pic').hover(function() {
		$(this).addClass('h_pic_hover');
		$(this).children('.view').addClass('view_hover');
	}, function() {
		$(this).removeClass('h_pic_hover');
		$(this).children('.view').removeClass('view_hover');
	});

	$('#pro_intro .h_pic .view, #pro_intro .h_pic img').attr( {
		'title' : '点击查看'
	});
	$('#pro_intro .h_pic .view, #pro_intro .h_pic img')
			.bind(
					'click',
					function() {
						$bigPic = $('<div class="big_pic"><span class="close"></span><img src=""/></div>');
						$transLayout = $('<div class="transparent"></div>');

						// append
						$('body').append($bigPic);
						$('body').append($transLayout);

						// 正则匹配
						var src_img = $(this).parent().children().eq(0).attr(
								'src');
						var re = (/(.+)\.jpg/g);
						src_img.match(re);
						var result = RegExp.$1;
						$('.big_pic img').attr( {
							'src' : result + '_big.jpg'
						});// 大图地址等于:小图地址 + _big.jpg
						$('.big_pic .close').css( {
							'display' : 'none'
						});
						$('.big_pic img').css( {
							'display' : 'none'
						});

						// 解决图片未加载完成，而取不到高度和宽度的问题
						$bigPic.children('img').get(0).onload = function() {
							var bigPicWidth = $('.big_pic img').width();
							var bigPicHeight = $('.big_pic img').height();
							var wClientHeight = document.documentElement.clientHeight;
							$('.big_pic').css( {
								'left' : '50%',
								'margin-left' : -bigPicWidth / 2,
								'margin-top' : -bigPicHeight / 2
							});
							$('.big_pic .close').css( {
								'display' : 'block'
							});
							$('.big_pic img').css( {
								'display' : 'block'
							});
							if ($.browser.version == '6.0') {
								$('.big_pic').css( {
									'margin-top' : 0
								});
							}

						}

						// 获得高度和半透明层
						var pageScreenHeight = $(document).height();
						$('.transparent').css( {
							'display' : 'block',
							'height' : pageScreenHeight
						});

						// 关闭1：点击‘关闭’按钮关闭
						$('.big_pic .close').attr( {
							'title' : '关闭'
						});
						$('.big_pic .close').one('click', function() {
							$bigPic.animate( {
								'opacity' : 0
							}, {
								duration : 200,
								complete : function() {
									$bigPic.remove();
									$transLayout.remove();
								}
							});
						});

						// 关闭2：或者按下ESC键关闭
						$(document).keydown(function(event) {
							// alert(event.keyCode);
								if (event.keyCode == '27') {
									$bigPic.animate( {
										'opacity' : 0
									}, {
										duration : 200,
										complete : function() {
											$bigPic.remove();
											$transLayout.remove();
										}
									});
								}

							});
						// >

					});

});

// 解决方案
function viewDetail(i) {
	var menu = $('.solution_box .tb_l .t li');
	var init = $('.solution_box .tb_r .init');
	var txt = $('.solution_box .tb_r .t');
	var num = $('.solution_box .tb_l li').size();
	txt.css( {
		'display' : 'none'
	});
	menu.removeClass('current');
	menu.eq(i).addClass('current');
	var cu = menu.index(menu.eq(i));
	txt.css( {
		'display' : 'none'
	});
	init.css( {
		'display' : 'none'
	});
	txt.eq(i).css( {
		'display' : 'block'
	});
}

$(function() {
	var menu = $('.solution_box .tb_l .t li');
	var init = $('.solution_box .tb_r .init');
	var txt = $('.solution_box .tb_r .t');
	var num = $('.solution_box .tb_l li').size();
	txt.css( {
		'display' : 'none'
	});
	menu.click(function() {
		menu.removeClass('current');
		$(this).addClass('current');
		var cu = menu.index(this);
		txt.css( {
			'display' : 'none'
		});
		init.css( {
			'display' : 'none'
		});
		txt.eq(cu).css( {
			'display' : 'block'
		});
	});

});

// tabbox span
$(function() {
	$('.tabbox .tab li span').hover(function() {
		$(this).css( {
			'color' : '#000'
		});
	}, function() {
		$(this).css( {
			'color' : ''
		});
	});
});

// 修改资料/重设密码
$(function() {
	// <0
	/*
	 * $('#mdfBox .tab li span:eq(0)').click(function() { $('#mdfBox .tab li
	 * span').removeClass('current'); $(this).addClass('current'); $('#mdfBox
	 * #mdf_tab_1 ul').css({'display':'block'}); $('#mdfBox #mdf_tab_2
	 * ul').css({'display':'none'}); }); //0>
	 *  //<1 $('#mdfBox .tab li span:eq(1)').click(function() { $('#mdfBox .tab
	 * li span').removeClass('current'); $(this).addClass('current'); $('#mdfBox
	 * #mdf_tab_2 ul').css({'display':'block'}); $('#mdfBox #mdf_tab_1
	 * ul').css({'display':'none'}); }); //1>
	 */

});

// 使用帮助
/*
 * 
 * $(function() { $('#faq .help_box .news_list_ul:eq(0) li:last , #faq .help_box
 * .news_list_ul:eq(1) li:last').css({'background':'none'}); var li = $('#faq
 * .help_box .news_list_ul li'); var tname = $('#faq .help_box .news_list_ul li
 * .tname'); var txt = $('#faq .help_box .news_list_ul li .txt'); tname.toggle(
 * function() { txt.css({'display':'none'});
 * $(this).next().css({'display':'block'}); li.removeClass('current');
 * $(this).parent().addClass('current'); }, function() {
 * txt.css({'display':'none'}); $(this).next().css({'display':'none'});
 * li.removeClass('current'); $(this).parent().addClass('current'); } );
 * 
 * var rs = window.location.href.match(/#(.+)$/); if (rs) { $('#faq .help_box >
 * ul > li > a[name=' + rs[1] + ']').next('span').trigger('click'); } });
 * 
 */

// faq
$(function() {
	// $('.f_table th:eq(0)').css({'width':'380px' , 'text-align':'left'});
	// $('.f_table tr:even td').addClass('even');
	// $('.f_table tr:odd td').addClass('odd');
	$('.f_table tr:last td').css( {
		'border' : 'none'
	});
	$('.f_table tr:last td:eq(0)').css( {
		'-moz-border-radius' : '0 0 0 3px'
	});
	$('.f_table tr:last td:eq(2)').css( {
		'-moz-border-radius' : '0 0 3px 0'
	});
	if ($('#faq .f_sidebar').height() < $('#faq .f_content').height()) {
		$('#faq .f_sidebar').css( {
			'height' : $('#faq .f_content').height()
		});
	}
});

// 快速操作入口
$(function() {
	$('.quick li').hover(function() {
		$('.quick li').removeClass('hover');
		$(this).addClass('hover');
	}, function() {
		$(this).removeClass('hover');
	});

	$('#home .quick li:eq(0)').addClass('disabled');
	$('#home .quick li:eq(0)').hover(function() {
		$(this).removeClass('hover');
	}, function() {
		$(this).removeClass('hover');
	});

});

// 注册成功_选择操作
$(function() {
	// $('.reg_s_box ul li').addClass('hover');
	$('.reg_s_box ul li').hover(function() {
		$('.reg_s_box ul li').removeClass('hover');
		$(this).addClass('hover');
	}, function() {
		$(this).removeClass('hover');
	});
});
// 显示半透明层
/*
 * function showTransparent() { var pageScreenHeight = $(document).height();
 * $('.transparent').css({'display':'block' , 'height':pageScreenHeight}); }
 * //关闭半透明层 function hideTransparent() {
 * $('.transparent').css({'display':'none'}); }
 */

// 显示浮层
/*
 * function showTabBox(boxName) { var tabBoxHeight = $('#'+boxName).height();
 * $('#'+boxName).css({'display':'block' , 'opacity':0 , 'left':'55%' ,
 * 'top':'50%' , 'margin-left':'-175px' , 'margin-top':-tabBoxHeight/2});
 * $('#'+boxName).animate({'left':'50%' , 'opacity':1} , 180); } //隐藏浮层 function
 * hideTabBox(boxName) { var tabBoxHeight = $('#'+boxName).height();
 * $('#'+boxName).css({'opacity':1 , 'left':'50%' , 'top':'50%' ,
 * 'margin-left':'-175px' , 'margin-top':-tabBoxHeight/2});
 * $('#'+boxName).animate({'left':'55%' , 'opacity':0} , {duration:150 ,
 * complete: function() {$('#'+boxName).css({'display':'none'});} }); }
 */