// 各劇場設定
//------------------------------------
//-- 1107ソース修正 --//
list = new Array(
	new Array("","◆北海道◆"),
	new Array("/cinema/otaru/","小樽"),
	new Array("/cinema/ebetsu/","江別"),
	new Array("/cinema/kitami/","北見"),
	new Array("/cinema/kushiro/","釧路"),
	new Array("","◆東北◆"),
	new Array("/cinema/hirosaki/","弘前"),
	new Array("/cinema/kitakami/","北上"),
	new Array("/cinema/ishinomaki/","新石巻"),
	new Array("/cinema/natori/","名取エアリ"),
	new Array("/cinema/yonezawa/","米沢"),
	new Array("/cinema/fukushima/","福島"),
	new Array("","◆関東◆"),
	new Array("/cinema/moriya/","守谷"),
	new Array("/cinema/urawa/","浦和美園"),
	new Array("/cinema/ohi/","大井"),
	new Array("/cinema/kumagaya/","熊谷"),
	new Array("/cinema/ohmiya/","大宮"),
	new Array("/cinema/hanyu/","羽生"),
	new Array("/cinema/ichikawa/","市川妙典"),
	new Array("/cinema/yukarigaoka/","ユーカリが丘"),
	new Array("/cinema/chiba/","千葉ニュータウン"),
	new Array("/cinema/itabashi/","板橋"),
	new Array("/cinema/tama/","多摩センター"),
	new Array("/cinema/hinode/","日の出"),
	new Array("/cinema/musashino/","むさし野ミュー"),
	new Array("/cinema/shinyurigaoka/","新百合ヶ丘"),
	new Array("/cinema/kohoku/","港北ニュータウン"),
	new Array("/cinema/ebina/","海老名"),
	new Array("/cinema/minatomirai/","みなとみらい"),
	new Array("/cinema/chigasaki/","茅ヶ崎"),
	new Array("/cinema/tsukimino/","つきみ野"),
	new Array("","◆北陸◆"),
	new Array("/cinema/kenoh/","県央"),
	new Array("/cinema/niigata/","新潟"),
	new Array("/cinema/niigataminami/","新潟南"),
	new Array("/cinema/kanazawa/","金沢"),
	new Array("/cinema/okyozuka/","御経塚"),
	new Array("","◆中部・近畿◆"),
	new Array("/cinema/kakamigahara/","各務原"),
	new Array("/cinema/toyokawa/","豊川"),
	new Array("/cinema/oodaka/","大高"),
	new Array("/cinema/sennan/","りんくう泉南"),
	new Array("/cinema/ibaraki/","茨木"),
	new Array("/cinema/dainichi/","大日"),
	new Array("/cinema/akashi/","明石"),
	new Array("/cinema/sanda/","三田ウッディタウン"),
	new Array("/cinema/kakogawa/","加古川"),
	new Array("/cinema/takanohara/","高の原"),
	new Array("/cinema/nishiyamato/","西大和"),
	new Array("/cinema/oumihachiman/","近江八幡"),
	new Array("/cinema/kusatsu/","草津"),
	new Array("/cinema/kuwana/","桑名"),
	new Array("/cinema/tsu/","津"),
	new Array("/cinema/suzuka/","鈴鹿ベルシティ"),
	new Array("","◆中国・四国◆"),
	new Array("/cinema/hiroshima/","広島"),
	new Array("/cinema/hofu/","防府"),
	new Array("/cinema/takamatsu/","高松"),
	new Array("/cinema/utazu/","宇多津"),
	new Array("/cinema/ayagawa/","綾川"),
	new Array("","◆九州◆"),
	new Array("/cinema/ohnojo/","大野城"),
	new Array("/cinema/tobata/","戸畑"),
	new Array("/cinema/fukuoka/","福岡ルクル"),
	new Array("/cinema/chikushino/","筑紫野"),
	new Array("/cinema/kamimine/","上峰"),
	new Array("/cinema/kumamoto/","熊本クレア")
);
//-- 1107ソース修正end --//


// image roll 
//------------------------------------
function imgRoll(obj,flag) {
	var pathsrc = obj.getAttribute("src");
	var path = pathsrc.slice(0,pathsrc.lastIndexOf("/")+1);
	var imgname = pathsrc.slice(pathsrc.lastIndexOf("/")+1,pathsrc.length);
	if(flag) {
		var imgname = imgname.replace(/_def/i,"_cur");
	} else {
		var imgname = imgname.replace(/_cur/i,"_def");
	}
	obj.setAttribute("src",path + imgname);
}

