/*
 * common.js
 *
 * 共通javascriptファイル
 *
 */

//---------------------------------------------------------------------------
// 画像先読み込み
//---------------------------------------------------------------------------
loadimg("../images/.jpg");

function loadimg(imgname){
	if (document.images) (new Image()).src = imgname;
}


//---------------------------------------------------------------------------
// HTMLオブジェクト取得
//---------------------------------------------------------------------------
function getObj( id )
{
	return document.all && document.all(id) || document.getElementById && document.getElementById(id);
}

//---------------------------------------------------------------------------
// 画像置換
//---------------------------------------------------------------------------
function changeImage(d, type){

	// 画像ファイル形式判定
	if(d.src.indexOf(".jpg") > -1)
	{
		ext = ".jpg";
	}
	else if(d.src.indexOf(".gif") > -1)
	{
		ext = ".gif";
	}
	else if(d.src.indexOf(".png") > -1)
	{
		ext = ".png";
	}
	else
	{
		return;
	}

	d.src=d.src.substring(0,d.src.length-5)+type+ext;
}


//---------------------------------------------------------------------------
// ポップアップ
//---------------------------------------------------------------------------
function popup(theURL,W,H,BAR){
	option = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars="+BAR+",resizable=1,width=" +  W +",height=" + H;
	nw=window.open(theURL,'pic',option,true);
	nw.focus();
}

//お問い合わせ
function gotoContact() {
	if(window.opener && !window.opener.closed){
		window.opener.location.href = "/inquiry/movie.php";
		window.close();
		//window.opener.focus();
	}else{
		location.href = "/inquiry/movie.php";
	}
}

//ホームに戻る
function gotoHome() {
	if(window.opener && !window.opener.closed){
		window.opener.location.href = "http://www.occs.co.jp/";
		window.close();
	}else{
		location.href = "http://www.occs.co.jp/";
	}
}
