
/*
--------------------------------------------
画像切り替え
--------------------------------------------
*/

function initRollOverImages() {
var image_cache = new Object();
var hname = 'h';
$(".leftbanner img, .recruitLink img, .subnavi img, .oneyearList a img, .oneyearBottom a img, .main_navi a img, .right_banner01 a img, .right_banner02 a img, .top_main_content02 ul img, .hnavi img, .btn_bottom img, .staff_btn img, .swap").each(function(i) {
	var myimg = this.src;
	var dot = this.src.lastIndexOf('.');
	
	var myimg_on = this.src.substr(0, dot) 
	+ hname 
	+ this.src.substr(dot, 4);
	
	image_cache[this.src] = new Image();
	image_cache[this.src].src = myimg_on;
	
	$(this).hover(
		function() {
		this.src = myimg_on;
		}, 
					  
		function() { 
	  	this.src = myimg;
		});
	});

}

/*
--------------------------------------------
ナビ・アクティブ画像差し替え
--------------------------------------------
*/

function initChangeImages(num) {
	
	var naviArray = new Array();
	naviArray = [".hnavi01", ".hnavi02", ".hnavi03", ".hnavi04", ".hnavi05", ".hnavi06", ".hnavi07"];
	
	var oldImg = $(""+naviArray[num]+" img").attr("src");
	var dot = oldImg.lastIndexOf('.');
	
	var hhh ="g";
	var changeImg = oldImg.substr(0, dot) 
	+ hhh 
	+ oldImg.substr(dot, 4);
	$(""+naviArray[num]+" img").attr("src", changeImg);
	
	initRollOverImages();
	}




/*
--------------------------------------------
イベント・パーティ用開閉機能
--------------------------------------------
*/

$(document).ready(function(){
	partyWindow();
	});

function partyWindow() {
	$(".partyBoxLink a").each(function(i) {

	$(this).click(function() {
	var myTarget = $(this).parent().parent().children(".partyBoxContentOutline").children(".partyBoxContent").children(".partyBox_detail");
	var param = $(myTarget).css("display");

	if(param == "none") { $(this).text("▲ 閉じる");
	}
	
	else { $(this).text("▼ 詳しく見る"); 
	var myAd = $(this).attr("href");
	$('html,body').animate({ scrollTop: $(myAd).offset().top }, 'slow','swing');
	}
	
	$(myTarget).slideToggle("slow");
	return false;
	});

	});
	}

/*
--------------------------------------------
ストーリー文章表示機能
--------------------------------------------
*/

function myToggle() {
	$(".controlDetail").each(function(i) {

	$(this).click(function() {
	var myTarget = $(this).parent().parent().children(".detailText");
	var param = $(myTarget).css("display");

	if(param == "none") { $(this).text("閉じる>>"); }
	else { $(this).text("つづきを読む>>"); }
		
	$(myTarget).slideToggle("fast");
	});

	});

	}

/*
--------------------------------------------
ベリサイン用ポップアップ
--------------------------------------------
*/

function verisign() {
	
	window.open("https://sealinfo.verisign.com/splash?form_file=fdf/splash.fdf&dn=www.p-a.jp&lang=ja", "verisign", "width=560, height=500, location=yes,status=yes,resizable=yes,scrollbars=yes");
	
	}

/*
--------------------------------------------
google Map用ポップアップ
--------------------------------------------
*/

function openMap(name) {

switch (name){
	case "ginza":
	window.open("map_index.html", "verisign", "width=680, height=800, location=yes,status=yes,resizable=yes,scrollbars=yes, menubar=yes");
    break;
	
	case "chiba":
	window.open("map_chiba.html", "verisign", "width=680, height=800, location=yes,status=yes,resizable=yes,scrollbars=yes, menubar=yes");
    break;
	
	case "osaka":
	window.open("map_osaka.html", "verisign", "width=680, height=800, location=yes,status=yes,resizable=yes,scrollbars=yes, menubar=yes");
    break;
	
	case "shinzyuku":
	window.open("map_shinzyuku.html", "verisign", "width=680, height=800, location=yes,status=yes,resizable=yes,scrollbars=yes, menubar=yes");
    break;
	
	case "yokohama":
	window.open("map_yokohama.html", "verisign", "width=680, height=800, location=yes,status=yes,resizable=yes,scrollbars=yes, menubar=yes");
    break;
	
	case "omiya":
	window.open("map_omiya.html", "verisign", "width=680, height=800, location=yes,status=yes,resizable=yes,scrollbars=yes, menubar=yes");
    break;
	
	case "nagoya":
	window.open("map_nagoya.html", "verisign", "width=680, height=800, location=yes,status=yes,resizable=yes,scrollbars=yes, menubar=yes");
    break;	
	
	case "osaki":
	window.open("map_osaki.html", "verisign", "width=680, height=660, location=yes,status=yes,resizable=yes,scrollbars=yes, menubar=yes");
    break;	
	}
	
	}
	
/*
--------------------------------------------
ドロップダウンメニュー
--------------------------------------------
*/	

// Copyright 2006-2007 javascript-array.com

var timeout = 500;
var closetimer = 0;
var ddmenuitem = 0;

function jsddm_open()
{	jsddm_canceltimer();
	jsddm_close();
	ddmenuitem = $(this).find('ul').eq(0).css('visibility', 'visible');}

function jsddm_close()
{	if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');}

function jsddm_timer()
{	closetimer = window.setTimeout(jsddm_close, timeout);}

function jsddm_canceltimer()
{	if(closetimer)
	{	window.clearTimeout(closetimer);
		closetimer = null;}}

$(document).ready(function()
{	$('#jsddm > li').bind('mouseover', jsddm_open);
	$('#jsddm > li').bind('mouseout',  jsddm_timer);});

document.onclick = jsddm_close;

