﻿/*
$(document).pngFix();ie6 png fix
$(this).lightBox();jq lightbox
$(this).fxFile(70);input type="file"
$(this).fxSlide(5, 300, 'v');slide can be vertical'v' or horizontal'h'
$(this).fxCss(target); clone target's css
$(this).mousewheel(function(e, delta){}); mousewheel event
$(this).bgiframe();
getUrlVars()["id"];
getAjaxVars(e)["me"];
--------jq effect
$(this).effect('blind');
blind bounce clip drop explode fade fold highlight pulsate scale shake slide transfer puff
--------jq easing 
$(this).animate({left:''}, 500, 'easeInQuad', callback);
easeInQuad	easeOutQuad	easeInOutQuad	easeInCubic	easeOutCubic	easeInOutCubic	easeInQuart	easeOutQuart	easeInOutQuart	easeInQuint	easeOutQuint	easeInOutQuint	easeInSine	easeOutSine	easeInOutSine	easeInExpo	easeOutExpo	easeInOutExpo	easeInCirc	easeOutCirc	easeInOutCirc	easeInElastic	easeOutElastic	easeInOutElastic	easeInBack	easeOutBack	easeInOutBack	easeInBounce	easeOutBounce	easeInOutBounce
--------share
anteaterAddBookmark("FaceBook");
anteaterAddBookmark("Twitter");
anteaterAddBookmark("Plurk");
--------outside event
clickoutside, dblclickoutside, focusoutside, bluroutside, mousemoveoutside, mousedownoutside, mouseupoutside, mouseoveroutside, mouseoutoutside, keydownoutside, keypressoutside, keyupoutside, changeoutside, selectoutside, submitoutside
--------own selector
$.extend($.expr[':'], {  
    over100pixels: function(a) {  
        return $(a).height() > 100;  
    }  
}); 
*/

