/*	File: dialogs.js
*/

// support.osp (help files)
var DLG_HELP_WIDTH = 630;
var DLG_HELP_HEIGHT = 500;
var DLG_HELP_HEIGHT_SMALL = 208;
// print_blank.html
var DLG_PRINT_WIDTH = 640;
var DLG_PRINT_HEIGHT = 400;
// con_detail.osp
var DLG_CON_STORAGE_CAPACITY_WIDTH = 375;
var DLG_CON_STORAGE_CAPACITY_HEIGHT = 260;
// cat_select_list.osp
var DLG_CAT_SELECT_WIDTH = 630;
var DLG_CAT_SELECT_HEIGHT = 400;
// cat_getnew.osp
var DLG_CAT_NEW_WIDTH = 500;
var DLG_CAT_NEW_HEIGHT = 176;
// cat_getrename.osp
var DLG_CAT_EDIT_WIDTH = 500;
var DLG_CAT_EDIT_HEIGHT = 176;
// cat_delete.osp
var DLG_CAT_DELETE_WIDTH = 500;
var DLG_CAT_DELETE_HEIGHT = 176;
// con_distlist_getassign.osp
var DLG_DISTLIST_ASSIGN_WIDTH = 630;
var DLG_DISTLIST_ASSIGN_HEIGHT = 400;
// prefs_save_layout.osp
var DLG_CON_SAVE_LAYOUT_WIDTH = 500;
var DLG_CON_SAVE_LAYOUT_HEIGHT = 182;
// con_copysave.osp
var DLG_CON_COPY_WIDTH = 430;
var DLG_CON_COPY_HEIGHT = 310;
// con_switchgroup.osp
var DLG_CON_COPY_GROUP_WIDTH = 430;
var DLG_CON_COPY_GROUP_HEIGHT = 250;
// con_save.osp
var DLG_CON_SAVE_WIDTH = 500;
var DLG_CON_SAVE_HEIGHT = 182;
// con_get_smsconinfo.osp
var DLG_CON_SEND_BY_SMS_WIDTH = 430;
var DLG_CON_SEND_BY_SMS_HEIGHT = 310;
// con_save.osp (1051 - c_image_delete_rc.html)
var DLG_CON_DELETE_IMG_WIDTH = 1;
var DLG_CON_DELETE_IMG_HEIGHT = 1;
// con_search.osp (957 - distlist_addcontacts.html)
var DLG_DISTLIST_ADD_WIDTH = 630;
var DLG_DISTLIST_ADD_HEIGHT = 500;
// con_distlist_getnew.osp
var DLG_DISTLIST_NEW_WIDTH = 500;
var DLG_DISTLIST_NEW_HEIGHT = 176;
// con_distlist_getrename.osp
var DLG_DISTLIST_EDIT_WIDTH = 500;
var DLG_DISTLIST_EDIT_HEIGHT = 176;
// ag_repeateask.osp
var DLG_CAL_REPEATASK_WIDTH = 500;
var DLG_CAL_REPEATASK_HEIGHT = 202;
// ag_deleteask.osp
var DLG_CAL_DELETEASK_WIDTH = 500;
var DLG_CAL_DELETEASK_HEIGHT = 345;
// asp_getfileid.osp (216 .. 219)
var DLG_CAL_REPETITION_WIDTH = 500;
var DLG_CAL_REPETITION_HEIGHT = 320;
// con_search.osp (914 - ag_contacts.html)
var DLG_CAL_ATTENDEES_WIDTH = 630;
var DLG_CAL_ATTENDEES_HEIGHT = 500;
// m_folder_list.osp (1623 - m_folder_list_select.html)
var DLG_MAIL_SELECT_FOLDER_WIDTH = 630;
var DLG_MAIL_SELECT_FOLDER_HEIGHT = 400;
// con_search.osp (913 - select_contact.html)
var DLG_MAIL_SELECT_CONTACTS_WIDTH = 630;
var DLG_MAIL_SELECT_CONTACTS_HEIGHT = 500;
// m_folder_getnew.osp
var DLG_MAIL_FOLDER_NEW_WIDTH = 500;
var DLG_MAIL_FOLDER_NEW_HEIGHT = 179;
// m_folder_getrename.osp
var DLG_MAIL_FOLDER_EDIT_WIDTH = 500;
var DLG_MAIL_FOLDER_EDIT_HEIGHT = 179;
// testpopconnect.osp
var DLG_POPTEST_NEW_WIDTH = 500;
var DLG_POPTEST_NEW_HEIGHT = 266;
// smtptestconnect.osp
var DLG_SMTPTEST_NEW_WIDTH = 500;
var DLG_SMTPTEST_NEW_HEIGHT = 266;
// support.osp (popsecurity_help.html)
var DLG_POP_SECURITY_HELP_NEW_WIDTH = 500;
var DLG_POP_SECURITY_HELP_NEW_HEIGHT = 208;
// con_get_import.osp
var DLG_MAIL_COPYTOCONTACTS_WIDTH = 500;
var DLG_MAIL_COPYTOCONTACTS_HEIGHT = 195;
// m_export_vcard2con.osp
var DLG_MAIL_COPYVCARD_WIDTH = 500;
var DLG_MAIL_COPYVCARD_HEIGHT = 208;
// asp_getfileid.osp (1302 - malias_add.html)
var DLG_ALIAS_NEW_WIDTH = 500;
var DLG_ALIAS_NEW_HEIGHT = 208;
// m_entry_dosend.osp
var DLG_MAIL_SEND_WIDTH = 500;
var DLG_MAIL_SEND_HEIGHT = 183;
var DLG_SMS_SEND_WIDTH = 500;
var DLG_SMS_SEND_HEIGHT = 208;
// con_search.osp (929 - select_msisdn.html)
var DLG_SMS_SELECT_CONTACTS_WIDTH = 630;
var DLG_SMS_SELECT_CONTACTS_HEIGHT = 500;
// backup_confirmrestore.osp
var DLG_RESTORE_WIDTH = 500;
var DLG_RESTORE_HEIGHT = 272;
// backup_new.osp
var DLG_BACKUP_WIDTH = 500;
var DLG_BACKUP_HEIGHT = 247;
// asp_getfileid.osp (2056 - deprovisioning_confirm.html)
var DLG_DEPROVISIONING_WIDTH = 500;
var DLG_DEPROVISIONING_HEIGHT = 208;
// ag_check_conflict.osp
var DLG_APP_CONFLICT_WIDTH = 500;
var DLG_APP_CONFLICT_HEIGHT = 208;
// prefs_msenderaddr_new.osp
var DLG_MAIL_VALIDATION_WIDTH = 465;
var DLG_MAIL_VALIDATION_HEIGHT = 184;
// ag_freebusy_occupations.osp
var DLG_CAL_FREEBUSY_WIDTH = 932;
var DLG_CAL_FREEBUSY_HEIGHT = 500;
// ag_freebusy_update_customer.osp
var DLG_CAL_FREEBUSY_RENAME_WIDTH = 500;
var DLG_CAL_FREEBUSY_RENAME_HEIGHT = 208;
// support.osp (oma_devices.html)
var DLG_SUPPORT_OMADEVICES_WIDTH = 470;
var DLG_SUPPORT_OMADEVICES_HEIGHT = 250;
// support.osp (SAS_devices.html)
var DLG_SUPPORT_SASDEVICES_WIDTH = 500;
var DLG_SUPPORT_SASDEVICES_HEIGHT = 250;
// support.osp (Verifying the Sender-address)
var DLG_VERIFY_ADDRESS_WIDTH = 470;
var DLG_VERIFY_ADDRESS_HEIGHT = 250;
// con_get_merge.osp
var DLG_CON_MERGE_WIDTH = 650;
var DLG_CON_MERGE_HEIGHT = 550;
//supported Countries
var DLG_PROVIDER_SUPPORT_WIDTH = 580;
var DLG_PROVIDER_SUPPORT_HEIGHT = 494;
//pcclient --> syncclient_request.html
var DLG_SYNCML_REQUEST_WIDTH = 650;
var DLG_SYNCML_REQUEST_HEIGHT = 550;
// con_grab_import.osp
var DLG_ADDRESSBOOK_GRAB_WIDTH = 500;
var DLG_ADDRESSBOOK_GRAB_HEIGHT = 247;
//pcclient --> client_request.html
var DLG_SMSLINK_REQUEST_WIDTH = 501;
var DLG_SMSLINK_REQUEST_HEIGHT = 178;
var DLG_SMS_SENDDETAIL_WIDTH = 500;
var DLG_SMS_SENDDETAIL_HEIGHT = 494;
// smscenter_evaluate.osp (6406 - smscenter_sent_multiple.html)
var DLG_SMS_CENTER_MULTIPLE_WIDTH = 630;
var DLG_SMS_CENTER_MULTIPLE_HEIGHT = 387;


