<!--


//wrapperかくしておく--------------------------------------------------
window.setting = {
    styling:'#wrapper{display:none}'
};
if ( setting.styling ) {
    var style = document.createElement("style");
    var head = document.getElementsByTagName('head')[0];
    style.type = "text/css";
    
    try {
        style.appendChild( document.createTextNode( setting.styling ) );
    } catch (e) {
        if ( style.styleSheet ) {
            style.styleSheet.cssText = setting.styling;
        }
    }
    head.appendChild( style );
};
//----------------------------------------------------------------------


var FlashWidth=900;
var FlashHeight=600;

var WrapID="openingFlash";
var WrapID2="areaFlash";

var openningFlag = 0; //オープニングのクッキーとれたか
var isDomLoadedFlag = 0; //DOMの読み込み終わったか
var readyFlag = 0; //オープニングswf終わったか

var isdebug = false; //デバッグ用


//クッキー処理-------------------------------------------------------
$.cookie=function(name,value) {
	if(typeof value!='undefined') {
		document.cookie=[name,'=',encodeURIComponent(value)].join('');
	}else{
		var cookieValue=null;
		if (document.cookie&&document.cookie!='') {
			var cookies=document.cookie.split(';');
			for (var i=0;i< cookies.length;i++) {
				var cookie=$.trim(cookies[i]);
				if (cookie.substring(0,name.length+1)==(name+'=')) {
					cookieValue=decodeURIComponent(cookie.substring(name.length+1));
					break;
				}
			}
		}
		return cookieValue;
	}
};

var openningFlag=1;


//--------------------------------------------------------------------


//DOM読み込み終わり---------------------------------------------------
$(function(){
	isDomLoadedFlag = 1;
	
	//はじめのラッパー非表示切り替え
	if( openningFlag==1 && !isdebug ){
		//クッキー有りなのでオープニング隠す＆ラッパー表示
		$("#openingFlash").hide();
		$("#wrapper").show();
		readyFlag = 1;
	}else{
		//クッキー無いのでオープニング表示＆ラッパー隠す
		$("#openingFlash").show();
		$("#wrapper").hide();
	}
	
});
//--------------------------------------------------------------------


//Flashから呼ばれる関数-----------------------------------------------
function showWrapper(){
	$("#wrapper").show();
}
function openingEnd(){
	$("#openingFlash").hide();
	readyFlag = 1;
}
function isDomLoaded(){
	return isDomLoadedFlag;
}
function isReady(){
	return readyFlag;
}
//--------------------------------------------------------------------


function writeOpeningFlash( flashPath ){
	var so2 = new SWFObject( flashPath, "externalInterface", "100%", "100%", "8", "#000000");
	so2.addParam("quality", "high");
	so2.addParam("swLiveConnect", "true");
	so2.addParam("allowScriptAccess", "always");
	so2.addParam('menu', 'false');
	so2.addParam("wmode", "transparent");
	
	so2.addVariable("configpath", "./shared/xml/opening.xml" );
	
	so2.write("openingFlashContent");
}

function writeMainFlash( flashPath ){
	var so = new SWFObject( flashPath, "externalInterface2", "100%", "100%", "8", "#000000");
	so.addParam("quality", "high");
	so.addParam("swLiveConnect", "true");
	so.addParam("allowScriptAccess", "always");
	so.addParam('menu', 'false');
	so.addParam("wmode", "transparent");
	
	so.addVariable("configpath", "./shared/xml/banners.xml" );
	
	so.write("mainFlashContent");
}




function getBrowserWidth ( ) {  
 if ( window.innerWidth ) { return window.innerWidth; }  
 else  if ( document.documentElement && document.documentElement.clientWidth != 0 ) { return document.documentElement.clientWidth; }  
 else if ( document.body ) { return document.body.clientWidth; }  
 return 0;  
}
function getBrowserHeight ( ) {  
 if ( window.innerHeight ) { return window.innerHeight; }  
 else if ( document.documentElement && document.documentElement.clientHeight != 0 ) { return document.documentElement.clientHeight; }  
 else if ( document.body ) { return document.body.clientHeight; }  
 return 0;  
}
function setFlaArea(){
 var WrapFlashElement = document.getElementById(WrapID);
 if(getBrowserWidth()>FlashWidth){ WrapFlashElement.style.width = "100%"; }
 else{ WrapFlashElement.style.width = FlashWidth+"px"; }
 if(getBrowserHeight()>FlashHeight){ WrapFlashElement.style.height = "100%"; }
 else{ WrapFlashElement.style.height = FlashHeight+"px"; }
}

function setFlaArea2(){
 var WrapFlashElement = document.getElementById(WrapID2);
 if(getBrowserWidth()>FlashWidth){ WrapFlashElement.style.width = "100%"; }
 else{ WrapFlashElement.style.width = FlashWidth + "px"; }
}

function setAllFlaArea(){
	setFlaArea();
	setFlaArea2();
}

window.onresize=setAllFlaArea;
window.onload=setAllFlaArea;


//-->