var menuDropBox;
var ALL;
var menuHar;
var productName;
$(document).ready(function(){
	if( $.browser.version == '6.0' && $.browser.msie ){ 
		$('#BG').bgiframe();
		$(document).pngFix();
	};
	if( document.getElementById('bcList') && $.browser.msie && $.browser.version == '7.0' || $.browser.version == '6.0'){ 
		$('#bcList a').click(function(){
			if( $(this).attr('href').search('www.') > 0 ){
				window.location.href = window.location.href;
			} else {
				window.location.href = window.location.href + $(this).attr('href');
			}
		});
	};
	$('#BG').css({width:'100%', display:'none'});
	ALL = $('#ALL');
	if( document.getElementById('topMenu')){
		menuHar = new Array();
		$('#topMenu > span').each(function(i){
			menuHar[i] = $(this).children('div').outerHeight(true);
		}).hover(function(){
			var _index = $('#topMenu > span').index(this);
			$(this).children('div').stop().animate({height: menuHar[_index]+ 'px',opacity:1}, 300);
			$(this).children('a').children('b').css({top:'-22px'});
			_index = null;
		}, function(){
			$(this).children('div').stop().animate({height: '0px',opacity:0}, 300);
			if($(this).attr('id') != 'Mon' ){
				$(this).children('a').children('b').css({top:'0'});
			}
		}).css({overflow:'visible'}).children('div').css({height:'0px'});
		
		$('#logStates > div').css({overflow:'visible'}).children('div.logsBox').hide();
		$('#logStates > div > div.logsImg').click(function(){
			if( $(this).next().css('display') == 'none' ){
				$('#logStates > div > div.logsImg > b').css({backgroundPosition:'left 35px'});
				$('#logStates > div > div.logsBox').hide().parent().css({zIndex:1});
				$(this).children('b').css({backgroundPosition:'left top'}).parent().next().show().parent().css({zIndex:2});
			} else {
				$(this).children('b').css({backgroundPosition:'left 35px'}).parent().next().hide().css({zIndex:1});
			}

		});
		
	}
	if( document.getElementById('flashIndex') ){
		var flashvars = {};
		var params = {'bgcolor':'#999999', 'allowfullscreen':'true', 'allowScriptAccess':'always', 'wmode':'opaque'};
		var attributes = {'id':'flashIndex', 'name':'flashIndex'};
		swfobject.embedSWF('swf/index.swf', 'flashIndex', '960', '545', '10.0.0', 'js/expressinstall.swf', flashvars, params, attributes);
		params = attributes = flashvars =null;
	}
	if( document.getElementById('flashActivity') ){
		var flashvars = {};
		var params = {'bgcolor':'#999999', 'allowfullscreen':'true', 'allowScriptAccess':'always', 'wmode':'opaque'};
		var attributes = {'id':'flashActivity', 'name':'flashActivity'};
		swfobject.embedSWF('swf/eventlist.swf', 'flashActivity', '960', '447', '10.0.0', 'js/expressinstall.swf', flashvars, params, attributes);
		params = attributes = flashvars =null;
	}
	if( document.getElementById('flashSeries') ){
		var flashvars = {};
		var params = {'bgcolor':'#999999', 'allowfullscreen':'true', 'allowScriptAccess':'always', 'wmode':'opaque'};
		var attributes = {'id':'flashSeries', 'name':'flashSeries'};
		swfobject.embedSWF('swf/product.swf', 'flashSeries', '960', '361', '10.0.0', 'js/expressinstall.swf', flashvars, params, attributes);
		params = attributes = flashvars =null;
	}
	if( document.getElementById('flashStory') ){
		var flashvars = {};
		var params = {'bgcolor':'#999999', 'allowfullscreen':'true', 'allowScriptAccess':'always', 'wmode':'opaque'};
		var attributes = {'id':'flashStory', 'name':'flashStory'};
		swfobject.embedSWF('swf/brand.swf', 'flashStory', '960', '737', '10.0.0', 'js/expressinstall.swf', flashvars, params, attributes);
		params = attributes = flashvars =null;
	}
	if( document.getElementById('flashCellar') ){
		$('#flashCellar').wrap('<div id="flashCellarBox" />');
		swfobject.embedSWF('swf/2012cellar.swf', 'flashCellar', '100%', '850', '10.0.0', 'js/expressinstall.swf', {}, {'allowScriptAccess':'always', 'wmode':'transparent'}, {});
	}
	/*
	var flashVars = {};
	var flashPara = { wmode : "window", allowscriptaccess : "always" };
	var flashAttr = { id : "mp", name : "mp" };
	swfobject.embedSWF( "mp.swf", "mp", "1", "1", "10.0.0",  "js/expressinstall.swf", flashVars, flashPara, { id : "mp", name : "mp" } );
	$('#indexSlide').fxSlide2(1, 500, 'h');*/
	if( document.getElementById('flashWine12')){
		//wineFlash("flashWine12", 12);
		productName =12;
	}
	if( document.getElementById('flashWine15')){
		//wineFlash("flashWine15", 15);
		productName =15;
	}
	if( document.getElementById('flashWine16')){
		//wineFlash("flashWine16", 16);
		productName =16;
	}
	if( document.getElementById('flashWine18')){
		//wineFlash("flashWine18", 18);
		productName =18;
	}
	if( document.getElementById('flashWine21')){
		//wineFlash("flashWine21", 21);
		productName =21;
	}
	if( document.getElementById('flashWine25')){
		//wineFlash("flashWine25", 25);
		productName =25;
	}
	if( document.getElementById('flashMap')){
		swfobject.embedSWF('swf/map.swf', 'flashMap', '846', '460', '10.0.0', 'js/expressinstall.swf', {}, {'bgcolor':'#999999', 'allowfullscreen':'true', 'allowScriptAccess':'always', 'wmode':'opaque'}, {'id':'flashcontent', 'name':'flashcontent'});
	}
	$('#productTTcon > div').css({height:'310px', display:'none'}).eq(0).show();
	if( document.getElementById('bcON') ){
		bcID = Math.floor($('#bcList >div').index($('#bcON').parent()) /4);
		$('#bcList > div').hide().slice( bcID*4, (bcID+1)*4).show();
		$('#bcPage>a').eq(bcID).addClass('ON');
	}
	if( document.getElementById('forumT1')){
		$('#forumT1 tr').hover(function(){
			$(this).children('td').css({backgroundColor:'white'});
		}, function(){
			$(this).children('td').css({backgroundColor:''});
		});
	}
	if(document.getElementById('memCon5')){
		
		$('#memCon5 input.checkAll').change(function(){
			if( $(this).attr('checked') ){
				$(this).parent().parent().parent().find('input:checkbox').attr('checked', true);
			} else {
				$(this).parent().parent().parent().find('input:checkbox').attr('checked', false);
			}
		});
	}
	if( document.getElementById('flashIndex2')){
		swfobject.embedSWF('event/201112_1980/swf/teaserCrazy.swf', 'flashIndex2', '960' , '745', '10.0.0', 'js/expressinstall.swf', {}, {'allowfullscreen':'true', 'allowScriptAccess':'always', 'wmode':'transparent'}, {});
		//$('#indexTempFlash1').css({left: - ($(document).width() - 960) / 2 + 'px'});
	}
	if( document.getElementById('flashCellarT')){
		swfobject.embedSWF('event/201112_1980/swf/teaser.swf', 'flashCellarT', '960', '520', '10.0.0', 'js/expressinstall.swf', {}, {'allowfullscreen':'true', 'allowScriptAccess':'always', 'wmode':'opaque'}, {});
	}
	$('#logStates').css({overflow:'visible', height:'auto'}).bind('clickoutside', closeMenuTab);

	if( window.location.href.toString().search('#') != -1){
		switch( window.location.href.toString().slice(window.location.href.toString().search('#')+1, window.location.href.toString().length) ){
			case 'forgot':
				popWin('#forgotPop');
				break;
			case 'verify':
				popWin('#verifyPop');
				break;
			case 'terms':
				popWin('#mrulePop');
				break;
			case 'agreement':
				popWin('#pprivacyPop');
				break;
		}
	}
	
	//popWin('#examPop');
});

