var cl = 0;
var NumOfImg = 5;
var flag=0;
var start = 0;
var images = {
	url : [
		['/share/img/rw_img_55.jpg', 'http://www.tochigiymca.org/try_east/', 'トライ東'],
		['/share/img/rw_img_50.jpg', 'http://www.tochigiymca.org/shioya/wp/', '塩谷キャンプ場'],
		['/share/img/rw_img_49.jpg', 'http://www.ja-mukawa.or.jp/', 'JAむかわ'],
		['/share/img/rw_img_48.jpg', 'http://www.jasendai.or.jp/', 'JA仙台'],
		['/share/img/rw_img_47.jpg', 'http://www.ja-tokyoaoba.or.jp/', 'JA東京あおば'],
		['/share/img/rw_img_46.jpg', 'http://www.ja-kitauonuma.or.jp/', 'JA北魚沼'],
		['/share/img/rw_img_45.jpg', 'http://www.kurinosato.org/', '栗の郷'],
		['/share/img/rw_img_44.jpg', 'http://www.ja-tokyochuo.or.jp/', 'JA東京中央'],
		['/share/img/rw_img_43.jpg', 'http://www.haircareroom.com/', 'ヘアケアルーム'],
		['/share/img/rw_img_42.jpg', 'http://www.tokyo-ja.or.jp/', 'JA東京中央会'],
		['/share/img/rw_img_40.jpg', 'http://www.okayama-chuoukai.or.jp/', 'JAグループ岡山'],  
		['/share/img/rw_img_39.jpg', 'http://www.rakuten.ne.jp/gold/murase-songoku/', 'むらせライス楽天店'],
		['/share/img/rw_img_01.jpg', 'http://www.sanyo-amc.jp/', '山陽動物医療センター'],
		['/share/img/rw_img_02.jpg', 'http://www.torii-ac.com/', 'とりい動物クリニック'],
		['/share/img/rw_img_03.jpg', 'http://www.ejima-ah.jp/', 'えじま動物病院'],
		['/share/img/rw_img_04.jpg', 'http://www.apple-ah.jp/', 'アップル動物病院'],
		['/share/img/rw_img_05.jpg', 'http://www.power-vets.jp/', 'Power-vets.jp'],
		['/share/img/rw_img_06.jpg', 'http://www.senoo-junkanki.gr.jp/', 'せのお循環器科心臓血管外科'],
		['/share/img/rw_img_07.jpg', 'http://www.chibanishi-hp.or.jp/', '千葉西総合病院'],
		['/share/img/rw_img_41.jpg', 'http://www.chibanishi-hp.or.jp/', '千葉西総合病院'],
		['/share/img/rw_img_08.jpg', 'http://www.yotsutoku.jp/', '四街道徳洲会病院'],
		['/share/img/rw_img_09.jpg', 'http://www.kuriyama-hp.jp/', '栗山中央病院'],
		['/share/img/rw_img_11.jpg', 'http://www.chigasakitokushukai.jp/', '茅ヶ崎徳洲会総合病院'],
		['/share/img/rw_img_13.jpg', 'http://www.yth.or.jp/', '大和徳洲会病院'],
		['/share/img/rw_img_14.jpg', 'http://www.kamagaya-hp.jp/', '鎌ケ谷総合病院'],
		['/share/img/rw_img_15.jpg', 'http://www.oyumino-naika.jp/', 'おゆみの診療所'],
		['/share/img/rw_img_16.jpg', 'http://www.oyumino-roken.jp/', '介護老人保健施設おゆみの'],
		['/share/img/rw_img_17.jpg', 'http://www.oyumino-seikei.jp/index.html', 'おゆみの整形外科クリニック'],
		['/share/img/rw_img_18.jpg', 'http://www.japan-bms.com/', 'BMS八重洲ゲート'],
		['/share/img/rw_img_19.jpg', 'http://www.jp-doctors.com/', '医師相談.com'],
		['/share/img/rw_img_38.jpg', 'http://www.sakuranbo.ed.jp/', 'さくらんぼ幼稚園'],
		['/share/img/rw_img_20.jpg', 'http://www.daishin-jp.com/', 'ダイシン百貨店'],
		['/share/img/rw_img_21.jpg', 'http://www.ja-ishinomaki.or.jp/', 'JAいしのまき'],
		['/share/img/rw_img_22.jpg', 'http://www.chiba-suiden.jp/', '千葉県水田農業推進協議会'],
		['/share/img/rw_img_23.jpg', 'http://www.ja-kushirotancho.or.jp/', 'JAくしろ丹頂'],
		['/share/img/rw_img_24.jpg', 'http://www.qualia-medical.jp/', 'QUALIA クオリア'],
		['/share/img/rw_img_25.jpg', 'http://search.opengroove.com/', 'エンタープライズサーチ（企業内検索・社内検索）'],
		['/share/img/rw_img_26.jpg', 'http://www.zeera.jp/', 'zeera document search'],
		['/share/img/rw_img_27.jpg', 'http://www.worldrecord314.com/', '円周率πの達人 原口證オフィシャルウェブサイト'],
		['/share/img/rw_img_28.jpg', 'http://www.shashoku.com/', '社食.com'],
		['/share/img/rw_img_29.jpg', 'http://www.yuyu-okinawa.jp/', 'サマーハウス遊遊'],
		['/share/img/rw_img_30.jpg', 'http://www.ytrans.com/', '山田翻訳事務所'],
		['/share/img/rw_img_31.jpg', 'http://www.aoba-tax.jp/', '青葉会計法人'],
		['/share/img/rw_img_32.jpg', 'http://www.e-yume-koubou.com/', 'フォトスタジオe夢工房'],
		['/share/img/rw_img_33.jpg', 'http://www.helsinkiformula.co.jp/', 'ヘルシンキ・フォーミュラ'],
		['/share/img/rw_img_34.jpg', 'http://www.rakuten.ne.jp/gold/helsinkiformula/', 'ヘルシンキ・フォーミュラ（楽天店）'],
		['/share/img/rw_img_35.jpg', 'http://www.rakuten.ne.jp/gold/helsinkiformula/', 'ヘルシンキ・フォーミュラ（楽天店）'],
		['/share/img/rw_img_36.jpg', 'http://store.shopping.yahoo.co.jp/fbshop/', 'ヘルシンキ・フォーミュラYahoo!店'],
		['/share/img/rw_img_37.jpg', 'http://2oi.jp/', 'アンチ加齢臭.NET'],
	]
};
var offset= parseInt(Math.random()*(images.url.length-2))

function xShowWorks(){
	for (i = 0; i < NumOfImg; i++) {
		n=cl*NumOfImg+i+offset;
		if(n > images.url.length-2){
			n = n-images.url.length+1;
			flag=1;
			start++;
		}
		$("#works"+i+" img").hide();
		$("#works"+i+" a").attr({ href: images.url[n][1]});
		$("#works"+i+" a").attr({ target: "_blank"});
		$("#works"+i+" img").attr({ src: images.url[n][0]});
		$("#works"+i+" img").fadeIn("slow");
		$("#works"+i+" .caption").text(images.url[n][2]);

	}
	cl++;
	if(flag==1){
		cl=0;
		flag=0;
		offset=start;
		start=0;
	}
}

$(document).ready(xShowWorks);
