﻿
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}
userAgent = window.navigator.userAgent;
browserVers = parseInt(userAgent.charAt(userAgent.indexOf("/")+1),10);
mustInitImg = true;
function initImgID() {var di = document.images; if (mustInitImg && di) { for (var i=0; i<di.length; i++) { if (!di[i].id) di[i].id=di[i].name; } mustInitImg = false;}}

function findElement(n,ly) {
	var d = document;
	if (browserVers < 4)		return d[n];
	if ((browserVers >= 6) && (d.getElementById)) {initImgID; return(d.getElementById(n))}; 
	var cd = ly ? ly.document : d;
	var elem = cd[n];
	if (!elem) {
		for (var i=0;i<cd.layers.length;i++) {
			elem = findElement(n,cd.layers[i]);
			if (elem) return elem;
		}
	}
	return elem;
}

function changeImagesArray(array) {
	if (preloadFlag == true) {
		var d = document; var img;
		for (i=0;i<array.length;i+=2) {
			img = null; var n = array[i];
			if (d.images) {
				if (d.layers) {img = findElement(n,0);}
				else {img = d.images[n];}
			}
			if (!img && d.getElementById) {img = d.getElementById(n);}
			if (!img && d.getElementsByName) {
				var elms = d.getElementsByName(n);
				if (elms) {
					for (j=0;j<elms.length;j++) {
						if (elms[j].src) {img = elms[j]; break;}
					}
				}
			}
			if (img) {img.src = array[i+1];}
		}
	}
}
function changeImages() {
	changeImagesArray(changeImages.arguments);
}
var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		pre_naviHome_on = newImage('images/menu_01_on.jpg');
		pre_naviPolicy_on = newImage('images/menu_02_on.jpg');
		pre_naviMenu_on = newImage('images/menu_03_on.jpg');
		pre_naviCamp_on = newImage('images/menu_04_on.jpg');
		pre_naviShop_on = newImage('images/menu_05_on.jpg');
		pre_naviShopping_on = newImage('images/menu_06_on.jpg');
		preloadFlag = true;
	}
}
var preloadFlag = false;
function preloadImages2() {
	if (document.images) {
		pre_lineup02_on = newImage('../images/lineup02_on.gif');
		pre_lineup03_on = newImage('../images/lineup03_on.gif');
		pre_lineup04_on = newImage('../images/lineup04_on.gif');
		pre_lineup05_on = newImage('../images/lineup05_on.gif');
		pre_lineup06_on = newImage('../images/lineup06_on.gif');
		pre_lineup01_on = newImage('images/lineup01_on.gif');
		preloadFlag = true;
	}
}
//Pass values by calling the function elsewhere
//Example: newWindow('test.html',50,50,220,250)" opens "test.html" 
//in a new window that is 50 pixels from top and left and 220 by 250 
//pixels in size.

var popup=0;
function newWindow(newURL,left,top,width,height)
{
  popup = window.open(newURL,'popup','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

//  Image Change for Top
ch_imgs=new Array();
	ch_imgs[0]='scm_common/images/top/mainImg.jpg';
	ch_imgs[1]='scm_common/images/top/mainImg2.jpg';
	ch_imgs[2]='scm_common/images/top/mainImg3.jpg';
	
function chImgTop() {
	a=Math.floor(Math.random()*ch_imgs.length);
	document.images["chImg"].src=ch_imgs[a];
	}

function OpenWinGinza(){
    win=window.open("ginza_map.html","new","width=586,height=543");
}

function OpenWinRoppongi(){
    win=window.open("roppongi_map.html","new","width=436,height=470");
}

function OpenWinJiyugaoka(){
    win=window.open("jiyugaoka_map.html","new","width=436,height=470");
}




