

function battleOpen(user,rival){
	// 二度押し対応
	var elm = $('flVCBParts');
	if(elm == null){
		var item = $('select1');
		if(item != null){
			Element.hide(item);
		}
		item = $('select2');
		if(item != null){
			Element.hide(item);
		}
		item = $('select3');
		if(item != null){
			Element.hide(item);
		}
		item = $('select4');
		if(item != null){
			Element.hide(item);
		}
		item = $('select5');
		if(item != null){
			Element.hide(item);
		}
		item = $('select6');
		if(item != null){
			Element.hide(item);
		}

	//	var version = deconcept.SWFObjectUtil.getPlayerVersion();
	//	if (document.getElementById && (version['major'] >= 8)) {
			var swf_url = "/swf/scorebattle.swf";
			var html = "";

			html += "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='100%' height='100%' id='bPatM' align='middle'>";
			html += "<param name='allowScriptAccess' value='always' />";
			html += "<param name='movie' value='"+swf_url+"?user="+user+"&rival="+rival+"' />";
			html += "<param name='scale' value='noscale' />";
			html += "<param name='salign' value='lt' />";
			html += "<param name='quality' value='high' />";
			html += "<param name='wmode' value='transparent' />";
			//html += "<embed src='" + swf_url + "' quality='high' scale='noscale' salign='lt' wmode='transparent' width='100%' height='100%' name='bPatM' id='bPatM' swLiveConnect=true align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' wmode='transparent' />";
			html += "<embed src='"+swf_url+"?user="+user+"&rival="+rival+"'quality='high' scale='noscale' salign='lt' wmode='transparent' width='100%' height='100%' name='bPatM' id='bPatM' swLiveConnect=true align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' wmode='transparent' />";
			html += "</object>";
			var oLayer = document.createElement('div');
			oLayer.setAttribute('id','flVCBParts');
			oLayer.innerHTML = html;
			oLayer.style.position = 'absolute';
			oLayer.style.top = 0;
			oLayer.style.left = 0;
			oLayer.style.zIndex = 99999;
			document.body.appendChild(oLayer);
			showFullWindowSize()
	//	showCustomSize(window.innerWidth,window.innerHeight);

	//	} else {
	//	}
	}
}

function iconmakerOpen(main, back, user){
	// 二度押し対応
	var elm = $('flVCBParts');
	if(elm == null){
		var item = $('select1');
		if(item != null){
			Element.hide(item);
		}
		item = $('select2');
		if(item != null){
			Element.hide(item);
		}
		item = $('select3');
		if(item != null){
			Element.hide(item);
		}
		item = $('select4');
		if(item != null){
			Element.hide(item);
		}
		item = $('select5');
		if(item != null){
			Element.hide(item);
		}
		item = $('select6');
		if(item != null){
			Element.hide(item);
		}

	//	var version = deconcept.SWFObjectUtil.getPlayerVersion();
	//	if (document.getElementById && (version['major'] >= 8)) {
			var swf_url = "/swf/iconmaker.swf";
			if(!main){main="0"};
			var path = "";
			
			if(!back){
				path = swf_url+"?cid="+main+"&userid="+user;
			}else{
				path = swf_url+"?main="+main+"&back="+back+"&userid="+user;
			}
			var html = "";

//			html += "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' width='100%' height='100%' id='bPatM' align='middle'>";
//			html += "<param name='allowScriptAccess' value='always' />";
//			html += "<param name='movie' value='"+swf_url+"?main="+main+"&back="+back+"' />";
//			html += "<param name='scale' value='noscale' />";
//			html += "<param name='salign' value='lt' />";
//			html += "<param name='quality' value='high' />";
//			html += "<param name='wmode' value='transparent' />";
			//html += "<embed src='" + swf_url + "' quality='high' scale='noscale' salign='lt' wmode='transparent' width='100%' height='100%' name='bPatM' id='bPatM' swLiveConnect=true align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' wmode='transparent' />";
//			html += "<embed src='"+swf_url+"?main="+main+"&back="+back+"'quality='high' scale='noscale' salign='lt' wmode='transparent' width='100%' height='100%' name='bPatM' id='bPatM' swLiveConnect=true align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' wmode='transparent' />";
//			html += "</object>";
			var oLayer = document.createElement('div');
			oLayer.setAttribute('id','flVCBParts');
//			oLayer.innerHTML = html;

			oLayer.style.position = 'absolute';
			oLayer.style.top = 0;
			oLayer.style.left = 0;
			oLayer.style.zIndex = 99999;
			document.body.appendChild(oLayer);

			var so = new SWFObject(path, "bPatM", "100%", "100%", "9", "#ffffff");
			so.addParam("allowScriptAccess", "always");
			so.addParam("scale", "noscale");
			so.addParam("salign", "lt");
			so.addParam("align", "middle");
			so.addParam("quality", "high");
			so.addParam("wmode", "transparent");
			so.write("flVCBParts");

			showFullWindowSize()
	//	showCustomSize(window.innerWidth,window.innerHeight);

	//	} else {
	//	}
	}
}


