// JavaScript Document

function all_reset()	{
	document.getElementById('click_detail').style.display = 'block';
	document.getElementById('click_personal').style.display = 'none';
	document.getElementById('click_cate').style.display = 'none';
	document.getElementById('click_week').style.display = 'none';
	document.getElementById('sel_personal').style.display = 'none';
	document.getElementById('sel_cate').style.display = 'none';
	document.getElementById('sel_week').style.display = 'none';
}
function close_div(idName)	{
	document.getElementById(idName).style.display = 'none';
}

function c_program ()	{
	all_reset();
	document.getElementById('sel_prog').style.display = 'block';
}
function change_prog (idName,dataName,txt)	{
	document.getElementById('click_detail').style.display = 'none';
	document.getElementById(idName).style.display = 'block';
	document.getElementById('click_prog').innerHTML = txt;
	document.getElementById('sel_prog').style.display = 'none';
	document.prog.category.value = dataName;
}

function show_detail (idName)	{
	document.getElementById(idName).style.display = 'block';
}
function change_detail (cateName,dataName,txt)	{
	var idName = 'sel_' + cateName;
	var aName = 'a_' + cateName;

	document.getElementById(aName).innerHTML = txt;
	document.getElementById(idName).style.display = 'none';
	document.prog.detail.value = dataName;
}


// M-onChart

function loadHTMLFile(fName)
{
	new Ajax.Request(fName, { method: "get", onComplete: displayData });
}
function displayData(httpObj)
{
//	document.getElementById("chart").innerHTML = httpObj.responseText;
	$("chart").innerHTML = httpObj.responseText;
}



// POPUP
function openWin(url,winname,width,height,resize,sclbar) {
  newWin=window.open(url,winname,'width='+width+',height='+height+',directories=no,location=no,menubar=no,resizable='+resize+',scrollbars='+sclbar+',status=no,titlebar=no,toolbar=no'); 
  newWin.focus();
}
function OpenRequest(){win=window.open("https://www.m-on.jp/popup/request.php","_blank","width=423,height=500,resizable=yes,scrollbars=1,status=yes,scrollbars=yes");}
function OpenMelmag(){win=window.open("https://www.m-on.jp/popup/mailmaga.html","_blank","width=423,height=500,resizable=yes,scrollbars=1,status=yes,scrollbars=yes");}
function OpenPrersv(id){win=window.open("../liveinfo/pre_reserve" + id +".html","_blank","width=423,height=500,resizable=no,scrollbars=1");}
function OpenSprsv(id){win=window.open("../liveinfo/special_reserve" + id +".html","_blank","width=423,height=500,resizable=no,scrollbars=1");}
function OpenMessage(){win=window.open("../popup/message.html","_blank","width=423,height=500,resizable=no,scrollbars=1");}
function OpenPresent(){win=window.open("../popup/present.html","_blank","width=423,height=500,resizable=no,scrollbars=1");}
function Opencontact(){win=window.open("http://dev.m-on.jp/contact/form.php","_blank","width=600,height=600,resizable=no,scrollbars=1");}