// subwin open
// ページ内では以下のように呼び出してください。
// <a href="呼び出したいページ" onclick="return openSubWindow(this.href,'小窓名',横サイズ[px指定],縦サイズ[px指定]);" target="_blank"><img src="/common/images/btn_slideshow.gif" width="160" height="50" alt="Slide Show" /></a>
// 例）<a href="slideshow.html" onclick="return openSubWindow(this.href,'slideshow',500,500);" target="_blank"><img src="/common/images/btn_slideshow.gif" width="160" height="50" alt="Slide Show" /></a>
//------------------------------------
function openSubWindow(strUrl,winName,winWidth,winHeight) {
	var features = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=' + winWidth + ',height=' + winHeight;
	winName = window.open(strUrl,winName,features);
	winName.focus();
	return false;
}

// bookmark 
//------------------------------------
function bookmark(url,title) {
	if(navigator.userAgent.indexOf("MSIE") != -1) {
		window.external.addFavorite(url, title);
	}
	else {
		el = document.getElementById('bookmark');
		el.href = url;
		el.title = title;
	}
}

// bread 2008/06/23：作品案内ナビ対応
//------------------------------------
var timeid;

function layshow(id){
	layhide_proc();
	var e1 = document.getElementById(id);
	if( e1.style.display == "block" ){
		e1.style.display = "none";
		e1.style.zIndex = 1;
	}
	else{
		e1.style.display = "block";
		e1.style.zIndex = 9999;
	}
}

function layhide(){
	layhide_proc();
}

function layhide_proc(){
	var e1;
	e1 = document.getElementById("shop");
	e1.style.display = "none";
	e2 = document.getElementById("movie");
	e2.style.display = "none";
}

// pagetop  __scroll
//------------------------------------

var __scroll = {sp:6, fps:16, timer:0};
function setScrollSp(sp) {
	if(typeof sp == "number") {
		this.__scroll.sp = sp;
	}
}
function setScrollFps(fps) {
	if(typeof fps == "number") {
		this.__scroll.fps = fps;
	}
}
function scrollToTop() {
	pageScroll(0, 0);
}
function getScrollLeft() {
	if(navigator.userAgent.indexOf("MSIE") != -1) {
		return (document.compatMode=="CSS1Compat")?document.documentElement.scrollLeft:document.body.scrollLeft;
	} else {
 	 return (window.pageXOffset) ? window.pageXOffset : 0;
 }
}
function getScrollTop() {
	if(navigator.userAgent.indexOf("MSIE") != -1) {
		return (document.compatMode=="CSS1Compat")?document.documentElement.scrollTop:document.body.scrollTop;
	} else {
 	 return (window.pageYOffset) ? window.pageYOffset : 0;
 }
}
function pageScroll(toX, toY, cuX, cuY) {
	clearTimeout(this.__scroll.timer);
	toX = (!toX || toX < 0) ? 0 : toX;
	toY = (!toY || toY < 0) ? 0 : toY;
	cuX = (!cuX) ? 0 + getScrollLeft() : cuX;
	cuY = (!cuY) ? 0 + getScrollTop() : cuY;
	cuX += (toX - getScrollLeft()) / this.__scroll.sp; 
	cuY += (toY - getScrollTop()) / this.__scroll.sp; 
	if(cuX < 0) { cuX = 0; }
	if(cuY < 0) {	cuY = 0;	}
	window.scrollTo(Math.floor(cuX), Math.floor(cuY));
	if(Math.floor(cuX) != toX || Math.floor(cuY) != toY) {
		this.__scroll.timer = setTimeout("pageScroll("+toX+","+toY+"," +cuX+","+cuY+")",this.__scroll.sp);
	}
}



/**********************************************************
* SCROLL_PAGE_LINK
*/

ScrollClass.prototype.speed = 12;
ScrollClass.prototype.timer = 0;
ScrollClass.prototype.direction = new Object();
ScrollClass.prototype.offset = new Object();

