<div class="usc_app_page_wrap" style="min-height:710px">
	
<h1>Global Settings</h1>

<form role="form" method="post" id="global_settings_submit">

        <div class="box-body">

            <div class="form-group" style="max-width:648px">
                <label>Widget code</label>
                    <div id="chat_widget_snippet" class="form-control">	
					&#60;script type="text/javascript"&#62;
					(function(d)&#123;
					    var s = d.getElementsByTagName('script'),f = s[s.length-1], p = d.createElement('script'); 
					    window.WidgetId = "USC_WIDGET";   
					    p.type = 'text/javascript';
					    p.setAttribute('charset','utf-8');
					    p.async = 1;
					    p.id = "ultimate_support_chat";
					    p.src = "{$protocol}{$application_path}widget/ultimate_chat_widget.js";    
					    f.parentNode.insertBefore(p, f);
					&#125;(document));
					&#60;/script&#62;
					</div>
					<i>Paste this code snippet just before the closing &#60;/body&#62; tag in the pages where you want the chat widget to appear.</i>
            </div>

            <div class="checkbox">
                <label>
                    <input type="checkbox" name="offline_hide" value="true" {if $smarty.post.offline_hide =='true'}checked{/if}>Hide widget when operators are offline
                </label>
            </div>
			
            <div class="checkbox">
                <label>
                    <input type="checkbox" name="allow_chat_invite" value="true" {if $smarty.post.allow_chat_invite =='true'}checked{/if}>Allow operators to invite visitors to chat
                </label>
            </div>
			
			
            <div class="checkbox">
                <label>
                    <input type="checkbox" name="admin_desktop_notifications" value="true" {if $smarty.post.admin_desktop_notifications =='true'}checked{/if}>Show admin desktop notifications
                </label>
            </div>

            <div class="checkbox">
                <label>
                    <input type="checkbox" name="admin_incoming_chat_request_audio" id="admin_incoming_chat_request_audio" value="true" {if $smarty.post.admin_incoming_chat_request_audio =='true'}checked{/if}>Incoming chat request sound notification
                </label>
            </div>

            <div id="admin_incoming_chat_request_audio_options" {if $smarty.post.admin_incoming_chat_request_audio !=='true'}style="display:none"{/if}>
                <div class="global_audio_wrapper">
                    <label>
                    <select id="incoming_chat_audio" name="incoming_chat_audio">
                        <option value="9" {if $smarty.post.incoming_chat_audio =='9'}selected{/if}>Default</option>
                        <option value="0" {if $smarty.post.incoming_chat_audio =='0'}selected{/if}>0</option>
                        <option value="1" {if $smarty.post.incoming_chat_audio =='1'}selected{/if}>1</option>
                        <option value="2" {if $smarty.post.incoming_chat_audio =='2'}selected{/if}>2</option>
                        <option value="3" {if $smarty.post.incoming_chat_audio =='3'}selected{/if}>3</option>
                        <option value="4" {if $smarty.post.incoming_chat_audio =='4'}selected{/if}>4</option>
                        <option value="5" {if $smarty.post.incoming_chat_audio =='5'}selected{/if}>5</option>
                        <option value="6" {if $smarty.post.incoming_chat_audio =='6'}selected{/if}>6</option>
                        <option value="7" {if $smarty.post.incoming_chat_audio =='7'}selected{/if}>7</option>
                        <option value="8" {if $smarty.post.incoming_chat_audio =='8'}selected{/if}>8</option>
                    </select>
                    </label>
                </div>
                <audio id="audio_player"></audio>
                <div id="play_pause" class="global_play_pause"><i class="play_pause_icon fa fa-play"></i></div>
                <br/>
            </div>

            <div class="form-group">
                <div class="radio">
                    <label>
                        <input type="radio" name="track_users" id="track_users" value="all" {if $smarty.post.track_users =='all'}checked{/if}>
                        Track all website users
                    </label>
                </div>
                <div class="radio">
                    <label>
                        <input type="radio" name="track_users" id="track_users" value="chats" {if $smarty.post.track_users =='chats'}checked{/if}>
                        Track only chat requests
                    </label>
                </div>

            </div>
			
			
			<h3>Security settings</h3>
			
			
            <div class="form-group">
				
                <div class="radio">
                    <label>
                         <input type="radio" name="allowedDomains" id="allowedDomains" value="all" onchange="allowedDomainsPanel()" {if $smarty.post.allowedDomains =='all'}checked{/if}>
                        Communicate with any website / domain containing the widget code
                    </label>
                </div>
				
                <div class="radio">
                    <label>
                       <input type="radio" name="allowedDomains" id="allowedDomains" value="limited" onchange="allowedDomainsPanel()" {if $smarty.post.allowedDomains =='limited'}checked{/if}>
                       Limit communication to the following website / domains:
                    </label>
					
					<div class="allowed_domains_wrap" style="width:100%;height:auto; margin:20px 0; display:none">
					   <small>Enter a list of allowed domains separeted by a comma, e.g. http://yoursite1.com, https://yousite2.com etc.</small>
					   <br/>
					   <textarea type="text" style="width:100%; max-width:648px" name="allowedDommainsList">{$smarty.post.allowedDommainsList}</textarea>	
					</div>	
                </div>
				
            </div>
			
			
			<h3>Map API Key</h3><small><a target="_blank" href="https://developers.google.com/maps/documentation/javascript/get-api-key#get-an-api-key">Get your Free API Key</a></small>	
						
            <div class="form-group">
				
				<input type="text" style="min-width:300px; max-width:648px" name="google_maps_api_key" placeholder="Enter your API Key" 
						value="{$smarty.post.google_maps_api_key}" /><br/>	
										               			
            </div>
				
        </div>

        <div class="box-footer">
            <button type="submit" name="submit" value="true" class="btn btn-primary">Save</button>
        </div>
		<br/><br/>

</form>
</div>

<script src="{$data_server}js/global_settings.min.js" type="text/javascript"></script>

{if $smarty.post.allowedDomains == 'limited'}{literal}<script>allowedDomainsPanel();</script>{/literal}{/if}
