

jQuery.noConflict();

/* 写真で読む展示会とMICE */

var count=1;//現在表示しているアイテムの番号
var wrapSize = 180;//表示エリアのwidth
var containedItems = 1;//表示エリアに格納するアイテム数

/* 展示会ニュース */

var count2=1;
var wrapSize2 = 275;//表示エリアのwidth
var containedItems2 = 5;//表示エリアに格納するアイテム数

/* 初期設定 */
jQuery(function(){
	//写真で読む展示会とMICE
	//jQuery("#carouselInner").css("height",610*jQuery("#carouselInner ul.column").size()+"px");
	//jQuery("#carouselInner ul.column:last").prependTo("#carouselInner");
	jQuery("#carouselInner ul.column").css("width", (wrapSize * jQuery("#carouselInner ul.column li").size()) + "px");//スクロール時に次のアイテムがスムースに入ってくるように、widthをセット。
	jQuery("#carouselInner").css("margin-left","0px");
	jQuery("#carouselPrev img").hide();
	if(jQuery("#carouselInner ul.column li").size()<containedItems){
		jQuery("#carouselNext img").hide();
	}

	//戻るボタン
	jQuery("#carouselPrev img").click(function(){
		count--;
		jQuery("#carouselNext img,#carouselPrev img").hide();
		jQuery("#carouselInner").animate({
			marginLeft : parseInt(jQuery("#carouselInner").css("margin-left"))+wrapSize+"px"
		},"normal","swing" , 
		function(){
			jQuery("#carouselNext img,#carouselPrev img").show();
			if(count == 1){
				jQuery("#carouselPrev img").hide();
			}
		})
	})
	//進むボタン
	jQuery("#carouselNext img").click(function(){
		count++;
		jQuery("#carouselNext img,#carouselPrev img").hide();
		jQuery("#carouselInner").animate({
			marginLeft : parseInt(jQuery("#carouselInner").css("margin-left"))-wrapSize+"px"
		},"normal","swing" , 
		function(){
			jQuery("#carouselNext img,#carouselPrev img").show();
			if(count >= Math.ceil(jQuery("#carouselInner ul.column li").size() / containedItems)){
				jQuery("#carouselNext img").hide();
			}
		})
	})
    
	
	
	//展示会スケジュール
	/*
	//jQuery("#carouselInner").css("height",610*jQuery("#carouselInner ul.column").size()+"px");
	jQuery("#carousel2Inner ul.column:last").prependTo("#carousel2Inner");
	jQuery("#carousel2Inner").css("margin-top","0px");
	jQuery("#carousel2Prev img").hide();

	//戻るボタン
	jQuery("#carousel2Prev img").click(function(){
		count2--;
		jQuery("#carousel2Next img,#carousel2Prev img").hide();
		jQuery("#carousel2Inner").animate({
			marginTop : parseInt(jQuery("#carousel2Inner").css("margin-top"))+wrapSize2+"px"
		},"normal","swing" , 
		function(){
			jQuery("#carousel2Next img,#carousel2Prev img").show();
			if(count2 == 1){
				jQuery("#carousel2Prev img").hide();
			}
		})
	})
	//進むボタン
	jQuery("#carousel2Next img").click(function(){
		count2++;
		jQuery("#carousel2Next img,#carousel2Prev img").hide();
		jQuery("#carousel2Inner").animate({
			marginTop : parseInt(jQuery("#carousel2Inner").css("margin-top"))-wrapSize2+"px"
		},"normal","swing" , 
		function(){
			jQuery("#carousel2Next img,#carousel2Prev img").show();
			if(count2 >= Math.ceil(jQuery("#carousel2Inner ul.column li").size() / containedItems2)){
				jQuery("#carousel2Next img").hide();
			}
		})
	})
	*/
	
})


/* 展示会とMICEをサポートする企業 */
jQuery(function(){
	//ランダマイズ
	var arr2 = new Array();
	jQuery("#comp .compList li").each(function(){
		arr2.push(jQuery(this));
	});
	var i = arr2.length;
	while(i){
		var j = Math.floor(Math.random()*i);
		var t = arr2[--i];
		arr2[i] = arr2[j];
		arr2[j] = t;
	}
	
	jQuery("#comp .compList").empty();
	jQuery.each(arr2, function(){
		jQuery("#comp .compList").append(this);
	});


	//開始
	jQuery("#comp .compList li:first").show("fade", "slow");
	setInterval(nextComp, 7000);
	
	jQuery("#comp .compList li a").click(companyLink);
});

function nextComp(){
	jQuery("#comp .compList li:first").hide("fade", "slow", function(){
		jQuery("#comp .compList li:eq(1)").show("fade", "slow", function(){
			jQuery("#comp .compList li:first").appendTo("#comp .compList");
		});
	});
	
}

function companyLink(){
	var key = jQuery(this).attr("href").split("/")[2];
	location.href = "/add/1153869605744/?goodsKey=" + key;
	return false;
}

/* 写真で読む展示会とMICE(lightbox) */
jQuery(function(){
	jQuery('a.lightbox').lightBox();
});

