// JavaScript Document
//垂直

function jFilterCaseListCallBack(){
	$('#main_container div.case div.caselist div.scrollpane').jScrollPane({animateTo:true, animateInterval:50, animateStep:5, showArrows: true, scrollbarWidth: 7, arrowSize: 8,dragMaxHeight:99999,scrollbarMargin:20,reinitialiseOnImageLoad: false})
	}
function loadcasedetail(url){
	$.ajax({
		   cache: true,
		   type:"get",
		   url:url,
		   beforeSend:function(){},
		   success:function(html){
			   var $items=$(html);
			   $("#main_container div.case div.caselist div.img").html($items.siblings(".img").html());
			   $items.siblings(".year").html() ? $("#main_container div.case div.caselist div.detail ul li.year").html($items.siblings(".year").html()).show() : $("#main_container div.case div.caselist div.detail ul li.year").hide();
			   $items.siblings(".type").html() ? $("#main_container div.case div.caselist div.detail ul li.type").html($items.siblings(".type").html()).show() : $("#main_container div.case div.caselist div.detail ul li.type").hide();
			   $items.siblings(".location").html() ? $("#main_container div.case div.caselist div.detail ul li.location").html($items.siblings(".location").html()).show() : $("#main_container div.case div.caselist div.detail ul li.location").hide();
			   $("#main_container div.case div.caselist div.detail div.intro").html($items.siblings(".intro").html());
			   $("#main_container div.case div.caselist div.detail").show();
			   }
		   })
	
	}
$(function(){
		  // $('div.category > ul').jcarousel({vertical: true,scroll: 10})
		   //jFilterCaseListCallBack()
		   
		   $('#main_container div.case div.category').accordion({
																autoheight: false,
																animated: false,
																header:"a[name='tab']",
																alwaysOpen: false
																})
		   .bind("change.ui-accordion", function(event, ui) {
												 if (ui.newHeader.attr("ref")=="bbc"){ location.reload();return false;}
												 $('#main_container div.case div.category div.content_'+ui.newHeader.attr("ref")+' div.scrollpane').jScrollPane({animateTo:true, animateInterval:50, animateStep:5, showArrows: true, scrollbarWidth: 7, arrowSize: 8,dragMaxHeight:99999,scrollbarMargin:20,reinitialiseOnImageLoad: false})
												 ui.newContent.next().find("div.title").css({"border-top":"1px solid #CDCDCD"})
												 ui.oldContent.next().find("div.title").css({"border-top":"0px none"})
												 })

		   $('#main_container div.case div.category div.casecontent div.scrollpane ul li a').click(function(){return false})
		   $('#main_container div.case div.category div.casecontent div.scrollpane ul li.picture a').click(function(){
																													$(".caselist").find(".title > span").html($(this).parent().parent().parent().parent().parent().prev().find(".title").html())
																													$(this).parent().siblings().removeClass("selected");
																													$(this).parent().addClass("selected");
																													loadcasedetail($(this).attr("href"))
																													return false
																												  })
		   $('#main_container div.case div.caselist div.scrollpane ul.caselist > li').jFilterCaseList({
																									rowCount:2,
																									caseLayout:"div.intro",
																									callBack:jFilterCaseListCallBack
																									})
		   });
