$(function(){

	// external link
	$('a[href^="http"]:not(a[href*="curlycollection.jp"], a[href*="curlyathome.jp"])').click(function(){
		window.open(this.href, '');
		return false;
	});

	// main image
	img = new Array();
	img[0] = '/images/main/mainimage2.jpg';
	img[1] = '/images/main/mainimage1.jpg';
	img[2] = '/images/main/mainimage3.jpg';
	img[3] = '/images/main/mainimage4.jpg';
	img[4] = '/images/main/mainimage5.jpg';

	img = shuffle(img);

	$('#mainimage img').Slides({
		images : [img[0],img[1],img[2],img[3],img[4]],
		pause : 4000,
		wait : 0
	});

	function shuffle(list) {
		var i = list.length;

		while (--i) {
			var j = Math.floor(Math.random() * (i + 1));
			if (i == j) continue;
			var k = list[i];
			list[i] = list[j];
			list[j] = k;
		}
		return list;
	}

	// colorbox
	$('.textwrap, .specialcontent, .pickupcontent').each(function(i){
		$('p a[href*="/pict/"]:has(img)', this).removeAttr("onclick").colorbox({
			scrolling: false,
			initialWidth: 50,
			initialHeight: 50,
			maxWidth:"90%", 
			maxHeight:"90%",
			rel: 'group' + i
		});
	});

});

