$(document).ready(function(){
	//$.tabs('tabPage');
	$('#AddressBox input,.alignR input').click(function(){
		submenu = $(".floatBox");
		if(submenu.css('display')=="block"){
			submenu.hide();
		}else{
			submenu.show();
		}
	});
	$('#chosefriend li').click(function(){
		var thisOn = $(this).attr('class').match(/on/ig);
		if(thisOn == 'on'){
			$(this).removeClass('on');
			$(this).find('.showBox').hide();
		}else{
			$(this).addClass('on');
			$(this).find('.showBox').show();
		}
	});

	$('#zoomOut').hover(function(){
			$(this).addClass('zoomOutOn');			 
	},function(){
			$(this).removeClass('zoomOutOn');			 
	});
	$('#zoomIn').hover(function(){
			$(this).addClass('zoomInOn');			 
	},function(){
			$(this).removeClass('zoomInOn');			 
	});
	
	
	$('.editTag .tags span a').click(function(){
		var thisOn = $(this).attr('class').match(/on/ig);
		if(thisOn == 'on'){
			$(this).removeClass('on');
		}else{
			$(this).addClass('on');
		}
	});
	$('#slides').cycle({
		fx:     'fade',
		speed:   1500,  //漸變周長
		timeout: 10000, //切換周長
		//pager:  '#aDnav',  输出按钮
		next:   '#next',
		prev:   '#prev'
	});
	$('.hotLink').cycle({
		fx:     'fade',
		speed:   2000,  //漸變周長
		timeout: 5000 //切換周長
	});
	/*
	$('a.mail , .sub .link .login a').click(function() {
		var ajaxUrl = $(this).attr('href');
		var thisTitle = $(this).attr('title');
		$.fn.jmodal({
			title: thisTitle,//标题 预设为触发器的Title属性


			content: function(e) {
				e.html('加载中...');
				e.load(ajaxUrl);//加载页面，为A标签的Href值


			},
			buttonText: { ok: '确认送出', cancel: '关闭' },
			okEvent: function(obj, args) {
				args.complete();//送出后的函数
				alert('发送成功');
			}
		});
		return false;
	});
	*/
	$('#slides .picBox').each(function(){
		var hW = $(this).width();
		$(this).css("marginLeft", -hW/2); 
		$(this).css("left", '50%'); 
	});
	var widowWidth = screen.width
	if(widowWidth < 1024 || widowWidth == 1024){
		$('a.button').hide();
	}
	
	$('.trendList li').hover(function(){
		$(this).addClass('on');
	},function(){
		$(this).removeClass('on');
	});
	$('.inputButton').hover(function(){
		$(this).addClass('hover');
	 },function(){
		$(this).removeClass('hover');
	 });
});
window.onload = function() {
	//tooltip();
	$('.home .link .login').click(function(){
		$('html,body').animate({scrollTop:550}, 400);
		$('input.name').focus();
		return false;
	});
	setClickable();
	$('input.name').focus();
};//为了使Dom载入时不占用太多资源，因此使用OnLoad加载部分函数


function setClickable() {
$('#editInPlace').click(function() {
	var textarea = '<div class="form"><textarea rows="10" cols="80">'+$(this).html()+'</textarea>';
	var button	 = '<p><input type="button" value="保存修改" class="inputButton saveButton" /> <input type="button" value="取消修改" class="inputButton cancelButton" /></p></div>';
	var revert = $(this).html();
	$(this).after(textarea+button).remove();
		$('.saveButton').click(function(){
			saveChanges(this, false);
		});
		$('.cancelButton').click(function(){
			saveChanges(this, revert);
		});
	})
	.mouseover(function() {
		$(this).addClass("editable");
	})
	.mouseout(function() {
		$(this).removeClass("editable");
	});
};

function saveChanges(obj, cancel) {
	if(!cancel) {
		var t = $(obj).parent().siblings(0).val();
		$.post("aa.java",{//aa.java 为Ajax接收页面
		  content: t
		},function(txt){
		alert( txt);
	});
}
else {
	var t = cancel;
}
if(t=='') t='(click to add text)';
	$(obj).parent().parent().after('<div class="description f14px" id="editInPlace">'+t+'</div>').remove();
	setClickable();
}//即点即改