function del(){
	//document.getElementById("flVCBParts").removeChild(document.getElementById("flVCBParts").firstChild);
	document.body.removeChild(document.getElementById("flVCBParts"));

	var item = $('select1');
	if(item != null){
		Element.show(item);
	}
	item = $('select2');
	if(item != null){
		Element.show(item);
	}
	item = $('select3');
	if(item != null){
		Element.show(item);
	}
	item = $('select4');
	if(item != null){
		Element.show(item);
	}
	item = $('select5');
	if(item != null){
		Element.show(item);
	}
	item = $('select6');
	if(item != null){
		Element.show(item);
	}
}

var body = document['CSS1Compat' == document.compatMode ? 'documentElement' : 'body'];
//browserCheck
function checkBrowser(){
	var uName = navigator.userAgent;
	if (uName.indexOf("Safari") > -1) return "Safari";
	if (uName.indexOf("MSIE") > -1) return "MSIE";
	if (uName.indexOf("Firefox") > -1) return "FIREFOX";
	if (uName.indexOf("Opera") > -1) return "OPERA";
	return "Netscape";
}
//OSCheck
function checkOSystem(){
	str = navigator.userAgent.toUpperCase();
	if (str.indexOf("MAC") >= 0) return "MacOS";
	if (str.indexOf("WIN") >= 0) return "Windows";
	if (str.indexOf("X11") >= 0) return "UNIX";
	return "OTHER";
}


//fullView
function showFullWindowSize(){
	//alert("showFullWindowSize");
	setValignTop();
	setAlignLeft();
	setFullWindow();
	window.onresize = function(){
		setValignTop();
		setAlignLeft();
		setFullWindow();
	}
	window.onscroll = window.onresize;
}

function clearDivSpace(){
	document.getElementById("flVCBParts").style.background = 'transparent';
}

//Layer Size ChangeView(WW:LayerWidth,HH:LayerHehight)
function showCustomSize(WW,HH){
	//alert("showCustomSize:"+WW+":"+HH);
	setValignTop();
	setAlignRight(WW);
	setLayerWidth(WW);
	setLayerHeight(HH);
	window.onresize = function(){

		setValignTop();
		setAlignLeft(WW);
		setLayerWidth(WW);
		setLayerHeight(HH);
	}
	window.onscroll = window.onresize;
}

//Layer FullWindow
function setFullWindow(){
	var browser =checkBrowser();
	var WW;
	var HH;
	if(browser == "MSIE"){
		HH = body.clientHeight;
		WW = body.clientWidth;
	}else {
		HH = window.innerHeight;
		WW = window.innerWidth;
	}
	setLayerHeight(HH);
	setLayerWidth(WW);
}

//Layer Set TopPosittion
function setValignTop(){
	var browser =checkBrowser();
	var YY;
	if(browser == "MSIE"){
		YY = body.scrollTop;
	}else {
		YY = pageYOffset;
	}
	document.getElementById("flVCBParts").style.top = YY + 'px';
}

//Layer Set Left Posittion
function setAlignLeft(){
	var XX;
	XX = 0;
	document.getElementById("flVCBParts").style.left =XX + 'px';
}

//Layer Set Right Position(layer_WW:Layer_Width)
function setAlignRight(layer_WW){
	var browser =checkBrowser() ;
	var XX;
	var WW;
	if(browser == "MSIE"){
		XX = body.scrollLeft;
		WW = body.clientWidth;
	}else {
		XX = pageXOffset;
		WW = window.innerWidth;
	}
	var dX = 0;
	if(browser != "MSIE"){
		dX = -15;
	}
	document.getElementById("flVCBParts").style.left =(WW - layer_WW + XX + dX) + 'px';
}

//Layer Width Change
function setLayerWidth(WW){
	var browser =checkBrowser() ;
	var dX = 0
	if(browser == "FIREFOX"){
		dX = -20;
	}

	document.getElementById("flVCBParts").style.width = WW+dX + 'px';
}

//Layer Height Change
function setLayerHeight(HH){
	document.getElementById("flVCBParts").style.height = HH + 'px';
}