// JavaScript Document
j$ = jQuery.noConflict();
//url = "http://www.cuoca.com/library/melmaga_test/php_post2.php";
url = "php_post2.php";
var param = {};
var ch_array = [];
var mode_array = [];
var bye = 0;
var form_html = "";

function ml_regi(flag){
	if(flag){
		if(j$(":checkbox","#melmaga-regi")[0].checked){
			ch_array.push("104");
			ch_array.push("105");
			mode_array.push("");
			mode_array.push("BYE");
		}
		if(j$(":checkbox","#melmaga-regi")[1].checked){
			ch_array.push("107");
			ch_array.push("106");
			mode_array.push("");
			mode_array.push("BYE");
		}
	}else{
		if(j$(":checkbox","#melmaga-regi")[0].checked){
			ch_array.push("104");
			ch_array.push("105");
			mode_array.push("BYE");
			mode_array.push("BYE");
		}
		if(j$(":checkbox","#melmaga-regi")[1].checked){
			ch_array.push("107");
			ch_array.push("106");
			mode_array.push("BYE");
			mode_array.push("BYE");
		}
		bye = 1;
	}
	
	email_adress=j$(":text","#melmaga-regi")[0].value;
	
	param['CH[]'] = ch_array;
	param['EMAIL'] = email_adress;
	param['MODE[]'] = mode_array;
	param['bye'] = bye;

var now = new Date();
param['time'] = now.getTime();
	
	if(ch_array.length!=0){
		j$.get(url,param,ml_Status);
		form_html = j$(".a04_2").html();
		j$(".a04_2").html('<div style="margin:48px 0 0 150px;"><table border="0" cellpadding="0" cellspacing="0"><tr><td><img src="img2/loadinfo.gif" /></td><td>処理をおこなっています</td></tr></table></div>');
	}else{
		j$(".a04").animate({"height":"135px"});
		data="ご希望のメルマガが選択されていません";
		j$("#message").html(data).css("padding","10px");
	}
}

function ml_Status(data,textStatus){
	j$(".a04").animate({"height":"200px"});
	j$(".a04_2").html(form_html);
	
	j$("#message").html(data).css("padding","10px");
	param = {};
	ch_array = [];
	mode_array = [];
	bye = 0;
}

/*  function radioChange() {
    if(document.form1.radio1[0].checked == true) {
      document.form1.CH[].disabled = false;
      document.form1.CH[].style.backgroundColor='#FFFFFF';
    } else if(document.form1.radio1[1].checked == true) {
      document.form1.text1.disabled = true;
      document.form1.text1.style.backgroundColor='#D4D0C8';
    } else {
      document.form1.text1.disabled = false;
      document.form1.text1.style.backgroundColor='#FFFFFF';
    }
  }
  */