$.tabs = function(containerId, start) {
    var ON_CLASS = 'on';
    var id = '#' + containerId;
    var i = (typeof start == "number") ? start - 1 : 0;
    $(id + '>div:eq(' + i + ')').css({display:"block"});
    $(id + '>ul>li:nth-child(' + (i+1) + ')').addClass(ON_CLASS);
    $(id + '>ul>li>a').click(function() {
        if (!$(this.parentNode).is('.' + ON_CLASS)) {
            var re = /([_\-\w]+$)/i;
            var target = $('#' + re.exec(this.href)[1]);
            if (target.size() > 0) {
                $(id + '>div:visible').hide();
                target.show();
                $(id + '>ul>li').removeClass(ON_CLASS);
                $(this.parentNode).addClass(ON_CLASS);
            } else {
                alert('无效的选项卡');
            }
        }
        return false;
    });
};

//FOR:jQuery Cycle Plugin
;eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}(';(4($){7 n=\'2.26\';7 q=$.1s.1t&&/2s 6.0/.2t(2u.2v);4 U(){3(1u.1v&&1u.1v.U)1u.1v.U(\'[A] \'+2w.2x.2y.2z(2A,\'\'))};$.D.A=4(m){x 8.V(4(){3(m===2B||m===u)m={};3(m.1w==1W){2C(m){1x\'2D\':3(8.B)12(8.B);8.B=0;$(8).19(\'A.1y\',\'\');x;1x\'1z\':8.P=1;x;1x\'2E\':8.P=0;x;2F:m={W:m}}}I 3(m.1w==2G){7 c=m;m=$(8).19(\'A.1y\');3(!m){U(\'2H 1a 2I, 2J 1a 1b 1X\');x}3(c<0||c>=m.1A.9){U(\'2K 1X 1Y: \'+c);x}m.r=c;3(8.B){12(8.B);8.B=0}Q(m.1A,m,1,c>=m.J);x}3(8.B)12(8.B);8.B=0;8.P=0;7 d=$(8);7 e=m.1B?$(m.1B,8):d.2L();7 f=e.2M();3(f.9<2){U(\'2N; 2O 2P 2Q: \'+f.9);x}7 g=$.2R({},$.D.A.1Z,m||{},$.20?d.20():$.2S?d.19():{});3(g.1C)g.1D=g.1E||f.9;d.19(\'A.1y\',g);g.1c=8;g.1A=f;g.L=g.L?[g.L]:[];g.M=g.M?[g.M]:[];g.M.2T(4(){g.1F=0});3(g.Y)g.M.13(4(){Q(f,g,0,!g.Z)});3(q&&g.1d&&!g.21)1G(e);7 h=8.2U;g.C=1e((h.1f(/w:(\\d+)/)||[])[1])||g.C;g.y=1e((h.1f(/h:(\\d+)/)||[])[1])||g.y;g.E=1e((h.1f(/t:(\\d+)/)||[])[1])||g.E;3(d.G(\'1g\')==\'2V\')d.G(\'1g\',\'2W\');3(g.C)d.C(g.C);3(g.y&&g.y!=\'1h\')d.y(g.y);3(g.R){g.S=[];22(7 i=0;i<f.9;i++)g.S.13(i);g.S.2X(4(a,b){x 2Y.R()-0.5});g.F=0;g.N=g.S[0]}I 3(g.N>=f.9)g.N=0;7 j=g.N||0;e.G({1g:\'23\',2Z:0,30:0}).31().V(4(i){7 z=j?i>=j?f.9-(i-j):j-i:f.9-i;$(8).G(\'z-1Y\',z)});$(f[j]).G(\'14\',1).24();3($.1s.1t)f[j].25.27(\'1H\');3(g.O&&g.C)e.C(g.C);3(g.O&&g.y&&g.y!=\'1h\')e.y(g.y);3(g.1z)d.32(4(){8.P=1},4(){8.P=0});7 k=$.D.A.28[g.W];3($.29(k))k(d,e,g);I 3(g.W!=\'1I\')U(\'33 34: \'+g.W);e.V(4(){7 a=$(8);8.2a=(g.O&&g.y)?g.y:a.y();8.2b=(g.O&&g.C)?g.C:a.C()});g.X=g.X||{};g.15=g.15||{};g.17=g.17||{};e.1a(\':1J(\'+j+\')\').G(g.X);3(g.2c)$(e[j]).G(g.2c);3(g.E){3(g.K.1w==1W)g.K={35:36,37:38}[g.K]||39;3(!g.1i)g.K=g.K/2;3a((g.E-g.K)<3b)g.E+=g.K}3(g.1K)g.1L=g.1M=g.1K;3(!g.1j)g.1j=g.K;3(!g.1k)g.1k=g.K;g.2d=f.9;g.J=j;3(g.R){g.r=g.J;3(++g.F==f.9)g.F=0;g.r=g.S[g.F]}I g.r=g.N>=(f.9-1)?0:g.N+1;7 l=e[j];3(g.L.9)g.L[0].1l(l,[l,l,g,2e]);3(g.M.9>1)g.M[1].1l(l,[l,l,g,2e]);3(g.18&&!g.H)g.H=g.18;3(g.H)$(g.H).1N(\'18\',4(){x 1b(f,g,g.Z?-1:1)});3(g.1O)$(g.1O).1N(\'18\',4(){x 1b(f,g,g.Z?1:-1)});3(g.T)2f(f,g);g.3c=4(a){7 b=$(a),s=b[0];3(!g.1E)g.1D++;f.13(s);3(g.2g)g.2g.13(s);g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b.S[b.F]}I{b.r=b.J+c;3(b.r<0){3(b.1n)x 1o;b.r=a.9-1}I 3(b.r>=a.9){3(b.1n)x 1o;b.r=0}}3(b.1p&&1m b.1p==\'4\')b.1p(c>0,b.r,a[b.r]);Q(a,b,1,c>=0);x 1o};4 2f(a,b){7 c=$(b.T);$.V(a,4(i,o){$.D.A.1P(i,o,c,a,b)});$.D.A.1T(b.T,b.N)};$.D.A.1P=4(i,a,b,c,d){7 e=(1m d.1U==\'4\')?$(d.1U(i,a)):$(\'<a 3g="#">\'+(i+1)+\'</a>\');3(e.3h(\'3i\').9==0)e.2h(b);e.1N(d.2m,4(){d.r=i;7 p=d.1c,E=p.B;3(E){12(E);p.B=0}3(1m d.1V==\'4\')d.1V(d.r,c[d.r]);Q(c,d,1,d.J<i);x 1o})};4 1G(b){4 1q(s){7 s=1e(s).3j(16);x s.9<2?\'0\'+s:s};4 2n(e){22(;e&&e.3k.3l()!=\'3m\';e=e.3n){7 v=$.G(e,\'2o-2p\');3(v.3o(\'3p\')>=0){7 a=v.1f(/\\d+/g);x\'#\'+1q(a[0])+1q(a[1])+1q(a[2])}3(v&&v!=\'3q\')x v}x\'#3r\'};b.V(4(){$(8).G(\'2o-2p\',2n(8))})};$.D.A.1I=4(a,b,c,d,e){7 f=$(a),$n=$(b);$n.G(c.X);7 g=e?1:c.1j;7 h=e?1:c.1k;7 i=e?u:c.1L;7 j=e?u:c.1M;7 k=4(){$n.2q(c.15,g,i,d)};f.2q(c.17,h,j,4(){3(c.1r)f.G(c.1r);3(!c.1i)k()});3(c.1i)k()};$.D.A.28={2r:4(a,b,c){b.1a(\':1J(\'+c.N+\')\').G(\'14\',0);c.L.13(4(){$(8).24()});c.15={14:1};c.17={14:0};c.X={14:0};c.1r={3s:\'3t\'}}};$.D.A.3u=4(){x n};$.D.A.1Z={W:\'2r\',E:3v,Y:0,K:3w,1j:u,1k:u,H:u,1O:u,1p:u,T:u,1V:u,2m:\'18\',1U:u,L:u,M:u,1R:u,1K:u,1L:u,1M:u,3x:u,15:u,17:u,X:u,1r:u,1S:u,y:\'1h\',N:0,1i:1,R:0,O:0,1z:0,1C:0,1E:0,2j:0,1B:u,1d:0,1n:0,2k:0}})(3y);',62,221,'|||if|function|||var|this|length||||||||||||||||||nextSlide|||null|||return|height||cycle|cycleTimeout|width|fn|timeout|randomIndex|css|next|else|currSlide|speed|before|after|startingSlide|fit|cyclePause|go|random|randomMap|pager|log|each|fx|cssBefore|continuous|rev||curr|clearTimeout|push|opacity|animIn||animOut|click|data|not|advance|container|cleartype|parseInt|match|position|auto|sync|speedIn|speedOut|apply|typeof|nowrap|false|prevNextClick|hex|cssAfter|browser|msie|window|console|constructor|case|opts|pause|elements|slideExpr|autostop|countdown|autostopCount|busy|clearTypeFix|filter|custom|eq|easing|easeIn|easeOut|bind|prev|createPagerAnchor|setTimeout|end|fxFn|updateActivePagerLink|pagerAnchorBuilder|pagerClick|String|slide|index|defaults|metadata|cleartypeNoBg|for|absolute|show|style||removeAttribute|transitions|isFunction|cycleH|cycleW|cssFirst|slideCount|true|buildPager|els|appendTo|onAddSlide|delay|fastOnEvent|activeSlide|pagerEvent|getBg|background|color|animate|fade|MSIE|test|navigator|userAgent|Array|prototype|join|call|arguments|undefined|switch|stop|resume|default|Number|options|found|can|invalid|children|get|terminating|too|few|slides|extend|meta|unshift|className|static|relative|sort|Math|top|left|hide|hover|unknown|transition|slow|600|fast|200|400|while|250|addSlide|find|removeClass|addClass|href|parents|body|toString|nodeName|toLowerCase|html|parentNode|indexOf|rgb|transparent|ffffff|display|none|ver|4000|1000|shuffle|jQuery'.split('|'),0,{}));