function crazyAd(){
	$('#indexTempFlash1').remove();
	$('#indexTempFlash2').show();
	$('#indexBody').css({zIndex:1});
}
function cellarStream(STR){
	if(STR == 'show'){
	$('<object type="video/x-ms-wmv" data="mms://203.69.41.22/glen" width="640" height="480" ><param name="src" value="mms://203.69.41.22/glen" /><param name="autostart" value="true" /></object>').appendTo('#cellarStream');
	} else if(STR == 'hide') {
		$('#cellarStream * ').remove();
	}

}
function checkDailyAnswer(DOM, NUM){
	if($('#dailyPop input:checked').val() == NUM){
		$('#adYes').show();
		$(DOM).parent().remove();
	} else if( $('#dailyPop input:checked').val() ){
		$('#adNo').show();
		$(DOM).parent().remove();
	} else {
		alert('尚未勾選答案');
	}
	
}
function closePop(){
	$('#logStates > div > div.logsImg > b').css({backgroundPosition:'left 35px'});
	$('#logStates > div > div.logsBox').hide().parent().css({zIndex:1});
}
function closeMenuTab(){
	$('#logStates > div > div.logsImg > b').css({backgroundPosition:'left 35px'});
	$('#logStates > div > div.logsBox').hide().parent().css({zIndex:1});
}
function sendMsg(){
	popWin2('#shormsgPop');
	friendClear();
	$('#smBlockIn3').show();
}
function readMsg(NAME, TITLE, TEXT){
	popWin('#readmsgPop');
	$('#readName').val(NAME);
	$('#readTitle').val(TITLE);
	$('#readText').val(TEXT);
	
}
function injectName1(DOM){
	$('#xto').val($(DOM).attr('fid'));
	popWin2('#shormsgPop');
	friendClear();
	$('#popFriendName').val($(DOM).parent().parent().find('h6').text());
}
function friendClear(){
	$('#smBlockIn3 div.list > a').removeClass();
	$('#smBlock2 input').val('');
	$('#smBlock2 textarea').val('');
}
function chosenF(DOM){
	if($(DOM).hasClass('ON')){
		$(DOM).removeClass();
	} else {
		$(DOM).addClass('ON');
	}
	var friendList = '';
	var friendList2 = '';
	$(DOM).parent().children('a.ON').each(function(i){
		friendList += $(this).text() + ',';
		if(i==0){
			friendList2 += $(this).attr('fid');
		} else {
			friendList2 += ',' +$(this).attr('fid');
		}
	});
	$('#popFriendName').val(friendList);
	$('#xto').val(friendList2);
	friendList = null;
}
function chooseFriend(){
	$('#smBlockIn3').animate({left:'-100%'}, 300);
}
function memTab5(DOM, NUM){
	$(DOM).parent().children('a').removeClass();
	$(DOM).addClass('ON');
	$('#memCon5 > div').hide().eq(NUM).show();
}
function popWin(DOM){
	$('#BG').show();
	$('#DOT').css({overflow:'visible', zIndex:15}).children('div').hide();
	$(DOM).show();
}
function popWin2(DOM){
	$('#BG').show();
	$('#DOT2').css({overflow:'visible', zIndex:15}).children('div').hide();
	$(DOM).show();
}
function recallWin(){
	$('#BG').hide();
	$('#DOT').css({overflow:'hidden', zIndex:-1}).children('div').hide();
	$('#DOT2').css({overflow:'hidden', zIndex:-1}).children('div').hide();
}
function askJoin(){
	$('#logStates > div > div.logsImg > b').css({backgroundPosition:'left 35px'}).eq(0).css({backgroundPosition:'left top'});
	$('#logStates > div > div.logsBox').hide().parent().css({zIndex:1}).eq(0).css({zIndex:2}).children('div.logsBox').show();
}
var bcID;
function bcPage(DOM, NUM){
	$('#bcList > div').hide().slice( NUM*4, (NUM+1)*4).show();
	$(DOM).blur().parent().children('a').removeClass('ON').eq(NUM).addClass('ON');
}
function wineFlash(ID, WINE){
	swfobject.embedSWF( "swf/FLVPlayer_Progressive.swf", ID, "421", "281", "10.0.0",  "js/expressinstall.swf",{
		streamName:"/flv/" + WINE,
		MM_ComponentVersion:1,
		skinName:"/swf/Clear_Skin_2",
		autoPlay:true,
		autoRewind:false
	}, { wmode : "opaque", allowscriptaccess : "always" }, { id : ID, name :ID } );
}

