// JavaScript Document

//IE用の背景ちらつき防止
try {
	document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}

//=========================================================
//swfの貼付け(※要swfObject)
function embedSWF( swfFile , id , width , height , color ){
	color = ( typeof color != 'undefined' ) ? color : "#FFFFFF";
	//alert( swfFile );
	var query = new Date().getTime();
	var request = swfFile + "?time=" + query;
	var so = new SWFObject( request , "embed_" + id , width, height, "9", color );
	so.addParam("quality", "high");
	so.addParam("scale", "noscale");
	so.addParam('allowScriptAccess', 'always');
	so.addParam("menu", "false");
	so.addParam("salign", "tl");
	so.addParam("wmode", "transparent");
	so.write( id );
}


/**==================================================
*lightboxの実行
*階層が変わるとcloseボタンとかが出なくなってしまうのでなんか考える必要あり。
*/
/*
$(function() {
	// Use this example, or...
	//$('a[@rel*=lightbox]').lightBox(); // Select all links that contains lightbox in the attribute rel
	// This, or...
	//$('#gallery a').lightBox(); // Select all links in object with gallery ID
	// This, or...
	
	$('a.lightbox').lightBox({
		overlayBgColor: '#000'
	})	;
	
	// Select all links with lightbox class
	// This, or...
	//$('a').lightBox(); // Select all links in the page
	// ... The possibility are many. Use your creative or choose one in the examples above

});
*/

//=========================================================
//UIHelper
$(document).ready(function() {
	/* ------------------------------------------------- */
	//グローバルメニューのドロップダウン
    $("#global_navi li").hover(function(){
		$(this).children('ul').show();
    }, function(){
		$(this).children('ul').hide();
    });
	
	/* ------------------------------------------------- */
	//先頭へ戻るボタンのスクロール
	$('div.anchor a').click(function(){
		$('html,body').animate({ scrollTop: 0 }, 500);
	});
	
	
	/* ------------------------------------------------- */
	//lightboxの設定
	var regExp = new RegExp( '/$' );
	var pathArray = location.href.replace("http://","").replace(regExp,"").split("/");
	var n = ( pathArray.length - 1 );
	var path = "";
	for( var i = 0 ; i < n ; i++ ){
		path += "../";
	}
	$('a[rel*=lightbox]').lightBox({
		overlayBgColor:'#000',
		overlayOpacity:0.6,
		imageLoading:path+'common/images/lightbox-ico-loading.gif',
		imageBtnClose:path+'common/images/lightbox-btn-close.gif',
		imageBtnPrev:path+'common/images/lightbox-btn-prev.gif',
		imageBtnNext:path+'common/images/lightbox-btn-next.gif',
		containerResizeSpeed:350,
		txtImage:'画像：',
		txtOf:'／'
	});
});

