/*******************************************************************
**--> Intro: For Lizus Customize WordPress Themes脚本
**--> Author: lizus.com@gmail.com
**--> WebSite: http://www.lizus.com
*******************************************************************/

jQuery.noConflict();
runOnLoad(function ()
{
	var ul_width=0;
	jQuery('#show li').each(function(){
		ul_width+=jQuery(this).width();
	})
	jQuery('#show ul:first').width(ul_width);
	if(jQuery('#show ul:first').width()>960){
		show_ul();
	}
});
function show_ul(){
	var html=jQuery('#show ul:first').html();
	jQuery('#show ul:first').append(html);
	var ul_width=0;
	jQuery('#show li').each(function(){
		ul_width+=jQuery(this).width();
	})
	jQuery('#show ul:first').width(ul_width);
	var show_ul=window.setInterval("ul_run()",20);
	jQuery('#show').hover(function(){
		window.clearInterval(show_ul);
	},function(){
		show_ul=window.setInterval("ul_run()",20);
	});
}
function ul_run(){
	var ul_width=jQuery('#show ul:first').width();
	var pos=jQuery('#show ul:first').position();
	if (pos.left>-ul_width/2){
		var left=parseInt(jQuery('#show ul:first').css('left'));
		jQuery('#show ul:first').css ({
			left:left-2+'px'
		});
	}else{
		jQuery('#show ul:first').css({
			left:0+'px'
		});
	}
}


jQuery(document).ready(function(){
	var years=[];
	var data={};
	//var url='http://www.takit.me/card';
	//added this for direct access to ajax loading page 08/02/2012 modified by Hody
	var url='http://www.takit.me/wp-content/themes/takit/page-card.php';
	jQuery('#date_ul li').each(function(){
		if(jQuery(this).attr('class')!=jQuery(this).prev().attr('class')){
			years.push(jQuery(this).attr('class').substring(1));
		}
	});
	years_num=years.length;
	for(var i=0;i<years_num;i++){
		var y_class='y'+years[i];
		jQuery('#date_ul li.'+y_class+':first').before('<li class="year">'+years[i]+'</li>');
		jQuery('#date_ul li.'+y_class).click(function(){
			jQuery('#card_ul').load(url,{
				'year':jQuery(this).attr('class').substring(1,5),
				'month':jQuery(this).children('span').attr('class').substring(1)
			});
			jQuery('#date_ul li').removeClass('current');
			jQuery(this).addClass('current');
		});
		
	}
	
	
	
	
	jQuery('#date_ul li.year').click(function(){
		data={
				'year':jQuery(this).html()
			};
		jQuery('#card_ul').load(url,data);
		jQuery('#date_ul li').removeClass('current');
		jQuery(this).addClass('current');
	});
	jQuery('#date_ul li').hover(function(){
		jQuery(this).addClass('current_hover');
	},function(){
		jQuery(this).removeClass('current_hover');
	});
});

jQuery(document).ready(function(){
	var b_height=jQuery('#begin').height();
	var c_height=document.documentElement.clientHeight;
	if(b_height<c_height){
		jQuery('#footer').css({
			'margin-top': c_height-b_height
		});
	}
});

jQuery(document).ready(function(){
	jQuery('img').parents('a').css ({
		background:'transparent'
	});
});
