﻿/**********************************************************************
ラブ、エイジング。
共通JS

/js/common.js
***********************************************************************/



/* 目次
-------------------------------------------------
 * ROOTPATH　環境設定
 * JQueryの読み込み
 * 共通フッター　サブメニュー
 * 画像ロールオーバー
 * SWF
 * Plugin SEPARATOR
 ------------------------------------------------- */



/*=====================================================================
 ROOTPATH　環境設定
=====================================================================*/ 

var gPathFlg = 0;    // 0:本サーバ, 1:テストサーバ
var gRootPath = '';

if( gPathFlg == 0 )     { gRootPath = location.protocol +'//' + document.domain + ':' + location.port + '/'; }
else if( gPathFlg == 1 ){ gRootPath = location.protocol +'//' + document.domain + ':' + location.port + '/loveageing/'; }



/*=====================================================================
 JQueryの読み込み
=====================================================================*/
document.write('<script type="text/javascript" src="' + gRootPath + 'js/lib/jquery.js"><\/script>');
document.write('<script type="text/javascript" src="' + gRootPath + 'js/lib/jquery.plugin.js"><\/script>');
document.write('<script type="text/javascript" src="' + gRootPath + 'js/lib/jquery.pngfix.js"><\/script>');
document.write('<script type="text/javascript" src="' + gRootPath + 'js/contents.js"><\/script>');




/*=====================================================================
 共通フッター　サブメニュー
=====================================================================*/
function mouseOn(obj){
obj.className = obj.className + '-on'
}
function mouseOut(obj){
obj.className = obj.className.replace(/-on/, "")
}




/*=====================================================================
画像ロールオーバー
=====================================================================*/	
	
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}



/*=====================================================================
SWF
=====================================================================*/
function BGM_SWF() {
    var objectData = (jQuery.browser.msie) ? '' : 'data="/flashdata/BGM.swf"';
    jQuery('#swfBGM').html('<object type="application/x-shockwave-flash"' + objectData + ' width="80" height="140" id="love-ageing_BGM"><param name="movie" value="/flashdata/BGM.swf" /><param name="src" value="/flashdata/BGM.swf" /><param name="wmode" /><param name="menu" value="false" /></object>');
};

function topSWF() {
    var objectData = (jQuery.browser.msie) ? '' : 'data="/flashdata/top.swf"';
    jQuery('#swfcontent').html('<object type="application/x-shockwave-flash"' + objectData + ' width="928" height="496" id="love-ageing_top"><param name="movie" value="/flashdata/top.swf" /><param name="src" value="/flashdata/top.swf" /><param name="wmode" value="transparent" /><param name="menu" value="false" /></object>');
};

function top_aboutSWF() {
    var objectData = (jQuery.browser.msie) ? '' : 'data="/flashdata/TOP_ABOUT.swf"';
    jQuery('#swfTopAbout').html('<object type="application/x-shockwave-flash"' + objectData + ' width="140" height="100" id="love-ageing_top_about"><param name="movie" value="/flashdata/TOP_ABOUT.swf" /><param name="src" value="/flashdata/TOP_ABOUT.swf" /><param name="wmode" /><param name="menu" value="false" /></object>');
};

function top_CF_SWF() {
    var objectData = (jQuery.browser.msie) ? '' : 'data="/flashdata/TOP_CF.swf"';
    jQuery('#swfTopCF').html('<object type="application/x-shockwave-flash"' + objectData + ' width="415" height="265" id="love-ageing_top_about"><param name="movie" value="/flashdata/TOP_CF.swf" /><param name="src" value="/flashdata/TOP_CF.swf" /><param name="wmode" /><param name="menu" value="false" /></object>');
};

function aboutSWF() {
    var objectData = (jQuery.browser.msie) ? '' : 'data="/flashdata/ABOUT.swf"';
    jQuery('#swfcontent').html('<object type="application/x-shockwave-flash"' + objectData + ' width="532" height="330" id="love-ageing_about"><param name="movie" value="/flashdata/ABOUT.swf" /><param name="src" value="/flashdata/ABOUT.swf" /><param name="wmode" /><param name="menu" value="false" /></object>');
};

function method_bust_SWF() {
    var objectData = (jQuery.browser.msie) ? '' : 'data="/flashdata/method.swf"';
    jQuery('#MethodBustSWF').html('<object type="application/x-shockwave-flash"' + objectData + ' width="250" height="151" id="love-ageing_method"><param name="movie" value="/flashdata/method.swf" /><param name="src" value="/flashdata/method.swf" /><param name="wmode" /><param name="menu" value="false" /></object>');
};

function method_hip_SWF() {
    var objectData = (jQuery.browser.msie) ? '' : 'data="/flashdata/method_hip.swf"';
    jQuery('#MethodHipSWF').html('<object type="application/x-shockwave-flash"' + objectData + ' width="250" height="163" id="love-ageing_method_hip"><param name="movie" value="/flashdata/method_hip.swf" /><param name="src" value="/flashdata/method_hip.swf" /><param name="wmode" /><param name="menu" value="false" /></object>');
};


function himitsu_SWF() {
    var objectData = (jQuery.browser.msie) ? '' : 'data="/flashdata/himitsu.swf"';
    jQuery('#HimitsuSWF').html('<object type="application/x-shockwave-flash"' + objectData + ' width="330" height="280" id="love-ageing_himitsu"><param name="movie" value="/flashdata/himitsu.swf" /><param name="src" value="/flashdata/himitsu.swf" /><param name="wmode" /><param name="menu" value="false" /></object>');
}

