/*
 * Copyright(C) 2010 avanza Co.,Ltd. All rights reserved.
 * http://www.avnz.co.jp/
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
dojo.provide("aipo.lunchorder.utils");

aipo.lunchorder.utils.onModalDialogWide = function(bln){
	
	var viewport = dijit.getViewport();
	var marginBox = dojo.marginBox("modalDialog");
	var widthWide = 900;
	if(bln){
	    dojo.style("modalDialog","width",widthWide+"px");
	    dojo.style("modalDialog","position","absolute");
	    dojo.style("modalDialog","left",Math.floor((viewport.l + (viewport.w -  widthWide)/2)) + "px");
	    dojo.style("modalDialog","top",Math.floor(viewport.t + 10) + "px");
	}else{
	    dojo.style("modalDialog","width","");
	    dojo.style("modalDialog","left","");
	    dojo.style("modalDialog","top","");
	}
}

aipo.lunchorder.utils.openDialog = function(button, url, portlet_id, callback) {
	aipo.pcasset.PcassetUtils.onModalDialogWide(true);
    aimluck.io.openDialog(button, url, portlet_id, callback);
}

aipo.lunchorder.utils.hideDialog = function() {
	aipo.pcasset.PcassetUtils.onModalDialogWide(false);
	aipo.common.hideDialog();
}

aipo.lunchorder.utils.buttonChangeDisabled = function(checkbox_id,button_id_1,button_id_2){
	if(dojo.byId(checkbox_id).checked){
			dojo.byId(button_id_1).disabled=false;
			dojo.byId(button_id_2).disabled=false; 
	}else{
			dojo.byId(button_id_1).disabled=true;
			dojo.byId(button_id_2).disabled=true; 
	}
}
