//ページ初期化
function configPage (){
	document.getElementById("second-form").style.display = "none" ;
	document.getElementById("second-form-text").style.display = "none" ;
}

//サブウインドウを開く
function dispSubWin (url,winname,params) { 
	opened=window.open(url,winname,params);
	setTimeout("opened.focus();",100);
}

// オブジェクトの表示、非表示		dispObj=オブジェクトID,vtype=表示状態（none,block,inline）
function setBlock (dispObj,vtype){
	document.getElementById(dispObj).style.display = vtype ;
}

// 配送先入力フォームを隠す
function hideSecondForm (){
	document.getElementById("second-form").style.display = "none" ;
	document.getElementById("second-form-text").style.display = "none" ;
}


//-----------------URL移動
function gotoUrl (url){
	location.href= url ;
}

//-----------------警告＆移動
function AlertAndMove (id,url){
	if (id == 1) {
		var done = confirm("未ダウンロードデータをダウンロードします。ダウンロードを開始してよろしいですか？\nなお、処理完了後、画面は更新されません。");
	}
	if (id == 2) {
		var done = confirm("ショッピングカートのウインドウを閉じます。商品が入っている場合はその内容が削除されます。");
	}
	if (done) {
		location.href= url ;
	}
}

//親ウインドウにフォーカス
function focusParent () {
	if(!window.opener || window.opener.closed){ // メインウィンドウの存在をチェック 
	window.alert('メインウィンドウがありません'); // 存在しない場合は警告ダイアログを表示 
	} 
	window.opener.focus();
}

//POSTをpopupウインドウで開いて送る
function postPopup (formID) { 
	var win_name = "cartwin";
	var formObj = document.getElementById (formID) ;
	window.open('about:blank', win_name, 'width=670,height=600,scrollbars=yes,resizable=yes') ;
	formObj.target = win_name ;
	formObj.submit();
}

//GETでpopupウインドウで開いて送る
function getPopup (url,formID) { 
	var pgmurl = url ;
	var formObj = document.getElementById (formID) ;
	var amount = formObj.item_amount.value ;
	var id = formObj.item_id.value ;
	if (formObj.ad_id) {
		var ad = '&ad_id=' + formObj.ad_id.value ; 
	} else {
		var ad = '' ;
	}
	var url = pgmurl + '&item_amount=' + amount + '&item_id=' + id + ad ; 
	opened = window.open(url, 'cart_win' , 'width=670,height=650,scrollbars=yes,resizable=yes,status=yes') ;
	setTimeout("opened.focus();",100);
}

//クイック注文
function quickOrder () {
	var params = $('quickForm').toQueryString();
	var pgmurl = 'https://cosme.puinpul.co.jp/cart/index.php?module=Cart' ;
	var url = pgmurl + '&add=recalcadd&' + params ; 
//	alert(url);return;
	opened = window.open(url, 'cart_win' , 'width=670,height=650,scrollbars=yes,resizable=yes,status=yes') ;
	setTimeout("opened.focus();",100);
}

/*
//郵便番号検索
function zipSerchAjax(target_input)
{
	var url = 'index.php?module=Cart&action=ZipSerch&zipcode=' + $(target_input).getValue() ;
	new Ajax(url, {
		method: 'post',
//		data : parameters ,
		onComplete: function(request) {
		alert(request);return;
			try {
				var json = Json.evaluate(request);
			} catch (e) {
				alert(request);
			}
//				var json = Json.evaluate(request);
//				var json = eval ("(" + request.responseText + ")");
//				if (! json['OK']) {alert(request);return;}		//OKが無い場合はアラート
				var contents = "";
				for (var i=0; i < json['message'].length; i ++) {
					contents += "<p style='line-height:200%'>" + json['message'][i] + "</p>";
				}
				hideItemMenu () ;
//				MyBoxA.confirm('Confirm: ok ?',{textBoxBtnOk: 'Yes', textBoxBtnCancel: 'No', onComplete: function(returnvalue) { alert(returnvalue); } });
				simpleAlert (contents);
//				alert(json['items']);
				if (json['expired'] == "yes") {Town.refleshItems (json['items']);}		//使用後無くなった場合、画面更新
		},
	evalScripts: true
	}).request() ;
}
*/
