/*//////////////////////////////////////////////////////////
//
//  # Functions
//
//  - Auth: ekkun.com [eiji@ekkun.com]
//  - 2011-09-01 (Thu)
//
//////////////////////////////////////////////////////////*/


jQuery(document).ready(function(){

	// A transparent PNG
	jQuery(document).pngFix();

	// Slide Tabs
	jQuery(".slidetabs").tabs(".slide > div", {
		effect: 'fade',
		fadeOutSpeed: "slow",
		rotate: true
	}).slideshow({
		autoplay: true,
		interval: 5000
	});

	// Fancybox
	jQuery("a.fancybox").fancybox({
		'overlayShow'	: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic'
	});

	jQuery("a[rel=201103], a[rel=201003], a[rel=200901], a[rel=200902], a[rel=200903], a[rel=200701], a[rel=200702], a[rel=200703], a[rel=200601], a[rel=200602], a[rel=200603]").fancybox({
		'overlayShow'	: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'titlePosition' : 'over',
		'titleFormat'	: function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		}
	});


});


// お問い合わせ
function verify_inquiry() {
	if (document.inquiry.subject.value == "") {
		alert("件名（Subject）を入力してください。");
		document.inquiry.subject.focus();
		return false;
	}
	if (document.inquiry.name_kana.value == "") {
		alert("フリガナ（Name）を入力してください。");
		document.inquiry.name_kana.focus();
		return false;
	}
	if (document.inquiry.name.value == "") {
		alert("お名前（Name）を入力してください。");
		document.inquiry.name.focus();
		return false;
	}
	var y = document.inquiry.email.value;
	if (y.indexOf("@") == -1) {
		alert("有効なメールアドレスを入力してください。");
		document.inquiry.email.focus();
		return false;
	}
	if (document.inquiry.comment.value == "") {
		alert("メッセージ（Question/Comment）を入力してください。");
		document.inquiry.comment.focus();
		return false;
	}
	else {
		return true;
	}
}

// カタログ請求
function verify_catalog() {
	if (document.catalog.name_kana.value == "") {
		alert("フリガナ（Name）を入力してください。");
		document.catalog.name_kana.focus();
		return false;
	}
	if (document.catalog.name.value == "") {
		alert("お名前（Name）を入力してください。");
		document.catalog.name.focus();
		return false;
	}
	var y = document.catalog.email.value;
	if (y.indexOf("@") == -1) {
		alert("有効なメールアドレスを入力してください。");
		document.catalog.email.focus();
		return false;
	}
	if (document.catalog.comment.value == "") {
		alert("メッセージ（Question/Comment）を入力してください。");
		document.catalog.comment.focus();
		return false;
	}
	else {
		return true;
	}
}

// コンテスト応募フォーム
function verify_contest() {
	if (document.contest.name_kana.value == "") {
		alert("フリガナ（Name）を入力してください。");
		document.contest.name_kana.focus();
		return false;
	}
	if (document.contest.name.value == "") {
		alert("お名前（Name）を入力してください。");
		document.contest.name.focus();
		return false;
	}
	if (document.contest.zip.value == "") {
		alert("郵便番号（Zip Code）を入力してください。");
		document.contest.zip.focus();
		return false;
	}
	if (document.contest.address.value == "") {
		alert("住所（Address）を入力してください。");
		document.contest.address.focus();
		return false;
	}
	if (document.contest.phone.value == "") {
		alert("電話番号（Phone）を入力してください。");
		document.contest.phone.focus();
		return false;
	}
	if (document.contest.job.value == "") {
		alert("職業（Occupation）を選択してください。");
		document.contest.job.focus();
		return false;
	}
	var y = document.contest.email.value;
	if (y.indexOf("@") == -1) {
		alert("有効なメールアドレスを入力してください。");
		document.contest.email.focus();
		return false;
	}
	if (document.contest.age.value == "") {
		alert("年齢（Age）を選択してください。");
		document.contest.age.focus();
		return false;
	}
	if (document.contest.sex.value == "") {
		alert("性別（Sex）を選択してください。");
		document.contest.sex.focus();
		return false;
	}
	if (document.contest.store.value == "") {
		alert("購入店舗名を入力してください。");
		document.contest.store.focus();
		return false;
	}
	if (document.contest.place.value == "") {
		alert("コンテストをお知りになった場所を入力してください。");
		document.contest.place.focus();
		return false;
	}
	if (document.contest.subscribe.value == "") {
		alert("ご購読されている雑誌やウェブサイト名を入力してください。");
		document.contest.subscribe.focus();
		return false;
	}
	var catalog = 0;
	if (document.contest.catalog.length) {
		catalog = 1;
		var i;
		for (i = 0; i < document.contest.catalog.length; i ++){
			if(document.contest.catalog[i].checked){
				catalog = 0; break;
			}
		}
	} else {
		if(!document.contest.catalog.checked){
			catalog = 1;
		}
	}
	if(catalog){
		alert("カタログ等の発送をについて選択されていません。");
		document.contest.catalog_yes.focus();
		return false;
	}
	if (document.contest.attach_01.value == "" && document.contest.attach_02.value == "" && document.contest.attach_02.value == "") {
		alert("添付ファイルがありません。");
		document.contest.attach_01.focus();
		return false;
	}

	var agree = 0;
	if (document.contest.agree.length) {
		agree = 1;
		var i;
		for (i = 0; i < document.contest.agree.length; i ++){
			if(document.contest.agree[i].checked){
				agree = 0; break;
			}
		}
	} else {
		if(!document.contest.agree.checked){
			agree = 1;
		}
	}
	if(agree){
		alert("弊社のご利用規約に同意してください。");
		document.contest.agree.focus();
		return false;
	}

	else {
		return true;
	}
}














