// JavaScript Document

function mobile_win() {
  self.window.name="main"
  w = window.open('', '_blank', 'width=220,height=200,status=yes,scrollbars=no,directories=no,menubar=no,resizable=yes,toolbar=no');
  if (w != null) {
    if (w.opener == null) {
      w.opener = self;
    }
    w.location.href = '/Help/i_bbs.html';
  }
}


function defined(elm){
  return typeof(document.frm.elements[elm])!="undefined";
}

function getCookie(cookie,key){
  var tmp1=" "+cookie+";";
  var xx1 =0;
  var xx2 =0;
  var len =tmp1.length;
  while(xx1<len){
    var tmp2,xx3;
    xx2 =tmp1.indexOf(";",xx1);
    tmp2=tmp1.substring(xx1+1,xx2);
    xx3 =tmp2.indexOf("=");
    if(tmp2.substring(0,xx3)==key){
      return(unescape(tmp2.substring(xx3+1,xx2-xx1-1)));
    }
    xx1=xx2+1;
  }
  return "";
}

function setCookie(){
  if(location.pathname=="/cgi-bin/bbs2/bbs.cgi"){
    return true; 
  }

  if(defined("use_cookie") && !document.frm.elements["use_cookie"].checked){
    clearCookie(); 
    return true;
  }

  var cookies="";
  if(defined("username") && document.frm.elements["username"].value!=""){
    cookies+="username="+escape(document.frm.elements["username"].value)+"; ";
  }
  if(defined("mail") && document.frm.elements["mail"].value!=""){
    cookies+="mail="+escape(document.frm.elements["mail"].value)+"; ";
  }
  if(defined("sex") && document.frm.elements["sex"].type=="select-one"){
    cookies+="sex="+escape(document.frm.elements["sex"].selectedIndex)+"; ";
  }
  if(defined("address") && document.frm.elements["address"].type=="select-one"){
    cookies+="address="+escape(document.frm.elements["address"].selectedIndex)+"; ";
  }
  cookies+="use_cookie=true; ";
  var expDate=new Date();
  expDate.setTime(expDate.getTime()+31*24*60*60*1000);
  document.cookie="bbs="+escape(cookies)+"; expires="+expDate.toGMTString()+"; path="+location.pathname.substring(0,location.pathname.lastIndexOf('/')+1);

  return true;
}

function restoreValues(){
  if(location.pathname=="/cgi-bin/bbs2/bbs.cgi"){
    return; 
  }

  var values=getCookie(document.cookie,'bbs');

  if(defined("use_cookie") && getCookie(values,"use_cookie")=="true"){
    document.frm.elements["use_cookie"].checked=true;
  }else{
    return; 
  }
  if(defined("username")){
    document.frm.elements["username"].value=getCookie(values,"username");
  }
  if(defined("mail")){
    document.frm.elements["mail"].value=getCookie(values,"mail");
  }
  if(defined("sex")){
    document.frm.elements["sex"].options[Math.floor(getCookie(values,"sex"))].selected=true;
  }
  if(defined("address")){
    document.frm.elements["address"].options[Math.floor(getCookie(values,"address"))].selected=true;
  }
}

function clearCookie(){
  var expDate=new Date();
  expDate.setTime(expDate.getTime()-1);
  document.cookie="bbs=x; expires="+expDate.toGMTString()+"; path="+location.pathname.substring(0,location.pathname.lastIndexOf('/')+1);
}


/*mobileウィンドウ用*/

function openWin(URL,winName,features) { 
  window.open(URL,winName,features);
}

function mobileWin() {
   window.open("http://www.sonymusic.co.jp/Music/Arch/AI/Rythem/index_m.html","mobile","width=245,height=350,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no");
}


function listWin() {
   window.open("http://www.sonymusic.co.jp/Music/Arch/AI/Rythem/m_disco_uta.html","list","width=640,height=330,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes");
}


/*確認用
function listWin() {
   window.open("m_disco_uta.html","list","width=640,height=330,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes");
}
*/


/*TOPライナーノーツウィンドウ用*/
function linerWin(url) {
   window.open(url,"liner","width=480,height=440,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes");
}


/*スペシャル*/
function popup(url){
wo=window.open("../special/070724/index.html","popup","width=700,height=470,left=0,top=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,favorites=no,resizable=yes");
wo.focus();
}


function popup02(url){
wo=window.open("../special/080407/index.html","popup02","width=700,height=220,left=0,top=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,favorites=no,resizable=yes");
wo.focus();
}