function productTab(DOM, NUM){
	$('#productTTcon > div').hide().eq(NUM).show();
	$(DOM).blur().parent().children('a').removeClass('ON').eq(NUM).addClass('ON');
	if(NUM == 1 && $('#productTTcon > div').eq(NUM).hasClass('proVideo')){
		$('#productTTcon > div').eq(NUM).children('*').remove();
		$('#productTTcon > div').eq(NUM).append('<div id="flashWine'+productName+'"></div>');
		wineFlash("flashWine"+productName, productName);
	} else {
		$('#productTTcon > div.proVideo > *').remove();
	}
}
function subOver(DOM, NUM){
	$(DOM).parent().parent().prev().children('div').hide().eq(NUM).fadeIn(500);
}
function subOut(DOM){
	$(DOM).parent().parent().prev().children('div').fadeOut(300);
}

$(window).load(function(){

});

function Flash(movieName){
	if (window.document[movieName]) {
		return window.document[movieName];
	} else if (navigator.appName.indexOf("Microsoft Internet")==-1)  {
		if (document.embeds && document.embeds[movieName]) return document.embeds[movieName]; 
	} else /* if (navigator.appName.indexOf("Microsoft Internet")!=-1)*/ {
		return document.getElementById(movieName);
	}
}

jQuery.fn.extend({
	fxSlide2: function (showAtOnce, animateSpeed, fxDirect, SORT){
		$(this).each(function(){
			if (!fxDirect) {
				alert('fxSlide error (showAtOnce『1,2,3』, animateSpeed『10,100,1000』, fxDirect『"h" or "v"』)');
			};
			var _this = $(this);
			var itemNum = $('.aItem > div', _this).length;
			
			var maxId = itemNum - showAtOnce;
			var itemWidth;
			var cId = 0;
			
			if(fxDirect == 'h'){
				itemWidth = $('.aItem > div', _this).outerWidth(true);
				$('.aItem', _this).css({width : itemWidth * itemWidth + 10 + "px"});
			} else if(fxDirect == 'v') {
				itemWidth = $('.aItem > div', _this).outerHeight(true);
				$('.aItem', _this).css({height : itemWidth * itemWidth + 10 + "px"});
			};
			var slideWidth = itemNum * itemWidth;
			
			if (itemNum <= showAtOnce){
				$('.aLeft > a', _this).remove();
				$('.aRight > a', _this).remove();
			} else {
				_this.mousewheel(function(e, delta){
					if(delta > 0){
						cId--;
					} else if (delta < 0){
						cId++;
					};
					sliding (cId);
					return false;
				});
			};
			$('.aLeft > a', _this).click(function () {
				cId --;
				sliding (cId);
				$(this).blur();
				return false;
			});
			$('.aRight > a', _this).click(function () {
				cId ++;
				sliding (cId);
				$(this).blur();
				return false;
			});
			function sliding (SID, NUM){
				if(cId >= maxId && maxId > 0) {
					$('.aRight > a', _this).hide();
					$('.aLeft > a', _this).show();
					cId = maxId;
				} else if(cId <= 0) {
					$('.aRight > a', _this).show();
					$('.aLeft > a', _this).hide();
					cId = 0;
				} else {
					$('.aRight > a, .aLeft > a', _this).show();
				};
				if (fxDirect == 'h') $('.aItem', _this).stop().animate( { marginLeft: - itemWidth * cId + "px" }, animateSpeed);
				if (fxDirect == 'v') $('.aItem', _this).stop().animate( { marginTop: - itemWidth * cId + "px" }, animateSpeed);
				if( NUM != 1){
					$('.aItem > div', _this).eq(cId).children('div').each(function(i){
						$(this).css({position:'relative', top:'96px', left:'0px', opacity:0}).delay(i*50 + (animateSpeed/1.5)).animate({left:'0px', top:'0px', opacity:1}, 500, function(){$(this).css({position:'static'});});
					});
				}
				$('#indexPage > a').removeClass().eq(cId).addClass('on');
				if( SORT == 'campwork'){
					$('.aNum i').text( (cId*10 + 1) + ' - ' + ((cId+1)*10) );
				};
				
			};
			sliding(cId, 1);
			$('#indexPage > a').click(function(){
				cId = $('#indexPage > a').index(this);
				sliding();
				return false;
			});
		});
	}, 	fxSlide3: function (showAtOnce, animateSpeed, fxDirect){
		$(this).each(function(){
			if (!fxDirect) {
				alert('fxSlide error (showAtOnce『1,2,3』, animateSpeed『10,100,1000』, fxDirect『"h" or "v"』)');
			};
			var _this = $(this);
			var itemNum = $('.aItem > div', _this).length;
			
			var maxId = itemNum - showAtOnce;
			var itemWidth;
			var cId = 0;
			
			if(fxDirect == 'h'){
				itemWidth = $('.aItem > div', _this).outerWidth(true);
				$('.aItem', _this).css({width : itemWidth * itemWidth + 10 + "px"});
			} else if(fxDirect == 'v') {
				itemWidth = $('.aItem > div', _this).outerHeight(true);
				$('.aItem', _this).css({height : itemWidth * itemWidth + 10 + "px"});
			};
			var slideWidth = itemNum * itemWidth;
			
			if (itemNum <= showAtOnce){
				$('.aLeft > a', _this).remove();
				$('.aRight > a', _this).remove();
			} else {
				/*_this.mousewheel(function(e, delta){
					if(delta > 0){
						cId--;
					} else if (delta < 0){
						cId++;
					};
					sliding (cId);
					return false;
				});*/
			};
			$('.aLeft > a', _this).click(function () {
				cId --;
				sliding (cId);
				$(this).blur();
				return false;
			});
			$('.aRight > a', _this).click(function () {
				cId ++;
				sliding (cId);
				$(this).blur();
				return false;
			});
			function sliding (SID, NUM){
				if(cId >= maxId && maxId > 0) {
					$('.aRight > a', _this).hide();
					$('.aLeft > a', _this).show();
					cId = maxId;
				} else if(cId <= 0) {
					$('.aRight > a', _this).show();
					$('.aLeft > a', _this).hide();
					cId = 0;
				} else {
					$('.aRight > a, .aLeft > a', _this).show();
				};
				if (fxDirect == 'h') $('.aItem', _this).stop().animate( { marginLeft: - itemWidth * cId + "px" }, animateSpeed);
				if (fxDirect == 'v') $('.aItem', _this).stop().animate( { marginTop: - itemWidth * cId + "px" }, animateSpeed);
				$('#indexPage > a').removeClass().eq(cId).addClass('on');
			};
			sliding(cId, 1);
			$('#indexPage > a').click(function(){
				cId = $('#indexPage > a').index(this);
				sliding();
				return false;
			});
		});
	}
});

