/*!
 * http://cmc3.cn/e
 * E-mail:59194618@qq.com
 * Copyright 2010, caii 蔡美纯
 * Dual licensed under the MIT or GPL Version 2 licenses.
 */
(function(){
var abload=$("#abloading").show(),doc= $(document);
abload.css({top: doc.height()/2-24,left: doc.width()/2-12});
window.onload=function() {
	if(!list.innerHTML)$('.pmenu li').eq(0).click();
	$("body").css({'padding-top': doc.height() / 2 - 262});
            ($body=$('.wrap')).css({'visibility':'visible'});
	abload.fadeOut();
	$.support.opacity? $body.fadeTo(1000,1) : $ml.show(400);
	noload=0;
	$("a[rel='flower']").cmcbox();
	var li = $('#nav li'),
	hfn = function(e) {
				e.type == 'mouseenter' && pageTracker._trackPageview("/color/nav" + li.index(this) + ".html");
				$(this).toggleClass('c' + li.index(this));
				$('a', this).toggleClass('chover')
	};

	li.hover(hfn, hfn).click(function() {
		open(this.firstChild.href, '_self')
	});
	li.eq(3).addClass('c3').unbind('mouseenter mouseleave').css('cursor', 'default');

};
$('#list li:last').css('margin-bottom', 0);
var $s1 = $('#sl'),$sli= $("#sline"),list=$('#list')[0],ih, $ml= $('.ml'),noload=1;
new scr({
	quyu: $s1[0],
	tiao: $("#sline")[0]
});
$('.pmenu li').click(function(e,f) {
	var that = $(this);
	if (that.hasClass('act')) {
		return;
	}
	var t = this.title;
	if ($.fx.now &&/\S/.test( $('.aint').text())) {
		return;
	}
	$.fx.now = true;
	$.ajax({async:!noload,url:t + ".html",success :function(data) {ih = data;}});
	
	that.attr('class', 'act').siblings().removeClass('act');
	if (!t) {
		return;
	}
	$('.aint:empty').eq(0).hide();
	$('.aint:parent').hide(700,
	function() {
		this.innerHTML = '';
	});
	$('.aint:empty').eq(0).load(t + '.txt').show(1000,
	function() {
		$.fx.now = 0;
	});
	$s1.animate({
		'left': -120
	},
	function() {
			list.innerHTML=ih;
			$('#list li:last').css('margin-bottom', 0);
			
			$('"a[rel=' + t + ']"').cmcbox();
			new scr({
				quyu: $s1[0],
				tiao: $sli[0]
			});
			$s1.animate({
				'left': 0
			});
			if(f&&!$.support.opacity&&noload )  $ml.hide();
	}
	)
}).hover(hc, hc).eq(0).trigger('click',[1]);
function hc() {
	var that=$(this);
	if (that.is('.act')) return;
	that.toggleClass('s');
};	
})();

