var user_id_name       = "CakeCookie[User][id]";
var user_password_name = "CakeCookie[User][security_pass]";
var user_icon_name = "CakeCookie[User][icon]";

idf = false;
psf = false;
user_icon_no = '/img/no_icon1.png"';

if (document.cookie) {
	var cookies = document.cookie.split("; ");
	for (var i = 0; i < cookies.length; i++) {
		var str = cookies[i].split("=");
		if (str[0] == user_id_name) {
			idf = true;
			user_id = str[1];
		}else if(str[0] == user_password_name){
			psf = true;
		}else if(str[0] == user_icon_name && str[1] != 'no-icon'){
			user_icon_no = '/img/pictograms/' + str[1] + '.gif';
		}
	}
}

function checkMemo() {
	mySelect1 = document.sendForm1.domain.selectedIndex;
	if (document.sendForm1.domain.options[mySelect1].value == 'i.softbank.jp' || document.sendForm1.domain.options[mySelect1].value == 'gmail.com') {
		document.getElementById('memotext1').style.display = "none";
	} else {
		document.getElementById('memotext1').style.display = "";
	}

	if(!document.sendForm2.empty){
		mySelect2 = document.sendForm2.domain.selectedIndex;
		if (document.sendForm2.domain.options[mySelect2].value == 'i.softbank.jp' || document.sendForm2.domain.options[mySelect2].value == 'gmail.com') {
			document.getElementById('memotext2').style.display = "none";
		} else {
			document.getElementById('memotext2').style.display = "";
		}
	}
}

function MemoColor1(i){
	if(document.getElementById('memo'+i).value == "メッセージ(任意)"){
		document.getElementById('memo'+i).value = "";
	}
	document.getElementById('memo'+i).style.color = "#000";
}

function MemoColor2(i){
	if(document.getElementById('memo'+i).value == ""){
		document.getElementById('memo'+i).value = "メッセージ(任意)";
		document.getElementById('memo'+i).style.color = "#CCC";
	}
}

function GotoBatchPage() {
	var s = 0;
	var pictogram_id = new Array();

	for(var i=0;i<20;i++) {
		if(document.getElementById("sendform"+i) != null) {
			pictogram_id[i] = document.getElementById("sendform"+i).value;
			if(document.getElementById("sendform"+i).checked === true) {
				if(s == 0) {
					link = pictogram_id[i];
					s++;
				} else {
					link += '-'+pictogram_id[i];
				}
			}
		}
	}

	if(typeof link !== "undefined") {
		location.href = "/batch_pictogram.php?pictograms=" + link;
	} else {
		alert('絵文字をチェックしてからクリックしてください。ダウンロードできない場合はアプリを最新バージョンにアップデートしてください。');
	}
}