function fxCirSlide(DOM) {
	var _this = $(DOM);
	var _thisAR = $('.htmlArray', _this);
    var maxDivision = $('.tvcfCenter > div', _this).length;
	var cHigher = 100;//current target higher X axis
	var smallCwidth = 200;
	var bigCwidth = 300;
    var radiusX = 200;
    var radiusY = 80;
    var cPI = Math.PI * 2 / 4;
    var xPI = Math.PI * 2 / maxDivision;
    var dId = 0;
	var cArray = new Array();
    $('.tvcfCenter > div', _this).each(function(i) {
        var seta = xPI * i + cPI;
        var tY = Math.floor((Math.sin(seta)) * radiusY);
        var tX = Math.floor((Math.cos(seta)) * radiusX);
        var opa = Math.floor((tY + (radiusY + (radiusY*0.1))) / (radiusY*2) * 1000) / 1000;
		var cObj;
        if (i != 0) {
			cObj = {
				ty: tY,
				tx: tX,
				wid: smallCwidth,
				zin:Math.floor(tY),
				opa:opa,
				ord:i
			};/*
            $('<b ty="' + tY + '" tx="' + tX + '" wid="' + smallCwidth + '" zin="' + Math.floor(tY) + '" opa="' + opa + '"></b>').appendTo(_thisAR);*/
            $(this).css({ zIndex: Math.floor(tY), top: tY + 'px', left: tX + 'px' });
            $('img', this).css({ width: smallCwidth + 'px' });
            $('a', this).css({ left: -(smallCwidth/ 2) + 'px', opacity: opa });
        } else {
			cObj = {
				ty: tY-cHigher,
				tx: tX,
				wid: bigCwidth,
				zin:Math.floor(tY),
				opa:opa,
				ord:i
			};/*
            $('<b ty="' + (tY - 100) + '" tx="' + tX + '" wid="' + bigCwidth + '" zin="' + Math.floor(tY) + '" opa="' + opa + '"></b>').appendTo(_thisAR);**/
            //$(this).css({zIndex:Math.floor(tY), top:tY - 100 +'px', left:tX+'px', width:'222px'});
            $(this).css({ zIndex: Math.floor(tY), top: tY - 100 + 'px', left: tX + 'px' });
            $('img', this).css({ width: bigCwidth + 'px' });
            $('a', this).css({ width: -(bigCwidth/2) + '0px', opacity: opa });
        };
		cArray.push(cObj);
    });
	$('.aNum i', _this).text( cArray[0].ord + 1 + ' / '+ maxDivision);
    $('.aLeft', _this).click(function() {
        //$('.htmlArray b:last-child').prependTo(_thisAR);
		cArray.unshift( cArray.pop() );
        run3D();
        $(this).blur();
        return false;
    });
    $('.aRight', _this).click(function() {
        //$('.htmlArray b:first-child').appendTo(_thisAR);
		cArray.push( cArray.shift() );
        run3D();
        $(this).blur();
        return false;
    });
    $(_this).mousewheel(function(e, delta) {
        if (delta > 0) {
            //$('b:last-child', _thisAR).prependTo(_thisAR);
			cArray.unshift( cArray.pop() );
        } else {
            //$('b:first-child', _thisAR).appendTo(_thisAR);
			cArray.push( cArray.shift() );
        };
        run3D();
        return false;
    });
    function run3D() {
        $('.tvcfCenter > div', _this).each(function(j) {/*
            $(this).stop().animate({
                top: $('.htmlArray b').eq(j).attr('ty') + 'px',
                left: $('.htmlArray b').eq(j).attr('tx') + 'px'
            }, 300).css({ zIndex: $('b', _thisAR).eq(j).attr('zin') });
            $('img', this).stop().animate({ width: $('b', _thisAR).eq(j).attr('wid') + 'px' }, 200);
            $('a', this).stop().animate({ left: -($('b', _thisAR).eq(j).attr('wid') / 2) + 'px', opacity: $('b', _thisAR).eq(j).attr('opa') }, 200);*/
            $(this).stop().animate({
                top: cArray[j].ty + 'px',
                left: cArray[j].tx + 'px'
            }, 300).css({ zIndex: cArray[j].zin });
            $('img', this).stop().animate({ width: cArray[j].wid + 'px' }, 200);
            $('a', this).stop().animate({ left: -( cArray[j].wid / 2) + 'px', opacity: cArray[j].opa }, 200);
        });
		$('.aNum i', _this).text( cArray[0].ord + 1 + ' / '+ maxDivision);
    };
	
};

