Shadowbox.init({
	players: ['iframe', 'html', 'img'],
	modal: true
});

function openShadowbox(content,w,h){
    Shadowbox.open({
		height : h,
		width : w,
		player:'iframe',
        content:content
	});
}



//のしメッセージ入力オープン関数//-------------------------------------------//
/*
* @param strings mode 開くモード
* @param strings productid 製品番号
* @param strings categoryid カテゴリid
* @param int w 幅
* @param int h 高さ
*/

function openNM_input( mode, productid, categoryid, w, h ){
	
	//フォームオブジェクト
	var f = document.getElementById('form1');
	
	var setParam;
	
	
	//エラーチェック
	//if( (mode=='call_list_noshi') || (mode=='call_list_message') ){
	if( mode == 'call_list_noshi' ){
		if( f.elements['classcategory_id'+productid+'_1'].selectedIndex == 0 ){
			alert( 'のし書きを選択してください。');
			return;
		}
		else{
			setParam = productid + '::::' + f.elements['classcategory_id'+productid+'_1'].selectedIndex;
		}
	}
	//if( (mode=='call_detail_noshi') || (mode=='call_detail_message') ){
	if(mode=='call_detail_noshi'){
		if(f.elements['classcategory_id1'].selectedIndex == 0 ){
			alert( 'のし書きを選択してください。');
			return;
		}
		else{
			setParam = productid + '::::' + f.elements['classcategory_id1'].selectedIndex;
		}
	}
	if(mode=='call_list_message'){
		setParam = productid;
	}
	
	var url = '/noshi_card_input/session.php?mode=' + mode + '&targetKey=' + setParam;
	
	/*alert( url );
	return;*/
	
	openShadowbox( url, w, h );
	
}
//===========================================================================//



//のし（リストページかごに入れる）//-----------------------------------------//
/*
* @param strings setVals のしに設定する値
* @param int setqty 数量に設定する値
* @param strings productid 対象のproductid
*/
function setNoshiList( setVals, setqty, productid ){
	
	var f = document.form1;
	var cart_free_field = 'cart_free_field' + productid;
	var quantity = 'quantity' + productid;
	
	f.elements[cart_free_field].value = setVals;
	f.elements[quantity].value = setqty;
	
	
	Shadowbox.close();
	
	fnChangeAction( CARTSENDURL + '#product' + productid);
	fnModeSubmit('cart','product_id',productid);
}
//===========================================================================//


//のし（詳細ページかごに入れる）//-------------------------------------------//
/*
* @param strings setVals のしに設定する値
* @param int setqty 数量に設定する値
* @param strings productid 対象のproductid
*/
function setNoshiDetail( setVals, setqty, productid ){
	
	var f = document.form1;
	var cart_free_field = 'cart_free_field';
	var quantity = 'quantity';
	
	f.elements[cart_free_field].value = setVals;
	f.elements[quantity].value = setqty;
	
	
	Shadowbox.close();
	
	document.form1.submit();
}
//===========================================================================//
