/* ------------------------------------------------------------------------
	init for javascript
------------------------------------------------------------------------- */

/******************************
** ポップアップウインドウ600×500用スクリプト
******************************/

$(function() {
	$(".popup").click(function(){
		window.open(this.href, "WindowName","width=600,height=500,resizable=yes,scrollbars=yes");
		return false;
	});
});

/******************************
** google-analytics用スクリプト
******************************/
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-16850624-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

	var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-16850624-2']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

/******************************
** ２重送信防止用スクリプト
******************************/
flag = false;
function send(){
	if (flag) { alert("送信済みです"); return false; }
	flag = true; return true;
}

function disable_links_outline() {
	var blur = function () { this.blur() };
	for (var i = 0; i < document.links.length; i++)
	document.links[i].onfocus = blur;
}


/******************************
** jquery.nivo.sliderの実行用スクリプト
******************************/
$(window).load(function() {
$('#slider').nivoSlider({
effect:'random', //エフェクトの種類
slices:15,
animSpeed:500, //スライドのエフェクトの時間
pauseTime:8000,//スライドの表示の時間
startSlide:0, //初めに表示するスライド番号 (0 index)
directionNav:true, //前後ナビゲーションボタンの表示・非表示
directionNavHide:true, //マウスが画像から外れた時前後ナビゲーションボタンが非表示にする
controlNav:true, //コントロールナビゲーションボタンの表示・非表示
controlNavThumbs:false, //コントロールナビゲーションボタンにサムネイル画像を使う
controlNavThumbsFromRel:false, //imgタグのrelからサムネイル画像のファイル名を取得する
controlNavThumbsSearch: '.jpg', //サムネイル画像の拡張子
controlNavThumbsReplace: '_thumb.jpg', //サムネイル画像の名前の置き換え
keyboardNav:true, //キーボードで前後ナビゲーションする
pauseOnHover:true, //マウスオーバーでスライド停止する
manualAdvance:false, //マニュアルで設定
captionOpacity:0.5, //キャプションの透明度
beforeChange: function(){}, //画像が変わる前に実行するスクリプトを入力
afterChange: function(){}, //画像が変わった後に実行するスクリプトを入力
slideshowEnd: function(){}, //スライドがすべて終わった後実行するスクリプトを入力
lastSlide: function(){}, //最後の画像が表示された時に実行するスクリプトを入力
afterLoad: function(){} //スライドがロードされた後に実行するスクリプトを入力
});
});

/******************************
** jquery.prettyPhotoの実行用スクリプト
******************************/
	$(document).ready(function(){
		$("a[rel^='prettyPhoto']").prettyPhoto({
			animationSpeed: 'normal', /* fast/slow/normal */
			opacity: 0.75, /* Value between 0 and 1 */
			showTitle: true, /* true/false */
			allowresize: true, /* true/false */
			/*default_width: 500,*/
			/*default_height: 344,*/
			counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
			theme: 'light_rounded', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
			hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
			wmode: 'opaque', /* Set the flash wmode attribute */
			autoplay: true, /* Automatically start videos: True/False */
			modal: false, /* If set to true, only the close button will close the window */
			changepicturecallback: function(){}, /* Called everytime an item is shown/changed */
			callback: function(){}, /* Called when prettyPhoto is closed */
			/*
			markup: '<div class="pp_pic_holder"> \
						<div class="pp_top"> \
							<div class="pp_left"></div> \
							<div class="pp_middle"></div> \
							<div class="pp_right"></div> \
						</div> \
						<div class="pp_content_container"> \
							<div class="pp_left"> \
							<div class="pp_right"> \
								<div class="pp_content"> \
									<div class="pp_fade"> \
										<a href="#" class="pp_expand" title="Expand the image">Expand</a> \
										<div class="pp_loaderIcon"></div> \
										<div class="pp_hoverContainer"> \
											<a class="pp_next" href="#">next</a> \
											<a class="pp_previous" href="#">previous</a> \
										</div> \
										<div id="pp_full_res"></div> \
										<div class="pp_details clearfix"> \
											<a class="pp_close" href="#">Close</a> \
											<p class="pp_description"></p> \
											<div class="pp_nav"> \
												<a href="#" class="pp_arrow_previous">Previous</a> \
												<p class="currentTextHolder">0/0</p> \
												<a href="#" class="pp_arrow_next">Next</a> \
											</div> \
										</div> \
									</div> \
								</div> \
							</div> \
							</div> \
						</div> \
						<div class="pp_bottom"> \
							<div class="pp_left"></div> \
							<div class="pp_middle"></div> \
							<div class="pp_right"></div> \
						</div> \
					</div> \
					<div class="pp_overlay"></div> \
					<div class="ppt"></div>',
			*/
			image_markup: '<img id="fullResImage" src="" />',
			flash_markup: '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}"><param name="wmode" value="{wmode}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed></object>',
			quicktime_markup: '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="{height}" width="{width}"><param name="src" value="{path}"><param name="autoplay" value="{autoplay}"><param name="type" value="video/quicktime"><embed src="{path}" height="{height}" width="{width}" autoplay="{autoplay}" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>',
			iframe_markup: '<iframe src ="{path}" width="{width}" height="{height}" frameborder="no"></iframe>',
			inline_markup: '<div class="pp_inline clearfix">{content}</div>'
		});
	});