/*	Function: showDialogDefault
**
**	Creates a new popup window with no name and default properties
**
**	Parameters:
**	dlgUrl - string
**	dlgWidth - integer
**	dlgHeight - integer
*/
function showDialogDefault(dlgUrl, dlgWidth, dlgHeight)
{
	var newDialog;
	var dlgProps;
	
	if(parent.cachedListDlg)
	{
		parent.cachedListDlg.reset();
	}
	dlgProps = 'width=' + dlgWidth + ',height=' + dlgHeight + ',innerWidth=' + dlgWidth + ',innerHeight=' + dlgHeight;
	newDialog = window.open(dlgUrl, '', dlgProps);
}

/*	Function: showDialog
**
**	Creates a new popup window with default name and custom properties
**
**	Parameters:
**	dlgUrl - string
**	dlgWidth - integer
**	dlgHeight - integer
*/
function showDialog(dlgUrl, dlgWidth, dlgHeight)
{
	var dlgProps;
	
	if(parent.cachedListDlg)
	{
		parent.cachedListDlg.reset();
	}

	// if the pop-up window is already open, close it, this is a work-around to ensure the PopUp window has focus
	if(window.omPopUpDialog)
	{
	    if(!window.omPopUpDialog.closed) window.omPopUpDialog.close();
	}

	dlgProps = 'toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=no,width=' + dlgWidth + ',height=' + dlgHeight + ',innerWidth=' + dlgWidth + ',innerHeight=' + dlgHeight;

	window.omPopUpDialog = window.open(dlgUrl, 'dialog', dlgProps);
}