ScrollClass.prototype.isCompatMode = document.compatMode == "CSS1Compat";
ScrollClass.prototype.major = parseInt(navigator.appVersion);
ScrollClass.prototype.minor = parseFloat(navigator.appVersion);
ScrollClass.prototype.isIE = navigator.userAgent.indexOf("MSIE") != -1;
ScrollClass.prototype.isOpera = window.opera;
ScrollClass.prototype.isMozilla = navigator.userAgent.indexOf("Gecko") != -1;
ScrollClass.prototype.isSafari = navigator.userAgent.indexOf('Safari') != -1;
ScrollClass.prototype.isNN  = navigator.userAgent.indexOf("Netscape") != -1;
ScrollClass.prototype.isMac = navigator.userAgent.indexOf("Mac") != -1;

var scroll = new ScrollClass();
function ScrollClass() {}
ScrollClass.prototype.setScrollSpeed = function(num) {
	if(typeof num == "number") {
		this.speed = num;
	}
}
ScrollClass.prototype.getScrollSpeed = function() {
	return this.speed;
}
ScrollClass.prototype.getMaxScroll = function() {
	var pos = new Object();
	if(this.isNN) {
		pos.x = this.major <= 5 ? document.documentElement.offsetWidth - window.innerWidth + 16 : document.documentElement.offsetWidth - window.innerWidth + 17;
		pos.y = this.major <= 5 ? document.documentElement.offsetHeight - window.innerHeight + 16 : document.documentElement.offsetHeight - window.innerHeight + 17;
	} else {
		if(this.isMac) {
			if(this.isIE) {
				pos.x = document.body.offsetWidth- document.body.clientWidth + 1;
				pos.y = document.body.offsetHeight - document.body.clientHeight + 1;
			} else {
				pos.x = document.documentElement.offsetWidth - window.innerWidth;
				pos.y = document.documentElement.offsetHeight - window.innerHeight;
			}
		} else {
			pos.x = this.isCompatMode ? document.documentElement.scrollWidth - document.documentElement.clientWidth : document.body.scrollWidth - document.body.clientWidth;
			pos.y = this.isCompatMode ? document.documentElement.scrollHeight - document.documentElement.clientHeight : document.body.scrollHeight - document.body.clientHeight;
		}
	}
	if(pos.x < 0) { pos.x = 0; }
	if(pos.y < 0) { pos.y = 0; }
	return {x:pos.x, y:pos.y };
}
ScrollClass.prototype.getScrollLeft = function() {
	if(this.isIE) {
		return this.isCompatMode ? document.documentElement.scrollLeft : document.body.scrollLeft;
	} else {
		return window.pageXOffset ? window.pageXOffset : 0;
	}
}
ScrollClass.prototype.getScrollTop = function() {
	if(this.isIE) {
		return this.isCompatMode ? document.documentElement.scrollTop : document.body.scrollTop;
	} else {
		return window.pageYOffset ? window.pageYOffset : 0;
	}
}
ScrollClass.prototype.scrollTo = function() {
	clearTimeout(this.timer);
	this.offset.x = null;
	this.offset.y = null;
	var toX = this.parse("x", this.findAnchor(arguments[0]) ? this.getAnchorPos(arguments[0]).x : arguments[0]);
	var toY = this.parse("y", this.findAnchor(arguments[1]) ? this.getAnchorPos(arguments[1]).y : arguments[1]);

	this.direction.is_x = toX - this.getScrollLeft() >= 0 ? true : false;
	this.direction.is_y = toY - this.getScrollTop() >= 0 ? true : false;
	if(this.isOpera) {
		window.scrollTo(toX, toY);
	} else {
		if(this.isMozilla) {
			//toY = toY - 16 > 0 ? toY - 16 : toY;
		}
		this.pageScroll(toX, toY);
	}
}
ScrollClass.prototype.findAnchor = function(id) {
	return (document.getElementsByName(id)[0] || document.anchors[id]);
}
ScrollClass.prototype.getAnchorPos = function(id) {
	if(document.getElementsByName(id)[0]) {
		var element = document.getElementsByName(id)[0];
		var obj = new Object();
		do {
			obj.x = (!obj.x) ? element.offsetLeft : obj.x + element.offsetLeft;
			obj.y = (!obj.y) ? element.offsetTop : obj.y + element.offsetTop;
		} while((element = element.offsetParent) != null);
		return {x:obj.x < 0 ? 0 : obj.x, y:obj.y };
	} else if(document.layers) {
		var element = document.anchors[id];
		return {x:element.x, y:element.y };
	} else {
		return {x:0, y:0};
	}
}
ScrollClass.prototype.parse = function(direction, value) {
	var maxScroll = this.getMaxScroll();
	var range = {min_x:0, max_x:maxScroll.x, min_y:0, max_y:maxScroll.y };
	switch(direction) {
		case "x":
			if(typeof value == "boolean") {
				return value ? 0 : this.getScrollLeft();
			} else if(typeof value == "number") {
				if(!this.isOpera) {
					if(value < 0) {
						return 0;
					} else if(value > range.max_x) {
						return range.max_x;
					}
				}
				return value;
			} else if(typeof value == "string") {
				switch(value) {
					case "left": return 0;
					case "center": return Math.floor(range.max_x / 2);
					case "right": return range.max_x;
					default: this.getScrollLeft();
				}
			}
			return this.getScrollLeft();
			break;
		case "y":
			if(typeof value == "boolean") {
				return value ? 0 : this.getScrollTop();
			} else if(typeof value == "number") {
				if(value < 0) {
					return 0;
				} else if(value > range.max_y) {
					return range.max_y;
				}
				return value;
			} else if(typeof value == "string") {
				switch(value) {
					case "top": return 0;
					case "middle": return Math.floor(range.max_y / 2);
					case "bottom": return range.max_y;
					default: this.getScrollTop();
				}
			}
			return this.getScrollTop();
			break;
	}
}
ScrollClass.prototype.pageScroll = function(toX, toY) {
	clearTimeout(this.timer);
	var dX = this.direction.is_x;
	var dY = this.direction.is_y;
	var scX = this.getScrollLeft();
	var scY = this.getScrollTop();
	var cuX = dX ? Math.ceil((toX - scX) / this.speed) : Math.floor((toX - scX) / this.speed);
	var cuY = dY ? Math.ceil((toY - scY) / this.speed) : Math.floor((toY - scY) / this.speed);
	if(((dX && scX + cuX < toX -1) || (!dX && scX + cuX > toX + 1)) || ((dY && scY + cuY < toY - 1) || (!dY && scY + cuY > toY +1))) {
		if(this.offset.x != null && this.offset.y != null) {
			if(this.offset.x == scX && this.offset.y == scY) {
				return;
			} else if((dX && this.offset.x > scX) || (!dX && this.offset.x < scX)) {
				return;
			} else if((dY && this.offset.y > scY) || (!dY && this.offset.y < scY)) {
				return;
			}
		}
		window.scrollTo(scX + cuX, scY + cuY);
		this.timer = setTimeout("ScrollClass.prototype.pageScroll("+toX+","+toY+")",this.speed);
		this.offset.x = scX;
		this.offset.y = scY;
	} else {
		clearTimeout(this.timer);
		window.scrollTo(toX, toY);
		return false;
	}
}

