

//▼ブラウザ判定-------------------------------

function checkGecko(){
	var ua = navigator.userAgent;
	if(ua.indexOf('Gecko')!=-1){
		return true;
	} else {
		return false;
	}
}


//▼CSS分岐設定-------------------------------

if(checkGecko()){
	document.write('<link href="/css/diverge_mozilla.css" rel="stylesheet" type="text/css">');
} else {
	document.write('<link href="/css/diverge_ie.css" rel="stylesheet" type="text/css">');
}



//▼別窓で開く-------------------------------

function wo_r(_tgt){
	if(_tgt){
		_popWin = window.open(_tgt);
		_popWin.focus();
	}
}



//▼ポップアップウィンドウ-------------------------------

//汎用
function wo(_tgt,_width,_height,_toolbar){
	if(_tgt){
		_width = (_width)?_width:660;
		_height = (_height)?_height:600;
		_toolbar = (_toolbar)?_toolbar:0;
		_popWin = window.open(_tgt,'_blank','width='+_width+',height='+_height+',scrollbars=yes,resizable=yes,toolbar='+_toolbar+',directories=no,location=no,menubar=no,status=yes');
		_popWin.focus();
	}
}



//▼ガルーシャウィンドウ-------------------------------
function galuchat_wo(){
	galuchat = window.open('/lineup/galuchat/','galuchat','width=1000,height=660,scrollbars=yes,resizable=yes,toolbar=0,directories=no,location=no,menubar=no,status=yes');
	galuchat.focus();
}


//▼親または子ウインドウの有無確認関数-------------------------------
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;
	}
}





//▼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-8']);
  _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);
  })();