/*	Function: showDialogResizeable
**
**	Creates a new popup window with default name and custom properties in a resizeable window
**
**	Parameters:
**	dlgUrl - string
**	dlgWidth - integer
**	dlgHeight - integer
*/
function showDialogByNameResizeable(dlgUrl, dlgName, dlgWidth, dlgHeight)
{
	var newDialog;
	var dlgProps;
	
	if(parent.cachedListDlg)
	{
		parent.cachedListDlg.reset();
	}
	dlgProps = 'toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=no,width=' + dlgWidth + ',height=' + dlgHeight + ',innerWidth=' + dlgWidth + ',innerHeight=' + dlgHeight;
	newDialog = window.open(dlgUrl, dlgName, dlgProps);
}


/*	Function: showDialogByName
**
**	Creates a new popup window with custom name and custom properties
**
**	Parameters:
**	dlgUrl - string
**	dlgName - string
**	dlgWidth - integer
**	dlgHeight - integer
*/
function showDialogByName(dlgUrl, dlgName, dlgWidth, dlgHeight)
{
	var dlgProps; 
	var returnHandle = false;
	
	if(arguments.length > 4)
	{
		returnHandle = arguments[4];
	}
	
	if(parent.cachedListDlg)
	{
	    parent.cachedListDlg.reset();
	}
	
	// if the pop-up window is already open, close it, this is a work-around to ensure the PopUp window has focus
	if(window.omPopUpDialog)
	{
	    if(!window.omPopUpDialog.closed) window.omPopUpDialog.close();
	}
	
	dlgProps = 'toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=no,width=' + dlgWidth + ',height=' + dlgHeight + ',innerWidth=' + dlgWidth + ',innerHeight=' + dlgHeight;

	window.omPopUpDialog = window.open(dlgUrl, dlgName, dlgProps);
	
	if(returnHandle)
	{
		return window.omPopUpDialog;
	}
} 

/*	Function: showDialogByNamePosCentered
**
**	Creates a centered new popup window with custom name and custom properties
**
**	Parameters:
**	dlgUrl - string
**	dlgName - string
**	dlgWidth - integer
**	dlgHeight - integer
*/
function showDialogByNamePosCentered(dlgUrl, dlgName, dlgWidth, dlgHeight)
{
	var dlgProps; 
	
	if(parent.cachedListDlg)
	{
	    parent.cachedListDlg.reset();
	}
	
	// if the pop-up window is already open, close it, this is a work-around to ensure the PopUp window has focus
	if(window.omPopUpDialog)
	{
	    if(!window.omPopUpDialog.closed) window.omPopUpDialog.close();
	}
	
   var padding; 
   (navigator.appName == "Microsoft Internet Explorer") ? (padding = 10) : (padding = 0); 

   var screenw = screen.availWidth; 
   var screenh = screen.availHeight; 
   var winw = (dlgWidth + 15 + padding); 
   var winh = (dlgHeight + 15 + padding); 
   var posx = (screenw / 2) - (winw / 2); 
   var posy = (screenh / 2) - (winh / 2); 
   	
	dlgProps = 'toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=no,width=' + dlgWidth + ',height=' + dlgHeight + ',innerWidth=' + dlgWidth + ',innerHeight=' + dlgHeight + ',top=' + posy + ',left=' + posx;

	window.omPopUpDialog = window.open(dlgUrl, dlgName, dlgProps);
} 

/*	Function: showDialogScroll
**
**	Creates a new popup window with default name and custom properties with enabled scrolling
**
**	Parameters:
**	dlgUrl - string
**	dlgWidth - integer
**	dlgHeight - integer
*/
function showDialogScroll(dlgUrl, dlgWidth, dlgHeight)
{
	var newDialog;
	var dlgProps;
	
	if(parent.cachedListDlg)
	{
		parent.cachedListDlg.reset();
	}
	dlgProps = 'toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes,width=' + dlgWidth + ',height=' + dlgHeight + ',innerWidth=' + dlgWidth + ',innerHeight=' + dlgHeight;
	newDialog = window.open(dlgUrl, 'dialog', dlgProps);
}

/*	Function: showDialogReturn
**
**	Creates a new popup window with default name and custom properties and returns its handle
**
**	Parameters:
**	dlgUrl - string
**	dlgWidth - integer
**	dlgHeight - integer
**
**	Return:
**	object - Handle of created popup
*/
function showDialogReturn(dlgUrl, dlgWidth, dlgHeight)
{
	var newDialog;
	var dlgProps;
	
	if(parent.cachedListDlg)
	{
		parent.cachedListDlg.reset();
	}
	dlgProps = 'toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=no,width=' + dlgWidth + ',height=' + dlgHeight + ',innerWidth=' + dlgWidth + ',innerHeight=' + dlgHeight;
	newDialog = window.open(dlgUrl, 'dialog', dlgProps);
	
	return newDialog;
}


