/**<?php
 * cms 1.0
 *
 * PHP versions 5.0.0 upper
 *
 * Copyright 2007-2010, MAGREX 
 *
 * @copyright		Copyright 2007-2010, MAGREX
 * @link			http://www.magrex.co.jp/
 * @version			1.0.0.3
 * @lastmodified	2010-08-16
 * 
*/

// 移行用dummy
function actionTabST3(){}
function actionTabST4(){}


(function($){
$(function(){


	var documentWidth = 672;

	////// Tab object

	// 旧バージョン対応
	// html にあるイベントハンドラの削除 #ペンディング
	if( $('.tabProtect').length ){
		//$('.tabProtect').remove();
	}

	var setTabObj = function(){

		var col = $(".colspuit").css("color");
		$(".tabST .tab dt p.sponge").css("background",col);

		var actChk = 0;

		var actionST3 = function(num, sw, tag){
			var $target = $(tag).parent().parent().parent();
			if( sw === 0 ){
				if( num == actChk ){
							$(".tab dt p, .tab dt span", $target).css('opacity','0.5');
					$(".tab2", $target).animate({ left: 204 }, 250);
					$(".tab3", $target).animate({ left: 408 }, 250,
						function(){
							$(".tab", $target).queue([]);
							actChk = 0;
						}
					);
				}
			}else {
				if( actChk === 0 ){
					actChk = num;
					if( num == 1 ){
							$(".tab1 dt p, .tab1 dt span", $target).css('opacity','0.7');
						$(".tab2", $target).animate({ left: 596 },250);
						$(".tab3", $target).animate({ left: 604 },250);
					}
					if( num == 2 ){
							$(".tab2 dt p, .tab2 dt span", $target).css('opacity','0.7');
						$(".tab2", $target).animate({ left: 8   },250);
						$(".tab3", $target).animate({ left: 604 },250);
					}
					if( num == 3 ){
							$(".tab3 dt p, .tab3 dt span", $target).css('opacity','0.7');
						$(".tab2", $target).animate({ left: 8   },250);
						$(".tab3", $target).animate({ left: 16  },250);
					}
				}
			}
		};

		var actionST4 = function(num, sw, tag){
			var $target = $(tag).parent().parent().parent();
			if( sw === 0 ){
				if( num == actChk ){
							$(".tab dt p, .tab dt span", $target).css('opacity','0.5');
					$(".tab2", $target).animate({ left: 153 }, 250);
					$(".tab3", $target).animate({ left: 306 }, 250);
					$(".tab4", $target).animate({ left: 459 }, 250,
						function(){
							$(".tab", $target).queue([]);
							actChk = 0;
						}
					);
				}
			}else {
				if( actChk === 0 ){
					actChk = num;
					if( num == 1 ){
							$(".tab1 dt p, .tab1 dt span", $target).css('opacity','0.7');
						$(".tab2", $target).animate({ left: 588 },250);
						$(".tab3", $target).animate({ left: 596 },250);
						$(".tab4", $target).animate({ left: 604 },250);
					}
					if( num == 2 ){
							$(".tab2 dt p, .tab2 dt span", $target).css('opacity','0.7');
						$(".tab2", $target).animate({ left: 8   },250);
						$(".tab3", $target).animate({ left: 596 },250);
						$(".tab4", $target).animate({ left: 604 },250);
					}
					if( num == 3 ){
							$(".tab3 dt p, .tab3 dt span", $target).css('opacity','0.7');
						$(".tab2", $target).animate({ left: 8   },250);
						$(".tab3", $target).animate({ left: 16  },250);
						$(".tab4", $target).animate({ left: 604 },250);
					}
					if( num == 4 ){
							$(".tab4 dt p, .tab4 dt span", $target).css('opacity','0.7');
						$(".tab2", $target).animate({ left: 8   },250);
						$(".tab3", $target).animate({ left: 16  },250);
						$(".tab4", $target).animate({ left: 24  },250);
					}
				}
			}
		}

		if( $('.tabObj .ST3').length ){
			$('.tabObj .ST3 .tab').mousemove(function(){
				if( $(this).hasClass('tab1') ){
					actionST3(1,1,this);
				}
				if( $(this).hasClass('tab2') ){
					actionST3(2,1,this);
				}
				if( $(this).hasClass('tab3') ){
					actionST3(3,1,this);
				}
			});
			$('.tabObj .ST3 .tab').mouseleave(function(){
				if( $(this).hasClass('tab1') ){
					actionST3(1,0,this);
				}
				if( $(this).hasClass('tab2') ){
					actionST3(2,0,this);
				}
				if( $(this).hasClass('tab3') ){
					actionST3(3,0,this);
				}
			});
		}

		if( $('.tabObj .ST4').length ){
			$('.tabObj .ST4 .tab').mousemove(function(){
				if( $(this).hasClass('tab1') ){
					actionST4(1,1,this);
				}
				if( $(this).hasClass('tab2') ){
					actionST4(2,1,this);
				}
				if( $(this).hasClass('tab3') ){
					actionST4(3,1,this);
				}
				if( $(this).hasClass('tab4') ){
					actionST4(4,1,this);
				}
			});
			$('.tabObj .ST4 .tab').mouseleave(function(){
				if( $(this).hasClass('tab1') ){
					actionST4(1,0,this);
				}
				if( $(this).hasClass('tab2') ){
					actionST4(2,0,this);
				}
				if( $(this).hasClass('tab3') ){
					actionST4(3,0,this);
				}
				if( $(this).hasClass('tab4') ){
					actionST4(4,0,this);
				}
			});
		}

	}
	if( $('.tabObj').length ){
		setTabObj();
	}

	////// end: Tab object

	////// start: tickerA object
	
	if($('.tickerA').length){
		$.getScript(getRootPath() + "js/jquery.li-scroller.1.0.js", function(){
			$('.tickerA').liScroll({travelocity: 0.07});
		});
	}
	
	////// end: tickerA object

	////// start: ickerB object
	
	if($(".tickerB").length){
		for(i=0;$(".tickerB").length > i;i++){
			var count = 1;
			$(".tickerB:eq("+ i +")").attr("id","tickerB_"+i);
			$("#tickerB_"+i+" li:nth-child("+count+")").fadeIn().css({"left":"510px","position":"absolute"}).animate({"left": "10px"}, 3000 );
			tickertimer("#tickerB_"+i+" li",count);
		}
	}

	function tickertimer(id,count){
		var timer = setInterval(function(){
			//count = $(id).length == count ? count : count++;
			if($(id).length == count){count = 1;}else{count++;}
			$(id).fadeOut("fast");
			$(id+":nth-child("+count+")").fadeIn().css({"left":"510px","position":"absolute"}).animate({"left": "10px"}, 3000 );
		},8000);
	}
	
	////// end: tickerB object
	
	////// start: slidebanner object
	
	if($('.SlideBannerA').length){
		$.getScript(getRootPath() + "js/jquery.innerfade.js", function(){
			$(".SlideBannerA").each(function(){
				var maxwidth = 0;
				var maxheight = 0;
				var allowedwidth = 468;
				if($(this).parent().attr("class") == "SlideBanner_bb"){
					allowedwidth = 160;
				}
				$(this).children().each(function(){
					$(this).css({"left":"-1000px","top":"-1000px"}).show();//li表示
					//幅置き換え、
					if($(this).find("img").width() > allowedwidth){
						$(this).find("img").width(allowedwidth);
					}
					//最大幅取得
					if ($(this).find("img").width() > maxwidth){
						maxwidth = $(this).find("img").width();
					}
					//最大高取得
					if ($(this).find("img").height() > maxheight){
						maxheight = $(this).find("img").height();
					}
				});
				$(this).children().each(function(){
					//各liセンタリング処理
					$(this).css({"left":(allowedwidth-$(this).find("img").width())/2+"px","top":(maxheight-$(this).find("img").height())/2+"px"});
				});
				//ulに最大高割り当て
				$(this).innerfade({ animationtype: 'fade', speed: 'slow', timeout: 5000, type: 'random',containerheight:maxheight});
			});
		});
	}

	////// end: slidebanner object
	
	////// start: slidebanneredit object
	
	if($('.SlideBannerAselect').length){
		$.getScript(getRootPath() + "js/jquery.innerfade.js", function(){
			$('.SlideBannerAselect li:nth-child(1)').css("display","block");
			$('.SlideBannerAselect').innerfade({ animationtype: 'fade', speed: 'slow', timeout: 5000, type: 'random',containerheight:'auto'});
		});
	}

	////// end: slideanneredit object

	////// RealTab object

	var setRealtabObj = function(){

		var rt = new Object;
			rt.obj = $('.realTab');
			rt.tab = $('dt div', rt.obj);

		$(rt.obj).each(function(){

			var dt0 = $('dt',this).eq(0);
			var dd0 = $('dd ol',this).eq(0);

			$('dt',this).each(function(i){
				if( i > 0 ){
					$('div',this).appendTo($(dt0));
					$(this).remove();
				}
			});
			$('dd',this).each(function(i){
				if( i > 0 ){
					$('ol li',this).appendTo($(dd0));
					$(this).remove();
				}
			});

			$('li:not(.realTab ol li ol li,.realTab ol li ul li)',dd0).nextAll().css("display","none").animate({ opacity:0.3 },0);
			$('div',dt0).nextAll().addClass("backtab");

		});

		$(rt.tab).mouseover(function(){
			if( $(this).hasClass("backtab") ){
				$(this).removeClass("backtab").addClass("onmouse");
			}
		});
		$(rt.tab).mouseleave(function(){
			if( $(this).hasClass("onmouse") ){
				$(this).removeClass("onmouse").addClass("backtab");
			}
		});

		$(rt.tab).click(function(){
			if( $(this).hasClass("onmouse") ){

				$(this).siblings().addClass("backtab");
				$(this).removeClass("onmouse");

				var num = $(this).prevAll().length;
				var myParent = $(this).parents(".realTab");

				$('dd ol li:not(.realTab ol li ol li,.realTab ol li ul li)', myParent).each(function(i){
					if( i == num ){
						$(this).animate({ height:"show", opacity:1.0 },400,"swing");
					}else {
						if( $(this).css("display") != "none" ){
							$(this).animate({ height:"hide", opacity:0.3 },300);
						}
					}
				});

			}
		});

	}
	if( $('.realTab').length && !$('.realTab').eq(0).hasClass("jsSleep") ){
		setRealtabObj();
	}

	////// end RealTab object


	////// set object container

	function chkObjContainer(h){
		if( h != "remove" ){
			if( !$('#objContainer').length ){
				$('#bodyB').append('<div id="objContainer"></div>');
				$('#objContainer').html(h).css("z-index","100");
				return true;
			}
			else {
				return false;
			}
		}
		else {
			$('#objContainer').remove();
		}
	}

	////// end: set object container


	////// Loupe Object

	var setLoupeObj = function(){

		// 非表示の対応
		$('.loupeObj img').each(function(i){
			if( $(this).css("display") == "none" ){
				$(this).parents("li").css("display","none");
			}
		});

		// 初期値
		var loupe_w = 360,
			loupe_h = 330,
			loupe_margin = 5,
			loupe_escx = 14,
			loupe_escy = 4,
			loupe_html = (function(){
				var h =  '\n<div id="loupe">\n';
					h +=   '<div class="loupebase"><span class="loupes1"></span><span class="loupes2"></span><span class="loupes3"></span><span class="loupes4"></span><span class="loupes5"></span></div>\n';
					h +=   '<div class="loupeimg"></div>\n';
					h +=   '<div class="loupenote">\n';
					h +=     '<div class="notebase"><span class="loupet1"></span><span class="loupet2"></span><span class="loupet3"></span></div>\n';
					h +=     '<div class="notetxt"><p></p></div>\n';
					h +=   '</div>\n';
					h += '</div>\n';
				return h;
				})()
			;

		// 本体
		var setLayer = function(){

			// レイヤの表示
			$('.loupeObj li').mouseenter(function(e){
				if( chkObjContainer(loupe_html) && !$('img',this).hasClass("notuse") ){
					$('.lphbox',this).addClass("onmouse");
					var posx = e.pageX + loupe_escx;
					var posy = e.pageY + loupe_escy;
					$('#loupe').css("top", posy + 'px').css("left", posx + 'px');
					var t = $('#loupe');
					$('img', this).clone().appendTo('#loupe .loupeimg');
					$('.loupenote p:first', t).html($('p:first', this).html());
					t.css("display","block");
				}
			});

			// レイヤの消去
			$('.loupeObj li').mouseleave(function(){
				if( $('#loupe').length ){
					$('.lphbox',this).removeClass("onmouse");
					chkObjContainer("remove");
				}
			});

			// レイヤの移動
			$('.loupeObj li').mousemove(function(e){
				if( $('#loupe').length ){
					var posx = e.pageX + loupe_escx;
					var posy = e.pageY + loupe_escy;
					var poscy = e.clientY + loupe_escy;
					var docw = getDocumentWidth() - loupe_margin * 2;
					var winh = getWindowHeight() - loupe_margin;

						// 画面からはみ出さないようにする
						if( docw < posx + loupe_w ){
							posx -= loupe_w + loupe_escx * 2;
						}
						if( winh < poscy + loupe_h ){
							posy -= ( poscy + loupe_h ) - winh;
						}

					$('#loupe').css("top", posy + 'px').css("left", posx + 'px');
				}
			});

		}
		setLayer();

	}
	if( $('.loupeObj').length && $('#bodyB').length ){
		setLoupeObj();
	}

	////// end: Loupe Object


	////// set imageViewer

	var presetImageViewer = function(){

		// 拡大表示設定になっている画像の調査と置換
		var prechk = false;
		$('.OBJ a > img').each(function(i){
			var myImg = this.src.split('/').pop();
			var myBimg = $(this).parents("a").attr("href").split('/').pop();
				if( myBimg == 'b' + myImg ){
					$(this).addClass("haveBph")
						.attr("title", "イメージビュアで開きます：" + $(this).attr("title"))
						.parents("a").replaceWith($(this));
					prechk = true;
				}
		});

		// 本体
		var imageViewer = function(){

			var ph = new Object;
			var viewer = new Object;

				// 対象画像の設定
				ph.tag = '.haveBph';
				ph.max = $(ph.tag).length;

			if( ph.max ){

				// レイヤを閉じる .live
				closeViewer();

				// リサイズ対応
				$(window).resize(function(){
					setPopLayer();
				});

				// 対象画像クリック後の動作
				$(ph.tag).click(function(){

					// ナンバ取得
					ph.element = this;
					ph.now = (function(){
						var now = 0;
						$(ph.tag).each(function(i){
							if( this == ph.element ) now = i;
						});
						return now;
						})();

					viewer.roop = 0;
					setViewer();

				});

				// メイン動作
				function setViewer(){

					ph.nowobj = $(ph.tag).eq(ph.now);
					ph.nowdom = $(ph.tag).get(ph.now);

					// 拡大画像の情報、状態取得
					this.bph = new Image();

						bph.ready = false;
						bph.onload = function(){ this.ready = true }
						bph.onabort = bph.onerror = function(){ this.ready = 'error' }
						bph.chk = 0;

						bph.src = (function(){
								var myArr = ph.nowobj.attr("src").split('/');
								myArr.push('b' + myArr.pop());
								return myArr.join('/');
							})()

						bph.note = ph.nowobj.attr("alt");
//						bph.note = ph.nowobj.attr("alt") + '<span style="right: -2px; top: 2px; width: auto; height: 15px; cursor: pointer;background-color:#FFF;">close</span>';//closeボタン 追記

					// ポップレイヤ配置
					if( !viewer.roop ){
						var h = '<div id="popg"></div><div id="popb"></div>';
						chkObjContainer(h);
						$('#popg, #popb').css("z-index","100");
						setPopLayer();
					}

					// ビュア配置
						var h =  '<div id="viewerContainer"><div id="viewerShade"></div>';
							h += '<div id="viewer" class="indicator"><span class="br"></span><span class="bl"></span>';
							h +=   '<div id="bphbox">';
							h +=     '<p id="bph"></p><dl id="goBack"><dt></dt><dd></dd></dl><dl id="goNext"><dt></dt><dd></dd></dl>';
							h +=   '</div>';
							h +=   '<p id="bnote"></p><p id="vclose"></p>';
							h +=   '<div id="viewerHundle"><span class="tl"></span><span class="tr"></span><p></p></div>';
							h +=   '<p id="viewerClose" title="画像を閉じる"></p>';
							h += '</div></div>';
						$('#popb').html(h);

						viewer.w = $('#viewer').width();
						viewer.h = $('#viewer').height();

						if( !viewer.roop ){
							viewer.l = ( getDocumentWidth() - viewer.w ) / 2;
							//viewer.t = getObjectPos(ph.nowdom,'top') - viewer.h / 4;
							viewer.t = $(window).scrollTop() + ($(window).height() / 2 ) - 80;
						}

						$('#viewerContainer').css("top",viewer.t + "px")
							.css("left",viewer.l + "px");

						if( !$.browser.msie ){
							$('#viewerContainer').fadeIn(200);
						}else {
							$('#viewerContainer').css("display","block")
						}

						ph.hundle = $('#viewerHundle').height();
						ph.border = $('#bphbox').width();

						$('#viewerClose').unbind('click').click(function(){
							chkObjContainer("remove");
						});

					// 画像のロード完了後の動作
					this.viewBph = function(){
						bph.w = bph.width;
						bph.h = bph.height;
							var myPx = Math.max( bph.w, bph.h );
							// 最大サイズをウィンドウサイズの9割に制限
							var wiPX = Math.max($(window).width()-50,$(window).height()-50);
							if( myPx > wiPX ){
								var myPer = wiPX / myPx * 0.95;
								bph.w = parseInt( bph.w * myPer );
								bph.h = parseInt( bph.h * myPer );
							}
							/* 最大サイズを600px未満に制限
							if( myPx > 600 ){
								var myPer = 600 / myPx;
								bph.w = parseInt( bph.w * myPer );
								bph.h = parseInt( bph.h * myPer );
							}
							*/
						viewer.roop = 1;
						viewer.lastw = viewer.w;
						viewer.lasth = viewer.h;
						viewer.w = bph.w + ph.border * 2;
						viewer.h = bph.h + ph.border * 2 + ph.hundle + $('#bnote').height() + parseInt($('#bnote').css("padding-top"));

						viewer.movet = (function(){
							var t = (bph.h - viewer.lasth)/2;
							var tafter = viewer.t - t;
							if ( tafter < 0 ) t += tafter - 5;
							return t;
							})()
						viewer.movel = (viewer.w - viewer.lastw)/2;
						$('#viewer').removeClass("indicator");

						$('#viewerContainer').animate(
							{ top: '-=' + viewer.movet, left: '-=' + viewer.movel },250
						);
						$('#viewer, #viewerShade').animate(
							{ width: viewer.w, height: viewer.h },250,
							function(){
								$('#bphbox').css("top", ph.border + ph.hundle + "px")
									.css("left", ph.border + "px");

								ph.borderIe6adj = ( $.browser.msie && $.browser.version < 7 && viewer.h % 2 != 0 ) ? -1 : 0;

								$('#bnote').css("bottom", ph.border + ph.borderIe6adj + "px")
									.css("left", ph.border + "px")
									.html(bph.note);
								
								$('#vclose').css("bottom", ph.border + ph.borderIe6adj + "px")
									.css("right", ph.border + "px")
									.html("close");
								
								//closeアクション 追記
								$('#vclose').click(function(){
									chkObjContainer("remove");
								});
									
								var h = '<img src="' + bph.src + '" alt="bigimage">';
								$('#bph').html(h);
								$('#viewerHundle').width(viewer.w)
									.height(ph.hundle);
								$('#bphbox, #bph, #bph img').width(bph.w);
								$('#bnote').width(bph.w - 45); //closeを避ける
								$('#bphbox, #bph, #bph img').height(bph.h);

								$('#viewer dl, #viewer dt, #viewer dd').width(parseInt(bph.w/2))
									.height(bph.h);

								moveViewer();
								goBackNext();

							}
						);
					}

					// ビュアレイヤの移動
					this.moveViewer = function(){
						var t = $('#viewerHundle');
						var tp = $('p', t);
						var hundle = new Object;
							hundle.pwhalf = parseInt(tp.width()/2);
							hundle.phhalf = parseInt(tp.height()/2);

						t.mouseover(function(){
							t.addClass("onmouse");
						});
						t.mouseout(function(){
							t.removeClass("onmouse");
						});

						var dieEvent = function(){
							tp.css('display','none');
							tp.unbind('mousemove');
							t.focus();
							viewer.l = hundle.x + parseInt($('#viewer').width() / 2);
							viewer.t = hundle.y + parseInt($('#viewer').height() / 2);
						}

						t.mousedown(function(event){
							hundle.ix = parseInt($('#viewerContainer').css("left"));
							hundle.iy = parseInt($('#viewerContainer').css("top"));
							hundle.lx = event.pageX;
							hundle.ly = event.pageY;
							tp.css('left',hundle.lx - hundle.ix - hundle.pwhalf + 'px')
								.css('top',hundle.iy - hundle.ly - hundle.phhalf + 'px')
								.css('display','block');

							tp.mousemove(function(e){
								hundle.nx = e.pageX;
								hundle.ny = e.pageY;
								hundle.x = hundle.nx - hundle.lx + hundle.ix;
								hundle.y = hundle.ny - hundle.ly + hundle.iy;
								if( hundle.nx > 0 && hundle.nx < $('#popb').width() && hundle.ny > 0 && hundle.ny < $('#popb').height() ){
									$('#viewerContainer').css('left',hundle.x)
										.css('top',hundle.y)
								}else {
									dieEvent();
								}
							});
							tp.one('mouseup',function(){
								dieEvent();
							});

						});
					}

					// 画像の前後移動
					this.goBackNext = function(){
						if ( ph.now != 0 ){
							var dlb = $('#goBack');
							$('dd',dlb).mouseover(function(){
								$('dt,dd',dlb).addClass("onmouse");
								$('dd',dlb).attr("title","前の画像");
							});
							$('dd',dlb).mouseout(function(){
								$('dt,dd',dlb).removeClass("onmouse");
							});
							$('dd',dlb).click(function(){
								ph.now--;
								setViewer();
							});
						}
						if ( ph.now != ph.max - 1 ){
							var dln = $('#goNext');
							$('dd',dln).mouseover(function(){
								$('dt,dd',dln).addClass("onmouse");
								$('dd',dln).attr("title","次の画像");
							});
							$('dd',dln).mouseout(function(){
								$('dt,dd',dln).removeClass("onmouse");
							});
							$('dd',dln).click(function(){
								ph.now++;
								setViewer();
							});
						}
					}

					// 読み込み失敗時の処理
					this.loadFailed = function(){
						$('#viewer').removeClass("indicator")
							.addClass("error");
						$('#viewerContainer').animate(
							{ left: '-=' + viewer.w / 2 },250
						);
						$('#viewerShade, #viewer').animate(
							{ width: viewer.w * 2 },250,
							function(){
								$('#bnote').addClass("error")
									.html("画像を読み込めませんでした");
							}
						);
						setTimeout('closeViewer()',3000);
					}

					// 画像の読み込みチェック
					this.loadChk = function(){
						if( bph.ready ){
							//alert( bph.chk );
							setTimeout('viewBph()',400);
						}
						else if( bph.ready == 'error' || bph.chk > 600 ){
							setTimeout('loadFailed()',50);
						}
						else {
							bph.chk++;
							setTimeout('loadChk()',50);
						}
					}
					loadChk();

				}

			}
		}
		if( prechk ) imageViewer();

		// ポップレイヤの設定
		function setPopLayer(){
			if( $('#popg')[0] ){
				$('#objContainer').css("display","none"); // ポップレイヤを消して正しく計測
				var w = getDocumentWidth();
				var h = getDocumentHeight();
				$('#objContainer').css("display","block");
				$('#popg, #popb').width(w).height(h);
				if( !$.browser.msie ){
					$('#popg').fadeTo('500', '0.7');
				}
				if( $('#viewer')[0] ){
					var vw = $('#viewer').width();
					var x = parseInt( w/2 - vw/2 );
					$('#viewerContainer').css("left", x);
				}
			}
		}

		// ポップレイヤを閉じる
		function closeViewer(){
			$('#popb').live('click',function(e){
				var x = e.pageX;
				var y = e.pageY;
				var vx0 = parseInt($('#viewerContainer').css("left"));
				var vy0 = parseInt($('#viewerContainer').css("top"));
				var vx1 = vx0 + $('#viewer').width();
				var vy1 = vy0 + $('#viewer').height();

				// ビュアを除くレイヤ背景をクリックした時のみ閉じる
				if ( !( x > vx0 && x < vx1 && y > vy0 && y < vy1 ) ){
					chkObjContainer("remove");
				}
			});
		}

	}
	if( $('#bodyB').length ){
		presetImageViewer();
	}

	////// end: set imageViewer

	////// start: set <a>
		// 非表示の対応
		$('a').each(function(i){
			if( $.trim( $(this).attr("href")) == "" ){
				$( $(this) ).click(function(){
					return false;
				});
			}

		});
	////// end: set <a>


	////// 共通ライブラリ

	//ルートパスを得る
	function getRootPath(){
		var temps = $('link[href$=common.css]').attr("href").split("css/common.css");
		var path = "";
		if(temps.length == 2){
			path = temps[0];
		}
		return path;
	}

	// オブジェクトの位置 - 画面左上からの取得
	function getObjectPos(tag,mod){
		var p = 0;
		while(tag){
			if( mod == 'top' ) p += tag.offsetTop;
			else if ( mod == 'left' ) p += tag.offsetLeft;
			tag = tag.offsetParent;
		}
		return p;
	}

	// 全体サイズの取得 - width
	function getDocumentWidth(){
		if( document.documentElement && document.documentElement.clientWidth ){
			var w = Math.max( document.documentElement.clientWidth, document.documentElement.scrollWidth );
			var w = Math.max( w, documentWidth );
			return w;
		}else if ( document.body && document.body.clientWidth){
			var w = Math.max( document.body.clientWidth, document.body.scrollWidth );
			var w = Math.max( w, documentWidth );
			return w;
		}
	}
	// 全体サイズの取得 - height
	function getDocumentHeight(){
		if( document.documentElement && document.documentElement.clientHeight ){
			var h = Math.max( document.documentElement.clientHeight, document.documentElement.scrollHeight );
			return h;
		}else if ( document.body && document.body.clientHeight){
			var h = Math.max( document.body.clientHeight, document.body.scrollHeight );
			return h;
		}
	}
	// 窓サイズの取得 - height
	function getWindowHeight(){
		if(window.innerHeight){
			return window.innerHeight;
		}else if(document.documentElement && document.documentElement.clientHeight){
			return document.documentElement.clientHeight;
		}else if ( document.body && document.body.clientHeight){
			return document.body.clientHeight;
		}
	}

});
})(jQuery);

//  eof