// Open Layer Window
//------------------------------------
function openLayerWindow(strUrl,winName,winWidth,winHeight,e) {
	if( document.all ) e = event;
	var st = Math.max( document.body.scrollTop, document.documentElement.scrollTop );
	if( navigator.userAgent.toLowerCase().indexOf('safari') >= 0 ) st = 0; 
	var leftPos = e.screenX - winWidth / 2;
	if( leftPos < 0 ) leftPos = 0;
	var topPos = e.screenY - winHeight / 2;
	if( topPos < 0 ) topPos = 0;
	
	var features = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,top='+topPos+',left='+leftPos+',width=' + winWidth + ',height=' + winHeight;
	winName = window.open(strUrl,winName,features);
	winName.focus();
	return false;
}

// pull-down 
//------------------------------------
function goto_sitetop(){
	//-- 1120ソース修正 --//
	var host = location.host;
	if(host == 'cinema.warnermycal.com' || host == 'webjpn00.warnermycal.com'){
		host = 'www.warnermycal.com';
	}
	//-- 08-07-03 ソース修正 --//
	var path = document.form1.siteID[document.form1.siteID.selectedIndex].value;
	if(path){
		//劇場トップページへ遷移
		location.href = 'http://' + host + document.form1.siteID[document.form1.siteID.selectedIndex].value;
	}
	else{
		document.form1.siteID.selectedIndex = 0;
	}
	//-- 08-07-03 ソース修正end --//
	//-- 1120ソース修正end --//
}

function createpull() {
	var c = document.form1.elements["siteID"];
	if(c.length == 1){
		for( i = 0; i < list.length; i++ ){
			c.length++;
			c.options[c.length - 1].value = list[i][0];
			c.options[c.length - 1].text = list[i][1];
		}
	}
}