//FOR:jmodal 2.0
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('$.K($.n,{x:g(){$(\'#3-l\').o({h:0},g(){$(L).j(\'p\',\'M\')});$(\'#9-3\').o({h:0},g(){$(L).j(\'p\',\'M\')})},3:g(b){y c=$.n.K({N:{},O:12,m:{z:\'13\',A:\'14\'},P:g(e){},B:15,C:16,q:\'17 18\',8:\'19 1a a 9 1b!\'},b);c.Q=$(r).R();c.S=$(r).T();D($(\'#9-3\').1c==0){$(\'<i E="3-l" 6="3-l"/>\'+\'<i 6="3-1d" E="9-3" >\'+\'<U 1e="0" 1f="0">\'+\'<k>\'+\'<4 6="3-s-t 3-d-f">&7;</4>\'+\'<4 6="3-u-s 3-d-f">&7;</4>\'+\'<4 6="3-s-F 3-d-f">&7;</4>\'+\'</k>\'+\'<k>\'+\'<4 6="3-u-t 3-d-f">&7;</4>\'+\'<4 >\'+\'<i 6="3-q" />\'+\'<i 6="3-8" E="3-G-8" />\'+\'<i 6="3-v">\'+\'<H V="W" w="\'+c.m.z+\'" />&7;&7;<H V="W" w="\'+c.m.A+\'" />\'+\'</i>\'+\'</4>\'+\'<4 6="3-u-F 3-d-f">&7;</4>\'+\'</k>\'+\'<k>\'+\'<4 6="3-v-t 3-d-f">&7;</4>\'+\'<4 6="3-u-v 3-d-f">&7;</4>\'+\'<4 6="3-v-F 3-d-f">&7;</4>\'+\'</k>\'+\'</U>\'+\'</i>\').1g($(r.1h))}1i{$(\'#3-l\').j({h:0,\'p\':\'X\'});$(\'#9-3\').j({h:0,\'p\':\'X\'})}$(\'#3-l\').j({T:c.S,h:0}).o({h:0.5});$(\'#9-3\').j({1j:(c.C?\'C\':\'1k\'),R:c.B,t:(c.Q-c.B)/2,s:(c.O+r.1l.1m)}).o({h:1});$(\'#9-3\').1n(\'.3-q\').Y(c.q).I().I().1o(\'H:1p-1q\').Z(\'w\',c.m.z).1r(\'J\').10(\'J\',g(e){y a={1s:$.n.x};c.P(c.N,a)}).I().Z(\'w\',c.m.A).10(\'J\',$.n.x);D(11 c.8==\'1t\'){$(\'#3-G-8\').Y(c.8)}D(11 c.8==\'g\'){y e=$(\'#3-G-8\');e.1u=$(\'#9-3\');c.8(e)}}})',62,93,'|||jmodal|td||class|nbsp|content|jquery||||png||fiexed|function|opacity|div|css|tr|overlay|buttonText|fn|animate|display|title|document|top|left|border|bottom|value|hideJmodal|var|ok|cancel|initWidth|fixed|if|id|right|container|input|next|click|extend|this|none|data|marginTop|okEvent|docWidth|width|docHeight|height|table|type|button|block|html|attr|one|typeof|100|Ok|Cancel|400|false|JModal|Dialog|This|is|plugin|length|main|cellpadding|cellspacing|appendTo|body|else|position|absolute|documentElement|scrollTop|find|children|first|child|unbind|complete|string|holder'.split('|'),0,{}))