function himitsu_bust1_SWF() {
    var objectData = (jQuery.browser.msie) ? '' : 'data="/flashdata/HIMITSU_bust1.swf"';
    jQuery('#HimitsuBust1SWF').html('<object type="application/x-shockwave-flash"' + objectData + ' width="280" height="250" id="love-ageing_himitsu_bust1"><param name="movie" value="/flashdata/HIMITSU_bust1.swf" /><param name="src" value="/flashdata/HIMITSU_bust1.swf" /><param name="wmode" /><param name="menu" value="false" /></object>');
}

function himitsu_bust2_SWF() {
    var objectData = (jQuery.browser.msie) ? '' : 'data="/flashdata/HIMITSU_bust2.swf"';
    jQuery('#HimitsuBust2SWF').html('<object type="application/x-shockwave-flash"' + objectData + ' width="280" height="250" id="love-ageing_himitsu_bust2"><param name="movie" value="/flashdata/HIMITSU_bust2.swf" /><param name="src" value="/flashdata/HIMITSU_bust2.swf" /><param name="wmode" /><param name="menu" value="false" /></object>');
}

function himitsu_hip1_SWF() {
    var objectData = (jQuery.browser.msie) ? '' : 'data="/flashdata/HIMITSU_hip1.swf"';
    jQuery('#HimitsuHip1SWF').html('<object type="application/x-shockwave-flash"' + objectData + ' width="280" height="250" id="love-ageing_himitsu_hip1"><param name="movie" value="/flashdata/HIMITSU_hip1.swf" /><param name="src" value="/flashdata/HIMITSU_hip1.swf" /><param name="wmode" /><param name="menu" value="false" /></object>');
}

function himitsu_hip2_SWF() {
    var objectData = (jQuery.browser.msie) ? '' : 'data="/flashdata/HIMITSU_hip2.swf"';
    jQuery('#HimitsuHip2SWF').html('<object type="application/x-shockwave-flash"' + objectData + ' width="280" height="250" id="love-ageing_himitsu_hip2"><param name="movie" value="/flashdata/HIMITSU_hip2.swf" /><param name="src" value="/flashdata/HIMITSU_hip2.swf" /><param name="wmode" /><param name="menu" value="false" /></object>');
}

function himitsu_hip3_SWF() {
    var objectData = (jQuery.browser.msie) ? '' : 'data="/flashdata/HIMITSU_hip3.swf"';
    jQuery('#HimitsuHip3SWF').html('<object type="application/x-shockwave-flash"' + objectData + ' width="280" height="250" id="love-ageing_himitsu_hip3"><param name="movie" value="/flashdata/HIMITSU_hip3.swf" /><param name="src" value="/flashdata/HIMITSU_hip3.swf" /><param name="wmode" /><param name="menu" value="false" /></object>');
}

function CPmovie_SWF() {
    var objectData = (jQuery.browser.msie) ? '' : 'data="/flashdata/CPmovie.swf"';
    jQuery('#CPmovieSWF').html('<object type="application/x-shockwave-flash"' + objectData + ' width="671" height="542" id="love-ageing_cp_movie"><param name="movie" value="/flashdata/CPmovie.swf" /><param name="src" value="/flashdata/CPmovie.swf" /><param name="wmode" /><param name="menu" value="false" /></object>');
};

function CPmovie2_SWF() {
    var objectData = (jQuery.browser.msie) ? '' : 'data="/flashdata/CPmovie2.swf"';
    jQuery('#CPmovieSWF').html('<object type="application/x-shockwave-flash"' + objectData + ' width="671" height="542" id="love-ageing_cp_movie"><param name="movie" value="/flashdata/CPmovie2.swf" /><param name="src" value="/flashdata/CPmovie2.swf" /><param name="wmode" /><param name="menu" value="false" /></object>');
};

function INFO_method_hip_SWF() {
    var objectData = (jQuery.browser.msie) ? '' : 'data="/flashdata/INFO_method_hip.swf"';
    jQuery('#event_movie').html('<object type="application/x-shockwave-flash"' + objectData + ' width="532" height="330" id="event_movie"><param name="movie" value="/flashdata/INFO_method_hip.swf" /><param name="src" value="/flashdata/INFO_method_hip.swf" /><param name="wmode" /><param name="menu" value="false" /></object>');
};




/*=====================================================================
Plugin SEPARATOR
=====================================================================*/	
function pagetopBtn() {
    jQuery('#toPagetop a,.toPagetopTag a').bind('click', function(e) {
        e.preventDefault();
        jQuery.scrollTo('#PageTop', 1000, {easing:'easeOutQuart'});
    });
};

function anchorWithinAPage(node) {
    jQuery(node).click(function(e) {
        e.preventDefault();
        var target = /(#[A-Za-z0-9_-]+)/.exec(this.href);
        if (target) {
            jQuery.scrollTo(jQuery(target[0]), 1000, {easing:'easeOutQuart'});
        }
        //alert(this);
    });
}

function geckoTextarea() {
    if (jQuery.browser.mozilla) {
        jQuery('textarea').css('font-size', '0.95em');
    }
};


