var WEB_SITE_HREF="";
var WEB_SITE_TITLE="";
var FAVORITES="Favorites";
var FACEBOOK="FaceBook";
var GOOGLE="Google";
var PLURK="Plurk";
var SINA="Sina";
var TWITTER="Twitter";
var QQ="QQ";
var HAPPY="Happy";
var SO="So";
var REN = "Ren";
var ICON_IMAGE_PATH="images/anteaterBookmark/";
var FILE_NAME_EXTENSION=".png";
var bookmarkList=[FAVORITES,SINA,QQ,HAPPY,SO,REN,FACEBOOK,GOOGLE,PLURK,TWITTER];
function getBookmarkList(){return bookmarkList;}
function getBookmarkListIcon(){var _array=bookmarkList.concat();for(var i=0;i<_array.length;i++){_array[i]=ICON_IMAGE_PATH+_array[i]+FILE_NAME_EXTENSION;};return _array;};
function anteaterAddBookmark(pType,DOM){
	var _locationHref=(WEB_SITE_HREF=="")?window.location.href:WEB_SITE_HREF;
	_locationHref=encodeURIComponent(_locationHref);var _title=(WEB_SITE_TITLE=="")?document.title:WEB_SITE_TITLE;
	_title=encodeURIComponent(_title);var _href;
	switch(pType){
	case FAVORITES:
		anteaterAddFavorites();
		return;
		break;
	case SINA:
		_href="http://v.t.sina.com.cn/share/share.php?url="+_locationHref+"&title="+_title;
		break;
	case QQ:
		_href="http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url="+_locationHref+"&title="+_title;
		break;
	case HAPPY:
		_href="http://www.kaixin001.com/repaste/share.php??rurl="+_locationHref+"&rtitle="+_title;
		break;
	case SO:
		_href="http://t.sohu.com/third/post.jsp?url="+_locationHref+"&title="+_title;
		break;
	case REN:
		_href = "http://share.renren.com/share/buttonshare.do?link="+_locationHref+"&title="+_title;
		break;
		
	case FACEBOOK:
		_href="http://www.facebook.com/sharer.php?u="+_locationHref+"&title="+_title;
		break;
	case GOOGLE:
		_href="http://www.google.com/bookmarks/mark?op=add&bkmk="+_locationHref+"&title="+_title;
		break;
	case PLURK:
		_href="http://www.plurk.com/?qualifier=shares&status=".concat(_locationHref).concat(' ').concat('(').concat(_title).concat(')');
		break;
	case TWITTER:
		_href="http://twitter.com/home/?status="+_title+" "+_locationHref;
		break;
	};
	window.open(_href,"_blank");return false;
};
function anteaterAddFavorites(){var _title=(WEB_SITE_TITLE=="")?document.title:WEB_SITE_TITLE;var _locationHref=(WEB_SITE_HREF=="")?window.location.href:WEB_SITE_HREF;if(window.sidebar&&window.sidebar.addPanel){window.sidebar.addPanel(_title,_locationHref,'');}else if(window.external){window.external.AddFavorite(_locationHref,_title);}else if(document.layers){window.alert('Please click OK then press Ctrl+D to create a bookmark');}else{window.alert('Please use your browsers\' bookmarking facility to create a bookmark');}};
(function($,c,b){$.map("click dblclick mousemove mousedown mouseup mouseover mouseout change select submit keydown keypress keyup".split(" "),function(d){a(d)});a("focusin","focus"+b);a("focusout","blur"+b);$.addOutsideEvent=a;function a(g,e){e=e||g+b;var d=$(),h=g+"."+e+"-special-event";$.event.special[e]={setup:function(){d=d.add(this);if(d.length===1){$(c).bind(h,f)}},teardown:function(){d=d.not(this);if(d.length===0){$(c).unbind(h)}},add:function(i){var j=i.handler;i.handler=function(l,k){l.target=k;j.apply(this,arguments)}}};function f(i){$(d).each(function(){var j=$(this);if(this!==i.target&&!j.has(i.target).length){j.triggerHandler(e,[i.target])}})}}})(jQuery,document,"outside");
