
//▼lightbox用jsファイル読み込み-------------------------------
document.write('<script src="/tr/js/lightbox/prototype.js" type="text/javascript"></script>');
//document.write('<script src="/tr/js/lightbox/scriptaculous.js?load=effects,builder" type="text/javascript"></script>');
//document.write('<script src="/tr/js/lightbox/lightbox.js" type="text/javascript"></script>');



//▼jsファイル読み込み-------------------------------
document.write('<script src="/tr/js/lib/jquery.js" type="text/javascript"></script>');
document.write('<script src="/tr/js/scrollsmoothly.js" type="text/javascript"></script>');
document.write('<script src="/tr/js/inlinebg.js" type="text/javascript"></script>');
document.write('<script src="/tr/js/sidebanner.js" type="text/javascript"></script>');
document.write('<script src="/tr/js/windowopen.js" type="text/javascript"></script>');
document.write('<script src="/tr/js/users_and_postcard.js" type="text/javascript"></script>');
document.write('<script src="/tr/js/list.js" type="text/javascript"></script>');
document.write('<script src="/tr/js/shopinfo/shop_data.js" type="text/javascript"></script>');
document.write('<script src="/tr/js/shopinfo/shopinfo.js" type="text/javascript"></script>');

document.write('<script src="/tr/js/correct_event.js" type="text/javascript"></script>');


//document.write('<script src="/tr/js/anchorlinkoff.js" type="text/javascript"></script>');
//document.write('<script src="/tr/js/externallink.js" type="text/javascript"></script>');










//▼ブラウザ判定-------------------------------

function checkGecko(){
	var ua = navigator.userAgent;
	if(ua.indexOf('Gecko')!=-1){
		return true;
	} else {
		return false;
	}
}


//▼CSS分岐設定-------------------------------

if(checkGecko()){
	document.write('<link href="/tr/css/diverge_mozilla.css" rel="stylesheet" type="text/css">');
} else {
	document.write('<link href="/tr/css/diverge_ie.css" rel="stylesheet" type="text/css">');
}


//▼イベントリスナー追加-------------------------------
var addListener = function(elm, type, func) {
  if(! elm) { return false; }
  if(elm.addEventListener) {
    elm.addEventListener(type, func, false);
  } else if(elm.attachEvent) {
    elm.attachEvent('on'+type, func);
  } else {
    return false;
  }
  return true;
};

//▼ロード時に動かすスクリプトまとめ-------------------------------

function loadAction(){
	sideBanner();
	prefecturesListWrite();
}

var obj = window;
addListener(obj, "load", loadAction);




//▼親または子ウインドウの有無確認関数-------------------------------
function win_closed(winVar) {
	var ua = navigator.userAgent
	if(!!winVar ){
		if( ( ua.indexOf('Gecko')!=-1 || ua.indexOf('MSIE 4')!=-1 ) && ua.indexOf('Win')!=-1 ){
			return winVar.closed;
		} else if( ua.indexOf('Firefox')!=-1 && ua.indexOf('Mac')!=-1 ){
			return winVar.closed;
		} else if( ua.indexOf('Safari')!=-1 && ua.indexOf('Mac')!=-1 ){
			return true;
		} else {
			return typeof winVar.document != 'object';
		}
	} else {
		return true;
	}
}


//▼エレメント削除関数-------------------------------
function removeElm(parentElmId,removedChildElmId){
	var parentElm = document.getElementById(parentElmId);
	var childElmRemoved = document.getElementById(removedChildElmId);
	parentElm.removeChild(childElmRemoved);
}


//▼エレメント生成関数-------------------------------
function createElm(parentElmId,obj,newChildElmId){
	var parentElm = document.getElementById(parentElmId);
	var newChildElm =document.createElement(obj);
	newChildElm.id=newChildElmId;
	parentElm.appendChild(newChildElm);
}


//▼スタイル設定関数-------------------------------
function setStyleOriginal(obj,style){
	var styleArray = style.split(",");
	for (i=0; i< styleArray.length; i++) {
		var attributeName=styleArray[i].split(":")[0];
		var attributeValue=styleArray[i].split(":")[1];
		document.getElementById(obj).style[attributeName] = attributeValue;
	}

}






//▼flash8をembedする（サイズ指定あり。fileNameはパス・拡張子とも要記述）-------------------------------

function embedFla8(fileName,_width,_height){

	sslFla8();

	//fileNameからファイル名を渡す場合;
	myURL = fileName;

	//ディレクトリ部分を取り除く;
    myFileName = myURL.substring(myURL.lastIndexOf("/")+1,myURL.length)

    //拡張子を取り除く;
    myFileName2 = myFileName.substring(0,myFileName.indexOf("."));
    thisFileName = "thisFileName=" + myFileName2;

	_width = (_width)?_width:480;
	_height = (_height)?_height:360;
	var writeStr = '\
	<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"'+ _codebase +' width="' + _width + '" height="' + _height + '" id="' + myFileName2 + '" align="middle">\
	<param name="allowScriptAccess" value="sameDomain" />\
	<param name="movie" value="' + fileName + '" />\
	<param name="flashvars" value="' + thisFileName + '" />\
	<param name="menu" value="false" />\
	<param name="quality" value="high" />\
	<param name="bgcolor" value="#4B585F" />\
	<embed src="' + fileName + '" FlashVars="' + thisFileName + '" menu="false" quality="high" bgcolor="#4B585F" width="' + _width + '" height="' + _height + '" name="' + myFileName2 + '" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash"'+ _pluginspage +' />\
	</object>';
	document.write(writeStr);
}

//▼httpsの際の回避-------------------------------

function sslFla8(){

	if(location.protocol == 'http:'){
		_codebase = 'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ';
		_pluginspage = 'pluginspage="http://www.macromedia.com/go/getflashplayer" '
		_path = ''
	} else {
		_codebase = 'codebase="https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ';
		_pluginspage = 'pluginspage="https://www.macromedia.com/go/getflashplayer" '
	}
}


//Google Analytics

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-872355-10']);
  _gaq.push(['_setLocalRemoteServerMode']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();


//▼ポップアップウィンドウ-------------------------------

//汎用
function wo(_TGT,_WIDTH,_HEIGHT,_TOOLBAR){
	if(_TGT){
		_WIDTH = (_WIDTH)?_WIDTH:717;
		_HEIGHT = (_HEIGHT)?_HEIGHT:500;
		_TOOLBAR = (_TOOLBAR)?_TOOLBAR:0;
		_popWin = window.open(_TGT,'_popWin','width='+_WIDTH+',height='+_HEIGHT+',scrollbars=yes,resizable=yes,toolbar='+_TOOLBAR+',directories=no,location=no,menubar=no,status=yes');
		_popWin.focus();
	}
}