function OpenRequest2(titles_id){
	window.open("https://www.m-on.jp/popup/request_pre_confirm.php?t=" + titles_id,"_blank","width=423,height=500,resizable=no,scrollbars=1");
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function MailMagazineRegister() {
//	ml = /^[0-9a-zA-Z\-\_]+@[0-9a-zA-Z\-\_\.]+\.[0-9a-zA-Z\-\_]+$/
	ml = /^[0-9A-Za-z._-]+@[0-9A-Za-z._-]+$/
	Mail = document.MG.email.value;
	if(!Mail.match(ml)) {
		alert("メールアドレスが不正です");
		return false;
	}
	else{
		win=window.open("https://www.m-on.jp/popup/mailmaga_conform.php?email="+ Mail,"_blank","width=450,height=600,resizable=no,scrollbars=1");
	}
}

function MailMagazineRegister_mid() {
//	ml = /^[0-9a-zA-Z\-\_]+@[0-9a-zA-Z\-\_\.]+\.[0-9a-zA-Z\-\_]+$/
	ml = /^[0-9A-Za-z._-]+@[0-9A-Za-z._-]+$/
	Mail = document.MG.email.value;
	if(!Mail.match(ml)) {
		alert("メールアドレスが不正です");
		return false;
	}
	else{
		win=window.open("https://www.m-on.jp/popup/mailmaga_conform.php?email="+ Mail,"_blank","width=423,height=500,resizable=no,scrollbars=1");
	}
}


function MailMagazineChange() {
//	ml = /^[0-9a-zA-Z\-\_]+@[0-9a-zA-Z\-\_\.]+\.[0-9a-zA-Z\-\_]+$/
	ml = /^[0-9A-Za-z._-]+@[0-9A-Za-z._-]+$/
	Mail = document.MG.email.value;
	if(!Mail.match(ml)) {
		alert("メールアドレスが不正です");
		return false;
	}
	else{
		win=window.open("https://www.m-on.jp/popup/mailmaga_change_resign.php?email="+ Mail,"_blank","width=423,height=500,resizable=no,scrollbars=1");
	}
}

function MailMagazineChange_mid() {
//	ml = /^[0-9a-zA-Z\-\_]+@[0-9a-zA-Z\-\_\.]+\.[0-9a-zA-Z\-\_]+$/
	ml = /^[0-9A-Za-z._-]+@[0-9A-Za-z._-]+$/
	Mail = document.MG.email.value;
	if(!Mail.match(ml)) {
		alert("メールアドレスが不正です");
		return false;
	}
	else{
		win=window.open("https://www.m-on.jp/popup/mailmaga_change_resign.php?email="+ Mail,"_blank","width=423,height=500,resizable=no,scrollbars=1");
	}
}


//------------------------------------------------------------
//レイヤー切り替え
//------------------------------------------------------------
function Start(strLayer, fType)
{
	//NNの場合
	if (document.layers)
	{
		if (fType)
		{
			//表示
			document.layers[strLayer].visibility = "show";
		}
		else
		{
			//非表示
			document.layers[strLayer].visibility = "hide";	
		}
	}
	//IEとNC6の場合
	if (document.getElementById)
	{	
		if (fType)
		{	
			//表示
			document.getElementById(strLayer).style.visibility="visible";
		}
		else
		{
			//非表示
			document.getElementById(strLayer).style.visibility="hidden";
		}
	}
	
}

//------------------------------------------------------------
//アーティストグッズ
//------------------------------------------------------------

function SetLayer(a){
	if(iIE4){
		L = document.all(a);
	}
	if(iNN4){
		L = document.layers[a];
	}
	
	if(iIE5NN5){
		L = document.getElementById(a);
	}
	
	return(L);
}

function Draw(L,com,cc){

	if(iIE4){
		L.innerHTML = com;
	}
	if(iNN4){
		L.document.open();
		L.document.write(com);
		L.document.close();
	}
	if(iIE5NN5){
		document.getElementById(cc).innerHTML=com;
	}
}


 var defaultTXT = "おすすめアイテム！";
 var prod1_titles = new Array();
 	prod1_titles = Array(); //prod1name
 var brw_v=navigator.appVersion.charAt(0);
 var brw_n=navigator.appName.charAt(0);
 var iIE4 = false;
 var iNN4 = false;
 var iIE5NN5 = false;
 //alert(brw_v);
 //alert(brw_n);
 if((brw_v >= 5)&&(brw_n == "N"))iIE5NN5 = true;
 if((brw_v >= 4)&&(brw_n == "M"))iIE5NN5 = true;
 if((brw_v == 3)&&(brw_n == "M"))iIE4 = true;
 if((brw_v == 4)&&(brw_n == "N"))iNN4 = true;
 
 lay1 = SetLayer("prod1name");
 
 
 