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


//头部2行导航样式;
$(function ()
{
	var nowLocation=window.location;
	$('#h_nav a').each(function ()
	{
		var thisURL=$(this).attr('href').slice(0,-1);
		var verify=nowLocation.toString().search(thisURL);
		if (verify==0)
		{
			$(this).parent().addClass('nowLocations');
		}
	});
	
	$(".nowLocations:last").addClass('nowLocation');
	
	var target_img=$('#h_nav .nowLocation').children('a:first').children('img:first');
	if (target_img.html()!=null) {
		var nav_taobao_img=target_img.attr('src');
		var nav_taobao_id=nav_taobao_img.search('.gif');
		var nav_taobao_rs=nav_taobao_img.slice(0,nav_taobao_id)+'_2.gif';
		target_img.attr('src',nav_taobao_rs);
	}
	if ($('#h_nav li:first').hasClass('nowLocation')) {
		var nav_taobao_img=$('#nav_taobao img:first').attr('src');
		var nav_taobao_id=nav_taobao_img.search('.gif');
		var nav_taobao_rs=nav_taobao_img.slice(0,nav_taobao_id)+'_2.gif';
		$('#nav_taobao img:first').attr('src',nav_taobao_rs);
	}
	
});
//头部2行导航样式;
$(function ()
{
	var nowLocation=window.location;
	$('#nav a').each(function ()
	{
		var thisURL=$(this).attr('href').slice(0,-1);
		var verify=nowLocation.toString().search(thisURL);
		if (verify==0)
		{
			$(this).parent().addClass('nowLocationss');
		}
	});
	
	$(".nowLocationss:last").addClass('nowLocation_2');
	
	var target_img_2=$('#nav .nowLocation_2').children('a:first').children('img:first');
	if (target_img_2.html()!=null){
		var nav_taobao_img_2=target_img_2.attr('src');
		var nav_taobao_id_2=nav_taobao_img_2.search('.gif');
		var nav_taobao_rs_2=nav_taobao_img_2.slice(0,nav_taobao_id_2)+'_2.gif';
		target_img_2.attr('src',nav_taobao_rs_2);
	}
	
});

//站内所有链接动画;
$(function(){
	$('a').hover(function(){
		$(this).animate({opacity:0.4},200).animate({opacity:1},200);
	},function(){
		$(this).animate({opacity:1},100);
	});
});


//首页列表动画;
$(function(){
	$('#home_show a').hover(function(){
		$(this).children('.item_title:first').fadeIn('slow');
	},function(){
		$(this).children('.item_title:first').fadeOut('slow');
	});
});

//列表页动画;
$(function(){
	$('#wp_ul a').hover(function(){
		$(this).children('.item_title:first').fadeIn('slow');
	},function(){
		$(this).children('.item_title:first').fadeOut('slow');
	});
});


//头部大图展示动画;
$(function(){	
	$('#show').css({overflow:'hidden',width:'960px',height:'231px'});
	$('#show div').css({position:'absolute',left:'-960px',top:0});
	$('#show div:last').css({left:0,top:0});
	$('#show div img').css({width:'960px',height:'231px'});
	setInterval('show_init()',8000);
});

function show_init(){
	var show_array=['top_show()','bottom_show()','right_show()','left_show()'];
	eval(show_array[rand()]);
}

function rand(){
	return Math.floor(Math.random()*4);
	
}

function top_show(){
	$('#show div:last').addClass('now_show');
	$('#show div:last').prev().addClass('next_show');
	$('#show .next_show:first').css({left:0,top:'231px'});
	$('#show .next_show:first').animate({top:0},1000);
	$('#show .now_show:first').animate({top:'-231px'},1000);
	$('#show div:last').removeClass('now_show');
	$('#show div:last').prev().removeClass('next_show');
	$('#show').prepend($('#show div:last'));
}
function bottom_show(){
	$('#show div:last').addClass('now_show');
	$('#show div:last').prev().addClass('next_show');
	$('#show .next_show:first').css({left:0,top:'-231px'});
	$('#show .next_show:first').animate({top:0},1000);
	$('#show .now_show:first').animate({top:'231px'},1000);
	$('#show div:last').removeClass('now_show');
	$('#show div:last').prev().removeClass('next_show');
	$('#show').prepend($('#show div:last'));
}
function right_show(){
	$('#show div:last').addClass('now_show');
	$('#show div:last').prev().addClass('next_show');
	$('#show .next_show:first').css({left:'-960px',top:'0'});
	$('#show .next_show:first').animate({left:0},1000);
	$('#show .now_show:first').animate({left:'960px'},1000);
	$('#show div:last').removeClass('now_show');
	$('#show div:last').prev().removeClass('next_show');
	$('#show').prepend($('#show div:last'));
}
function left_show(){
	$('#show div:last').addClass('now_show');
	$('#show div:last').prev().addClass('next_show');
	$('#show .next_show:first').css({left:'960px',top:'0'});
	$('#show .next_show:first').animate({left:0},1000);
	$('#show .now_show:first').animate({left:'-960px'},1000);
	$('#show div:last').removeClass('now_show');
	$('#show div:last').prev().removeClass('next_show');
	$('#show').prepend($('#show div:last'));
}
//头部大图展示动画 END;


$(function(){
	$('#lizus_rss a:first').toggle(function(){
		$('#lizus_rss ul:first').show();
		return false;
	},function(){
		$('#lizus_rss ul:first').hide();
		return false;
	});
});
