function MM_swapImgRestore() {
    var i, x, a = document.MM_sr;
    for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++)
        x.src = x.oSrc;
}

function MM_findObj(n, d) {
    var p, i, x;
    if (!d)
        d = document;
    if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
        d = parent.frames[n.substring(p + 1)].document;
        n = n.substring(0, p);
    }
    if (!(x = d[n]) && d.all)
        x = d.all[n];
    for (i = 0; !x && i < d.forms.length; i++)
        x = d.forms[i][n];
    for (i = 0; !x && d.layers && i < d.layers.length; i++)
        x = MM_findObj(n, d.layers[i].document);
    if (!x && d.getElementById)
        x = d.getElementById(n);
    return x;
}

function MM_swapImage() {
    var i, j = 0, x, a = MM_swapImage.arguments;
    document.MM_sr = new Array;
    for (i = 0; i < (a.length - 2); i += 3)
        if ((x = MM_findObj(a[i])) != null) {
            document.MM_sr[j++] = x;
            if (!x.oSrc)
                x.oSrc = x.src;
            x.src = a[i + 2];
        }
}

function changePage(pageName) {
    document.frmMain.action = pageName;
    location.replace(pageName);
}

function forward(pageName) {
    location.href = pageName;
}

function newpage(pageName) {
    // document.frmMain.action = pageName;
    // document.frmMain.target = "_findit";
    // document.frmMain.method = "post";
    // document.frmMain.submit();
    window.open(pageName, "_findit");
}

function newmember_open() {
    window.open("qr-visit/iu_input.html", "findit_newmember",
            "resizable=no,width=610,height=730,left=600,top=100");
}

function map_open(store_id) {
    window.open("display_map.html?empid="+store_id, "findit_map",
            "resizable=no,width=610,height=730,left=600,top=100");
}

function reserve_open(store_id) {
    window.open("../reserve/step1.html?empid="+store_id, "findit_reserve",
            "resizable=no,width=610,height=730,left=600,top=100");
}

function btnFocus_w(pFrm, pBtn) {
    window.document.forms[pFrm].elements[pBtn].style.color = "#E9967A";
}

function btnFocus_w2(pFrm, pBtn) {
    window.document.forms[pFrm].elements[pBtn].style.color = "#cccccc";
}

function btnUnfocus_w(pFrm, pBtn) {
    window.document.forms[pFrm].elements[pBtn].style.color = "#ffffff";
}

function mail_open(id) {
    location.href = 'mailto:' + id + '@' + 'find-it.co.jp';
}

//======================================================-
//	スペース/改行除去関数
//======================================================-
function trim(str)
{
	return rtrim(ltrim(str));
}
function ltrim(str)
{
	var trimed = str;
	var lchar = trimed.substr(0, 1);
	// 頭の改行は残す
	while (lchar == ' ' || lchar == '　' || lchar == '\r' || lchar == '\n') {
		trimed = trimed.substr(1);
		lchar = trimed.substr(0, 1);
	}
	return trimed;
}
function rtrim(str)
{
	var trimed = str;
	var rchar = trimed.substr(trimed.length - 1, 1);
	while (rchar == ' ' || rchar == '　' || rchar == '\r' || rchar == '\n') {
		trimed = trimed.substr(0, trimed.length - 1);
		rchar = trimed.substr(trimed.length - 1, 1);
	}
	return trimed;
}
