/* Begin of Calendar functions */
function s(obj) {
	obj.style.color = "blue";
	obj.style.backgroundColor = "#EFEFEF";
}
function us(obj, color) {
	obj.style.color = color;
	obj.style.backgroundColor = "white";
}
function sel(yearmonth, date, calNum) {
	if(calNum == 1) {
		objYearMonth = document.goResult.goYearMonth;
		objDate = document.goResult.goDate;
	}
	if(calNum == 2) {
		objYearMonth = document.goResult.returnYearMonth;
		objDate = document.goResult.returnDate;
	}
	objYearMonth.value = yearmonth;
	objDate.value = date;
	
	for(cnt = 1; cnt <= 5; cnt++) {
		document.all("calendar" + calNum + cnt).style.visibility = "hidden";
	}
}
/* End of Calendar Functions */
function setPng24(obj) {
obj.width=obj.height=1;
obj.className=obj.className.replace(/\bpng24\b/i,''); 
obj.style.filter =
"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"
obj.src='about:blank;';
return '';
}
function blink(imgObject, showTimeSpan) {
	document[imgObject].src = eval(imgObject + 'on.src');
	setTimeout("blinkUp('" + imgObject + "')", showTimeSpan);
}
function blinkUp(imgObject) {
	document[imgObject].src = eval(imgObject + 'off.src');
}
function email_check(email) {
	if(email == ""){
		alert("メールアドレスが入力されていません。");
		return false;
	}
	
	var str = email;
	var atPos = str.indexOf('@');
	var atLastPos = str.lastIndexOf('@');
	var dotPos = str.indexOf('.');
	var spacePos = str.indexOf(' ');
	var commaPos = str.indexOf(',');
	var eMailSize = str.length;
	
	if(atPos > 1 && atPos == atLastPos && spacePos == -1 && commaPos == -1 && dotPos + 1 < eMailSize);
	else {
		alert('メールアドレスの形式が正しくありません。');
		return false;
	}
	
	return true;
}
function mail_magazine(email_address) {
	if(email_check(email_address)) {
		window.open('','mailmag','resizable=0,scrollbars=1,menubar=0,directories=0,status=0,location=0,width=500,height=280');
		return true;
	} else {
		return false;
	}
}
function goBullitinDelete() {
	if(confirm("Really delete this Article? Please Re-check.")) {
		document.coun.submit();
	}
}
function goBulletinModify(thisPage, serial, shopSerial) {
	document.location = thisPage + "?sub=modify&serial=" + serial;
}
function setButtonOver(obj) {
	obj.color = "red";
}
function setButtonOut(obj) {
	obj.color = "black";
}
function go_comment_delete(serial) {
	if(confirm("Really delete this Article? Please Re-check.")) {
		document.comment_form.action_type.value = "bulletin_comment_delete";
		document.comment_form.serial.value = serial;
		document.comment_form.submit();
	}
}
function set_clipboard(message) {
	window.clipboardData.setData('Text', message);
}

function set_default(obj) {
	obj.value = "■メルマガの解除アドレスはこちら\r\n\r\n[-=shop_full_url=-]\r\n\r\n■お問い合わせ\n・ＴＥＬ　: [-=shop_phone=-]\r\n==========================================\r\n[-=shop_locale=-]発 「[-=shop_name=-]」\r\n24時間営業　[-=shop_full_url=-]\r\n(携帯版：[-=shop_full_url=-]/i/)\r\n==========================================";
}

function select_radio_by_id(radio_num) {
	document.all("priority" + radio_num).checked = "true";
}

function set_over(obj) {
	obj.backgroundColor = "#eeeeff";
}

function set_out(obj) {
	obj.backgroundColor = "#ffffff";
}

//////////////////////////////////////////////////////////////////////
// 2009/06/03 girl list serialization functions
//////////////////////////////////////////////////////////////////////
function select_change(obj) {
	document.fman.mode[0].disabled = true;
	document.fman.mode[1].disabled = true;

	if(document.fman.mode[0].checked) {
		change(obj);
    }

    if(document.fman.mode[1].checked) {
        insert(obj);
    }
}

function change(obj) {
	var target = obj.name.substring(11);
	obj.style.backgroundColor = '#ccccff';
	eval('document.fman.girl_serial' + obj.value).style.backgroundColor = '#ffcccc';
	eval('document.fman.girl_serial' + obj.value).value = target;
	
}

function insert(obj) {
	var target_start = obj.value * 1;
	var target_end = obj.name.substring(11) * 1;

	for(counter = target_start; counter < target_end; counter++) {
		now_obj = eval('document.fman.girl_serial' + counter);
		now_obj.value = now_obj.value * 1 + 1;
		now_obj.style.backgroundColor = '#ffcccc';
	}
	obj.style.backgroundColor = '#ccccff';
}
//////////////////////////////////////////////////////////////////////

function img_delete(img_num, target_form) {
	if(confirm("Please Confirm. It's OK?")) {
		target_form.action_type.value = "bulletin_img_delete";
		target_form.img_num.value = img_num;
		target_form.submit();
	}
}
function img_change(img_num, target_form, type) {
	target_form.action_type.value = "bulletin_img_change";
	target_form.img_num.value = img_num;
	target_form.img_change_type.value = type;
	target_form.submit();
}