//検索ボックス

function keyword_on(a) {
    var element = document.getElementById(a);
    if (element.value == '') { 
        element.value = 'キーワードを入力してください。'; 
        element.style.color='#949494';
    }
}

function keyword_off(a) {
    var element = document.getElementById(a);
    if (element.value == 'キーワードを入力してください。') {
        element.value = '';
    }
}

function not_blank(a) {
    var element = document.getElementById(a);
    if (element.value == '' ||
        element.value == 'キーワードを入力してください。') { 
        alert('キーワードを入力してください。');
        return false;
    }
    return true;
}


//お問い合わせフォーム

function inquire_on(a) {
	var element = document.getElementById(a);
	if (element.value == '') { 
		element.value = 'こちらにお問い合わせの詳細をご記入ください。'; 
		element.style.color='#949494';
	}
}

function inquire_off(a) {
	var element = document.getElementById(a);
	(element.value);
	if (element.value  == 'こちらにお問い合わせの詳細をご記入ください。') element.value = '';
}


//閉じるボタン

function clsWin(){
	window.opener = window;
	var win = window.open(location.href,"_self");
	win.close();
}


//ユーザログインページのPOST先
function CLocationSearch(sSource) {
	
	/* 初期化処理 */
	var sAry = new Array();	/* アイテム配列を追加 */
	{
		var nCur = 0, nRet = 0;
		var sSearch = sSource.substr(1);
		var sName, sValue;
				
		nRet = sSearch.indexOf('=', nCur)		// 最初の'='を検索
		while(nRet >= 0) {
			// '='以前が変数名
			sName = sSearch.substring(nCur, nRet);
			nCur = nRet + 1;
			
			// 値を取り出す
			nRet = sSearch.indexOf('&', nCur);	// 変数の区切りを検索
			if (nRet == -1) nRet = sSearch.length + 1;		// なければ最後まで
			sValue = sSearch.substring(nCur, nRet);
			
			// 配列に格納
			sAry[sName] = sValue;
			
			// 次を検索
			nCur = nRet + 1;
			nRet = sSearch.indexOf('=', nCur);
		}
	}
	
	/* 値 */
	this.valueOf = function () {
		return sSource;
	}
	
	/* 値を取り出すメソッド */
	this.item = function (sVarname) {
		try {
			return sAry[sVarname];	//あれば返す
		} catch(e) {
			return '';				//なければ空文字を返す
		}
	}
	
	/* 要素数 */
	this.length   = function () {
		return sAry.length;
	}
	
	/* toString */
	this.toString = function () {
		return this.length + '';
	}
	
}


//ログインページのアラート
function login_submit() {
    uid = document.login.uid.value;
    if ( uid.match(/^\d{13}$/ ) ) {
        if ( uid.match(/^216/ ) ) {
            document.login.submit();
        }
        else {
            alert("216から始まる半角数字13桁を入力してください");
            return false;
        }
    }
    else {
        alert("216から始まる半角数字13桁を入力してください");
        return false;
    }
}

//エンター用
function handleEnter (field, event) {
    var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
    if (keyCode == 13) {
        result = login_submit();
        return false;
    }
}

function contact(){
    new_win1 = eval( 'window.open("https://www.oricomall.com/inquiry/form.html?open=1","mail","width=700,height=650,status=0,location=0,toolbar=0,resizable=1,menubar=0,scrollbars=1")' );
    new_win1.focus();
}

