//*************************************************************************************************
//
//
//
//*************************************************************************************************

/*======================================*/
/*										*/
/*======================================*/

var	winsz_x = 784;						//subwindow-default-size-x //784
var	winsz_y = 768;						//subwindow-default-size-y //628

//=================================================================================================
//=================================================================================================
//=================================================================================================
//=================================================================================================

/*======================================*/
/*										*/
/*======================================*/

function A_Li(){
    Sel = document.Link1.OP.selectedIndex;
    Ms  = document.Link1.OP.options[Sel].value;
    location.href = Ms;
}

/*======================================*/
/*										*/
/*======================================*/

function MM_preloadImages(){
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImage(){
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2]; }
}
function MM_swapImgRestore(){
	var	i,x,a=document.MM_sr;
	for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++){ x.src=x.oSrc; }
}
function MM_findObj(n, d){
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

/*======================================*/
/*										*/
/*======================================*/

function closewin()
{
	window.close();
}
function closewinp()
{
	parent.close();
}

function remote(url)
{
	window.top.opener.location.href = url
	window.top.opener.focus();
}
function remoteopen(url)
{
	if(window.top.opener == false || window.top.opener.closed){
		window.top.open(url,"_blank");
	}
	else{
		window.top.opener.location.href = url;
	}
}

/*======================================*/
/*										*/
/*======================================*/

///////////////////////////////////////////////////////////////////////////////////////////////////
//
//
//
///////////////////////////////////////////////////////////////////////////////////////////////////
function cwindowsize(maxx,maxy)
{
	var	width  = maxx;//screen.width;
	var	height = screen.height;

	//...adjust-x

	//...adjust-y
	if     (height > 768){	//768- (    x    )
		height = (maxy > height) ? height : maxy;
	}
	else if(height > 600){	//-768 (1024x 768)
		height = 708;
	}
	else if(height > 480){	//-600 ( 800x 600)
		height = 540;
	}
	else{					//-480 ( 640x 480)
		height = 420;
	}

	//---------------------------------------------------------------------------------------------

	function getwidth()
	{
		return width;
	}
	cwindowsize.prototype.getwidth  = getwidth;

	function getheight()
	{
		return height;
	}
	cwindowsize.prototype.getheight = getheight;

	return this;					//
}

///////////////////////////////////////////////////////////////////////////////////////////////////
//
// method : 
//
// param  : 
//
// return : 
//
///////////////////////////////////////////////////////////////////////////////////////////////////
function iswindowclose(winobj)
{
	if(!winobj){
		return true;
	}
	else{
		return winobj.closed;
//		var ua = navigator.userAgent;
//		if((ua.indexOf('Gecko') != -1 || ua.indexOf('MSIE 4') != -1) && ua.indexOf('Win') != -1){
//			return winobj.closed;
//		}
//		else{
//			return typeof(winobj.document) != 'object';
//		}
	}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
//
// method : 
//
// param  : 
//
// return : 
//
///////////////////////////////////////////////////////////////////////////////////////////////////
function loaddocument(uri,winobj,winname,winstyle,mode)
{
	if(iswindowclose(winobj) == false){
		subwin = winobj;
		subwin.location.href = uri;
	}
	else{
		if(mode == "parent"){
			subwin = parent.open(uri,winname,winstyle);
		}
		else{
			subwin = window.open(uri,winname,winstyle);
		}
	}
	subwin.focus();
	return subwin;					//
}

///////////////////////////////////////////////////////////////////////////////////////////////////
//
// method : 
//
// param  : 
//
// return : 
//
///////////////////////////////////////////////////////////////////////////////////////////////////
function resizewindow(winobj,sizew,sizeh)
{
	winobj.resizeTo(sizew,sizeh);

	//...get window clientsize
	if     (window.opera || document.layers){	//op n4
		var	width  = winobj.innerWidth;
		var	height = winobj.innerHeight();
	}
	else if(document.all){						//ie
		var	width  = winobj.document.body.clientWidth;
		var	height = winobj.document.body.clientHeight;
	}
	else if(document.getElementbyId){			//n6 n7
		var	width  = winobj.innerWidth;
		var	height = winobj.innerHeight();
	}

	//...revise windowsize
	if(width != sizew || height != sizeh){
		winobj.resizeBy(sizew - width,sizeh - height);
		if(document.layers){
			winobj.location.reload(0);
		}
	}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
//
// method : 
//
// param  : 
//
// return : 
//
///////////////////////////////////////////////////////////////////////////////////////////////////
function resizemywindow(sizew,sizeh)
{
	var	cwin = new cwindowsize(sizew,sizeh);
	var	winw = cwin.getwidth();
	var	winh = cwin.getheight();
	resizewindow(window.self,cwin.getwidth(),cwin.getheight());
}

/*======================================*/
/*										*/
/*======================================*/

///////////////////////////////////////////////////////////////////////////////////////////////////
//
// method : 
//
// param  : 
//        : 
//
// return : 
//
///////////////////////////////////////////////////////////////////////////////////////////////////
function boardopencgi(ifile,icode)
{
	var	old   = document.location.href;
	if(old.match(/\.html#.*/)){ old = old.replace(/#.*/,""); }

	var	uri   = "http://www.elf-game.co.jp/cgi-bin/shop/imgframe.cgi?ref=" + old + "&action=cap&code=" + icode + "&" + "file=" + ifile;
	var	style = "width="+winsz_x+",height="+winsz_y+",scrollbars=yes,resizable=yes,directions=yes,location=yes,menubar=yes,toolbar=yes,status=yes";
	elfwin = loaddocument(uri,window.elfwin,"elfsubwin",style,"window");
}
function boardopencgip(ifile,icode)
{
	var	old   = document.location.href;
	if(old.match(/\.html#.*/)){ old = old.replace(/#.*/,""); }

	var	uri   = "http://www.elf-game.co.jp/cgi-bin/shop/imgframe.cgi?ref=" + old + "&action=cap&code=" + icode + "&" + "file=" + ifile;
	var	style = "width="+winsz_x+",height="+winsz_y+",scrollbars=yes,resizable=yes,directions=yes,location=yes,menubar=yes,toolbar=yes,status=yes";
	elfwin = loaddocument(uri,window.elfwin,"elfsubwin",style,"parent");
}

///////////////////////////////////////////////////////////////////////////////////////////////////
//
// method : 
//
// param  : 
//
// return : 
//
///////////////////////////////////////////////////////////////////////////////////////////////////
function boardopenhtm(urlcode,bchild)
{
	var	uri   = urlcode;
	var	style = "width="+winsz_x+",height="+winsz_y+",scrollbars=yes,resizable=yes,directions=yes,location=yes,menubar=yes,toolbar=yes,status=yes";
	elfwin = loaddocument(uri,window.elfwin,"elfsubwin",style,"window");
}
function boardopenhtmp(urlcode,bchild)
{
	var	uri   = urlcode;
	var	style = "width="+winsz_x+",height="+winsz_y+",scrollbars=yes,resizable=yes,directions=yes,location=yes,menubar=yes,toolbar=yes,status=yes";
	elfwin = loaddocument(uri,window.elfwin,"elfsubwin",style,"parent");
}

///////////////////////////////////////////////////////////////////////////////////////////////////
//
// method : 
//
// param  : 
//        : 
//
// return : 
//
///////////////////////////////////////////////////////////////////////////////////////////////////
function boardopenhtmadjustname(urlcode,winname,mode)
{
	//...object works
	var	cwin  = new cwindowsize(winsz_x,winsz_y);
	var	winw  = cwin.getwidth();
	var	winh  = cwin.getheight();
	//...create window
	var	uri   = urlcode;
	var	style = "width="+winw+",height="+winh+",scrollbars=yes,resizable=yes,directions=yes,location=yes,menubar=yes,toolbar=yes,status=yes";
	elfwin = loaddocument(uri,window.elfwin,winname,style,mode);
}
function boardopenhtmadjust(urlcode)
{
	boardopenhtmadjustname(urlcode,'elfsubwin','window');
}
function boardopenhtmadjustp(urlcode)
{
	boardopenhtmadjustname(urlcode,'elfsubwin','parent');
}

/*======================================*/
/*										*/
/*======================================*/

///////////////////////////////////////////////////////////////////////////////////////////////////
//
// method : 
//
// param  : 
//
// return : 
//
///////////////////////////////////////////////////////////////////////////////////////////////////
function digest()
{
	var	uri   = "http://www.elf-game.co.jp/net_shop/shopitem/lineup_frame.html";
	var	style = "width="+winsz_x+",height="+winsz_y+",scrollbars=yes,resizable=yes,directions=yes,location=yes,menubar=yes,toolbar=yes,status=yes";
	elfwin = loaddocument(uri,window.elfwin,"elfsubwin",style,"window");
}

/*======================================*/
/*										*/
/*======================================*/

///////////////////////////////////////////////////////////////////////////////////////////////////
//
// method : 
//
// param  : 
//
// return : 
//
///////////////////////////////////////////////////////////////////////////////////////////////////
function shop_lineup(htmlname,mode)
{
	var	uri   = "http://www.elf-game.co.jp/net_shop/shopitem/"+htmlname;
	var	style = "width="+winsz_x+",height="+winsz_y+",scrollbars=yes,resizable=yes,directions=yes,location=yes,menubar=yes,toolbar=yes,status=yes";
	elfwin = loaddocument(uri,window.elfwin,"elfsubwin",style,mode);
}
function soft_win(){
	shop_lineup("soft_win.html","window");
}
function soft_winp(){
	shop_lineup("soft_win.html","parent");
}
function soft_mac(){
	shop_lineup("soft_mac.html","window");
}
function soft_tel(){
	shop_lineup("soft_tel.html","window");
}
function soft_silkys(){
	shop_lineup("soft_silkys.html","window");
}
function soft_s_tell(){
	shop_lineup("soft_s_tel.html","window");
}
function soft_dvd(){
	shop_lineup("soft_dvd.html","window");
}
function soft_cd(){
	shop_lineup("soft_cd.html","window");
}
function soft_book(){
	shop_lineup("soft_book.html","window");
}
function soft_goods(){
	shop_lineup("soft_goods.html","window");
}
function soft_goodsp(){
	shop_lineup("soft_goods.html","parent");
}

/*======================================*/
/*										*/
/*======================================*/

///////////////////////////////////////////////////////////////////////////////////////////////////
//
// method : 
//
// param  : 
//
// return : 
//
///////////////////////////////////////////////////////////////////////////////////////////////////
function openchildwin(uri,name,width,height)
{
	var	style   = "width="+width+",height="+height+",scrollbars=yes,resizable=yes,directions=yes,location=yes,menubar=yes,toolbar=yes,status=yes";
	window.open(uri,name,style);
}

/*======================================*/
/*										*/
/*======================================*/

///////////////////////////////////////////////////////////////////////////////////////////////////
//
// method : 
//
// param  : 
//
// return : 
//
///////////////////////////////////////////////////////////////////////////////////////////////////
function ktai()
{
//	win=window.open("member_ktaimail.html","ktai","width=772,height=384,scrollbars=no,resizable=yes,directions=yes,location=yes,menubar=yes,toolbar=yes,status=yes");
	win=window.open("member_ktaimail.html","ktai","scrollbars=yes,resizable=yes,directions=yes,location=yes,menubar=yes,toolbar=yes,status=yes");
	win.focus();
}

/*======================================*/
/*										*/
/*======================================*/



//=================================================================================================
//=================================================================================================
//=================================================================================================
//=================================================================================================

///////////////////////////////////////////////////////////////////////////////////////////////////
//
// method : 
//
// param  : 
//
// return : 
//
///////////////////////////////////////////////////////////////////////////////////////////////////
function showimagedate()
{
}

///////////////////////////////////////////////////////////////////////////////////////////////////
//
// method : 
//
// param  : 
//
// return : 
//
///////////////////////////////////////////////////////////////////////////////////////////////////
function showimagespecialdate()
{
	var	dateobj = new Date;
	var	month   = dateobj.getMonth() + 1;

	switch(month){
		case	 1:
			setNewyear(dateobj.getDate());
			break;
		case	12:
			setLastyear(dateobj.getDate());
			break;
		default:
			setDefault();
			break;
	}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
//
// method : 
//
// param  : 
//
// return : 
//
///////////////////////////////////////////////////////////////////////////////////////////////////
function setNewyear(date)
{
	if(date > 4){
		setDefault();
	}
	else{
		document.open();
		document.write("<img src='img/18/elf2006.jpg' width=780 height=480 alt='今年もよろしくお願い申し上げます。'>");
		document.close();
	}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
//
// method : 
//
// param  : 
//
// return : 
//
///////////////////////////////////////////////////////////////////////////////////////////////////
function setLastyear(date)
{
	if(date < 28){
		setDefault();
	}
	else{
		document.open();
		document.write("<img src='img/18/elf2005.jpg' width=780 height=480 alt='今年もありがとうございました！'>");
		document.close();
	}
}
///////////////////////////////////////////////////////////////////////////////////////////////////
//
// method : 
//
// param  : 
//
// return : 
//
///////////////////////////////////////////////////////////////////////////////////////////////////
function setDefault()
{
	document.open();
	document.write("<img src='img/18/elf_logo.gif' width=361 height=165 alt='elf'>");
	document.close();
}

///////////////////////////////////////////////////////////////////////////////////////////////////
//
// method : 
//
// param  : 
//
// return : 
//
///////////////////////////////////////////////////////////////////////////////////////////////////
function playbgmdate(bgmfilename,idname)
{
	var	dateobj = new Date;
	//...check new year
	if(dateobj.getMonth() + 1 == 1 && dateobj.getDate() < 5){
		playbgm(bgmfilename,idname);
	}
}

/*======================================*/
/*										*/
/*======================================*/

///////////////////////////////////////////////////////////////////////////////////////////////////
//
// method : 
//
// param  : 
//
// return : 
//
///////////////////////////////////////////////////////////////////////////////////////////////////
function playone(bgmfilename,idname)
{
	var	htmltag = '<embed width=0 height=0 src=\"'+bgmfilename+'\" hidden=true autostart=true loop=false>';
	sethtml(htmltag,idname);
	return false;					//
}
///////////////////////////////////////////////////////////////////////////////////////////////////
//
// method : 
//
// param  : 
//
// return : 
//
///////////////////////////////////////////////////////////////////////////////////////////////////
function playbgm(bgmfilename,idname)
{
	var	htmltag = '<embed width=0 height=0 src=\"'+bgmfilename+'\" hidden=true autostart=true loop=true>';
	sethtml(htmltag,idname);
	return false;					//
}
///////////////////////////////////////////////////////////////////////////////////////////////////
//
// method : 
//
// param  : 
//
// return : 
//
///////////////////////////////////////////////////////////////////////////////////////////////////
function stopbgm(idname)
{
	var	htmltag = '';
	//stop
	sethtml(htmltag,idname);
//	return true;					//
}

///////////////////////////////////////////////////////////////////////////////////////////////////
//
// method : 
//
// param  : 
//
// return : 
//
///////////////////////////////////////////////////////////////////////////////////////////////////
function sethtml(htmltag,idname)
{
	if		(document.all){					//IE6
		document.all(idname).innerHTML            = htmltag;
	}
	else if	(document.getElementById){		//NN6
		document.getElementById(idname).innerHTML = htmltag;
	}
	else if	(document.layers){				//NN4
		document.layers[idname].open();
		document.layers[idname].writeln(htmltag);
		document.layers[idname].close();
	}
}

// referer -> http://allabout.co.jp/internet/javascript/closeup/CU20031226/index.htm
function writeFlashHTML(arg)
{
	//
	// 引数から属性を抽出する
	//
	var	parm = [];
	//すべての引数を順番に
	for(i=0;i<arguments.length;i++){
		//属性名と属性値をあらわす文字列を配列parmへセットする(半角空白は除去)
		parm[i] = arguments[i].split(' ').join('').split('=');
		//有効な属性名があれば属性値で変数化( 無効な名前は無視 )
		switch(parm[i][0]){
			case '_swf'      : var _swf     = parm[i][1]; break; // フラッシュのURL
			case '_quality'  : var _quality = parm[i][1]; break; // 画質
			case '_loop'     : var _loop    = parm[i][1]; break; // 繰り返し
			case '_bgcolor'  : var _bgcolor = parm[i][1]; break; // 背景色
			case '_wmode'    : var _wmode   = parm[i][1]; break; // 背景透明(WinIEのみ)
			case '_play'     : var _play    = parm[i][1]; break; // 自動再生
			case '_menu'     : var _menu    = parm[i][1]; break; // 右クリックメニュー
			case '_scale'    : var _scale   = parm[i][1]; break; // 幅高さが%の時の縦横比等
			case '_salign'   : var _salign  = parm[i][1]; break; // 表示領域内表示位置
			case '_height'   : var _height  = parm[i][1]; break; // ムービーの高さ
			case '_width'    : var _width   = parm[i][1]; break; // ムービーの幅
			case '_hspace'   : var _hspace  = parm[i][1]; break; // まわりの余白(水平方向)
			case '_vspace'   : var _vspace  = parm[i][1]; break; // まわりの余白(垂直方向)
			case '_align'    : var _align   = parm[i][1]; break; // 表示位置
			case '_class'    : var _class   = parm[i][1]; break; // クラス
			case '_id'       : var _id      = parm[i][1]; break; // ID名
			case '_name'     : var _name    = parm[i][1]; break; // ムービー名
			case '_style'    : var _style   = parm[i][1]; break; // スタイル
			case '_declare'  : var _declare = parm[i][1]; break; // 読み込まれるだけで実行しない
			default          :;
		}
	}

	//
	// タグ用文字列生成
	//
	var	htm = "";
	htm+="<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'";
	htm+="        codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0'\n";
	if(!!_width)   htm+="        width    = '" + _width   + "'\n";
	if(!!_height)  htm+="        height   = '" + _height  + "'\n";
	if(!!_hspace)  htm+="        hspace   = '" + _hspace  + "'\n";
	if(!!_vspace)  htm+="        vspace   = '" + _vspace  + "'\n";
	if(!!_align)   htm+="        align    = '" + _align   + "'\n";
	if(!!_class)   htm+="        class    = '" + _class   + "'\n";
	if(!!_id)      htm+="        id       = '" + _id      + "'\n";
	if(!!_name)    htm+="        name     = '" + _name    + "'\n";
	if(!!_style)   htm+="        style    = '" + _style   + "'\n";
	if(!!_declare) htm+="                    " + _declare +  "\n";
	htm+=">\n";
	if(!!_swf)     htm+="<param  name     = 'movie'   value ='" + _swf     + "'>\n"
	if(!!_quality) htm+="<param  name     = 'quality' value ='" + _quality + "'>\n"
	if(!!_loop)    htm+="<param  name     = 'loop'    value ='" + _loop    + "'>\n"
	if(!!_bgcolor) htm+="<param  name     = 'bgcolor'   value ='" + _bgcolor   + "'>\n"
	if(!!_play)    htm+="<param  name     = 'play'    value ='" + _play    + "'>\n"
	if(!!_menu)    htm+="<param  name     = 'menu'    value ='" + _menu    + "'>\n"
	if(!!_scale)   htm+="<param  name     = 'scale'   value ='" + _scale   + "'>\n"
	if(!!_salign)  htm+="<param  name     = 'salign'  value ='" + _salign  + "'>\n"
	if(!!_wmode)   htm+="<param  name     = 'wmode'   value ='" + _wmode   + "'>\n"
//	htm+=""
	htm+="<embed                          \n";
	htm+="        pluginspage='http://www.macromedia.com/go/getflashplayer'\n";
	if(!!_width)   htm+="        width    = '" + _width   + "'\n";
	if(!!_height)  htm+="        height   = '" + _height  + "'\n";
	if(!!_hspace)  htm+="        hspace   = '" + _hspace  + "'\n";
	if(!!_vspace)  htm+="        vspace   = '" + _vspace  + "'\n";
	if(!!_align)   htm+="        align    = '" + _align   + "'\n";
	if(!!_class)   htm+="        class    = '" + _class   + "'\n";
	if(!!_id)      htm+="        id       = '" + _id      + "'\n";
	if(!!_name)    htm+="        name     = '" + _name    + "'\n";
	if(!!_style)   htm+="        style    = '" + _style   + "'\n";
	               htm+="        type     = 'application/x-shockwave-flash'\n";
	if(!!_declare) htm+="                    " + _declare +  "\n";
	if(!!_swf)     htm+="        src      = '" + _swf     + "'\n";
	if(!!_quality) htm+="        quality  = '" + _quality + "'\n";
	if(!!_loop)    htm+="        loop     = '" + _loop    + "'\n";
	if(!!_bgcolor) htm+="        bgcolor   = '" + _bgcolor   + "'\n";
	if(!!_play)    htm+="        play     = '" + _play    + "'\n";
	if(!!_menu)    htm+="        menu     = '" + _menu    + "'\n";
	if(!!_scale)   htm+="        scale    = '" + _scale   + "'\n";
	if(!!_salign)  htm+="        salign   = '" + _salign  + "'\n";
	htm+=">\n";
	htm+="</embed>\n";
	htm+="</object>\n";

	//書き出し処理
	document.write(htm);
}

//*************************************************************************************************
//
//
//
//*************************************************************************************************
