https://files.fm/u/2fq5c8j3mr

Submitted URL:
https://files.fm/u/2fq5c8j3mr
Report Finished:

The outgoing links identified from the page

JavaScript Variables · 499 found

Global JavaScript variables loaded on the window object of a page, are variables declared outside of functions and accessible from anywhere in the code within the current scope

Console log messages · 37 found

Messages logged to the web console

HTML

The raw HTML body of the page

<html id="adaptive_html" lang="EN"><head><script type="text/javascript" async="" src="https://static.criteo.net/js/ld/publishertag.prebid.144.js"></script><script type="text/javascript" async="" src="https://script.4dex.io/localstore.js"></script><style class="vjs-styles-defaults">
      .video-js {
        width: 300px;
        height: 150px;
      }

      .vjs-fluid:not(.vjs-audio-only-mode) {
        padding-top: 56.25%
      }
    </style><script type="text/javascript" async="" src="https://www.google-analytics.com/analytics.js"></script><script type="text/javascript" async="" src="https://www.googletagmanager.com/gtag/js?id=G-H8LJ280FZW&amp;l=dataLayer&amp;cx=c"></script><script type="text/javascript" async="" src="https://www.googletagmanager.com/gtag/js?id=AW-1043031755&amp;l=dataLayer&amp;cx=c"></script><script type="text/javascript" async="" src="https://www.googletagmanager.com/gtag/js?id=UA-1970559-6&amp;l=dataLayer&amp;cx=c"></script><script type="text/javascript" async="" src="https://www.google-analytics.com/analytics.js"></script><script type="text/javascript" async="" src="https://www.googletagmanager.com/gtag/js?id=G-EFZ32Z07VR&amp;l=dataLayer&amp;cx=c"></script><script async="" src="//analytics.files.fm/matomo.js"></script><script type="text/javascript">
        var intPrevAdRefreshTST = (new Date()).getTime();
		var bolIsListViewForSpecificFile = Boolean(0);
    </script>



<meta charset="UTF-8">
<meta name="globalsign-domain-verification" content="WVoCXGP9WWz7ZO3hqGZASmZCYQ2jhO7WxIRwsepEgV">
<meta name="theme-color" content="#ffffff">
<meta name="facebook-domain-verification" content="nikti9bu56gz5oi6d126k5bloj0772">
<title>File upload &amp; sharing. Send large photos and videos. Online cloud storage.</title>
<meta name="keywords" content="ftp file upload, file hosting, android, file cloud, cloud storage, file sharing, failu glabāšana, bilžu hostings, bilžu apmaiņa, failu apmaiņa, failu serveris, failu koplietošana, failu rezerves kopijas, failu backup, file hosting, file sharing, file exchange, file storage, image hosting, file upload, files, file share, web file hosting, internet file storage, image upload, free upload, photo sharing, online photo gallery, photos online, data backup, online backup">
<meta property="og:title" content="Desktop 2024.08.06 - 19.03.46.03.mp4">
<meta property="og:description" content="Visit this link to download: Desktop 2024.08.06 - 19.03.46.03.mp4">
<meta name="description" content="Visit this link to download: Desktop 2024.08.06 - 19.03.46.03.mp4">
<meta property="og:image" content="https://files.fm/images/meta_share/files-meta-1200-2x.png">
<meta property="og:image:secure_url" content="https://files.fm/images/meta_share/files-meta-1200-2x.png">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="https://files.fm/images/meta_share/files-meta-1200-2x.png">
<meta property="twitter:image" content="https://files.fm/images/meta_share/files-meta-1200-2x.png">
<meta property="og:url" content="https://files.fm/u/2fq5c8j3mr">
<meta property="og:type" content="website">
<meta property="og:site_name" content="Files.fm">
<meta property="fb:app_id" content="303254966461402">
<link rel="canonical" href="https://files.fm/u/2fq5c8j3mr">
<link rel="alternate" hreflang="x-default" href="https://files.fm/u/2fq5c8j3mr">
<link rel="alternate" hreflang="en" href="https://files.fm/u/2fq5c8j3mr">
<link rel="preconnect" href="https://www.googletagmanager.com" crossorigin="">
<link rel="preconnect" href="https://files.fm" crossorigin="">
<link rel="preconnect" href="https://www.google-analytics.com" crossorigin="">
<link rel="preconnect" href="https://www.googleadservices.com" crossorigin="">
<link rel="preconnect" href="https://googleads.g.doubleclick.net" crossorigin="">
<link rel="preconnect" href="https://stats.g.doubleclick.net" crossorigin="">
<link rel="preconnect" href="https://www.google.com" crossorigin="">
<link rel="preconnect" href="https://www.google.lv" crossorigin="">
<script>
	
    var _paq = window._paq = window._paq || [];
    
    _paq.push( [ 'trackPageView' ] );
    _paq.push( [ 'enableLinkTracking' ] );
    
    (function()
    {
        var u= '//analytics.files.fm/';
        
        _paq.push( [ 'setTrackerUrl', u + 'matomo.php' ] );
        _paq.push( [ 'setSiteId', '1' ] );
        
        var d = document;
        var g = d.createElement( 'script' );
        var s = d.getElementsByTagName( 'script' )[ 0 ];
        
        g.async = true;
        g.src = u + 'matomo.js';
        s.parentNode.insertBefore( g, s );
    } )();

</script>
<script async="" src="https://www.googletagmanager.com/gtag/js?id=UA-1970559-10"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  
    
  gtag('js', new Date());
  
    gtag('config', 'UA-1970559-10');

    gtag('config', 'UA-1970559-6');
  
    
    gtag('config', 'AW-1043031755');
  
</script>
<script src="/js/google_conversion.js?v=4"></script>

<script async="" src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
<script>
    window.googletag = window.googletag || {cmd: []};
    googletag.cmd.push(function() {
      if(window.innerWidth > 1000) {
        googletag.defineSlot('/19238985/files_970x90_sticky_anchorad_desktop', [[970,90],[950,90],[900,90],[728,90],[970,50],[1000,90],[1000,100]], 'files_970x90_sticky_anchorad_responsive').addService(googletag.pubads());
        googletag.defineSlot('/19238985/files_300x250_sidebar_desktop_1', [[300,250]], 'files_300x250_sidebar_desktop_1').addService(googletag.pubads());
        googletag.defineSlot('/19238985/files_300x250_sidebar_desktop_2', [[300,250]], 'files_300x250_sidebar_desktop_2').addService(googletag.pubads());
        googletag.defineSlot('/19238985/files_300x250_file_desktop_1', [[300,250]], 'files_300x250_file_desktop_1').addService(googletag.pubads());
        googletag.defineSlot('/19238985/files_300x250_desktop_left_sticky', [[300,250]], 'files_300x250_desktop_left_sticky').addService(googletag.pubads());
      } else {
        googletag.defineSlot('/19238985/files_300x250_file_desktop_1', [[300,250]], 'files_300x250_file_desktop_1').addService(googletag.pubads());
		googletag.defineSlot('/19238985/files_320x100_sticky_anchorad_mobile', [[320,100],[300,100],[320,50],[300,50]], 'files_970x90_sticky_anchorad_responsive').addService(googletag.pubads());
        googletag.defineSlot('/19238985/files_320x100_top_mobile', [[320,100],[300,100],[320,50],[300,50]], 'files_320x100_top_responsive').addService(googletag.pubads());
        googletag.defineSlot('/19238985/files_300x250_mobile', [[300,250],[336,336],[336,320],[320,320],[300,300],[336,280],[320,250],[320,336]], 'files_300x250_mobile').addService(googletag.pubads());
		googletag.defineSlot('/19238985/files_300x250_desktop_left_sticky', [[300,250]], 'files_300x250_desktop_left_sticky').addService(googletag.pubads());
      }  
        var interstitialSlot = googletag.defineOutOfPageSlot('/19238985/files.fm_interstitial', googletag.enums.OutOfPageFormat.INTERSTITIAL);
        if (interstitialSlot) interstitialSlot.addService(googletag.pubads());
      
    googletag.pubads().disableInitialLoad();
    googletag.pubads().enableSingleRequest();              
    googletag.pubads().collapseEmptyDivs();
    googletag.enableServices();
    googletag.display(interstitialSlot);
    })
             
</script>
<script async="" src="https://stpd.cloud/saas/3285"></script>
<base href="https://files.fm/">
<meta name="verify-v1" content="4MHpv5CF+UNp34oMIZOxnVwoSslLpr+5GPkxFp94Wq8=">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" media="all" href="/css/reset.css?v=1715343650"><link rel="stylesheet" type="text/css" media="all" href="/css/global.css?v=1722490362"><link rel="stylesheet" type="text/css" media="all" href="/css/header.css?v=1728475221"><link rel="stylesheet" type="text/css" media="all" href="/css/messages/messages.css?v=1715343651"><link rel="stylesheet" type="text/css" media="all" href="/ts/chat/dist/chat.css?v=1715343647">
<script src="/js/jquery-1.12.2.min.js?v=1715343643"></script>
<script src="/js/jquery-migrate-1.3.0.js?v=1715343643"></script>
<script src="/js/JSON/cycle.js?v=1715343642"></script> <script src="/error_handler_client?v=4"></script>
<link rel="icon" type="image/png" href="/images/logo/rebranded/favicon-192x192px.png?v=2">
<link rel="icon" type="image/svg+xml" href="/images/logo/rebranded/favicon-192x192px.svg?v=2">
<script>

				var DOMAIN_NAME = 'files.fm';
				
				var HTTP_HOST = 'files.fm';
				var IS_DEV_SERVER = false;

				// capitalize first letter of domain
                DOMAIN_NAME = DOMAIN_NAME.charAt(0).toUpperCase() + DOMAIN_NAME.slice(1);

				var lang_code = 'EN';

				var DOCUMENT_IS_LOADED = false;

				var MMVD = false;
				var STDT = new Date().getTime();

				var WEB_ROOT_PATH = '';

				var FB_APP_ID = '303254966461402';

				var strTranslation_LinkCopied = 'Link copied to memory';

				var strSellFilesCurrency = 'USD';

				$(function(){

					DOCUMENT_IS_LOADED=true

                    var intScrollTop = $('html').scrollTop();
                    var intFlagHeight = $('body').hasClass('show_header_flag') ? 20 : 0;
					intScrollTop = Math.max(intScrollTop, $('body').scrollTop());
					
                    if ( intScrollTop > 0 )
                    {
                        $('body').addClass('scrolled');
                    }
                    
                    var intPrevScrollPos = intScrollTop;
                    var objHeaderElem = document.getElementById("header");
                    
                    $(window).on('scroll', function () {
                        //close side menu
                        $( '#navbar-toggler-chb' ).prop('checked', false);
                        $( '#header' ).css('z-index', '');

                        var intScrollTop = $('html').scrollTop();
                        intScrollTop = Math.max(intScrollTop, $('body').scrollTop());
                        
                        if ( intScrollTop > 0 )
                        {
                            $('body').addClass('scrolled');
                        }
                        else
                        {
                            $('body').removeClass('scrolled');
                            checkMenuItems();
                        }

                                            });

					$( document ).mousemove( function( event )
					{
						if ( ! MMVD )
						{
							if ( ( ( new Date().getTime() ) - STDT ) > 1000 )
							{
								MMVD = true;
							}
						}
					});
				});


				function changeLanguage(strLangCode, strTitle)
				{
					var strUrl = '';
					switch (strLangCode)
					{
						case 'lv':
                            strUrl = 'https://failiem.lv/u/2fq5c8j3mr';
                            break;
						case 'en':
                            strUrl = 'https://files.fm/u/2fq5c8j3mr';
                            break;
						case 'ru':
                            strUrl = 'https://ru.files.fm/u/2fq5c8j3mr';
                            break;
						case 'de':
                            strUrl = 'https://de.files.fm/u/2fq5c8j3mr';
                            break;
						case 'fi':
                            strUrl = 'https://fi.files.fm/u/2fq5c8j3mr';
                            break;
                        case 'es':
                            strUrl = 'https://es.files.fm/u/2fq5c8j3mr';
                            break;
                        case 'ko':
                            strUrl = 'https://ko.files.fm/u/2fq5c8j3mr';
                            break;
                        case 'uk':
                            strUrl = 'https://ua.files.fm/u/2fq5c8j3mr';
                            break;
					}
                    gaev('HeaderClick', 'Lang_switch', strLangCode);
					window.location = strUrl + WEB_ROOT_PATH;// + '?lng='+strLangCode;
					$('.language_dropdown .activator SPAN').each(function (){
						var img = $('IMG', this).clone();
						$(this).html(strTitle + ' ').append(img);
					});
					hidePopups();
				}


				function gaev(strCategory, strAction, strLabel, strValue) {

					if (typeof gtag != 'undefined') {
						// old ga.js
						//_gaq.push(['_trackEvent', strCategory, strAction, strLabel]);
						
						// Send the event to the gtag.js Google Analytics property
						// with tracking ID GA_MEASUREMENT_ID.
						gtag('event', 'Events', {
						  'event_category': strCategory,
						  'event_action': 	strAction,
						  'event_label': 	strLabel,
						  'value':			strValue
						});
						
						/*gtag('event', 'strEveryEventTest', {
						  'send_to': 'UA-1970559-10',
						  'event_category': 'EveryEvent',
						  'event_action': 	'TestAction',
						  'event_label': 	'TestLabel'
						});*/

					};
					
					
					if ( typeof _paq != 'undefined' )
					{
						_paq.push( [
							'trackEvent',
							strCategory ,
							strAction ,
							strLabel ,
							strValue
						] );
					}
				}
				
				function logClick(strButton)
				{
										if (typeof gtag != 'undefined')
					{
						//_gaq.push(['_trackEvent', 'ActionLine', strButton, 'List']);

						gtag('event', 'Clicks', {
						  'send_to': 'UA-1970559-10',
						  'event_category': 'ActionLine',
						  'event_action': 	strButton,
						  'event_label': 	'List'
						});
					};
									}


				function printAdwordsConversion(strIframeName) {

					var  iframe = document.createElement('iframe');
					iframe.style.width = '0px';
					iframe.style.height = '0px';
					document.body.appendChild(iframe);

					iframe.src = 'https://files.fm/server_scripts/google_adwords/'+ strIframeName +'.php';
				}

			</script>
<script>
				var IS_MOBILE = false;
			</script>

<!--[if lt IE 9]>
				<script type="text/javascript" src="./js/html5.js"></script>
				<script type="text/javascript" src="./js/css3-mediaqueries.js"></script>
			<![endif]-->
<script>  	var tb_lang = new Object();  	tb_lang["close"] = "Close";  	tb_lang["or_esc_key"] = "or press the Esc key";  </script>
<script>

				Math._round = function(number, precision)
				{
					precision = Math.abs(parseInt(precision)) || 0;
					var coefficient = Math.pow(10, precision);
					return Math.round(number*coefficient)/coefficient;
				}

				function file_size_format (filesize, intPrecision, bolShowBits=false )
				{
					if ( bolShowBits )
					{
						filesize = filesize * 8;
					}
				    
				    if (typeof(intPrecision) == 'undefined' || intPrecision==null)
				        intPrecision = 2;
				    
					if (filesize >= 1073741824)
					{
						filesize = Math._round(filesize / 1073741824, 2).toFixed(intPrecision) + '&nbsp;G';
					}
					else
					{
						if (filesize >= 1048576)
						{
							filesize = Math._round(filesize / 1048576, 2).toFixed(intPrecision) + '&nbsp;M';
						}
						else
						{
							if (filesize >= 1024)
							{
								filesize = Math._round(filesize / 1024, 0).toFixed(intPrecision) + '&nbsp;K';
							}
							else
							{
								filesize = filesize.toFixed(intPrecision) + '&nbsp;';
							};
						};
					};
					
					if ( bolShowBits )
					{
						filesize += 'bits';
					}
					else 
					{
						filesize += 'B';
					}
					
					return filesize;
				};

			</script>
<script>
    /**
     * @param strEmails - one or more emails delimited with ","
     * @param bolIsSingleEmail - is strEmails only one email
     */
    function EmailValidator(strEmails, bolIsSingleEmail)
    {
        this.state = EmailValidator.states.READY;
        this.strSuggestedEmails = "";
        this.strEmails = strEmails.trim();
        this.strNoMxEmails = "";
        this.strInputID = "";
        this.bolIsSingleEmail = bolIsSingleEmail;

        // set default invalid cb
        this.setOnInvalidCB(function(){});
        this.strErrorClass = "has-error";
    }
    
    EmailValidator.regexTest = function(email) 
    {
        var re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
        
        return re.test( email )
            // disallow single quotes
            && email.indexOf( "'" ) === -1;
    };
    
    //<editor-fold desc="Setters">
    /**
     * this.onValidCB and this.onInvalidCB and this.setOnSuggestionCB execution order:
     *  1. remove this.strErrorClass from this.strInputID
     *  2. show or hide modal - only for onInvalid and onValid
     *  3. run callback
     */
    EmailValidator.prototype.setOnValidCB = function (onValidCB)
    {
        this.onValidCB = applyTo(this, function ()
        {
            if (this.strModalID && $('#' + this.strModalID).css('opacity') == 0)
            {
                showModal(this.strModalID);
            }
            this.removeClassFromInput();
            onValidCB();
        });

        return this;
    };
    EmailValidator.prototype.setOnInvalidCB = function (onInvalidCB)
    {
        this.onInvalidCB = applyTo(this, function ( strInvalidEmails)
        {
            if( typeof strInvalidEmails === 'undefined' )
            {
                strInvalidEmails =  '';
            }
            
            if (this.strModalID && $('#' + this.strModalID).css('opacity') == 0)
            {
                showModal(this.strModalID);
            }
            this.addErrorClassToInput();
            onInvalidCB(strInvalidEmails);
        });

        return this;
    };
    EmailValidator.prototype.setOnSuggestionCB = function (onSuggestionCB)
    {
        this.revalidate = function ()
        {
            this.addErrorClassToInput();
            onSuggestionCB();
        };
        return this;
    };
    
    EmailValidator.prototype.setModalID = function (strModalID)
    {
        this.strModalID = strModalID;
        return this;
    };

    EmailValidator.prototype.setInputID = function (strInputID)
    {
        this.strInputID = strInputID;
        return this;
    };

    EmailValidator.prototype.setErrorClass = function (strErrorClass)
    {
        this.strErrorClass = strErrorClass;
        return this;
    };
    //</editor-fold>
    
    EmailValidator.prototype.onTooManyEmails = function () 
    {
        fError("You cannot send more than 5 emails at one time.", "", "OK", applyTo(this, this.onInvalidCB));
    };

    /**
     * adds this.strErrorClass to element with ID this.strInputID
     */
    EmailValidator.prototype.addErrorClassToInput = function ()
    {
        if (this.strInputID)
        {
            $("#" + this.strInputID).addClass(this.strErrorClass);
        }
    };

    /**
     * removes this.strErrorClass from element with ID this.strInputID
     */
    EmailValidator.prototype.removeClassFromInput = function ()
    {
        if (this.strInputID)
        {
            $("#" + this.strInputID).removeClass(this.strErrorClass);
        }
    };

    EmailValidator.prototype.run = function ()
    {
        if(this.strEmails === "") 
        {
            this.state = EmailValidator.states.INVALID;
            this.onInvalidCB();
            return;
        }
        
        // onValid, onInvalid and strEmails are necessary!
        if (!this.onValidCB || !this.onInvalidCB)
        {
            throw new Error("EmailValidator is missing essential data!");
        }
        
        var emails;

        // check if not over allowed email count
        if( !this.bolIsSingleEmail )
        {
            emails = this.strEmails.split(",");
            if( emails.length > 50 ) {
                this.state = EmailValidator.states.TOO_MANY_EMAILS;
                this.onTooManyEmails();
                return;
            }
        }
        else
        {
            emails = [ this.strEmails ];
        }

        // test emails against email regex before posting them
        for (var i in emails)
        {
            if ( emails.hasOwnProperty(i) && !EmailValidator.regexTest( emails[i].trim() ) )
            {
                this.state = EmailValidator.states.INVALID;
                this.onInvalidCB( emails[i].trim() );
                return;
            }
        }

        this.state = EmailValidator.states.RUNNING;

        $.post('/chkMail.php', {'q': this.strEmails}, applyTo(this, this.onResponse));
    };

    EmailValidator.prototype.onResponse = function (data)
    {
        var arrReturn = JSON.parse(data);

        if (arrReturn['result'] === 0)
        {
            this.state = EmailValidator.states.VALID;
            this.onValidCB(this);
        }
        else if(arrReturn['result'] === EmailValidator.states.INVALID) 
        {
            this.state = EmailValidator.states.INVALID;
            this.onInvalidCB();
        }
        else if (arrReturn['result'] === 2)
        {
            this.strSuggestedEmails = arrReturn['suggest'];

            if (arrReturn['no_mx'])
            {
                this.strNoMxEmails = arrReturn['no_mx'];
                this.state = EmailValidator.states.MISSING_MX_RECORDS;
            }
            else
            {
                this.state = EmailValidator.states.POSSIBLE_TYPO;
            }

            // this calls onSuggestionCB
            this.revalidate();
        }
        else if (arrReturn['result'] === 4)
        {
            this.state = EmailValidator.states.TOO_MANY_EMAILS;
            this.onTooManyEmails();
        }
    };

    EmailValidator.prototype.revalidate = function ()
    {
        // add typo suggestions and emails with no mx records to string
        var strMsg = '';
        if (this.strSuggestedEmails !== '')
        {
            strMsg += "Did you mean:";
            strMsg += " " + this.strSuggestedEmails + "?\n";
        }
        if (this.strNoMxEmails !== '')
        {
            if(this.bolIsSingleEmail)
            {
                strMsg += "It\u2019s possible that this e-mail address is incorrect:"            }
            else 
            {
                strMsg += "These e-mail addresses might be invalid:"            }
            
            strMsg += " " + this.strNoMxEmails + ".\n";
        }

        if(this.bolIsSingleEmail)
        {
            strMsg += "Please check the email you have entered! If it is correct, click OK.";
        }
        else 
        {
            strMsg += "Please verify that the entered e-mails are correct! If all e-mails are correct, press OK.";
        }

        this.addErrorClassToInput();

        // hide the original modal to avoid overlapping
        if (this.strModalID && $('#'+this.strModalID).css('opacity') == 1)
        {
            hideModal(this.strModalID);
        }

        fConfirm(
            strMsg,
            "Check the email address you entered",
            "OK",
            "Cancel",
            applyTo(this, function ( bolResult)
            {
                // execute onInvalid only if user declines
                if (bolResult === false)
                {
                    this.state = EmailValidator.states.INVALID;
                    this.onInvalidCB();
                }
            }),
            applyTo(this, function ()
            {
                this.state = EmailValidator.states.ACCEPTED_TYPO;
                this.onValidCB();
            }, this)
        );
    };

    EmailValidator.prototype.isSubmittable = function ()
    {
        return [EmailValidator.states.VALID, EmailValidator.states.ACCEPTED_TYPO].indexOf(this.state) !== -1;
    };

    EmailValidator.states = {
        READY: -2,              // initial state
        RUNNING: -1,            // request has started and server has not responded yet

        // => onValidCB
        VALID: 0,

        // => onInvalidCB
        INVALID: 1,

        // => revalidate => onSuggestionCB
        POSSIBLE_TYPO: 2,       // there are typos in the submitted emails
        MISSING_MX_RECORDS: 3,  // some emails have missing mx records
        TOO_MANY_EMAILS: 4,     // too many emails are submitted

        // => revalidate => onSuggestionCB (clicked OK) => onValid 
        ACCEPTED_TYPO: 5        // typo was spotted but user dismissed it
    };
    
    // the function is defined in functions.js, but because this script is included in bergafoto, lets check to make sure.
    if ( typeof applyTo !== 'function' )
    {
        /**
         * Magic function that makes vanilla JS objects usable
         *  - execute fn in the context of $this with passed parameters
         *  - you can also pass parameters to the fn that is returned, they will be added to the fn call
         * @param $this - Object scope
         * @param fn - Object method to execute
         * @param var1 - first parameter to be passed to fn
         * @returns {Function}
         */
        window.applyTo = function( $this, fn, var1 )
        {
            if ( !$this )
            {
                throw new Error( "Invalid usage of closure function, scope must be defined." );
            }
        
            if ( !fn )
            {
                throw new Error( "Invalid usage of closure function, fn must be defined." );
            }
        
            var finalArgs = [];
        
            // skip first 3 arguments (callee, $this, fn)
            for ( var i = 2; i < arguments.length; ++i )
            {
                // add to list of args
                finalArgs.push( arguments[ i ] );
            }
        
            return function ()
            {
                // add all arguments
                for ( var i = 0; i < arguments.length; ++i )
                {
                    finalArgs.push( arguments[ i ] );
                }
            
                // first arguments will be the ones passed to closure, then the ones passed to this function
                return fn.apply( $this, finalArgs );
            };
        }
    }
</script>
<link rel="stylesheet" type="text/css" media="all" href="/bootstrap/css/dropdown.css?v=1715343645"><link rel="stylesheet" type="text/css" media="all" href="/css/global_facelift.css?v=1720449903"><link rel="stylesheet" type="text/css" media="all" href="/css/inputs.css?v=1717752354"><link rel="stylesheet" type="text/css" media="all" href="/js/jquery-ui-1.12.1.custom/jquery-ui.min.css?v=1715343640"><link rel="stylesheet" type="text/css" media="all" href="/css/thickbox.css?v=1715343651"><link rel="stylesheet" type="text/css" media="all" href="/css/modal.css?v=1715343648"><link rel="stylesheet" type="text/css" media="all" href="/css/font-awesome-new/css/font-awesome.min.css?v=1715343648"><link rel="stylesheet" type="text/css" media="all" href="/css/font-awesome-pro/css/light.min.css?v=1715343650"><link rel="stylesheet" type="text/css" media="all" href="/css/font-awesome-pro/css/brands.min.css?v=1715343650"><link rel="stylesheet" type="text/css" media="all" href="/css/font-awesome-pro/css/fontawesome.min.css?v=1715343649"><link rel="stylesheet" type="text/css" media="all" href="/css/alert.css?v=1715343648">
<script src="/js/jquery.cookie.js?v=1715343634"></script>
<script src="/js/jquery-ui-1.12.1.custom/jquery-ui.js?v=1715343640"></script>
<script src="/js/global.js?v=1727422596"></script>
<script src="/js/info_tooltips.js?v=1722490360"></script>
<script src="/js/jquery-ui-1.11.4.custom/jquery-ui.min.js?v=1715343634"></script>
<script src="/js/event.js?v=1715343644"></script>
<script src="/js/functions.js?v=1715343642"></script>
<script src="/js/thickbox.js?v=1715343642"></script>
<script src="/js/modal.js?v=1715343639"></script>
<script src="/js/alert.js?v=1715343643"></script>
<link rel="stylesheet" type="text/css" media="all" href="css/list.v2/main.css?v=5091">
<link rel="stylesheet" type="text/css" media="all" href="css/list.v2/horizontal_view.css?v=23">
<link rel="stylesheet" type="text/css" media="all" href="css/list.v2/grid_view.css?v=5029">
<link rel="stylesheet" type="text/css" media="all" href="css/list.v2/list_view.css?v=5030">
<link rel="stylesheet" type="text/css" media="all" href="css/list.v2/vertical_view.css?v=21">
<link rel="stylesheet" type="text/css" media="all" href="css/bootstrap/dropdowns_custom.css?v=103">
<link rel="stylesheet" type="text/css" media="all" href="js/guillotine/css/jquery.guillotine.css">
<script type="text/javascript" src="js/jqote2/jquery.jqote2.min.js"></script>
<script type="text/javascript" src="js/timeago-en.js"></script>
<script type="text/javascript" src="js/list.v2.js?v=1104"></script>
<script type="text/javascript" src="js/long-press-event.min.js"></script>
<script type="text/javascript" src="js/jquery-lazyload/jquery.scrollstop.min.js"></script>
<script type="text/javascript" src="js/jquery-lazyload/jquery.lazyload.min.js"></script>
<script type="text/javascript" src="js/guillotine/js/jquery.guillotine.js?v=2"></script>
<script type="text/javascript" src="js/iro.js"></script><link rel="stylesheet" type="text/css" media="all" href="https://failiem.lv/u/2fq5c8j3mr?set_visited_cookie_and_exit=1&amp;upload_hash=2fq5c8j3mr"><link rel="stylesheet" type="text/css" media="all" href="/css/stripe_payment_form.css?v=1715343648">
<script src="/js/stripe_payment_form.js?v=1720712236"></script>
<script>

	var PHPSESSID = '9ec2943be38ec1b81485a61c5596edc86d31d3d3';
	var STRIPE_PUBLIC_KEY = 'pk_live_qdaFEN4KBX40UvEYnwlKCIX8';
	var STRIPE_LOCALE = 'auto';

	var arrStripePaymentFormErrorMsg = {
		'FinishOrder' : 'An error occurred while processing the order. Please contact [email protected]!' ,
		'Processing' : 'An error occurred while processing the payment. Please try again or contact [email protected]!' ,
		'InvalidData' : 'Please enter valid payment card details!' ,
		'BankDeclined' : 'An error occurred while processing payment - your bank declined the payment. Please check if your bank account has enough funds; if your payment card is authorized to make payments on the Internet. Or contact your bank, or use another payment card.' ,
		'NotEnoughFunds' : 'Your bank account does not have enough funds. Please supplement the account or use another payment card!' ,
		'InvalidCVV' : 'Please check and enter a valid payment card CVV code!' ,
        'AlreadyPaid' : 'Thank you, payment has already been received.' ,
	};

</script> <meta http-equiv="origin-trial" content="AlK2UR5SkAlj8jjdEc9p3F3xuFYlF6LYjAML3EOqw1g26eCwWPjdmecULvBH5MVPoqKYrOfPhYVL71xAXI1IBQoAAAB8eyJvcmlnaW4iOiJodHRwczovL2RvdWJsZWNsaWNrLm5ldDo0NDMiLCJmZWF0dXJlIjoiV2ViVmlld1hSZXF1ZXN0ZWRXaXRoRGVwcmVjYXRpb24iLCJleHBpcnkiOjE3NTgwNjcxOTksImlzU3ViZG9tYWluIjp0cnVlfQ=="><meta http-equiv="origin-trial" content="Amm8/NmvvQfhwCib6I7ZsmUxiSCfOxWxHayJwyU1r3gRIItzr7bNQid6O8ZYaE1GSQTa69WwhPC9flq/oYkRBwsAAACCeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXN5bmRpY2F0aW9uLmNvbTo0NDMiLCJmZWF0dXJlIjoiV2ViVmlld1hSZXF1ZXN0ZWRXaXRoRGVwcmVjYXRpb24iLCJleHBpcnkiOjE3NTgwNjcxOTksImlzU3ViZG9tYWluIjp0cnVlfQ=="><meta http-equiv="origin-trial" content="A9wSqI5i0iwGdf6L1CERNdmsTPgVu44ewj8QxTBYgsv1LCPUVF7YmWOvTappqB1139jAymxUW/RO8zmMqo4zlAAAAACNeyJvcmlnaW4iOiJodHRwczovL2RvdWJsZWNsaWNrLm5ldDo0NDMiLCJmZWF0dXJlIjoiRmxlZGdlQmlkZGluZ0FuZEF1Y3Rpb25TZXJ2ZXIiLCJleHBpcnkiOjE3MzY4MTI4MDAsImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9"><meta http-equiv="origin-trial" content="A+d7vJfYtay4OUbdtRPZA3y7bKQLsxaMEPmxgfhBGqKXNrdkCQeJlUwqa6EBbSfjwFtJWTrWIioXeMW+y8bWAgQAAACTeyJvcmlnaW4iOiJodHRwczovL2dvb2dsZXN5bmRpY2F0aW9uLmNvbTo0NDMiLCJmZWF0dXJlIjoiRmxlZGdlQmlkZGluZ0FuZEF1Y3Rpb25TZXJ2ZXIiLCJleHBpcnkiOjE3MzY4MTI4MDAsImlzU3ViZG9tYWluIjp0cnVlLCJpc1RoaXJkUGFydHkiOnRydWV9"><script src="https://securepubads.g.doubleclick.net/pagead/managed/js/gpt/m202410030101/pubads_impl.js" async=""></script></head>
<body class="lang_en use_vh full-width non-sticky">

<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-N9HRMM7"
            height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>


<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-5ZNTW54" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>

<script>

    jQuery.fn.shake = function(interval,distance,times){
        interval = typeof interval == "undefined" ? 100 : interval;
        distance = typeof distance == "undefined" ? 10 : distance;
        times = typeof times == "undefined" ? 3 : times;
        var jTarget = $(this);
        jTarget.css('position','relative');
        for(var iter=0;iter<(times+1);iter++){
            jTarget.animate({ left: ((iter%2==0 ? distance : distance*-1))}, interval);
        }
        return jTarget.animate({ left: 0},interval);
    }

	$( window ).bind( 'load', function()
	{
        const strUrlParams = new URLSearchParams(window.location.search);
		if( strUrlParams.has('coupon') || strUrlParams.has('kupons') ) 
		{
			showCreateAccount();
            adaptFormForCoupon();
        }
	} );
</script>
<div id="container" class="filesfm ">
<noscript>
				<table class="alert_container alert_container_danger" style="display: block">
					<tr>
						<td>
							<i class="fa fa-exclamation-circle"></i>
						</td>
						<td>
							<div class="alert_main_text">
								Your browser does not support Javascript. To use this page turn on JavaScript or use another browser.							</div>
						</td>
					</tr>
				</table>
			</noscript>
<header id="header" class="">
<nav>


<div id="header_flag">
<div id="header_flag_1"></div>
<div id="header_flag_2"></div>
</div>
<!-- -->

<div class="container">
<input type="checkbox" class="navbar-toggler" id="navbar-toggler-chb">
<label id="navbar-toggler" class="only-bottom navbar-toggler-stripes user-has-not-clicked-navbar-toggler new" for="navbar-toggler-chb" onclick="if(! $('#navbar-toggler-chb').is(':checked')) { $( '#header' ).css('z-index', '100000'); } $( this ).toggleClass( 'clicked' ); navbarTogglerClicked(); gaev('HeaderClick', 'Hamburger-menu', '');" onmouseover="navbarTogglerClicked()" style="visibility: visible;">
Menu </label>
<script type="text/javascript">
                function navbarTogglerClicked()
                {
                    $( '#navbar-toggler' ).removeClass( 'user-has-not-clicked-navbar-toggler' );
                    document.cookie = 'user-has-clicked-navbar-toggler=1; max-age=' + (365*24*60*60) + ' ; path=/ ; domain=failiem.lv';
                    document.cookie = 'user-has-clicked-navbar-toggler=1; max-age=' + (365*24*60*60) + ' ; path=/ ; domain=.failiem.lv';
                    document.cookie = 'user-has-clicked-navbar-toggler=1; max-age=' + (365*24*60*60) + ' ; path=/ ; domain=files.fm';
                    document.cookie = 'user-has-clicked-navbar-toggler=1; max-age=' + (365*24*60*60) + ' ; path=/ ; domain=.files.fm';
                }
            </script>
<div class="nav-left">
<a class="navbar-brand menu-link" onclick="gaev('HeaderClick', 'Logo', '');" href="/">
<img class="logo" alt="Files.fm" src="/images/logo/rebranded/files-fm-logo-slogan.svg"> </a>
</div>
<div class="navbar" id="main-nav" style="overflow: initial;">
<ul>





<li class="nav-button showonfirstload_mid nav-upload nav-bottom" data-priority="2" data-original-order="5" style="display: list-item;">
<a class="nav-link" href="javascript:void(0);" onclick="$('html, body').animate({ scrollTop: 0 }, 'fast'); setTimeout(()=>{$('#uploadifive-file_upload').shake();}, 50); gaev('HeaderClick', 'Upload', '');"></a>
</li>
<li class="nav-button showonfirstload_mid nav-plans nav-bottom" data-priority="2" data-original-order="6">
<a class="nav-link" href="/storage-plans" onclick="gaev('HeaderClick', 'Storage_plans_and_prices', '');">
<div class="top">Pricing</div>
<div class="bottom">Upgrade</div>
</a>
</li>
<li class="nav-button darker nav-right" data-priority="2" data-original-order="7" style="display: list-item;">
<a href="/" onclick="gaev('HeaderClick', 'Start_upload', ''); hidePopups();" class="nav-link">
Upload files </a>
</li>
<li class="nav-button darker blue showonfirstload_small nav-files nav-bottom nav-hideTop" data-priority="1" style="margin-right: 6px; display: list-item;" data-original-order="8">
<a href="/filebrowser" onclick="gaev('HeaderClick', 'My_files', 'NotLoggedIn');" class="nav-link">
My files </a>
</li>
<li class="nav-right nav-button darker showonfirstload_small nav-bottom nav-login" data-priority="0" data-original-order="9">
<div id="login">
<a href="javascript:void(0);" onclick="gaev('HeaderClick', 'Log_in', ''); showSignIn(); return false;" id="login_button" class="">
<span id="login_button_text">Log in</span>
</a>
</div>
</li>
<li class="nav-right nav-button red showonfirstload_small" data-priority="1" data-original-order="10">
<div>
<a href="javascript:void(0);" onclick="gaev('HeaderClick', 'Sign_up', ''); showCreateAccount(); return false;" id="signup">New</a>
</div>
</li>
<li class="nav-right showonfirstload_mid" id="lang_switch" data-priority="2" data-original-order="11">
<div class="header_menu_wrap">
<div class="header_menu_label">
<img id="lang_switch_icon_dark" src="/images/UI_icons/globe.svg">
<span class="currentlang">EN</span>
</div>
<div class="header_menu_drawer right">
<a class="drawer-item" href="javascript:changeLanguage('en', 'EN');">English (EN)</a>
<a class="drawer-item" href="javascript:changeLanguage('es', 'ES');">Español (ES)</a>
<a class="drawer-item" href="javascript:changeLanguage('de', 'DE');">Deutsch (DE)</a>
<a class="drawer-item" href="javascript:changeLanguage('fi', 'FI');">Suomi (FI)</a>

<a class="drawer-item" href="javascript:changeLanguage('ru', 'РУ');">Русский (РУ)</a>
<a class="drawer-item" href="javascript:changeLanguage('uk', 'UK');">Українська (UA)</a>
<a class="drawer-item" href="javascript:changeLanguage('lv', 'LV');">Latviešu (LV)</a>
</div>
</div>
</li>
</ul>
</div>
<script>
                function addAnonymousUploads()
                {
                    var addUploads = confirm('Bind previous uploads from this device to your account? You can manage or delete them.');
                    if (addUploads == true)
                    {
                        $('.add_anonym_uplaods').val('1');
                    }
                }
            </script>
<div id="mega-menu" class="collapse">
<div class="container event_ignore_click">
<ul id="nav-functional" class="has-items event_ignore_click"><li data-priority="10" class="nav-button" data-original-order="0" data-original-width="125" style="display: list-item;">
<div class="header_menu_wrap">
<div class="header_menu_label">Solutions</div>
<div class="header_menu_drawer">
<a class=" SyncShare withicon drawer-item" href="/sync-share" onclick="gaev('HeaderClick', 'Solutions-Storage', '');">
Data storage <div class="desc">Automatic sync and sharing tools</div>
</a>
<a class=" Filebox withicon drawer-item" href="/upload-form" onclick="gaev('HeaderClick', 'Solutions-Filebox', '');">
Integrate file uploads or API <div class="desc">File upload form for websites</div>
</a>
<a class="PublicProfiles withicon drawer-item" href="/public-profiles" onclick="gaev('HeaderClick', 'Solutions-Publish', '');">
Publish content <div class="desc">Create a public profile and file catalog</div>
</a>
<a class=" SportEvents withicon drawer-item" href="/events" onclick="gaev('HeaderClick', 'Solutions-SportEvents', '');">
For sports and events <div class="desc">Publishing content from events</div>
</a>
<a class=" SellFiles withicon drawer-item" href="/sell-files" onclick="gaev('HeaderClick', 'Solutions-SellFiles', '');">
Sell content <div class="desc">Sell your content publicly or privately</div>
</a>

</div>
</div>
</li><li data-priority="2" class="nav-button" data-original-order="1" style="display: list-item;" data-original-width="96">
<div class="header_menu_wrap">
<div class="header_menu_label">Apps</div>
<div class="header_menu_drawer">
<a class="drawer-item" href="https://chat.files.fm" onclick="gaev('HeaderClick', 'Apps-Chat-AI', '');" target="_blank"> AI chat.files.fm</a>
<a class="drawer-item" href="https://play.google.com/store/apps/details?id=com.files.fm" onclick="gaev('HeaderClick', 'Apps-Android', '');" target="_blank"> Mobile: Android <div class="drawer-item-new">New!</div></a>
<a class="drawer-item" href="https://apps.apple.com/in/app/files-fm-cloud-storage/id1636301796" onclick="gaev('HeaderClick', 'Apps-IOS', '');" target="_blank"> Mobile: Apple iOS <div class="drawer-item-new">New!</div></a>
<a class="drawer-item" href="/sync-share#setup" onclick="gaev('HeaderClick', 'Apps-Desktop', '');"> Sync for Windows | MacOS | Linux</a>

<a class="drawer-item" href="/webdav-info" onclick="gaev('HeaderClick', 'Apps-Webdav', '');">Network drive via Webdav</a>
</div>
</div>
</li><li data-priority="2" class="nav-button" data-original-order="2" style="display: list-item;" data-original-width="96">
<div class="header_menu_wrap">
<div class="header_menu_label">Tools</div>
<div class="header_menu_drawer">
<a class="withicon drawer-item Useroutline" target="_blank" href="/public-profiles" onclick="gaev('HeaderClick', 'Tools-My-public-profile', '');">My public profile</a>
<a class="withicon drawer-item ConvertMp4" href="?convert-to-mp4" onclick="gaev('HeaderClick', 'Tools-convert-to-mp4', '');">Convert video to mp4</a>
<a class="withicon drawer-item ConvertPDF" href="?convert-to-pdf" onclick="gaev('HeaderClick', 'Tools-convert-to-pdf', '');">Convert docs to PDF</a>
<a class="withicon drawer-item VideoCall" href="https://video.failiem.lv/b/auth/openid_connect" onclick="gaev('HeaderClick', 'Tools-Video-room', '');">Create video room</a>
</div>
</div>
</li><li class="nav-button" data-priority="2" data-original-order="3" style="display: list-item;" data-original-width="109">
<a href="/business" class="nav-link">
Business </a>
</li><li class="nav-button library-button  new" data-priority="2" data-original-order="4" style="display: list-item;" data-original-width="93">
<a href="/library" class="nav-link">
Library <div class="tag new">New!</div>
</a>
</li></ul>
</div>
<div class="overlay"></div>
</div>
<div id="mega-menu-close"></div>
</div>
<div id="navbar-css"></div>
</nav>
</header>
<script>

            if (!$.cookie('new_library'))
        {
            $('.library-button').addClass('new');
            $('.navbar-toggler-stripes').addClass('new');
            
        }

        $('.library-button').on('click', function () {
            if ( $(this).hasClass('new') )
            {
                document.cookie = 'new_library="1"; max-age=' + (90*24*60*60) + ' ; path=/ ; domain=failiem.lv';
                document.cookie = 'new_library="1"; max-age=' + (90*24*60*60) + ' ; path=/ ; domain=.failiem.lv';
                document.cookie = 'new_library="1"; max-age=' + (90*24*60*60) + ' ; path=/ ; domain=files.fm';
                document.cookie = 'new_library="1"; max-age=' + (90*24*60*60) + ' ; path=/ ; domain=.files.fm';

                $(this).removeClass('new');
                $('.navbar-toggler-stripes').removeClass('new');
            }
        });

        
    $('#mega-menu .other-apps LI').on('click', function () {
        if ( $('A:first-child', this).attr('href') != null && $('A:first-child', this).attr('href').indexOf('javascript:') == -1 )
        {
            window.location = $('A:first-child', this).attr('href');
        }
    });
    
    $('#mega-menu-close').on('click', function () {
        $( '#navbar-toggler-chb' ).prop('checked', false);
        $( '#header' ).css('z-index', '');
    });

    $('.header_menu_wrap').on('mouseleave', function (e)
    {
        var $elem = $(this);
        
        if (! $elem.parents('#mega-menu').length) 
        {
            if ($elem.is("#usergreeting") ){
                setTimeout(function() {
                    if(! $('#usergreeting:hover').length > 0)
                    {
                        $elem.find('.header_menu_label').removeClass('open');
                    }
                }, 500);
            }
            else
            {
                if(!$elem[ 0 ].matches(":hover"))
                {
                    $elem.find('.header_menu_label').removeClass('open');
                }
            }
        }
    });

    $('.header_menu_label').on('click', function () {
       
        var that = this;

        $(".header_menu_label").filter(function() {
            // check object in list is not current object
            if ($(this).parents('#mega-menu').length)
            {
                return false;
            }
            return this != that;
        }).removeClass('open');

        $(this).toggleClass('open');
       
        var $elem = $(this);
        
        $elem.parent().find('.header_menu_drawer').css({
            'left': '', 
            'right': ''
        });
        
        var bounding = $elem.parent().find('.header_menu_drawer')[0].getBoundingClientRect();
        var boundingParent = $elem[0].getBoundingClientRect();
        if (bounding.left < 0)
        {
            $elem.parent().find('.header_menu_drawer').css({
                'left': -boundingParent.left+5 + 'px', 
                'right': 'unset'
            });
        }
        if (bounding.right > (window.innerWidth || document.documentElement.clientWidth))
        {
            $elem.parent().find('.header_menu_drawer').css({
                'left': 'unset', 
                'right': -(window.innerWidth-boundingParent.right)+20 + 'px'
            });
        }
    });
</script>
<script src="/js/Captcha/Google/LazyGoogleReCaptchaV2.js"></script>
<script>
                objLazyGoogleReCaptchaV2.strLanguageKey = "en";
                objLazyGoogleReCaptchaV2.strSiteKey = "6LflqXQUAAAAAP2CM782IqIgjzooEt9soXTCwxX2";
            </script>
<link rel="stylesheet" type="text/css" media="all" href="/css/sign_in_form.css?v=35">
<div id="sign-in" class="modal-container" tabindex="-1" role="dialog" aria-labelledby="createaccount-header signin-header" aria-hidden="true" style="display:none">
<div class="modal-inner">

<div id="sign-in-header">
<span id="signin-header" onclick="if( !$( '#signin-modal-content' ).is( ':visible' ) ) showSignIn(); return false;">
Log in <img id="signin-header_icon_inactive" src="/images/signup_form/log_in.svg?v=2" alt="Login to upload files">
<img id="signin-header_icon_active" src="/images/signup_form/log_in_blue.svg?v=2" alt="Login to upload files">
</span>
<span id="createaccount-header" onclick="if( !$('#createaccount-modal-content').is(':visible')) showCreateAccount(); return false;">
Sign up </span>
</div>

<div id="createaccount-referral-container" style="display:none">
<span class="referrer-container">
You have been invited by&nbsp;<span id="createaccount-referral-referrer"></span>&nbsp;to create account and get 1GB </span>
<hr>
</div>
<div id="createaccount-message-container">
<table class="alert_container alert_container_danger">
<tbody><tr>
<td><i class="fa fa-exclamation-circle"></i></td>
<td><div class="alert_main_text"></div></td>
</tr>
</tbody></table>
</div>

<div id="createaccount-modal-content" class="modal-content">
<div class="info"></div>

<div class="signin-modal-content-social">
<div class="signin-modal-content-social-title">Create free account:</div>
<div class="signin-modal-content-social-buttons-container signin-modal-content-social-buttons-container-2-buttons">

<div class="standard_button google_button social_login_button" onclick="checkSocialLogin('google');">
<img src="/images/signup_form/login-google.svg?v=2" alt="Sign up with Google to upload files for free">
<span>Google</span>
</div>
<div class="standard_button ms_button social_login_button" onclick="checkSocialLogin('microsoft');">
<img src="/images/signup_form/login-microsoft.svg" alt="Sign up with Microsoft to upload files for free">
<span>Microsoft</span>
</div>
<div class="justify_el"></div>
</div>
</div>

<div class="or-delimiter">
or </div>

<div id="createaccount-simple-container">
<input id="createaccount-referral-hash" name="inviter_hash" type="hidden">
<input id="createaccount-referral-user" name="inviter_user" type="hidden">
<div id="register_coupon_code">
<div class="input-label">
<label for="register_coupon_code_input">Coupon code</label>
<input id="register_coupon_code_input" name="coupon_code" type="text">
</div>
<div class="createaccount-input-container"></div>
</div>
<div class="no-coupon-link">
<a href="" onclick="revertFormFromCoupon(); return false">I do not have a coupon code »</a>
</div>
<div class="input-label">
<label for="createaccount_name">First name</label>
<input id="createaccount_name" name="createaccount_name" type="text" autocomplete="off">
</div>
<div class="input-label">
<label for="createaccount_surname">Last name</label>
<input id="createaccount_surname" name="createaccount_surname" type="text" autocomplete="off">
</div>
<div class="input-label">
<label for="createaccount_email">E-mail</label>
<input id="createaccount_email" name="createaccount_email" type="email" autocomplete="off" onchange="createUsername(this.value);">
</div>
<div class="input-label">
<label for="createaccount_password">Password</label>
<input id="createaccount_password" name="createaccount_password" type="password" autocomplete="off">
</div>
<div class="justify_el"></div>


<div id="your_public_profile_container">
<div id="your_public_profile_label_text_before">
Your profile:
</div>
<div id="your_public_profile_label">
<span id="your_public_profile_label_text">
Your profile:
</span>
<span id="your_public_profile_label_host">
https://files.fm/ </span>
</div>
<div id="your_public_profile_field_input">
<input id="createaccount_username" name="createaccount_username" type="text" autocomplete="off" placeholder="Username" onkeyup="usernameChanged();">
</div>
</div>
<div id="createaccount_coupon_info" onclick="showSignIn()">
I already have a Files.fm account » </div>
<div id="createaccount_error_msg" class="error_msg"></div>
<div class="sign_in_captcha" id="createaccount_captcha">
<div class="google-recaptcha-v2-container" id="B24748AF-A384-47A6-2F06-772DBA716398"></div> <script>
                                function loadCreateAccountCaptcha()
                                {
                                    (function () {
            var init = function (){
                // Wait for include to load
                if ( typeof(objLazyGoogleReCaptchaV2) !== "undefined" )
                {
                    objLazyGoogleReCaptchaV2.initInstance (
                        "B24748AF-A384-47A6-2F06-772DBA716398",
                        captchaCreateAccountLoaded,
                        captchaCreateAccountSubmitted
                    )
                }
                else
                {
                    setTimeout(init, 50);
                }
            };
            init();
        })();
                                }
                            </script>
</div>
<div class="sign_in_submit_bn" onclick="checkCreateAccountForm();">
Sign up <img src="/images/signup_form/sign_up.svg" alt="Sign up to upload files for free">
</div>
<div id="createaccount-modal-link-container">
<a id="createaccount-modal-coupon-link" href="javascript:void(0)" onclick="adaptFormForCoupon()">
<span>Use a coupon</span>
</a>
</div>
<div id="createaccount_info">
By using this website, you agree to the terms and data processing: <a href="/terms?source=sign-up" target="_blank">Learn more »</a> </div>
<div id="createaccount_info_ico">
Registred users can store and access files for unlimited time and choose to publish them in their profile. <a href="/storage-plans" target="_blank">More info »</a> </div>

<div id="createaccount_termsandcondtotions_ico">
By signing up, you agree to our <a href="/terms" target="blank">terms of use »</a> </div>
<input id="register_from_ico" type="hidden" name="from_ico" value="0">
<input type="hidden" name="login_return_url" class="login_return_url" value="">
<input type="hidden" name="dont_redirect_after_login" class="dont_redirect_after_login" value="">
</div>

</div>


<div id="signin-modal-content" class="modal-content">
<table id="signin-modal-content-error" class="alert_container alert_container_info">
<tbody><tr>
<td>
<i class="fa fa-exclamation-circle"></i>
</td>
<td>
<div class="alert_main_text"></div>
</td>
</tr>
</tbody></table>

<div class="signin-modal-content-social">
<div class="signin-modal-content-social-title">Choose sign-in method:</div>
<div class="signin-modal-content-social-buttons-container">
<div class="standard_button fb_button social_login_button" onclick="checkSocialLogin('facebook');">
<img src="/images/signup_form/login-facebook.svg?v=2" alt="Login with Facebook to upload files for free">
<span>Facebook</span>
</div>
<div class="standard_button google_button social_login_button" onclick="checkSocialLogin('google');">
<img src="/images/signup_form/login-google.svg?v=2" alt="Login with Google to upload files for free">
<span>Google</span>
</div>
<div class="standard_button ms_button social_login_button" onclick="checkSocialLogin('microsoft');">
<img src="/images/signup_form/login-microsoft.svg" alt="Sign up with Microsoft to upload files for free">
<span>Microsoft</span>
</div>
<div class="justify_el"></div>
</div>
</div>

<div class="or-delimiter">
or </div>

<div id="signin-modal-content-simple">
<form onsubmit="checkSignInForm(); return false;" id="login_filesfm">
<div id="signin_input_container">
<div class="input-label l_coupon_code">
<label for="l_coupon_code">Coupon code</label>
<input id="l_coupon_code" name="coupon_code" type="text">
</div>
<div class="no-coupon-link">
<a href="" onclick="revertFormFromCoupon(); return false">I do not have a coupon code »</a>
</div>
<div class="input-label">
<label for="l_user">Username or e-mail</label>
<input id="l_user" name="l_user" type="text">
</div>
<div class="input-label">
<label for="l_pass">Password</label>
<input id="l_pass" name="l_pass" type="password">
</div>
<div class="justify_el"></div>
</div>
<a id="signin-modal-forgot-link" href="" onclick="showForgotPassword(); return false">
<span>Forgot password?</span>
</a>
<div id="signin_coupon_info" onclick="showCreateAccount()">
I do not have a Files.fm account » </div>
<div id="signin_error_msg" class="error_msg"></div>
<input type="submit" style="display: none;">
<div class="sign_in_submit_bn" onclick="checkSignInForm()">
Log in <img src="/images/signup_form/sign_up.svg" alt="Sign up">
</div>
</form>
<div id="signin-modal-link-container">
<a id="signin-modal-coupon-link" href="javascript:void(0)" onclick="adaptFormForCoupon()">
<span>Use a coupon</span>
</a>
</div>
<input type="hidden" name="login_return_url" class="login_return_url" value="">
<input type="hidden" name="dont_redirect_after_login" class="dont_redirect_after_login" value="">
</div>

</div>


<div id="forgotpassword-modal-content" class="modal-content">
<form onsubmit="return false;">
<div id="forgotpassword_text">
Enter your email address to reset your password. You may need to check your spam folder: </div>
<div class="input-label forgotpassword_email">
<label for="forgotpassword_email">E-mail</label>
<input id="forgotpassword_email" type="text">
</div>
<div id="forgotpassword_error_msg" class="error_msg"></div>
<div class="sign_in_submit_bn" onclick="checkForgotPasswordForm();">
Send recovery email <img src="/images/signup_form/sign_up.svg" alt="Send recovery email">
</div>
</form>
</div>


<div id="addcookieuploads-modal-content" class="modal-content">
<div id="addcookieuploads_info">
Bind previous uploads from this device to your account? You can manage or delete them. </div>
<div id="addcookieuploads_button_container">
<div class="addcookieuploads_button" id="addcookieuploads_button_no" onclick="setAddCookieUploads(false)">
No </div>
<div class="addcookieuploads_button" id="addcookieuploads_button_yes" onclick="setAddCookieUploads(true)">
Yes </div>
</div>
</div>


<div id="createaccountsuccessmessage-modal-content" class="modal-content">
<div id="createaccountsuccessmessage_info">
<div>
Thank you! Your Files.fm account is created and an e-mail with account access data is sent to you. </div>
<div>
Close this form, fill in the information about the folder and press the button "Save and send the link". </div>
</div>
<div id="createaccountsuccessmessage_button" onclick="hideModal('sign-in', true)">
Close </div>
</div>

<div id="twofactor_authcode-modal-content" class="modal-content" style="display:none">
<div id="twofactor_authcode_container">
<div id="twofactor_error_msg" class="error_msg"></div>
<div class="twofactor_code_required_message">
Please enter the two factor authentication code from your email! </div>
<input id="twofactorcode" name="twofactorcode" type="text" placeholder="Authentification code">
<div class="sign_in_submit_bn" onclick="trySignIn( $('#twofactorcode').val() )">
Log in <img src="/images/signup_form/sign_up.svg" alt="Log in">
</div>
<div id="twofactor-modal-link-container">
<a id="twofactor-modal-goback-link" href="" onclick="bolPrevFinished_checkSignInForm = true; showSignIn(); return false">
<span>Go back</span>
</a>
</div>
</div>
</div>

<div style="display: none">
<form id="login_facebook" method="get" action="/">
<input type="hidden" name="fb_login" value="">
<input type="hidden" name="add_anonym_uplaods" class="add_anonym_uplaods" value="">
<input type="hidden" name="login_return_url" class="login_return_url" value="">
<input type="hidden" name="dont_redirect_after_login" class="dont_redirect_after_login" value="">
<input type="hidden" name="inviter_user" value="">
<input type="hidden" name="inviter_hash" value="">
<input type="submit" class="standard_button" value="Log in with Facebook" style="width: 100%">
</form>
<form id="login_google" method="get" action="/">
<input type="hidden" name="google_login" value="">
<input type="hidden" name="add_anonym_uplaods" class="add_anonym_uplaods" value="">
<input type="hidden" name="login_return_url" class="login_return_url" value="">
<input type="hidden" name="dont_redirect_after_login" class="dont_redirect_after_login" value="">
<input type="hidden" name="inviter_user" value="">
<input type="hidden" name="inviter_hash" value="">
<input type="submit" class="standard_button" value="Log in with Google" style="width: 100%">
</form>
<form id="login_microsoft" method="get" action="/">
<input type="hidden" name="microsoft_login" value="">
<input type="hidden" name="add_anonym_uplaods" class="add_anonym_uplaods" value="">
<input type="hidden" name="login_return_url" class="login_return_url" value="">
<input type="hidden" name="dont_redirect_after_login" class="dont_redirect_after_login" value="">
<input type="hidden" name="inviter_user" value="">
<input type="hidden" name="inviter_hash" value="">
<input type="submit" class="standard_button" value="Login with Microsoft account" style="width: 100%">
</form>
</div>

<div id="sign-in_disable_form">
<i class="fa fa-spinner fa-spin"></i>
</div>
</div>
<div class="modal-close" id="sign-in_modal_close" data-dismiss="modal" data-close="Close"></div>
</div>
<script>

	var bolRewriteUrlHash = true;
	
    var bolSigninCaptchaRequired = Boolean();
    var bolSignupCaptchaRequired = Boolean(1);
    
    var strSinginCaptchaContainerID = 'signin_captcha';
    var strSignupCaptchaContainerID = 'createaccount_captcha';
    
    
	function showCreateAccount( bolICO )
	{
        bolHasCookieUploadsFunc();
        if( typeof bolICO === 'undefined' )
        {
            // if switching forms, get bolICO from other form
            bolICO = $( "#register_from_ico" ).val() > 0;
        }
        
        $( '#signin-header' ).removeClass( 'active' );
        $( '#createaccount-header' ).addClass( 'active' );

		$( '#signin-modal-content' ).hide();
		$( '#forgotpassword-modal-content' ).hide();
		$( '#addcookieuploads-modal-content' ).hide();
		$( '#createaccountsuccessmessage-modal-content' ).hide();

		$('#createaccount-modal-content').show();
		
		if( bolICO )
        {
            $( "#business_account_chechbox_container" ).hide();
            $( "#createaccount_info_ico" ).show();
            $( "#createaccount_termsandcondtotions_ico" ).show( );
            $( "#createaccount_termsandcondtotions" ).hide( );
            $( "#createaccount_info" ).hide();
            $( "#register_from_ico" ).val( 1 );
        }
        else
        {
            $( "#business_account_chechbox_container" ).show();
            $( "#createaccount_termsandcondtotions" ).show( );
            $( "#createaccount_termsandcondtotions_ico" ).hide( );
            $( "#createaccount_info_ico" ).hide();
            $( "#createaccount_info" ).show();
            $( "#register_from_ico" ).val( 0 );
        }

		showModal( 'sign-in' );
  
		if ( bolSignupCaptchaRequired )
            loadCreateAccountCaptcha();
		
		if ( bolRewriteUrlHash )
		{
			window.location.hash = 'sign_up';
		}
	}
	
	function setRegisterReferral( strInviter, hash, strInviteeEmail )
    {
        $( "#createaccount-referral-referrer" ).text( strInviter );
        $( "#createaccount-referral-container" ).show();
        
        if ( strInviteeEmail )
        {
            $( "#createaccount_email" )
                .val( strInviteeEmail )
                .attr( 'disabled', 'true' );
        }
    
        $("input[name='inviter_user']").val( strInviter );
        $("input[name='inviter_hash']").val( hash );
    }

	function showSignIn( bolICO )
	{
        bolHasCookieUploadsFunc();
	    if( typeof bolICO === 'undefined' )
        {
            // if switching forms, get bolICO from other form
            bolICO = $( "#register_from_ico" ).val() > 0;
        }

        $( '#signin-header' ).addClass( 'active' );
        $( '#createaccount-header' ).removeClass( 'active' );
        
	    		
		$( '#createaccount-modal-content' ).hide();
		$( '#forgotpassword-modal-content' ).hide();
		$( '#addcookieuploads-modal-content' ).hide();
		$( '#createaccountsuccessmessage-modal-content' ).hide();
        $( '#twofactor_authcode-modal-content' ).hide();
        
        if ( bolICO )
        {
            $( "#register_from_ico" ).val( 1 );
        }
        else
        {
            $( "#register_from_ico" ).val( 0 );
        }

		$( '#signin-modal-content' ).show();

		showModal( 'sign-in' );
  
		if ( bolSigninCaptchaRequired )
            loadSignInCaptcha();
		
		if ( bolRewriteUrlHash )
		{
			window.location.hash = 'log_in';
		}
	}
    
    /*** Start: Captcha callbacks ***/
    
    function captchaCreateAccountLoaded( bolSuccess )
    {
        if ( ! bolSuccess )
        {
            addError(strSignupCaptchaContainerID, "createaccount_error_msg", "An error has occurred! Please check your internet connection and try again later. If the problem does not resolve, please contact [email protected]");
        }
        else
        {
            removeError( strSignupCaptchaContainerID );
            removeAllErrors( "createaccount_error_msg" );
            $("#"+strSignupCaptchaContainerID).append('<input type="hidden" class="captcha_response" value="" />');
        }
    }
    
    function captchaCreateAccountSubmitted( strResponse )
    {
        removeError( strSignupCaptchaContainerID );
        removeAllErrors( "createaccount_error_msg" );
        $('#' + strSignupCaptchaContainerID + ' .captcha_response').val( strResponse );
    }
    
    
    function captchaSignInLoaded( bolSuccess )
    {
        if ( ! bolSuccess )
        {
            addError(strSinginCaptchaContainerID, "signin_error_msg", "An error has occurred! Please check your internet connection and try again later. If the problem does not resolve, please contact [email protected]");
        }
        else
        {
            removeError( strSinginCaptchaContainerID );
            removeAllErrors( "signin_error_msg" );
            $("#"+strSinginCaptchaContainerID).append('<input type="hidden" class="captcha_response" value="" />');
        }
    }
    function captchaSignInSubmitted( strResponse )
    {
        removeError( strSinginCaptchaContainerID );
        removeAllErrors( "signin_error_msg" );
        $('#' + strSinginCaptchaContainerID + ' .captcha_response').val( strResponse );
    }
    /*** End: Captcha callbacks ***/
    
    
	function revertFormFromCoupon()
    {
	    $( '#sign-in' ).removeClass( 'coupun_form' );
    }
    
    function adaptFormForCoupon()
    {
	    $( '#sign-in' ).addClass( 'coupun_form' );

        const strUrlParams = new URLSearchParams(window.location.search);
		if( strUrlParams.has('coupon') ) 
		{
            var strCouponCode = strUrlParams.get('coupon');
        }
        if( strUrlParams.has('kupons') ) 
		{
            var strCouponCode = strUrlParams.get('kupons')
        }

        if( typeof strCouponCode !== 'undefined' )
        {
            $('#register_coupon_code_input').val(strCouponCode)
        }
    }

	function showForgotPassword( strEmail )
	{
	    if ( typeof strEmail != 'undefined' )
	    {
			$( '#sign-in-header' ).hide();
			$( '#forgotpassword_email' ).val( strEmail );
	    }

		$( '#signin-header' ).insertBefore( $( '#createaccount-header' ) );
		
		$( '#createaccount-modal-content' ).hide();
		$( '#signin-modal-content' ).hide();
		$( '#addcookieuploads-modal-content' ).hide();
		$( '#createaccountsuccessmessage-modal-content' ).hide();

		$( '#forgotpassword-modal-content' ).show();

		showModal( 'sign-in' );

		if ( bolRewriteUrlHash )
		{
			window.location.hash = 'forgot_password';
		}
	}

	function showAddCookieUploads()
	{
		$( '#createaccount-modal-content' ).hide();
		$( '#forgotpassword-modal-content' ).hide();
		$( '#signin-modal-content' ).hide();
		$( '#createaccountsuccessmessage-modal-content' ).hide();

		$( '#addcookieuploads-modal-content' ).show();

		showModal( 'sign-in' );
	}

	function showCreateAccountSuccessMessage()
	{
		$( '#createaccount-modal-content' ).hide();
		$( '#forgotpassword-modal-content' ).hide();
		$( '#signin-modal-content' ).hide();
		$( '#addcookieuploads-modal-content' ).hide();
		
		$( '#createaccountsuccessmessage-modal-content' ).show();
		
		showModal( 'sign-in' );
	}

	var bolHasCookieUploads = false;

    function bolHasCookieUploadsFunc()
    {
        $.each(document.cookie.split(/; */), function()  {
            var splitCookie = this.split('=');
            if(splitCookie[0].slice(0, 2) == 'uf')
            {
                bolHasCookieUploads = true;
            }
        });
    }

	var bolAddCookieUploadsAnswered = false;
	var bolAddCookieUploads = false;
	var strActiveForm = '';

	function setAddCookieUploads(val) {

		bolAddCookieUploads = val;
		bolAddCookieUploadsAnswered = true;

		if (val) {
			$('#login_facebook .add_anonym_uplaods').val('1');
			$('#login_google .add_anonym_uplaods').val('1');
			$('#login_draugiem .add_anonym_uplaods').val('1');
		}

		if (strActiveForm == 'signin') {
			checkSignInForm();
			showSignIn();
		}
		else if (strActiveForm == 'createaccount') {
			checkCreateAccountForm();
			showCreateAccount();
		}
		else if (strActiveForm == 'facebook' || strActiveForm == 'google' || strActiveForm == 'draugiem') {

			checkSocialLogin(strActiveForm);
		}
	}


	var bolPrevFinished_checkCreateAccountForm = true;
	function checkCreateAccountForm(bolCouponCheckResult) {
        
        var jqCaptchaResultInput = $('#' + strSignupCaptchaContainerID + ' .captcha_response');
	    
		if ( bolCouponCheckResult === undefined )
		{
			bolCouponCheckResult = null;
		}

		if (bolPrevFinished_checkCreateAccountForm)
		{
			bolPrevFinished_checkCreateAccountForm = false;
			$('#sign-in_disable_form').show();
   
			var bolCreateBusinessAccountDataOk = true;
			if (bolCreateBusinessAccount)
			{
				bolCreateBusinessAccountDataOk = false;

				if ($('#createaccount_company_name').val().trim().length < 4 ) {

					addError('createaccount_company_name', 'createaccount_error_msg', 'Please enter a company name that is at least 4 characters long.');
				}
				else {

					removeError('createaccount_company_name');

					if ($('#createaccount_company_phone').val().trim().length < 4 ) {

						addError('createaccount_company_phone', 'createaccount_error_msg', 'The company phone number must be at least 4 digits long!');
					}
					else {

						removeError('createaccount_company_phone');

						bolCreateBusinessAccountDataOk = true;
					}
				}
			}
            
            if ( $( "#register_coupon_code" ).css("display") !== "none" && !bolCouponCheckResult )
            {
                // coupon field is visible -> so it must be filled
                if( bolCouponCheckResult === false )
                {
                    addError( 'register_coupon_code_input', 'createaccount_error_msg', 'The coupon code you entered is invalid or already used!' );
                    
                    bolPrevFinished_checkCreateAccountForm = true;
                    $('#sign-in_disable_form').hide();
                    return;
                }
                else if( !bolCouponCheckResult )
                {
                    removeError( 'register_coupon_code_input' );
                    
                    bolPrevFinished_checkCreateAccountForm = true;
                    verifyCouponCode( 'register_coupon_code_input', 'createaccount_error_msg', checkCreateAccountForm );
                    return;
                }                
            }
			
			if ( bolCreateBusinessAccountDataOk )
			{
				if ($('#createaccount_name').val().trim().length < 2 ) {

					addError('createaccount_name', 'createaccount_error_msg', 'Please enter a name that is at least 2 characters long.');

					bolPrevFinished_checkCreateAccountForm = true;
					$('#sign-in_disable_form').hide();
				}
				else {

					removeError('createaccount_name');

					if ($('#createaccount_surname').val().trim().length < 2 ) {

						addError('createaccount_surname', 'createaccount_error_msg', 'Please enter a surname that is at least 2 characters long.');

						bolPrevFinished_checkCreateAccountForm = true;
						$('#sign-in_disable_form').hide();
					}
					else {
                        function isURL(url) {
                           return url.match(/(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g) !== null;
                        }
                        
                        if ( isURL( $( '#createaccount_surname' ).val().trim() ) )
                        {
                            addError('createaccount_surname', 'createaccount_error_msg', 'Invalid name!');
                            
                            bolPrevFinished_checkCreateAccountForm = true;
                            $('#sign-in_disable_form').hide();
                            return;
                        }
                        else 
                        {
                            removeError( 'createaccount_surname' );
                        }
                        
                        if ( isURL( $( '#createaccount_name' ).val().trim() ) )
                        {
                            addError('createaccount_name', 'createaccount_error_msg', 'Invalid name!');
                            
                            bolPrevFinished_checkCreateAccountForm = true;
                            $('#sign-in_disable_form').hide();
                            return;
                        }
                        else
                        {
                            removeError( 'createaccount_name' );
                        }
					    
						removeError('createaccount_surname');

						if (!validateEmail($('#createaccount_email').val())) {

							addError('createaccount_email', 'createaccount_error_msg', 'Enter a valid e-mail!');

							bolPrevFinished_checkCreateAccountForm = true;
							$('#sign-in_disable_form').hide();
						}
						else {
				            new EmailValidator( $('#createaccount_email').val(), true)
                                .setOnValidCB(function(){
                                    $.ajax({
                                    type: "POST",
                                    dataType: "json",
                                    url: "./ajax/sign_in.php?PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3",
                                    data: {
                                        'check_email' : true ,
                                        'email' : $('#createaccount_email').val()
                                    },
                                    success: function(data) {
                                        if (data['status'] != 'ok') {
                                            var strError = "This e-mail address is already taken!";
                                            strError += "<br/><a href='' onclick='showForgotPassword(); return false'>" + 'Forgot password' + "</a>";

                                            addHTMLError('createaccount_email', 'createaccount_error_msg', strError );

                                            bolPrevFinished_checkCreateAccountForm = true;
                                            $('#sign-in_disable_form').hide();
                                        }
                                        else {

                                            removeError('createaccount_email');

                                            if ($('#createaccount_username').val().trim().length < 4 ) {

                                                addError('createaccount_username', 'createaccount_error_msg', 'Please enter a username that is at least 4 characters long!');

                                                bolPrevFinished_checkCreateAccountForm = true;
                                                $('#sign-in_disable_form').hide();
                                            }
                                            else {

                                                if (!validateUsername($('#createaccount_username').val().trim())) {

                                                    addError('createaccount_username', 'createaccount_error_msg', 'Can only contain "a-z", "A-Z", "0-9" and "_.@-"');

                                                    bolPrevFinished_checkCreateAccountForm = true;
                                                    $('#sign-in_disable_form').hide();
                                                }
                                                else
                                                {
                                                    $.ajax({
                                                        type: "POST",
                                                        dataType: "json",
                                                        url: "./ajax/sign_in.php?PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3",
                                                        data: {
                                                            'check_username' : true ,
                                                            'username' : $('#createaccount_username').val()
                                                        },
                                                        success: function(data) {
                                                            if (data['status'] != 'ok') {

                                                                addError('createaccount_username', 'createaccount_error_msg', 'This username is already taken! Please enter a different one!');

                                                                bolPrevFinished_checkCreateAccountForm = true;
                                                                $('#sign-in_disable_form').hide();
                                                            }
                                                            else {

                                                                removeError('createaccount_username');

                                                                if ($('#createaccount_password').val().trim().length < 4 ) {

                                                                    addError('createaccount_password', 'createaccount_error_msg', 'Please enter a password that is at least 4 characters long!');

                                                                    bolPrevFinished_checkCreateAccountForm = true;
                                                                    $('#sign-in_disable_form').hide();
                                                                }
                                                                else
                                                                {
                                                                    removeError('createaccount_password');
    
                                                                    var bolCaptchaOk = true;
                                                                    if ( bolSignupCaptchaRequired )
                                                                    {
                                                                        bolCaptchaOk = false;
                                                                        
                                                                        if ( jqCaptchaResultInput.length && jqCaptchaResultInput.val().length )
                                                                        {
                                                                            bolCaptchaOk = true;
                                                                            removeError( strSignupCaptchaContainerID );
                                                                        }
                                                                        else
                                                                        {
                                                                            if ( ! jqCaptchaResultInput.length )
                                                                            {
                                                                                addError( strSignupCaptchaContainerID, "createaccount_error_msg", "An error has occurred! Please check your internet connection and try again later. If the problem does not resolve, please contact [email protected]" );
                                                                            }
                                                                            else
                                                                            {
                                                                                addError( strSignupCaptchaContainerID, 'createaccount_error_msg', 'Please fill out Captcha!' );
                                                                            }
                                                                        }
                                                                    }
                                                                    
                                                                    if ( ! bolCaptchaOk )
                                                                    {
                                                                        bolPrevFinished_checkCreateAccountForm = true;
                                                                        $( '#sign-in_disable_form' ).hide();
                                                                    }
                                                                    else
                                                                    {
                                                                        removeError( 'createaccount_password' );
                                                                        removeError( strSignupCaptchaContainerID );
        
                                                                        removeAllErrors( 'createaccount_error_msg' );
        
        
                                                                        if ( bolHasCookieUploads == true && bolAddCookieUploadsAnswered == false )
                                                                        {
            
                                                                            strActiveForm = 'createaccount';
                                                                            showAddCookieUploads();
            
                                                                            bolPrevFinished_checkCreateAccountForm = true;
                                                                            $( '#sign-in_disable_form' ).hide();
                                                                        }
                                                                        else
                                                                        {
                                                                            var postData = {
                                                                                'create_account': true,
                                                                                'username': $( '#createaccount_username' ).val(),
                                                                                'email': $( '#createaccount_email' ).val(),
                                                                                'password': $( '#createaccount_password' ).val(),
                                                                                'add_cookie_uploads': bolAddCookieUploads,
                                                                                'first_name': $( '#createaccount_name' ).val(),
                                                                                'surname': $( '#createaccount_surname' ).val(),
                                                                                'create_business_account': bolCreateBusinessAccount,
                                                                                'company_name': $( '#createaccount_company_name' ).val(),
                                                                                'company_phone': $( '#createaccount_company_phone' ).val(),
                                                                                'company_country': $( '#createaccount_company_country' ).val(),
                                                                                'from_ico': $( "#register_from_ico" ).val() ,
                                                                                'recaptcha_response': (jqCaptchaResultInput.length ? jqCaptchaResultInput.val() : '')
                                                                            };

                                                                            // add referral fields if the container is visible
                                                                            if ( $( "#createaccount-referral-container" ).css( "display" ) !== "none" )
                                                                            {
                                                                                postData[ 'inviter_hash' ] = $( "#createaccount-referral-hash" ).val();
                                                                                postData[ 'inviter_user' ] = $( "#createaccount-referral-user" ).val();
                                                                            }
                                                                            
                                                                            if ( $( "#register_coupon_code" ).css( "display" ) !== "none" )
                                                                            {
                                                                                postData.coupon_code = $( "#register_coupon_code_input" ).val().trim();
                                                                            }

                                                                                                                                                        
                                                                            var bolDontRedirectAfterLogin = true;
                                                                            
                                                                            if ( $( '.dont_redirect_after_login' ).val() == '' )
                                                                            {
                                                                            	bolDontRedirectAfterLogin = false;
                                                                            }
                                                                            
                                                                            var strCustomLoginReturnUrl = $( '.login_return_url' ).val();

                                                                            
                                                                            if ( ! bolDontRedirectAfterLogin && strCustomLoginReturnUrl == '' )
                                                                            {
                                                                            	postData.show_onboarding_survey = true;
                                                                            }
                                                                            else 
                                                                            {
                                                                            	postData.show_onboarding_survey = false;
                                                                            }
                                                                            
            
                                                                            $.ajax( {
                                                                                type: "POST",
                                                                                dataType: "json",
                                                                                url: "./ajax/sign_in.php?PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3",
                                                                                data: postData,
                                                                                success: function ( data )
                                                                                {
                                                                                    if ( data[ 'status' ] == 'ok' )
                                                                                    {
                        																                        																
                                                                                        if ( ! bolDontRedirectAfterLogin )
                                                                                        {
                                                                                            if ( data[ 'custom_login_return_url' ] != 'undefined' )
                                                                                            {
                                                                                                strCustomLoginReturnUrl = data[ 'custom_login_return_url' ];
                                                                                            }

                                                                                            if ( strCustomLoginReturnUrl != '' )
                                                                                            {

                                                                                                if (
                                                                                                    ( "/" + strCustomLoginReturnUrl ).search( 'filebrowser' ) == -1 &&
                                                                                                    ( "/" + strCustomLoginReturnUrl ).search( window.location.pathname ) != -1 &&
                                                                                                    strCustomLoginReturnUrl != 'sync-share?create_cloud_files_user' &&
                                                                                                    strCustomLoginReturnUrl != 'library-info?after_login' &&
                                                                                                    strCustomLoginReturnUrl != 'video?after-signup' &&
                                                                                                    ( "/" + strCustomLoginReturnUrl ).search( 'lifetime-storage' ) == -1 &&
                                                                                                    ( "/" + strCustomLoginReturnUrl ).search( 'save-youtube-video' ) == -1
                                                                                                )
                                                                                                {
                                                                                                    if ( location.hash == '#sign_up' )
                                                                                                    {
                                                                                                        location.hash = '';
                                                                                                    }
                                    
                                                                                                    if ( strCustomLoginReturnUrl == 'storage-plans#subscribe' )
                                                                                                    {
                                                                                                        location.hash = 'subscribe';
                                                                                                    }
                                    
                                                                                                    location.reload();
                                                                                                }
                                                                                                else
                                                                                                {
                                                                                                    window.location = "https://files.fm/" + strCustomLoginReturnUrl;
                                                                                                }
                                
                                                                                            }
                                                                                            else
                                                                                            {
                                
                                                                                                window.location = "/account";
                                                                                            }
                                                                                        }
                                                                                        else
                                                                                        {
        
                                                                                            showCreateAccountSuccessMessage();
                            
                                                                                            bolPrevFinished_checkCreateAccountForm = true;
                                                                                            $( '#sign-in_disable_form' ).hide();
                                                                                        }
                                                                                    }
                                                                                    else
                                                                                    {
                        
                                                                                        addError( 'createaccount_error_msg', 'createaccount_error_msg', 'There was an error, contact the Files.fm team!' );
                        
                                                                                        bolPrevFinished_checkCreateAccountForm = true;
                                                                                        $( '#sign-in_disable_form' ).hide();
                                                                                    }
                                                                                },
                                                                                error: function ( data )
                                                                                {
                    
                                                                                    addError( 'createaccount_error_msg', 'createaccount_error_msg', 'An error occurred. Please try again or contact [email protected]!' );
                    
                                                                                    bolPrevFinished_checkCreateAccountForm = true;
                                                                                    $( '#sign-in_disable_form' ).hide();
                                                                                }
                                                                            } );
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        } ,
                                                        error: function(data) {

                                                            addError('createaccount_error_msg', 'createaccount_error_msg', 'An error occurred. Please try again or contact [email protected]!');

                                                            bolPrevFinished_checkCreateAccountForm = true;
                                                            $('#sign-in_disable_form').hide();
                                                        }
                                                    });
                                                }
                                            }
                                        }
                                    } ,
                                    error: function(data) {

                                        addError('createaccount_error_msg', 'createaccount_error_msg', 'An error occurred. Please try again or contact [email protected]!');

                                        bolPrevFinished_checkCreateAccountForm = true;
                                        $('#sign-in_disable_form').hide();
                                    }
                                })
                                }).setOnInvalidCB(function() {
                                    bolPrevFinished_checkCreateAccountForm = true;
                                    $('#sign-in_disable_form').hide();
                                    addError('createaccount_email', 'createaccount_error_msg', 'Enter a valid e-mail!');
                                }).setModalID("sign-in").run();
						}
					}
				}
			}
			else
			{
				bolPrevFinished_checkCreateAccountForm = true;
				$('#sign-in_disable_form').hide();
			}
		}
	}

	function getSigninReturnRedirectUrl()
    {
        if ($('.login_return_url').val() != '') {

            if ($('.dont_redirect_after_login').val() == '') {
                if (
                    ("/"+$('.login_return_url').val()).search(window.location.pathname) != -1 &&
                    $('.login_return_url').val() != 'sync-share?create_cloud_files_user' && 
                    $('.login_return_url').val() == 'storage-plans#subscribe' 
                )
                {
                    return '#subscribe';
                }
                else if ($('.login_return_url').val() == 'my-profile' )
                {
                    return $( '#l_user' ).val();
                }
                else {
                    return $('.login_return_url').val();
                }
            }
        }

        
	    return false;
    }
     
    function verifyCouponCode( strCouponInputID, strErrorID, fnCallback, bolResult )
    {
    	if ( bolResult === undefined )
		{
    		bolResult = null;
		}

        var strCouponInputSelector = "#" + strCouponInputID;
        
        var onError = function ()
        {
            addError( strCouponInputID, strErrorID, 'Invalid coupon code!' );
            
            bolPrevFinished_checkCreateAccountForm = true;
            $( '#sign-in_disable_form' ).hide();
        };
        
        if ( bolResult === false )
        {
            onError();
            return false
        }
        else if ( bolResult === true )
        {
            return true;
        }
        
        if ( $( strCouponInputSelector ).css( "display" ) !== "none" )
        {
            // coupon field is visible -> so it must be filled
            if ( $( strCouponInputSelector ).val().trim().length === 0 )
            {
                onError();
                return false
            }
            else
            {
                if ( !bolResult )
                {
                    removeError( strCouponInputID );
                    
                    $.ajax( {
                        type: "POST",
                        dataType: "json",
                        url: "./ajax/sign_in.php?PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3",
                        global: false,
                        data: {
                            'check_coupon': true,
                            'coupon_code': $( strCouponInputSelector ).val().trim()
                        },
                        success: function ( data )
                        {
                            fnCallback( typeof data[ 'status' ] !== "undefined" && data[ 'status' ] === 'ok' );
                        },
                        error: function ( )
                        {
                            fnCallback( false );
                        }
                    } );
                    return false;
                }
                else
                {
                    return true;
                }
            }
        }
        else
        {
            return true;
        }
    }

	var bolPrevFinished_checkSignInForm = true;

    function trySignIn( strTwoFactorAuthCode )
    {
        if ( typeof strTwoFactorAuthCode === "undefined" )
        {
            strTwoFactorAuthCode = "";
        }

        var jqCaptchaResultInput = $( '#' + strSinginCaptchaContainerID + ' .captcha_response' );

        removeAllErrors( 'signin_error_msg' );
       
        var strReturnUrl = getSigninReturnRedirectUrl();

        var objPostData = {
            'signin': true,
            'username': $( '#l_user' ).val(),
            'password': $( '#l_pass' ).val(),
            'remember_me': $( '#remember_me' ).prop( 'checked' ),
            'from_ico': $( '#register_from_ico' ).val(),
            'add_cookie_uploads': bolAddCookieUploads,
            'recaptcha_response': ( jqCaptchaResultInput.length ? jqCaptchaResultInput.val() : '' )
        };

        if ( strTwoFactorAuthCode )
        {
            objPostData[ 'two_factor_auth_code' ] = strTwoFactorAuthCode;
        }

        if ( strReturnUrl )
        {
            objPostData[ 'override_return_url' ] = strReturnUrl;
        }

        if ( $( "#l_coupon_code" ).css( "display" ) !== "none" )
        {
            objPostData.coupon_code = $( "#l_coupon_code" ).val().trim();
        }

        
        $.ajax( {
            type: "POST",
            dataType: "json",
            url: "./ajax/sign_in.php?PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3",
            crossDomain: true,
            data: objPostData,
            success: function ( data )
            {
                var strAdditionalMessage = "";
                
                if ( typeof data[ 'login_attempts_left' ] !== 'undefined' )
                {
                    var strPartOne = +data[ 'login_attempts_left' ] === 1 ? ' You have ' : ' You have ';
                    var strPartTwo = +data[ 'login_attempts_left' ] === 1 ? ' login attempt left before your account is automatically blocked.' : ' more login attempts before your account is automatically blocked.';

                    strAdditionalMessage = strPartOne + data[ 'login_attempts_left' ] + strPartTwo;
                }
                
                if ( ( data[ 'status' ] === 'ok' || data[ 'status' ] === 'missing_account_data' ) && typeof data[ 'redirect_to' ] !== 'undefined' )
                {
                    
                    if ( data[ 'redirect_to' ].substring( 0, 17 ) == '/lifetime-storage' )
                    {
                        data[ 'redirect_to' ] += '?after_login';
                    }

                    if ( data[ 'redirect_to' ].substring( 0, 6 ) == '/token' )
                    {
                        data[ 'redirect_to' ] = '/token';
                    }

                    window.location = data[ 'redirect_to' ];
                }
                else if ( data[ 'status' ] === 'invalid_auth_code' )
                {
                    $( '#twofactor_error_msg' ).text( 'The entered code is invalid! Please try again!' + strAdditionalMessage ).show();
                    bolPrevFinished_checkSignInForm = true;
                    $( '#sign-in_disable_form' ).hide();
                }
                else
                {
                    var $errorCont;
                    if( strTwoFactorAuthCode )
                    {
                        $errorCont = $( '#twofactor_error_msg' );
                    }
                    else
                    {
                        $errorCont = $( '#signin_error_msg' );
                    }
                    
                    if ( typeof data[ "message" ] === "undefined" )
                    {
                       $errorCont.text( 'Incorrect username or password! Access can be restored via your email address.' + strAdditionalMessage );
                       console.log( 'SIGNIN ERROR CODE : 1' );
                    }
                    else
                    {
                        $errorCont.text( data[ "message" ] + strAdditionalMessage );
                    }
                    $errorCont.show();

                    bolPrevFinished_checkSignInForm = true;
                    $( '#sign-in_disable_form' ).hide();
                }
            },
            error: function ( data )
            {

                $( '#signin_error_msg' ).text( 'An error occurred. Please try again or contact [email protected]!' );
                $( '#signin_error_msg' ).show();

                bolPrevFinished_checkSignInForm = true;
                $( '#sign-in_disable_form' ).hide();
            }
        } );
    }

    function show2FAPrompt()
    {
        $( '#createaccount-modal-content' ).hide();
        $( '#forgotpassword-modal-content' ).hide();
        $( '#addcookieuploads-modal-content' ).hide();
        $( '#createaccountsuccessmessage-modal-content' ).hide();
        $( '#signin-modal-content' ).hide();

        $( '#twofactor_authcode-modal-content' ).show();
    }
    
	function checkSignInForm(bolCouponCheckResult) {

		if ( bolCouponCheckResult === undefined )
		{
			bolCouponCheckResult = null;
		}
        
        var jqCaptchaResultInput = $('#' + strSinginCaptchaContainerID + ' .captcha_response');
        
		if (bolPrevFinished_checkSignInForm) {

			bolPrevFinished_checkSignInForm = false;
            $('#sign-in_disable_form').show();
            
            if ( $( "#l_coupon_code" ).css("display") !== "none" )
            {
                if ( bolCouponCheckResult )
                {
                    $( "#signin_error_msg" ).hide();
                }
                else if ( bolCouponCheckResult === null )
                {
                    bolPrevFinished_checkSignInForm = true;
                    return verifyCouponCode( "l_coupon_code", "signin_error_msg", checkSignInForm, bolCouponCheckResult );
                }
                else
                {
                    $( "#signin_error_msg" )
                        .text( "The coupon code you entered is invalid or already used!" )
                        .show();
                    bolPrevFinished_checkSignInForm = true;
                    $( '#sign-in_disable_form' ).hide();
                    return false;
                }
            }
                
			bolError = false;

			if ($('#l_user').val() == '' ) {

				$('#l_user').addClass( 'has_error' );
				bolError = true;
			}
			else {
				$('#l_user').removeClass( 'has_error' );
			}

			if ($('#l_pass').val() == '' ) {
				$('#l_pass').addClass( 'has_error' );
				bolError = true;
			}
			else {
				$('#l_pass').removeClass( 'has_error' );
			}
            
            
            if ( bolSigninCaptchaRequired )
            {
                if ( jqCaptchaResultInput.length === 0 )
                {
                    bolError = true;
    
                    addError(strSinginCaptchaContainerID, "signin_error_msg", "An error has occurred! Please check your internet connection and try again later. If the problem does not resolve, please contact [email protected]");
                }
                else if ( jqCaptchaResultInput.val().length === 0 )
                {
                    bolError = true;
    
                    addError(strSinginCaptchaContainerID, "signin_error_msg", "Please fill in the captcha field!");
                }
                else
                {
                    removeError( strSinginCaptchaContainerID );
                }
            }

			if (!bolError) {

				$.ajax({
					type: "POST",
					dataType: "json",
					url: "./ajax/sign_in.php?PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3",
                    crossDomain: true,
                    data: {
						'check_signin' : true ,
						'username' : $('#l_user').val() ,
						'password' : $('#l_pass').val()
					},
					success: function(data) {
                        if ( data[ 'status' ] === 'ok' )
                        {
                            if ( bolHasCookieUploads == true && bolAddCookieUploadsAnswered == false && data[ 'show_add_cookie_uploads' ] == true )
                            {
                                strActiveForm = 'signin';
                                showAddCookieUploads();

                                bolPrevFinished_checkSignInForm = true;
                                $( '#sign-in_disable_form' ).hide();
                            }
                            else
                            {
                                trySignIn();
                            }
                        }
                        else if ( data[ 'status' ] === 'requires_auth_code' )
                        {
                            $( '#sign-in_disable_form' ).hide();
                            bolPrevFinished_checkSignInForm = true;
                            
                            show2FAPrompt();
                        }
                        else
                        {
                            var strMessage = 'Incorrect username or password! Access can be restored via your email address.';

                            if ( typeof data[ 'message' ] !== "undefined" )
                            {
                                strMessage = data[ 'message' ];
                            } 
                            else if ( typeof data[ 'login_attempts_left' ] !== 'undefined' ) 
                            {
                                var strPartOne = +data['login_attempts_left'] === 1 ? ' You have ' : ' You have ';
                                var strPartTwo = +data['login_attempts_left'] === 1 ? ' login attempt left before your account is automatically blocked.' : ' more login attempts before your account is automatically blocked.';
                                
                                strMessage += strPartOne + data[ 'login_attempts_left' ]  + strPartTwo;
                            }
                            else
                            {
                                console.log( 'SIGNIN ERROR CODE : 2' );
                            }

                            $( '#signin_error_msg' ).text( strMessage );
							$('#signin_error_msg').show();

							bolPrevFinished_checkSignInForm = true;
							$('#sign-in_disable_form').hide();
						}
					} ,
					error: function(data) {

						$('#signin_error_msg').text('An error occurred. Please try again or contact [email protected]!');
						$('#signin_error_msg').show();

						bolPrevFinished_checkSignInForm = true;
						$('#sign-in_disable_form').hide();
					}
				});
			}
			else {

				bolPrevFinished_checkSignInForm = true;
				$('#sign-in_disable_form').hide();
			}
		}
	}


	function checkForgotPasswordForm() {

		if (!validateEmail($('#forgotpassword_email').val())) {

			addError('forgotpassword_email', 'forgotpassword_error_msg', 'Enter a valid e-mail!');
		}
		else {

			removeError('forgotpassword_email');

			$.ajax({
				type: "POST",
				dataType: "json",
				url: "./ajax/sign_in.php?PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3",
				data: {
					'recover_password' : true ,
					'email' : $('#forgotpassword_email').val()
				},
				success: function(data) {
					if (data['status'] == 'ok') {

						removeAllErrors('forgotpassword_error_msg');

						$('#forgotpassword_error_msg').addClass('ok_msg_active');
						$('#forgotpassword_error_msg').text('If an account with this email exists, then the password reset link was sent to the email provided.');
						$('#forgotpassword_error_msg').show();
					}
					else {

						addError('forgotpassword_email', 'forgotpassword_error_msg', 'This e-mail is not registered.');
					}
				}
			});
		}
	}

	function checkSocialLogin(strType) {
	
		if ( strType == 'facebook' )
		{
			fError( 'Facebook has changed something, so unfortunately logging in with Facebook is not available at the moment. To get in, reset the password to your e-mail (with which you used Facebook) <a href="/?a#forgot_password">by clicking here</a> . In the future, we recommend using your email or Google account so that you are not dependent on Facebook. We plan to disable this method.' );
			return;
		}

		if (bolHasCookieUploads == true && bolAddCookieUploadsAnswered == false) {

			strActiveForm = strType;
			showAddCookieUploads();
		}
		else {

			if ($('.dont_redirect_after_login').val() == 'true')
			{
				$('#sendfiles').submit();
				$('.add_anonym_uplaods').val('true');
			}

			if (strType == 'facebook') {

				$('#login_facebook').submit();
			}
			else if (strType == 'google') {

				$('#login_google').submit();
			}
			else if (strType == 'draugiem') {

				$('#login_draugiem').submit();
			}
			else if (strType == 'microsoft') {

				$('#login_microsoft').submit();
			}

		}
	}


	function validateEmail(email) {
		var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
		var result = re.test(email);
		return result;
	}

	function validateUsername(username) {

		var re = /^[a-zA-Z0-9_\.@\-]+$/;
		var result = re.test(username);
		return result;
	}
    
    function addHTMLError(strDomId, strErrorMsgId, strErrorMsgText) {
        $('#' + strDomId).addClass( 'has_error' );
        $('#' + strErrorMsgId).html(strErrorMsgText);
        $('#' + strErrorMsgId).show();
    }

	function addError(strDomId, strErrorMsgId, strErrorMsgText) {
		$('#' + strDomId).addClass( 'has_error' );
		$('#' + strErrorMsgId).text(strErrorMsgText);
		$('#' + strErrorMsgId).show();
	}

	function removeError(strInputId) {
		$('#' + strInputId).removeClass( 'has_error' );
	}

	function removeAllErrors(strErrorMsgId) {
		$('#' + strErrorMsgId).text('');
		$('#' + strErrorMsgId).hide();
	}

	var isUsernameChanged = false;
	function usernameChanged()
	{
		isUsernameChanged = true;
	}

	function createUsername(strEmail)
	{
		if( !isUsernameChanged && strEmail != '' && validateEmail(strEmail))
		{
			var arrEmail = strEmail.split("@");

			var strUsername = arrEmail[0];
			while (strUsername.length < 4)
			{
				strUsername += '1';
			}


			$.ajax(
			{
				type: "POST",
				dataType: "json",
				url: "./ajax/sign_in.php?PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3",
				data:
				{
					'get_username' : true ,
					'username' : strUsername
				},
				success: function(data)
				{
					if (data['status'] == 'ok' && data['username'])
					{
						$('#createaccount_username').val(data['username']);
					}
				}
			});
		}
	}

	var bolCreateBusinessAccount = false;
	function toggleCreateBusinessAccount()
	{
		if (bolCreateBusinessAccount)
		{
			bolCreateBusinessAccount = false;
			$('#create_business_account_container').hide();
		}
		else
		{
			bolCreateBusinessAccount = true;
			$('#create_business_account_container').show();
		}
	}


    
    </script> <script type="text/javascript" src="js/prebid-ads.js"></script>
<script type="text/javascript">
        if( window.canRunAds === undefined )
        {
            fError( "An ad blocking plugin has been detected in your browser. There is a possibility that the page is displayed incorrectly. Please disable the plugin and refresh the page!" );
            document.cookie="adblock_warning_shown; max-age=86400";
        }
    </script>
<div id="content">
<script type="text/javascript">

	var objWebTorrentDownloadForm;
	
	$( function()
	{
		objWebTorrentDownloadForm = new WebTorrentDownloadForm( '9ec2943be38ec1b81485a61c5596edc86d31d3d3' );
	} );

</script>
<link rel="stylesheet" type="text/css" media="all" href="/css/webtorrent_download_form.css?v=1715343651">
<script src="/webtorrent/FilesFm_P2P/filesfm_p2p.min.js?v=1719512729"></script>
<script src="/js/webtorrent_download_form.js?v=1715343639"></script>
<script src="/js/p2p-graph/p2p-graph.js?v=1715343639"></script>
<section id="webtorrent_download_form" class="modal-container" tabindex="-1" role="dialog" aria-labelledby="modal-label" aria-hidden="true">
<div class="modal-inner">
<div class="modal-content">

<div id="webtorrent_download_form__header_main">
Peer-Powered Download </div>
<div id="webtorrent_download_form__close_btn" onclick="$('#webtorrent_download_form_modal_close').click()">
<i class="fal fa-times-circle"></i>
</div>

<div id="webtorrent_download_form__top_content">
<div id="webtorrent_download_form__main_content__wt_download">
<div class="webtorrent_download_form__main_content__wt_download__status" id="webtorrent_download_form__main_content__wt_download__status__in_progress">
<span id="webtorrent_download_form__main_content__wt_download__status__in_progress__label">
<b>Keep this browser tab active in foreground</b>. Finish in </span>
<span id="webtorrent_download_form__main_content__wt_download__status__in_progress__value"></span>
</div>
<div id="webtorrent_download_form__main_content__wt_download__progress" class="progress-bar">
<div id="webtorrent_download_form__main_content__wt_download__progress__bar_outer" class="progress-bar-outer"><div id="webtorrent_download_form__main_content__wt_download__progress__bar_inner" class="progress-bar-inner"></div></div>
<div id="webtorrent_download_form__main_content__wt_download__progress__bar_text" class="progress-bar-text"></div>
</div>



<div class="webtorrent_download_form__main_content__wt_download__status" id="webtorrent_download_form__main_content__wt_download__status__download_error">
<i class="fa fa-exclamation-circle"></i>
ERROR while downloading. REFRESH or try another download method! </div>
</div>
<div class="webtorrent_download_form__sharing_stats_cont">
<div class="webtorrent_download_form__sharing_info__stats my_tooltip" my_title="Download">
<i class="fal fa-arrow-down"></i>
<span class="webtorrent_download_form__sharing_size" id="webtorrent_download_form__sharing_size__download"></span><br>
<span class="webtorrent_download_form__sharing_speed" id="webtorrent_download_form__sharing_speed__download"></span>
</div>
<div class="webtorrent_download_form__download_all_button"></div>
<div class="webtorrent_download_form__sharing_info__stats my_tooltip" my_title="Upload">
<i class="fal fa-arrow-up"></i>
<span class="webtorrent_download_form__sharing_size" id="webtorrent_download_form__sharing_size__upload"></span><br>
<span class="webtorrent_download_form__sharing_speed" id="webtorrent_download_form__sharing_speed__upload"></span>
</div>
</div>
</div>
<div id="webtorrent_download_form__desktop_clients_line">
<a id="webtorrent_download_form__torrent_file_url" href="javascript:void()" target="_blank" class="my_tooltip" my_title="Download">.torrent</a>
<span class="webtorrent_download_form__desktop_clients_text">
You can use <a href="https://www.vuze.com" target="_blank">Vuze</a> or other <a href="https://webtorrent.io/desktop/" target="_blank">WebTorrent</a> desktop clients to download and seed </span>
</div>
<div id="webtorrent_download_form__top_alerts_container">
<table id="webtorrent_download_form__alert_container__wait" class="alert_container alert_container_info">
<tbody><tr>
<td>
<i class="fa fa-spinner fa-spin"></i>
</td>
<td>
<div class="alert_main_text"></div>
</td>
</tr>
</tbody></table>
<table id="webtorrent_download_form__alert_container__error" class="alert_container alert_container_danger">
<tbody><tr>
<td>
<i class="fa fa-exclamation-circle"></i>
</td>
<td>
<div class="alert_main_text"></div>
</td>
</tr>
</tbody></table>
<table id="webtorrent_download_form__alert_container__ok" class="alert_container alert_container_success">
<tbody><tr>
<td>
<i class="fa fa-check-circle"></i>
</td>
<td>
<div class="alert_main_text"></div>
</td>
</tr>
</tbody></table>
</div>
<div id="webtorrent_download_form__main_content">
<div id="webtorrent_download_form__world_image"></div>
<div id="webtorrent_download_form__p2p_graph"></div>
</div>
<div id="webtorrent_download_form__bottom_content">
<div>
"Save as" window will pop up for each file, when download finishes. This window must be in foreground. You can set your browser to allow download of multiple files: Settings &gt; Advanced &gt; Ask where to save each file before downloading. Doesn’t work? <a href="/contacts" target="_blank">Let us know</a> </div>
<div id="webtorrent_download_form__file_links" style="width: 100%; height: 1px; overflow: hidden;">
</div>
</div>
</div>
</div>
<div id="webtorrent_download_form_modal_close" class="modal-close" data-dismiss="modal" data-close="Close">X</div>
</section><link rel="stylesheet" type="text/css" media="all" href="/css/elements/upload_access_switch.css?v=114">
<script type="text/javascript">

	var bolUploadAccessSwitch_closeAllSelect_Binded = false;
	var bolSessionUser_IsStorageSubscriber = false;
	var bolSessionUser_HasLifetimeStorage = false;

	function UploadAccessSwitch( objParentElement, objUploadAccessSwitchSettings )
	{
		this.objParentElement = objParentElement;
		this.bolAccessTypeChanged = false;


		this.strItemType = 'upload';

		if ( typeof objUploadAccessSwitchSettings.item_type != 'undefined' && objUploadAccessSwitchSettings.item_type == 'file' )
		{
			this.strItemType = objUploadAccessSwitchSettings.item_type;
		}
		
		
		this.strUploadHash = objUploadAccessSwitchSettings.upload_hash;
		this.strFileHash = objUploadAccessSwitchSettings.file_hash;
		this.strParentAccessType = objUploadAccessSwitchSettings.parent_access_type;

		
		this.bolOwnerLoggedIn;

		if ( typeof objUploadAccessSwitchSettings.owner_logged_in == 'undefined' )
		{
			this.bolOwnerLoggedIn = 1;
		}
		else
		{
			this.bolOwnerLoggedIn = objUploadAccessSwitchSettings.owner_logged_in;
		}

		this.strAccessType;
		this.strUploadPassword = '';

		if ( objUploadAccessSwitchSettings.access_type == 'PRIVATE' )
		{
			this.strAccessType = 'private';
		}
		else if ( this.strItemType == 'upload' && objUploadAccessSwitchSettings.password != null && objUploadAccessSwitchSettings.password != '' )
		{
			this.strAccessType = 'password';
			this.strUploadPassword = objUploadAccessSwitchSettings.password;
		}
		else if ( this.strItemType == 'upload' && objUploadAccessSwitchSettings.is_public == 1 )
		{
			this.strAccessType = 'public';
		}
		else
		{
			this.strAccessType = 'link';
		}

		
		if ( objUploadAccessSwitchSettings.access_type != 'PRIVATE' && typeof objUploadAccessSwitchSettings.from_eparaksts != 'undefined' && objUploadAccessSwitchSettings.from_eparaksts )
		{
			this.strAccessType = 'link-can-edit';
			$( '.copy_button_wrapper_popup' ).addClass('no-dropdown');
		}
		else
		{
			$( '.copy_button_wrapper_popup' ).removeClass('no-dropdown');
		}

		if ( objUploadAccessSwitchSettings.access_type == 'link-can-upload' )
		{
			this.strAccessType = 'link-can-upload';
		}

		this.strUploadAccessSwitchType = 'default';

		if ( typeof objUploadAccessSwitchSettings.upload_access_switch_type != 'undefined' )
		{
			this.strUploadAccessSwitchType = objUploadAccessSwitchSettings.upload_access_switch_type;
		}

		this.strEmbedPlace = objUploadAccessSwitchSettings.embed_place;

		
		
		var _this = this;
		
		
		this.init = function()
		{
			var objTypeCopyWrap = $( '#copy_button_drawer_popup' );
			objTypeCopyWrap.html('');
			$( '.copy_button_wrapper_popup' ).removeClass('copy_input_value_to_clipboard_no_tooltip');
			
			var strHtml = '';

			var objTypeSelectWrap = $( '<div></div>' ).attr( {
        						'class' : 'styled-select upload-access-switch-select' ,
        					} )
			var objTypeSelect = $( '<select></select>' ).attr( {
                    				'class' : 'upload-access-switch_type-select' ,
                    				'disabled' : ( this.strUploadAccessSwitchType == 'default' && ! this.bolOwnerLoggedIn ? true : false )
                    			} );

			objTypeSelect.append(
				$( '<option></option>' ).text( '&nbsp;' )
			);
			if ( this.bolOwnerLoggedIn )
			{
				objTypeSelect.append(
    					$( '<option></option>' ).attr( {
    						'value' : 'private' ,
    						'desc' : 'Only you or users invited by email can access.' ,
    						'selected' : ( this.strAccessType == 'private' ? true : false )
    					} )
    					.text( 'Only with private permission' )
    				);
			}
			
			if ( this.strUploadAccessSwitchType == 'default' )
			{ 
    			objTypeSelect.append(
						$( '<option></option>' ).attr( {
							'value' : 'link' ,
							'desc' : 'View and download access' ,
							'selected' : ( this.strAccessType == 'link' ? true : false )
						} )
						.text( 'Anyone with a link' )
					);

				strHtml = 	'<div id="drawer_copy_button_view" class="share-input copy_input_value_to_clipboard_no_tooltip checked" onclick="updateSharePopupLink(1)">' +
								'<span>Copy view link</span>' +
								'<span class="desc_popup">Can be viewed and downloaded</span>' +
							'</div>';
			}
			else if ( this.strUploadAccessSwitchType == 'sharing_form' )
			{
    			objTypeSelect.append(
    					$( '<option></option>' ).attr( {
    						'value' : 'link-can-view' ,
    						'desc' : 'View and download.' ,
    						'selected' : ( this.strAccessType == 'link' ? true : false ) ,
    						'class' : 'upload-access-switch_type-select_option_link-can-view'
    					} )
    					.text( 'via link to access content' )
    				);
					
				if ( !( objUploadAccessSwitchSettings.access_type != 'PRIVATE' && typeof objUploadAccessSwitchSettings.from_eparaksts != 'undefined' && objUploadAccessSwitchSettings.from_eparaksts ) )
				{
					strHtml = 	'<div id="drawer_copy_button_view" class="share-input copy_input_value_to_clipboard_no_tooltip checked" onclick="updateSharePopupLink(1)">' +
								'<span>Copy view link</span>' +
								'<span class="desc_popup">Can be viewed and downloaded</span>' +
							'</div>';
							objTypeCopyWrap.append(strHtml);
				}

    			objTypeSelect.append(
    					$( '<option></option>' ).attr( {
    						'value' : 'link-can-edit' ,
    						'desc' : 'Link to add, edit or delete content.' ,
    						'selected' : ( this.strAccessType == 'link-can-edit' ? true : false ) ,
    					} )
    					.text( 'Get a link to edit content' )
    				);

					strHtml = 	'<div id="drawer_copy_button_edit" class="share-input copy_input_value_to_clipboard_no_tooltip" onclick="updateSharePopupLink(2)">' +
									'<span>Copy edit link</span>' +
									'<span class="desc_popup">Can add, edit content, e-sign and delete</span>' +
								'</div>';
								objTypeCopyWrap.append(strHtml);

    			if ( this.strItemType == 'upload' )
    			{
        			objTypeSelect.append(
        					$( '<option></option>' ).attr( {
        						'value' : 'link-can-upload' ,
        						'desc' : 'Visitors can add files, but can’t delete or edit existing.' ,
        						'selected' : ( this.strAccessType == 'link-can-upload' ? true : false ) ,
        					} )
        					.text( 'Get Link to add content' )
        				);

					if ( !( objUploadAccessSwitchSettings.access_type != 'PRIVATE' && typeof objUploadAccessSwitchSettings.from_eparaksts != 'undefined' && objUploadAccessSwitchSettings.from_eparaksts ) )
					{
						strHtml = 	'<div id="drawer_copy_button_upload" class="share-input copy_input_value_to_clipboard_no_tooltip" onclick="updateSharePopupLink(3)">' +
										'<span>Copy add link</span>' +
										'<span class="desc_popup">You can add files, but not delete or edit existing files</span>' +
									'</div>';
									objTypeCopyWrap.append(strHtml);
					}
    			}
			}
			else if ( this.strUploadAccessSwitchType == 'modal_gallery' )
			{
    			objTypeSelect.append(
    					$( '<option></option>' ).attr( {
    						'value' : 'link-can-view' ,
    						'desc' : 'View and download.' ,
    						'selected' : ( this.strAccessType == 'link' ? true : false ) ,
    						'class' : 'upload-access-switch_type-select_option_link-can-view'
    					} )
    					.text( 'via link to access content' )
    				);

    			objTypeSelect.append(
    					$( '<option></option>' ).attr( {
    						'value' : 'link-can-edit' ,
    						'desc' : 'Link to add, edit or delete content.' ,
    						'selected' : ( this.strAccessType == 'link-can-edit' ? true : false ) ,
    					} )
    					.text( 'Get a link to edit content' )
    				);

    			if ( this.strItemType == 'upload' )
    			{
        			objTypeSelect.append(
        					$( '<option></option>' ).attr( {
        						'value' : 'link-can-upload' ,
        						'desc' : 'Visitors can add files, but can’t delete or edit existing.' ,
        						'selected' : ( this.strAccessType == 'link-can-upload' ? true : false ) ,
        					} )
        					.text( 'Get Link to add content' )
        				);
    			}
			}

			if ( this.strItemType == 'upload' && this.bolOwnerLoggedIn )
			{
				objTypeSelect.append(
    					$( '<option></option>' ).attr( {
    						'value' : 'password' ,
    						'desc' : 'Visitors must enter a password to access' ,
    						'selected' : ( this.strAccessType == 'password' ? true : false )
    					} )
    					.text( 'Set password' )
    				);
			
				objTypeSelect.append(
    					$( '<option></option>' ).attr( {
    						'value' : 'public' ,
    						'desc' : 'Visible to anyone on your profile and via search.' ,
    						'selected' : ( this.strAccessType == 'public' ? true : false )
    					} )
    					.text( 'Posted on my profile page' )
    				);
			}

			objTypeSelectWrap.append( objTypeSelect );

			$('.url_wrapper ').removeClass('switch');
			
			if ( this.strUploadAccessSwitchType == 'sharing_form' )
			{
				strHtml = 	'<div id="upload-access-switch_type-toggle_wrapper">'+
							'<input type="checkbox" class="upload-access-switch_type-toggle"'+
							( this.strAccessType == 'private' ? ' ' : 'checked ' )+
							//'disabled="'+( this.strUploadAccessSwitchType == 'default' && ! this.bolOwnerLoggedIn ? true : false )+'"'+
							'id="upload-access-switch_type-toggle">'+
							'<label for="upload-access-switch_type-toggle"></label>'+
							'<div>Private</div>'+
							'<div>Link</div>'+
							'</div>';


				if (this.strItemType == 'upload' )
				{
					$('.url_wrapper ').addClass('switch');
					strHtml += '<div id="upload-access-switch-password-download-wrap">'+
									'<div class="upload-access-switch_password-wrapper ' + (this.strAccessType == 'password' ? 'has_password' : '') + '">'+
										'<label onclick="$(this).parent().addClass(\'open\'); $(this).parent().find(\'input\').focus()"> ' + (this.strAccessType == 'password' ? 'Password:' : 'Set password') + '</label>'+
										'<input onclick="$(this).parent().addClass(\'open\')" type="text" class="upload-access-switch_password" value="'+this.strUploadPassword+'"></input>'+
										'<input onclick="$(this).parent().addClass(\'open\')" type="password" class="upload-access-switch_password_placeholder" value="111111"></input>'+
										'<div class="upload-access-switch_password-save-btn">Save</div>'+
									'</div>';
					
					if (typeof objUploadAccessSwitchSettings.hide_download_buttons !== 'undefined' && ! (! bolSessionUser_IsStorageSubscriber && ! bolSessionUser_HasLifetimeStorage) )
					{
						strHtml +=	'<div class="upload-access-switch-hide-download">' +
										'<label for="upload-access-switch_hide-download-toggle">Hide download buttons:</label>' +
										'<input type="checkbox" class="upload-access-switch_hide-download-toggle" '+ (objUploadAccessSwitchSettings.hide_download_buttons == '1' ? 'checked' : '') +' id="upload-access-switch_hide-download-toggle">' +
										'<label for="upload-access-switch_hide-download-toggle"></label>' +
										'<label>'+(objUploadAccessSwitchSettings.hide_download_buttons == '1' ? 'Yes' : 'No')+'</label>'+
									'</div>';	
					}
					
					strHtml += '</div>';
				}

				$( this.objParentElement ).html(

					$( '<div></div>' ).attr( {
						'class' : 'upload-access-switch ' + (typeof objUploadAccessSwitchSettings.propagate_settings !== 'undefined' && objUploadAccessSwitchSettings.propagate_settings == 2 ? 'disabled' : '') ,
						'data-selected-access-type' : this.strAccessType 
					} )
					.append(
						$( '<div></div>' ).attr( {
							'class' : 'upload-access-switch_type-wrapper' 
						} )
						.append(
							$( '<label></label>' ).text( ( this.strUploadAccessSwitchType == 'sharing_form' ? 'Access rights:' : 'Access:' ) )
						)
						.append(
							$( '<label></label>' ).attr( {
							'class' : 'upload-access-switch_type-wrapper-desc' 
							} ).text(( this.strAccessType == 'private' ? 'Only with private permission' : 'Anyone with a link' ))
						)
					)
					.append( strHtml )

					
					
				);
			}
			else
			{
				$( this.objParentElement ).html(

					$( '<div></div>' ).attr( {
						'class' : 'upload-access-switch' ,
						'data-selected-access-type' : this.strAccessType 
					} )
					.append(
						$( '<div></div>' ).attr( {
							'class' : 'upload-access-switch_type-wrapper' 
						} )
						.append(
							$( '<label></label>' ).text( ( this.strUploadAccessSwitchType == 'sharing_form' ? 'Link and Access rights:' : 'Access:' ) )
						)
						.append( objTypeSelectWrap )
					)
					.append(
						$( '<div></div>' ).attr( {
							'class' : 'upload-access-switch_password-wrapper'
						} )
						.append(
							$( '<label></label>' ).text( 'Password:' )
						)
						.append(
							$( '<input/>' ).attr( {
								'class' : 'upload-access-switch_password' ,
								'type' : 'text' ,
								'title' : 'Enter a password' ,
								'value' : this.strUploadPassword
							} )
						)
						.append(
							$( '<div></div>' ).attr( {
								'class' : 'upload-access-switch_password-save-btn'
							} ).text( 'Save' )
						)
					)
					.append(
						$( '<div></div>' ).attr( {
							'class' : 'upload-access-switch_loading-mask'
						} )
						.append(
							$( '<i></i>' ).attr( {
								'class' : 'fal fa-spinner fa-spin'
							} )
						)
					)
				);
			}
		


			checkTooltips();
			
			var x, i, j, selElmnt, a, b, c, d, e;
			/*look for any elements with the class "styled-select":*/
			x = document.getElementsByClassName("upload-access-switch-select");
			
			for (i = 0; i < x.length; i++) 
			{
				if (x[i].getElementsByClassName("select-selected").length < 1) 
				{
					selElmnt = x[i].getElementsByTagName("select")[0];
					/*for each element, create a new DIV that will act as the selected item:*/
					a = document.createElement("DIV");
					a.setAttribute("class", "select-selected");
					a.innerHTML = selElmnt.options[selElmnt.selectedIndex].innerHTML;
					x[i].appendChild(a);
					/*for each element, create a new DIV that will contain the option list:*/
					b = document.createElement("DIV");
					b.setAttribute("class", "select-items select-hide");
					for (j = 1; j < selElmnt.length; j++) {
						/*for each option in the original select element,
						create a new DIV that will act as an option item:*/
						c = document.createElement("DIV");
						d = document.createElement("DIV");
						if(selElmnt.options[j].value == selElmnt.value)
						{
							c.setAttribute("class", "checked");
						}
						e = document.createElement("DIV");
						e.setAttribute("class", "value");
						d.setAttribute("class", "desc");
						//c.innerHTML = selElmnt.options[j].innerHTML;
						e.innerHTML = selElmnt.options[j].innerHTML;
						d.innerHTML = selElmnt.options[j].getAttribute('desc');
						c.appendChild(e);
						c.appendChild(d);
						if ( !!selElmnt.id && !!selElmnt.options[j].value )
						{
							c.setAttribute( 'id', selElmnt.id + '_' + selElmnt.options[j].value );
						}
						c.addEventListener("click", function(e) {
							/*when an item is clicked, update the original select box,
							and the selected item:*/
							var y, i, k, s, sjq, h, clicked;
							clicked = this;
							s = this.parentNode.parentNode.getElementsByTagName("select")[0];
							sjq = $(s);
							$(clicked).parents().children().removeClass('checked');
							$(clicked).addClass('checked');

									
							h = this.parentNode.previousSibling;
							for (i = 0; i < s.length; i++) {
								if (s.options[i].innerHTML == this.getElementsByClassName("value")[0].innerHTML) {
									s.selectedIndex = i;
									h.innerHTML = this.getElementsByClassName("value")[0].innerHTML;
									y = this.parentNode.getElementsByClassName("same-as-selected");
									for (k = 0; k < y.length; k++) {
										y[k].removeAttribute("class");
									}
									this.setAttribute("class", "same-as-selected checked");
									sjq.trigger("change");
									break;
								}
							}
							h.click();
						});
						b.appendChild(c);
					}
					x[i].appendChild(b);
					a.addEventListener("click", function(e) {
						/*when the select box is clicked, close any other select boxes,
						and open/close the current select box:*/
						e.stopPropagation();
						closeAllSelect(this);
						this.nextSibling.classList.toggle("select-hide");
						this.classList.toggle("select-arrow-active");
						this.parentElement.classList.toggle("blue-border");
						if (this.parentElement.previousElementSibling)
						{
							this.parentElement.previousElementSibling.classList.toggle("blue-span");
						}
						
					});
				}
			}
			function closeAllSelect(elmnt) {
				/*a function that will close all select boxes in the document,
				except the current select box:*/
				var x, y, i, arrNo = [];
				x = document.getElementsByClassName("select-items");
				y = document.getElementsByClassName("select-selected");
				for (i = 0; i < y.length; i++) {
					if (elmnt == y[i]) {
						arrNo.push(i)
					} else {
						y[i].classList.remove("select-arrow-active");
					}
				}
				for (i = 0; i < x.length; i++) {
					if (arrNo.indexOf(i)) {
						x[i].classList.add("select-hide");
						x[i].parentElement.classList.remove("blue-border");
						if (x[i].parentElement.previousElementSibling)
						{
							x[i].parentElement.previousElementSibling.classList.remove("blue-span");
						}
					}
				}
			}
			/*if the user clicks anywhere outside the select box,
			then close all select boxes:*/
			if ( ! bolUploadAccessSwitch_closeAllSelect_Binded )
			{
				document.addEventListener("click", closeAllSelect);
				bolUploadAccessSwitch_closeAllSelect_Binded = true;
			}

			if ( ! this.bolOwnerLoggedIn )
			{
				if ( this.strUploadAccessSwitchType == 'sharing_form' )
				{
					// do nothing
				}
				else
				{
        			$( this.objParentElement ).on( 'click', function( event )
        			{
        				showCreateAccount();
        			} );
				}
			}
			else
			{
    			$( this.objParentElement ).find( '.upload-access-switch_type-select' ).on( 'change', function()
    			{
    				_this.changeAccessType( $( this ).val() );
    			} );
    
				$( this.objParentElement ).find( '.upload-access-switch_password' ).on( 'blur', function()
    			{
					if($( this ).val().trim() != '' ) {
						$(this).parent().delay(500).queue(function(next) {
							$(this).removeClass('open');
							$( '.upload-access-switch_password-save-btn' ).html('Save');
							$( '.upload-access-switch_password-save-btn' ).removeClass("green");
							next();
						});
					}
					else
					{
						$( this ).parent().removeClass('has_password').removeClass('open');
						$( '.upload-access-switch_password-save-btn' ).html('Save');
						$( '.upload-access-switch_password-save-btn' ).removeClass("green");
					}
				} );

    			$( this.objParentElement ).find( '.upload-access-switch_password' ).on( 'change', function()
    			{
					$(this).parent().addClass('has_password');
    				_this.changeAccessType( 'password' );
    			} );

				$( this.objParentElement ).find( '#upload-access-switch_type-toggle' ).on( 'change', function()
    			{
					if ($(this).is(':checked'))
					{
						_this.changeAccessType( 'link' );
					}
					else
					{
						_this.changeAccessType( 'private' );
					}
    				
    			} );

				$( this.objParentElement ).find( '.upload-access-switch_hide-download-toggle' ).on( 'change', function()
    			{

					if ($(this).is(':checked'))
					{
						_this.changeHideDownloadButtons( 1 );
						$(this).next().next().html('Yes');
					}
					else
					{
						_this.changeHideDownloadButtons( 0 );
						$(this).next().next().html('No');
					}
    			} );
				

				$( this.objParentElement ).find( '.upload-access-switch_password' ).on( 'input', function()
    			{
					$( '.upload-access-switch_password-save-btn' ).html('Save');
            		$( '.upload-access-switch_password-save-btn' ).removeClass("green");
    			} );
			}
		}

		this.init();

		this.changeHideDownloadButtons = function( intHideDownloadButtons )
		{
			this.showLoadingMask();

			var strAjax_Url = '';
            var objAjax_Data = null;

            if ( this.strItemType == 'upload' )
            {
            	strAjax_Url = '/ajax/upload_info.php?PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3';
            	
            	objAjax_Data = {
                    'set_upload_hide_download_buttons': true ,
					'upload_hash' : this.strUploadHash ,
					'hide_download_buttons' : intHideDownloadButtons
                };
            }
            
            			
            $.ajax(
            {
                type: "POST",
                dataType: "json",
                url: strAjax_Url ,
                data: objAjax_Data ,
                success: function( data )
                {
                    if ( data['status'] == 'ok' )
                    {
                    	if ( _this.strItemType == 'upload' && ( _this.strEmbedPlace == 'filebrowser' || _this.strEmbedPlace == 'list' ) )
            			{
                        	location.reload();
            			}

            			_this.hideLoadingMask();
                    }
                    else
                    {
                        _this.afterErrorOn_changeAcceccType();
                    }
                } ,
                error: function()
                {
                    _this.afterErrorOn_changeAcceccType();
                }
            } );
		}
		

		this.changeAccessType = function( strNewAccessType )
		{
			$( this.objParentElement ).find( '.upload-access-switch' ).attr( 'data-selected-access-type', strNewAccessType );

			
			if ( strNewAccessType == 'password' && $( this.objParentElement ).find( '.upload-access-switch_password' ).val().trim() == '' )
			{
				if ( this.strUploadAccessSwitchType == 'sharing_form' )
				{
					this.changeAccessType( 'link' );
					$( this.objParentElement ).find( '.upload-access-switch_password' ).parent().removeClass('has_password').removeClass('open');
					$( '.upload-access-switch_password-save-btn' ).html('Save');
					$( '.upload-access-switch_password-save-btn' ).removeClass("green");
				}
				return;
			}

			if (
					strNewAccessType == 'link-can-view'
					|| strNewAccessType == 'link-can-edit'
					|| strNewAccessType == 'link-can-upload'
				)
			{
				strNewAccessType = 'link';
			}
   
			
			this.showLoadingMask();


			var strAjax_Url = '';
            var objAjax_Data = null;

            if ( this.strItemType == 'upload' )
            {
            	strAjax_Url = '/ajax/upload_info.php?PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3';
            	
            	objAjax_Data = {
                    'set_upload_access_type' : true ,
					'upload_hash' : this.strUploadHash ,
					'upload_access_type' : strNewAccessType ,
					'upload_password' : $( this.objParentElement ).find( '.upload-access-switch_password' ).val()
                };
            }
            else if ( this.strItemType == 'file' )
            {
            	strAjax_Url = '/ajax/file_info.php?PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3';
            	
            	objAjax_Data = {
                    'set_file_access_type' : true ,
					'file_hash' : this.strFileHash ,
					'file_access_type' : strNewAccessType 
                };
            }
            
            			
            $.ajax(
            {
                type: "POST",
                dataType: "json",
                url: strAjax_Url ,
                data: objAjax_Data ,
                success: function( data )
                {
                    if ( data['status'] == 'ok' )
                    {
                    	_this.strAccessType = strNewAccessType;
                    	_this.bolAccessTypeChanged = true;

                    	if ( _this.strItemType == 'upload' )
                    	{
                			if ( strNewAccessType != 'password' )
                			{
                				$( _this.objParentElement ).find( '.upload-access-switch_password' ).val( '' );
								$( _this.objParentElement ).find( '.upload-access-switch_password-wrapper' ).find('label').eq(0).html('Set password');
								$( _this.objParentElement ).find( '.upload-access-switch_password' ).parent().removeClass('has_password').removeClass('open');
                			}
							else 
							{
								$( '.upload-access-switch_password-save-btn' ).html('Saved!');
            					$( '.upload-access-switch_password-save-btn' ).addClass("green");
								$( _this.objParentElement ).find( '.upload-access-switch_password-wrapper' ).find('label').eq(0).html('Password:');
							}
    
                			if ( strNewAccessType == 'link' )
                			{
                    			$( '#upload_button__publish' ).show();
                    			$( '#upload_button__unpublish' ).hide();
                			}
                			else if ( strNewAccessType == 'public' )
                			{
                    			$( '#upload_button__publish' ).hide();
                    			$( '#upload_button__unpublish' ).show();
                			}
                			else 
                			{
                    			$( '#upload_button__publish' ).hide();
                    			$( '#upload_button__unpublish' ).hide();
                			}
    
                			if ( _this.strEmbedPlace == 'filebrowser' )
                			{
    							gaev( 'filebrowser-folder-info', 'access', strNewAccessType );
                			}
                    	}

                    	if ( _this.strEmbedPlace == 'filebrowser' || _this.strEmbedPlace == 'list' )
            			{
                        	location.reload();
            			}

            			_this.hideLoadingMask();
            			
                    }
                    else
                    {
                        _this.afterErrorOn_changeAcceccType();
                    }
                } ,
                error: function()
                {
                    _this.afterErrorOn_changeAcceccType();
                }
            } );
		}

		this.afterErrorOn_changeAcceccType = function( strErrorMsg )
		{
			if ( this.strAccessType == 'link' && this.strUploadAccessSwitchType == 'sharing_form' )
			{
				this.strAccessType = 'link-can-view';
			}
    					
			$( this.objParentElement ).find( '.upload-access-switch' ).attr( 'data-selected-access-type', this.strAccessType );
			$( this.objParentElement ).find( '.upload-access-switch_type-select option[value="' + this.strAccessType + '"]' ).attr( 'selected', 'selected' );

			$( this.objParentElement ).find( '.upload-access-switch_type-select' ).trigger( 'change' );

			if ( typeof strErrorMsg == 'undefined' )
			{
				strErrorMsg = 'An error occurred. Try again!';
			}
			
			fError( strErrorMsg );

			this.hideLoadingMask();
		}

		this.showLoadingMask = function()
		{
			$( this.objParentElement ).find( '.upload-access-switch_loading-mask' ).show();
		}

		this.hideLoadingMask = function()
		{
			$( this.objParentElement ).find( '.upload-access-switch_loading-mask' ).hide();
		}
	}

</script>
<script src="/js/download_selected_files/download_selected_files.js?v=1725995709"></script>
<script type="text/javascript">
	
	var objDownloadSelectedFiles;
	
	$( function()
	{
		objDownloadSelectedFiles = new downloadSelectedFiles(
			{
				'Warning-DontUseIOS' : 'Apple mobile devices do not support this option. Download each file individually or all files in a ZIP archive, or use a different device. On iOS, files are stored in Files > Downloads folder.<br/><br/> You are using the iOS operating system, the limitations of which prevent you from using this feature. It works on MacOS, Windows or Android operating systems. On iOS files are stored in the Files > Downloads.' ,
				'Warning-SelectFiles' : 'Please select at least one file.' ,
			}
		);
	} );

</script> <script type="text/javascript" src="/js/file.report.functions.js.php"></script>
<div id="list_waiting_overly_for_printing_order" style="display: none;position: absolute; top: 0; left:0; width: 100%; height: 100%; background: rgba(43, 61, 82, 0.9); z-index: 10000001; padding-top: 20%; text-align: center;">
<i class="fa fa-spinner fa-spin fa-fw" style="color: white; font-size: 50px;"></i>
</div>
<script type="text/javascript">

    if ( window.location.hash == '#order'|| window.location.hash.substr( 0, 10 ) == '#eparaksts' )
    {
        $( '#list_waiting_overly_for_printing_order' ).show();
    }

</script>
<div id="center" class="list_page_container show_ads">

<script type="text/x-jqote-template" id="file_context_menu_drawer_template"><![CDATA[
<div id="file_context_menu_drawer" class="dropdown-menu">	
	<div class="copy_button_wrapper" >				
		<div class="copy_button_drawer">
			<*= ! this.item_view_link ? '<!--':''*>
			<div class="drawer_copy_button" data-item-hash="<*= this.file_hash *>" data-clipboard-text="<*= this.item_view_link *>">
				<span>Copy link to view</span>
				<span class="desc">View and download rights</span>
			</div>
			<*= ! this.item_view_link ? '-->':''*>
		
			<*= ! this.item_edit_link ? '<!--':''*>
			<div class="drawer_edit_button" data-item-hash="<*= this.file_hash *>" data-clipboard-text="<*= this.item_edit_link *>">
				<span>Copy edit link</span>
				<span class="desc">Can add, edit content, e-sign and delete</span>
			</div>
			<*= ! this.item_edit_link ? '-->':''*>
		</div>
	</div>
</div>
]]>
</script>

<script type="text/x-jqote-template" id="upload_context_menu_drawer_template"><![CDATA[
<div id="upload_context_menu_drawer" class="dropdown-menu">					
	<div class="copy_button_drawer">
		<*= ! this.item_view_link ? '<!--':''*>
		<div class="drawer_copy_button" data-item-hash="<*= this.upload_hash *>" data-clipboard-text="<*= this.item_view_link *>">
			<span>Copy link to view</span>
			<span class="desc">View and download rights</span>
		</div>
		<*= ! this.item_view_link ? '-->':''*>
	
		<*= ! this.item_edit_link ? '<!--':''*>
		<div class="drawer_edit_button" data-item-hash="<*= this.upload_hash *>" data-clipboard-text="<*= this.item_edit_link *>">
			<span>Copy edit link</span>
			<span class="desc">Can add, edit content, e-sign and delete</span>
		</div>
		<*= ! this.item_edit_link ? '-->':''*>
		
		<*= ! this.item_add_link ? '<!--':''*>
		<div class="drawer_edit_button" data-item-hash="<*= this.upload_hash *>" data-clipboard-text="<*= this.item_add_link *>">
			<span>Copy add link</span>
			<span class="desc">You can add files, but not delete or edit existing files</span>					
		</div>
		<*= ! this.item_add_link ? '-->':''*>
	</div>
</div>
]]>
</script>

<script type="text/x-jqote-template" id="file_context_menu_template"><![CDATA[
<ul id="file_context_menu" class="dropdown-menu">

    <li role="presentation" class="item-name">
        <div class="context-img"><img style="width: 18px; height: unset" src="/images/file_types_v2/<*= this.file_icon *>"/></div>
        <span class="title">
            <*= this.name *>
        </span>
        <div id="file_context_menu_close"> <i class="fal fa-times"></i></div>
    </li>

    
    <li role="presentation" class="divider" style="margin-top: 0"></li>
    
	<div class="button-wrap">
    <!-- View -->
    
	    <!-- Download -->
    <*= ! this.can_download ? '<!--':''*>
    <li role="presentation"><a role="menuitem" tabindex="-1" href="javascript:void(0)" onclick="downloadFile( '<*= this.file_hash *>' )"><div class="context-img"><img src="/images/UI_icons/download.svg"/></div>Download</a></li>
    <*= ! this.can_download ? '-->':''*>
        
    
	    <!-- Open in web view -->
    <*= this.panel_id != 'shared-with-me' ? '<li role="presentation"><a role="menuitem" tabindex="-1" href="/f/' + this.file_hash + '" target="_blank"><div class="context-img"><img src="/images/UI_icons/external.svg"/></div>Open direct link</a></li>' : '' *>
        
        <!-- Copy link -->
    <*= this.panel_id != 'shared-with-me' ? '<li role="presentation"><a role="menuitem" tabindex="-1" href="javascript:void(0)" onclick="copyToClipboard(\'https://files.fm/f/' + this.file_hash + '\')"><div class="context-img"><img src="/images/UI_icons/link.svg"/></div>Copy link</a></li>' : '' *>
        
        <!-- Embed -->
    <li role="presentation"><a role="menuitem" tabindex="-1" href="javascript:void(0)" onclick="$( '#list_item_embed_button_for_file_<*= this.file_hash *>' ).click();"><div class="context-img"><img src="/images/UI_icons/code.svg"/></div>Embed content</a></li>
    
	<li role="presentation" class="divider"></li>

	
    
	
    
	<!-- Sell file-->
    <*= ! this.can_sell_file ? '<!--':''*>
	<li role="presentation"><a role="menuitem" tabindex="-1" href="javascript:void(0)" onclick="showSetPriceFormModal('<*= this.file_hash *>')"><div class="context-img"><img src="/images/UI_icons/euro.svg"/></div>Sell file</a></li>
    <*= ! this.can_sell_file ? '-->':''*>

	<!-- Buy file-->
    <*= ! this.can_buy_file ? '<!--':''*>
	<li role="presentation"><a role="menuitem" tabindex="-1" href="javascript:void(0)" onclick="showBuyFileFormModal('<*= this.file_hash *>')"><div class="context-img"><img src="/images/UI_icons/cart.svg"/></div>Buy</a></li>
    <*= ! this.can_buy_file ? '-->':''*>

	<!-- Order prints-->
    <*= ! this.can_order_prints ? '<!--':''*>
	<li role="presentation"><a role="menuitem" tabindex="-1" href="javascript:void(0)" onclick="showPrintingOrderModal('<*= this.file_hash *>', 'ListActionLineDropdown');"><div class="context-img"><img src="/images/UI_icons/print.svg"/></div>Order prints</a></li>
    <*= ! this.can_order_prints ? '-->':''*>

	<!-- Order products -->
    <*= ! this.can_order_producs ? '<!--':''*>
	<li role="presentation"><a role="menuitem" tabindex="-1" href="/c/<*= this.upload_hash *>?h=<*= this.file_hash *>" target="_blank"><div class="context-img"><img src="/images/UI_icons/cup.svg"/></div>View products</a></li>
    <*= ! this.can_order_producs ? '-->':''*>

	<!-- Slideshow-->
    <*= ! this.can_open_slideshow ? '<!--':''*>
    <li role="presentation"><a role="menuitem" tabindex="-1" href="javascript:void(0)" onclick="showSlideshow( '<*= this.file_hash *>' )"><div class="context-img"><img src="/images/UI_icons/play.svg"/></div>Slideshow</a></li>
    <*= ! this.can_open_slideshow ? '-->':''*>


	<!-- Report-->
	<*= ! this.can_be_reported ? '<!--':''*>
	<li role="presentation" class="divider"></li>
	<*= ! this.can_be_reported ? '-->':''*>

	<*= ! this.can_be_reported ? '<!--':(! this.has_reported ? '<!--':'')*>
	<li role="presentation"><a role="menuitem" tabindex="-1" href="javascript:void(0)" onclick="showCancelFileReportModal(this, '<*= this.file_hash *>');"><div class="context-img"><img src="/images/UI_icons/alert.svg"/></div>Cancel a problem report</a></li>
    <*= ! this.can_be_reported ? '-->':(! this.has_reported ? '-->':'')*>

    <*= ! this.can_be_reported ? '<!--':( this.has_reported ? '<!--':'')*>
	<li role="presentation"><a role="menuitem" tabindex="-1" href="javascript:void(0)" onclick="showFileReportModal(this, '<*= this.file_hash *>');"><div class="context-img"><img src="/images/UI_icons/alert.svg"/></div>Report a problem</a></li>
    <*= ! this.can_be_reported ? '-->':( this.has_reported ? '-->':'')*>
    </div>
</ul>
]]>
</script>
<link rel="stylesheet" type="text/css" media="all" href="/css/upload_copy_form.css?v=101">
<script type="text/javascript" src="/js/upload_copy_form.js?v=109"></script>
<script type="text/javascript">

	var objUploadCopyForm = null;
	var PHPSESSID = '9ec2943be38ec1b81485a61c5596edc86d31d3d3';
	
	$( function()
	{
		objUploadCopyForm = new UploadCopyForm(
			false ,
			false ,
			'9ec2943be38ec1b81485a61c5596edc86d31d3d3' ,
			{
				'Error-General' : 'Sorry, an error occurred while processing data. Please try again!' ,
				'Error-FileSizeLimitExceeded' : 'Some of the files you selected for copying exceeds the file size limit for your account.' ,
				'Error-UploadSizeLimitExceeded' : 'The total file size exceeds the folder size limit for your account.' ,
				'Error-CircularMove' : 'Copying a folder to one of its child folders or itself is not possible! Pick another folder.' ,
				'Error-HttpDownloadNotAllowed' : 'Some of the selected files are not allowed to be downloaded.' ,
				'ConfirmText-CloseForm' : 'Are you sure you want to close the form and stop copying files?' ,
				'YES' : 'Yes' ,
				'NO' : 'No' ,
				'Header' : 'Files are being copied' ,
				'SubHeader-1' : 'Do not close this window while files are being copied.' ,
				'Copied' : 'Copied' ,
				'Header-Share' : 'File saving in your account' ,
				'SubHeader-1-Share' : 'Do not close this window while files are being uploaded' ,
				'Copied-Share' : 'Saved' ,
			} ,
		);
	} );

</script>
<section id="upload-copy-form" class="modal-container" tabindex="-1" role="dialog" aria-labelledby="modal-label" aria-hidden="true">
<div class="modal-inner">
<div id="upload-copy-form__close-top-button" onclick="objUploadCopyForm.confirmClose()"><i class="fal fa-times"></i></div>
<div class="modal-content">
<div id="upload-copy-form_header-main"></div>
<div id="upload-copy-form_header-info"></div>
<div id="upload-copy-form_main-content">
<div id="upload-copy-form_stats-top">
<span id="upload-copy-form_stats_text"></span>
<span id="upload-copy-form_stats_finished-count">-</span>
<span>from</span>
<span id="upload-copy-form_stats_total-count">-</span>
</div>
<div id="upload-copy-form_progress-bar">
<div id="upload-copy-form_progress-bar_text">-%</div>
<div id="upload-copy-form_progress-bar_outer">
<div id="upload-copy-form_progress-bar_inner"></div>
</div>
</div>
<div id="upload-copy-form_stats-bottom">
<span id="upload-copy-form_stats_finished-size">-</span>
<span id="upload-copy-form_stats_total-size">-</span>
</div>
<div id="upload-copy-form_finished-info">
<div id="upload-copy-form_finished-info_text">
Copy complete </div>
<div id="upload-copy-form_finished-info_button" onclick="hideModal('upload-copy-form')">
OK </div>
</div>

<div id="upload-copy-form_main-content_loading-mask">
<i class="fa fa-spinner fa-spin"></i>
</div>

</div>
</div>
</div>
<div id="upload-copy-form_modal-close" class="modal-close modal-close-dont-close" data-dismiss="modal" data-close="Close" onclick="objUploadCopyForm.confirmClose()"></div>
</section>
<link rel="stylesheet" type="text/css" media="all" href="/js/bxslider/jquery.bxslider.min.css?v=1715343640"><link rel="stylesheet" type="text/css" media="all" href="/css/modal_gallery.v2.css?v=1728476259"><link rel="stylesheet" type="text/css" media="all" href="/css/global_facelift.css?v=1720449903"><link rel="stylesheet" type="text/css" media="all" href="/css/audio_player.css?v=1715343651"><link rel="stylesheet" type="text/css" media="all" href="/js/filesfm_videojs/videojs_8.3.0/video-js.css?v=1715343635"><link rel="stylesheet" type="text/css" media="all" href="/js/filesfm_videojs/css/filesfm_videojs.css?v=1717493775"><link rel="stylesheet" type="text/css" media="all" href="/js/filesfm_videojs/plugins/videojs-quality-selector_1.3.1/quality-selector.css?v=1715343635"><link rel="stylesheet" type="text/css" media="all" href="/js/highlight/styles/atom-one-dark.min.css?v=1715343642">
<script src="/js/jquery.tagsinput.js?v=1715343639"></script>
<script src="/js/jquery.fitvids.js?v=1715343639"></script>
<script src="/js/bxslider/jquery.bxslider.js?v=1715343640"></script>
<script src="/js/autosize.min.js?v=1715343635"></script>
<script src="/js/audio_player.js?v=1715343635"></script>
<script src="/js/functions.js?v=1715343642"></script>
<script src="/js/dropdown.button.js?v=1715343643"></script>
<script src="/js/panzoom/panzoom.min.js?v=1715343639"></script>
<script src="/js/exif-js/exif.js?v=1715343634"></script>
<script src="/js/filesfm_videojs/videojs_8.3.0/video.min.js?v=1715343635"></script>
<script src="/js/filesfm_videojs/filesfm_videojs.js?v=1715343635"></script>
<script src="/js/filesfm_videojs/plugins/videojs-quality-selector_1.3.1/silvermine-videojs-quality-selector.min.js?v=1715343635"></script>
<script src="/js/edit_image_popup.js?v=1715343639"></script>
<script src="/js/highlight/highlight.min.js?v=1715343642"></script>
<div id="gallery2" style="display: none;" class=" ">
<div id="gallery2__bg"></div>
<div id="gallery2__content-wrapper">
<div id="gallery2__header_mobile">
<span class="gallery2__header__img-count">&nbsp;</span>
<span class="gallery2__header__file_name_value"></span>
<span class="gallery2__header__close" onclick="if($( '#gallery2__content' ).hasClass( 'gallery__sidebar__info-visible' ) &amp;&amp; $( '#gallery2__content' ).hasClass( 'gallery__sidebar-visible' ) ){showGalleryInfo(); $(window).trigger('resize');} else {closeGallery(strCurrentFileHash);}"></span>
</div>
<div id="gallery2__header">
<div id="gallery2__header__inner" class="clearfix">
<div class="gallery2__header__icon-group" id="gallery2__header__left">
<span class="gallery2__header__img-count">&nbsp;</span>
<span class="gallery2__header__file_name_value"></span>
</div>
<div id="gallery2__header__mid">
<div id="gallery2__header__mid_content">
<span id="gallery2__buyproducts" class="gallery2__header_middle_button gallery2__button__buy-products">
<a href="javascript:void(0);">
<span class="text">Buy prints</span>
</a>
</span>
<span id="gallery2__sign_main" class="gallery2__header_middle_button">
<a href="javascript:void(0);">
<span>eSign</span>
</a>
</span>
<span id="gallery2__download_space"></span>
<span id="gallery2__buyfile" style="display:none" class="gallery2__header_middle_button ">
<a href="javascript:void(0);">
<span class="text">Buy</span>
<span class="dash"> - </span>
<span class="price"></span>
</a>
</span>
<span id="gallery2__buyall" style="" class="gallery2__header_middle_button ">
<a href="javascript:void(0);">
<span class="text">Buy all</span>
<span class="dash"> - </span>
<span class="price"></span>
</a>
</span>
<span id="gallery2__share" class="gallery2__header_middle_button">
<a href="javascript:void(0);" id="gallery2__share_button">
<span>Share link</span>
</a>
</span>
<span id="gallery2__header__right_more" class="gallery2__header_middle_button" onclick="if(!bolGallerySidebarVisible || $(window).width() > 500){$(this).toggleClass('open')}else{showGalleryInfo(); $(window).trigger('resize');} galleryLoadFileInfo(true);">More</span>
<div id="gallery2__header__mobile_menu">
<span id="gallery2__edit" class="gallery2__header_middle_button gallery2__edit">
<a href="javascript:void(0);" id="gallery2__edit_button">
<span>Edit</span>
</a>
</span>
<span id="gallery2__edit_in_google" class="gallery2__header_middle_button gallery2__edit_in_google">
<a href="javascript:void(0);" id="gallery2__edit_in_google_button">
<span>Edit in Google</span>
</a>
</span>
<span id="gallery2__sign" class="gallery2__header_middle_button">
<a href="javascript:void(0);">
<span>eSign</span>
</a>
</span>
<a id="gallery2__item_info_cover_middle" class="gallery2__header_middle_button bottom_menu" onclick="setAsThumb(arrIDs[ getItemIndex ( strCurrentFileHash ) ], strUploadHash);" href="javascript:void(0)">
Set as cover image </a>
<a id="gallery2__sidebar__info-price_middle" class="gallery2__header_middle_button bottom_menu" href="javascript:void(0)"></a>
<a id="gallery2__sidebar__info-rename_middle" onclick=" if( bolIsOwner )
                                                                                    {
                                                                                        $('#gallery2__header__right_more').toggleClass('open');
                                                                                        showGalleryInfo();
                                                                                        $(window).trigger('resize');
                                                                                        $('#file_name_edit_wrapper textarea').focus();
                                                                                        $('#file_name_edit_wrapper textarea').addClass('pulse');
                                                                                    }" class="not_owner_hide gallery2__header_middle_button bottom_menu" href="javascript:void(0)">Rename</a>
<a href="javascript:void(0);" id="gallery2__sidebar__info_embed_button_middle" class="gallery2__header_middle_button bottom_menu">
Embed links <div class="tag pro">Pro</div>
</a>
<a id="gallery2__item_info_delete_middle" class="gallery2__header_middle_button bottom_menu" href="javascript:void(0)">
Delete </a>
<a id="gallery2__item_info_replace_middle" class="gallery2__header_middle_button bottom_menu" href="javascript:void(0)">
Replace file</a>

<div class="gallery2__header__mobile_menu_seperator"></div>
<a id="gallery2__info_more" class="gallery2__header_middle_button bottom_menu" href="javascript:void(0)" onclick="showGalleryInfo(); $(window).trigger('resize'); $('#gallery2__header__right_more').removeClass('open')">
Info </a>
<a id="gallery2__slideshow_middle" class="gallery2__header_middle_button bottom_menu" onclick="enterSlideshow()" href="javascript:void(0)">
Slideshow </a>
<div id="gallery2__comments_button_middle" class="gallery2__header_middle_button" onclick="if(!bolGallerySidebarVisible) {showGalleryInfo();} showGalleryMessages(); $(window).trigger('resize'); $('#gallery2__header__right_more').removeClass('open')">Add comment</div>
<span id="gallery2__buy-products" class="gallery2__header_middle_button gallery2__button__buy-products">
<a href="javascript:void(0);">
<span class="text">Buy prints</span>
</a>
</span>
<div id="gallery2__report_button_middle" class="gallery2__report_button gallery2__header_middle_button" onclick="$('#gallery2__header__right_more').removeClass('open')">
<span class="not-reported">Report a problem</span>
<span class="reported">Cancel a problem report</span>
</div>
<div id="gallery2_item_info_share_middle" class="gallery2_item_info_share">
<div class="gallery2_input-container">
<input type="text" id="gallery_share_popup_url_middle" onclick="this.setSelectionRange(0, this.value.length); gaev( 'filebrowser-file-info', 'share-link', '' );  $( '#copy_button_middle' ).addClass( 'copied' ).delay( 4000 ).queue( function( next ){$( this ).removeClass( 'copied' );next();} );" class="gallery2_share-input copy_input_value_to_clipboard my_tooltip" data-clipboard-text="" my_title="You can send the link to other users for access to these files. File owner can change access rights.">
</div>
<div id="copy_button_middle" class="copy_button">
<div class="copy_text">
<div class="hover mobile">Copy</div>
<div class="copied">Copied</div>
</div>
</div>
</div>
</div>
<div id="gallery2__header__mobile_menu_close_before"></div>
<span id="gallery2__info_middle" class="gallery2__info gallery2__header_middle_button" onclick="showGalleryInfo(); $(window).trigger('resize'); $('#gallery2__header__right_more').removeClass('open')">Info</span>
</div>
</div>
<div class="gallery2__header__icon-group gallery2__header__right" id="gallery2__header__right">
<span id="gallery2__close" class="gallery2__close" onclick="closeGallery(strCurrentFileHash);"></span>
</div>
</div>
</div>
<div id="gallery2__header_slideshow">
<span class="gallery2__header_slideshow_resume" onclick="nextSlide(); resumeSlideshow()">Play</span>
<span class="gallery2__header_slideshow_pause" onclick="pauseSlideshow()">Pause</span>
<span class="gallery2__header__close" onclick="exitSlideshow()"></span>
</div>
<div id="gallery2__content" class="gallery__image__is-image gallery__thumbs-visible clearfix">
<div id="gallery2__content__sidebar">
<div id="gallery2__sidebar__info__comments">
<div id="gallery2__info_button" onclick="hideGalleryMessages(); $(window).trigger('resize');">
Information </div>
<div id="gallery2__comments_button" onclick="showGalleryMessages(); $(window).trigger('resize');">
Add a comment </div>
<div id="gallery2__sidebar-close" onclick="hideSidebar();"></div>
</div>
<div id="gallery2__content__sidebar__inner" class="gallery2__content__sidebar__inner__flex">
<div id="gallery2__sidebar__info">
<div class="gallery2__sidebar__content">
<div id="file-info">File info:</div>
<div id="gallery2_file_info">
<div id="gallery2_item_info_bottom_section">
<div class="gallery2_item_info_padded">
<div id="gallery2_info_head">
<div class="info_head">
<div class="thumbnail-wrapper">
</div>
<div id="gallery2__sidebar__info-name" class="not_owner_hide">
<div id="file_name_edit_wrapper">
<div class="error_msg">An error occurred. Please try again!</div>
<textarea class="gallery2__sidebar__info-value gallery2__sidebar__file_name_value" rows="1"></textarea>
<div class="editable_field_save_button">
Save </div>
<div class="edit_wrapper_edit_button"><div class="edit_wrapper_edit_button_icon"></div></div>
</div>
</div>
<h1 id="gallery2__sidebar__info-name-uneditable" style="word-wrap: break-word;" class="not_owner_show">
<span class="gallery2__sidebar__file_name_value"></span>
</h1>
</div>
<label class="block-label" for="gallery2__sidebar__file_description_value" style="margin-top: 30px;">Description</label>
<div id="gallery2__sidebar__info-description" class="not_owner_hide">
<div id="file_description_edit_wrapper">
<div class="error_msg">An error occurred. Please try again!</div>
<textarea id="gallery2__sidebar__file_description_value" class="gallery2__sidebar__info-value not_owner_hide gallery2__sidebar__file_description_value" placeholder="Add file description"></textarea>
<div class="editable_field_save_button">
Save </div>
<div class="edit_wrapper_edit_button not_owner_hide"><div class="edit_wrapper_edit_button_icon"></div></div>
</div>
</div>
<div class="not_owner_show">
<span class="gallery2__sidebar__file_description_value"></span>
</div>
<div id="gallery2__sidebar__info-set-custom-thumbnail"></div>
</div>
</div>
<div class="gallery2_item_info_padded share">
<label class="block-label" for="upload-access-switch_type-select" style="margin-bottom: 10px;">Access</label>
<div id="gallery2_item_info_share-wrapper">
<div id="gallery_upload-access-switch"></div>
</div>
<div id="gallery2_item_info_share" class="gallery2_item_info_share">
<div class="gallery2_input-container">
<input type="text" id="gallery_share_popup_url" onclick="this.setSelectionRange(0, this.value.length); gaev( 'filebrowser-file-info', 'share-link', '' ); $( '#copy_button_left' ).addClass( 'copied' ).delay( 4000 ).queue( function( next ){$( this ).removeClass( 'copied' );next();}" class="gallery2_share-input gallery_share_popup_url copy_input_value_to_clipboard my_tooltip" data-clipboard-text="" my_title="You can send the link to other users for access to these files. File owner can change access rights.">
</div>
<div id="copy_button_left" class="copy_button">
<div class="copy_text">
<div class="hover">Copy</div>
<div class="copied">Copied</div>
</div>
</div>
</div>
</div>
<div class="gallery2_item_info_padded signatures">
<div id="gallery2__left_info__signers-list-container">
<div class="file-signing-eparaksts-form_file-list_file-item_signatures-info_is-signed_header">
Signed by:
</div>
<div id="gallery2__left_info__signers-list">
</div>
</div>
</div>
<div class="header-owner">
<div class="header-owner_title block-label">User </div>
<div class="header-owner_image-wrapper"></div>
<div class="header-owner_name"></div>
</div>
<label class="block-label" style="padding-left: 20px">Meta data</label>
<table id="gallery2_file_details_table" class="zebra_table gallery2_item_info_padded">
<tbody>
<tr id="gallery2__sidebar__info-date-created">
<td>
Created:
</td>
<td class="gallery2__sidebar__info-value">
</td>
</tr>
<tr id="gallery2__sidebar__info-moddate">
<td>
Modified:
</td>
<td class="gallery2__sidebar__info-value">
</td>
</tr>
<tr id="gallery2__sidebar__info-date">
<td>
Uploaded:
</td>
<td class="gallery2__sidebar__info-value">
</td>
</tr>
<tr id="gallery2__sidebar__info-date-delete">
<td style="color:#C96F6F">
Will be deleted:
</td>
<td class="gallery2__sidebar__info-value" style="color:#C96F6F">
</td>
</tr>
<tr id="gallery2__sidebar__info-size">
<td>
Size:
</td>
<td class="gallery2__sidebar__info-value">
</td>
</tr>
<tr id="gallery2__sidebar__info-dimensions">
<td>
Resolution:
</td>
<td class="gallery2__sidebar__info-value">
</td>
</tr>
<tr id="gallery2__sidebar__info-views">
<td>
Views:
</td>
<td class="gallery2__sidebar__info-value">
</td>
</tr>
<tr id="gallery2__sidebar__info-downloads">
<td>
Downloads:
</td>
<td class="gallery2__sidebar__info-value">
</td>
</tr>
<tr id="gallery2__sidebar__info-comments">
<td>
Comments:
</td>
<td class="gallery2__sidebar__info-value">
</td>
</tr>
<tr id="gallery2__sidebar__info-mainexif">
<td colspan="2" class="gallery2__sidebar__info-value">
<div class="exif-grid">
<div class="Model my_tooltip" my_title="Device"><span></span></div>
<div class="ISO my_tooltip" my_title="ISO"><span></span></div>
<div class="LensModel my_tooltip" my_title="Lens Model"><span></span></div>
<div class="FocalLength my_tooltip" my_title="Focal Length"><span></span></div>
<div class="ApertureValue my_tooltip" my_title="Aperture Value">f/<span></span></div>
<div class="ExposureTime my_tooltip" my_title="Exposure Time"><span></span></div>
<div class="size my_tooltip" my_title="Resolution"><span></span></div>
<div class="mp my_tooltip" my_title="Dimensions"><span></span></div>
</div>
</td>
</tr>
<tr id="gallery2__sidebar__info-metadata-title" class="gallery2__sidebar__info-metadata">
<td>
Title:
</td>
<td class="gallery2__sidebar__info-value">
</td>
</tr>
<tr id="gallery2__sidebar__info-metadata-subject" class="gallery2__sidebar__info-metadata">
<td>
Subject:
</td>
<td class="gallery2__sidebar__info-value">
</td>
</tr>
<tr id="gallery2__sidebar__info-metadata-content_type" class="gallery2__sidebar__info-metadata">
<td>
Content type:
</td>
<td class="gallery2__sidebar__info-value">
</td>
</tr>
<tr id="gallery2__sidebar__info-metadata-category" class="gallery2__sidebar__info-metadata">
<td>
Category:
</td>
<td class="gallery2__sidebar__info-value">
</td>
</tr>
<tr id="gallery2__sidebar__info-metadata-categories" class="gallery2__sidebar__info-metadata">
<td>
Categories:
</td>
<td class="gallery2__sidebar__info-value">
</td>
</tr>
<tr id="gallery2__sidebar__info-metadata-keywords" class="gallery2__sidebar__info-metadata">
<td>
Keywords:
</td>
<td class="gallery2__sidebar__info-value">
</td>
</tr>
<tr id="gallery2__sidebar__info-metadata-creator" class="gallery2__sidebar__info-metadata">
<td>
Author:
</td>
<td class="gallery2__sidebar__info-value">
</td>
</tr>
<tr id="gallery2__sidebar__info-metadata-publisher" class="gallery2__sidebar__info-metadata">
<td>
Publisher:
</td>
<td class="gallery2__sidebar__info-value">
</td>
</tr>
<tr id="gallery2__sidebar__info-metadata-contributor" class="gallery2__sidebar__info-metadata">
<td>
Contributor:
</td>
<td class="gallery2__sidebar__info-value">
</td>
</tr>
<tr id="gallery2__sidebar__info-metadata-copyrights" class="gallery2__sidebar__info-metadata">
<td>
Copyrights:
</td>
<td class="gallery2__sidebar__info-value">
</td>
</tr>
<tr id="gallery2__sidebar__info-metadata-license_type" class="gallery2__sidebar__info-metadata">
<td>
License type:
</td>
<td class="gallery2__sidebar__info-value">
</td>
</tr>
<tr id="gallery2__sidebar__info-metadata-license_details" class="gallery2__sidebar__info-metadata">
<td>
License details:
</td>
<td class="gallery2__sidebar__info-value">
</td>
</tr>
<tr id="gallery2__sidebar__info-metadata-language" class="gallery2__sidebar__info-metadata">
<td>
Language:
</td>
<td class="gallery2__sidebar__info-value">
</td>
</tr>
<tr id="gallery2__sidebar__info-metadata-location" class="gallery2__sidebar__info-metadata">
<td>
Location:
</td>
<td class="gallery2__sidebar__info-value">
</td>
</tr>
<tr id="gallery2__sidebar__info-metadata-location_lat" class="gallery2__sidebar__info-metadata">
<td>
GPS Lat:
</td>
<td class="gallery2__sidebar__info-value">
</td>
</tr>
<tr id="gallery2__sidebar__info-metadata-location_long" class="gallery2__sidebar__info-metadata">
<td>
GPS Long:
</td>
<td class="gallery2__sidebar__info-value">
</td>
</tr>
<tr id="gallery2__sidebar__info-metadata-references" class="gallery2__sidebar__info-metadata">
<td>
References:
</td>
<td class="gallery2__sidebar__info-value">
</td>
</tr>
<tr id="gallery2__sidebar__info-metadata-relates_to" class="gallery2__sidebar__info-metadata">
<td>
Relates to:
</td>
<td class="gallery2__sidebar__info-value">
</td>
</tr>
<tr id="gallery2__sidebar__info-metadata-format" class="gallery2__sidebar__info-metadata">
<td>
Format:
</td>
<td class="gallery2__sidebar__info-value">
</td>
</tr>
<tr id="gallery2__sidebar__info-metadata-device" class="gallery2__sidebar__info-metadata">
<td>
Device:
</td>
<td class="gallery2__sidebar__info-value">
</td>
</tr>
<tr id="gallery2__sidebar__info-metadata-source" class="gallery2__sidebar__info-metadata">
<td>
Source:
</td>
<td class="gallery2__sidebar__info-value">
</td>
</tr>
<tr id="gallery2__sidebar__info-metadata-duration" class="gallery2__sidebar__info-metadata">
<td>
Length:
</td>
<td class="gallery2__sidebar__info-value">
</td>
</tr>
<tr id="gallery2__sidebar__info-exif_tags-button" class="gallery2__sidebar__info-metadata">
<td class="gallery2__sidebar__info-exif_tags-dropdown" onclick="loadExifTags();">
<span class="gallery2__sidebar__info-dropdown_text">
Show Exif info </span>
<span class="gallery2__sidebar__info-dropdown_icon"></span>
</td>
</tr>
<tr id="gallery2__sidebar__info-easyocr_text" class="gallery2__sidebar__info-metadata">
<td colspan="2" class="metadata-title_above_content">
<div>
Basic OCR </div>
<div class="gallery2__sidebar__info-value"></div>
</td>
</tr>
<tr id="gallery2__sidebar__info-google_cv_text" class="gallery2__sidebar__info-metadata">
<td colspan="2" class="metadata-title_above_content">
<div>
PRO OCR </div>
<div class="gallery2__sidebar__info-value"></div>
</td>
</tr>
<tr id="gallery2__sidebar__info-google_cloud-speech_to_text-button" class="gallery2__sidebar__info-metadata gallery2__sidebar__exif_tags-top-separator">
<td colspan="2">
<div class="gallery2__sidebar__info-one_line_buttons">
<div class="gallery2__sidebar__info-dropdown_button" onclick="speechToText( this ); gaev( 'modal-gallery-speech-to-text', 'any-user-clicked', '' );" style="width: max-content;">
<span class="gallery2__sidebar__info-dropdown_text">
Recognize speech </span>
<span class="gallery2__sidebar__info-dropdown_icon"></span>
</div>
</div>
</td>
</tr>
<tr id="gallery2__sidebar__info-google_cloud-speech_to_text-text" class="gallery2__sidebar__info-metadata">
<td colspan="2" class="metadata-title_above_content">
<div>
Transcription </div>
<div class="gallery2__sidebar__info-value"></div>
</td>
</tr>
<tr id="gallery2__sidebar__info-content_analyze-buttons" class="gallery2__sidebar__info-metadata gallery2__sidebar__exif_tags-top-separator">
<td colspan="2">
<div class="gallery2__sidebar__info-one_line_buttons">
<div>
<div class="gallery2__sidebar__info-dropdown_button google_cloud-vision" onclick="objectsLabelsDetection( this ); gaev( 'modal-gallery-objects_labels_detection', 'any-user-clicked', '' );">
<span class="gallery2__sidebar__info-dropdown_text">
Find objects PRO </span>
<span class="gallery2__sidebar__info-dropdown_icon"></span>
</div>
<div class="gallery2__sidebar__info-dropdown_button yolo-object_detection" onclick="objectDetection( this ); gaev( 'modal-gallery-yolo_objects_labels_detection', 'any-user-clicked', '' );">
<span class="gallery2__sidebar__info-dropdown_text">
Find objects </span>
<span class="gallery2__sidebar__info-dropdown_icon"></span>
</div>
</div>
<div>
<div class="gallery2__sidebar__info-dropdown_button google_cloud_vision-ocr" onclick="ocrAnalyze( this, 'googlecv' ); gaev( 'modal-gallery-ocr-buttons', 'googlecv-model', '' );">
<span class="gallery2__sidebar__info-dropdown_text">
Find text PRO </span>
<span class="gallery2__sidebar__info-dropdown_icon"></span>
</div>
<div class="gallery2__sidebar__info-dropdown_button easyocr-text_recognition" onclick="ocrAnalyze( this, 'easyocr' ); gaev( 'modal-gallery-ocr-buttons', 'easyocr-model', '' );">
<span class="gallery2__sidebar__info-dropdown_text">
Find Text </span>
<span class="gallery2__sidebar__info-dropdown_icon"></span>
</div>
</div>
</div>
</td>
</tr>
<tr id="gallery2__sidebar__info-metadata-tags" class="gallery2__sidebar__info-metadata gallery2__sidebar__exif_tags-top-separator">
<td colspan="2">
Tags </td>
</tr>
</tbody>
</table>
<ul class="fa-ul" id="gallery2__sidebar__info-data">
<li id="gallery2__sidebar__info-tags">
<div id="gallery_file_tags_container" class="file_tags_container ">
<input class="file_tags_input" style="display:none">
<div class="file_tags_error">An error occurred. Please try again!</div>
</div>
</li>
</ul>
<div id="gallery2__sidebar__info-object_tags" class="gallery2__sidebar__info-metadata gallery2__sidebar__info-image_annotation">
<div class="title">
Objects </div>
<div class="tags"></div>
</div>
<div id="gallery2__sidebar__info-label_tags" class="gallery2__sidebar__info-metadata gallery2__sidebar__info-image_annotation">
<div class="title">
Labels </div>
<div class="tags"></div>
</div>
</div>
</div> 
</div>
</div>
<div id="gallery2__sidebar__banner">
<div id="files_300x250_file_desktop_1" data-google-query-id="CMyM7JSwg4kDFbNL9ggd5j0xAQ" style="display: none;">
<script>
                                    if ( typeof googletag != 'undefined' && typeof googletag.cmd != 'undefined' )
                                    {
                                        googletag.cmd.push(function () {
                                            googletag.display('files_300x250_file_desktop_1');
                                        });
                                    }
                                </script>
<div id="google_ads_iframe_/19238985/files_300x250_file_desktop_1_0__container__" style="border: 0pt none; width: 300px; height: 0px;"></div></div>
</div>
</div>
<script>
                            var CHAT_DATA = {
                                userId: null,
                                phpSessid: '9ec2943be38ec1b81485a61c5596edc86d31d3d3',
                                fullChat: false,
                                apiUrl: "https://files.fm/api/chat/",
                                mainUrl: "https://files.fm/",
                                avatarCache: Date.now(),
                                isOrg: false,
                                translations: {"CHATFM_SEND-BUTTON":"Send","CHATFM_MEMBERS":"Members","CHATFM_TYPE-NEW-MESSAGE":"Write a message","CHATFM_NEW-CONVERSATION-BUTTON":"New conversation","CHATFM_START-NEW-CONVERSATION-BUTTON":"Start a new conversation","CHATFM_GROUP-CHAT-TITLE":"Create a new conversation:","CHATFM_GROUP-CHAT-INPUT":"Type a conversation name","CHATFM_GROUP-CHAT-SELECT":"Select members:","CHATFM_GROUP-CHAT-ACTION-ALL":"Select all","CHATFM_GROUP-CHAT-ACTION-NONE":"Clear","CHATFM_GROUP-CHAT-CREATE-BUTTON":"Create","CHATFM_SELECT-CONVERSATION":"Select conversation or","CHATFM_EMPTY-CHANNELS":"You currently do not have any conversation","CHATFM_CANCEL-BUTTON":"Cancel","CHATFM_REPORT-TITLE":"Report message?","CHATFM_REPORT-BUTTON":"Report","CHATFM_DELETE-TITLE":"Delete message?","CHATFM_DELETE-BUTTON":"Delete","CHATFM_MESSAGE-DELETED":"Message deleted","CHATFM_NEW-ACCOUNT-TITLE":"Create an account to write a message.","CHATFM_SIGN-UP":"Sign up","CHATFM_LOG-IN":"Log in","CHATFM_ERROR":"Something went wrong. Please reload the page and try again.","CHATFM_MESSAGES-LOAD-MORE":"Load more","CHATFM_SYSTEM-MESSAGES":"System messages","CHATFM_SYSTEM-MESSAGE":"System message","CHATFM_NOT_VALID_EMAIL":"Not valid email!","CHATFM_ALREADY_ADDED_TO_WAITINGLIST":"Invitation sent!","CHATFM_ADDED_TO_WAITINGLIST":"Invitation sent!","CHATFM_ALREADY_ADDED_TO_CHANNEL":"Already added!","CHATFM_ADDED_TO_CHANNEL":"Successfully added!","CHATFM_NOT_FROM_ORG":"This email is not registered in the organisation!","CHATFM_ADD_MEMBER_TITLE":"Invite a new member via email to chat","CHATFM_ADD_MEMBER_INPUT":"Email","CHATFM_ADD_MEMBER_BUTTON":"Add","CHATFM_REQUEST_ACCESS_ALREADY_MEMBER":"User is already in this conversation!","CHATFM_REQUEST_ACCESS_NOT_POSSIBLE":"Unable to send request!","CHATFM_REQUEST_ACCESS_SENT":"Request sent!","CHATFM_REQUEST_ACCESS_TITLE":"You don\\'t have access to this conversation.","CHATFM_REQUEST_ACCESS_BUTTON_SEND":"Send access request","CHATFM_REQUEST_ACCESS_BUTTON_BACK":"Back to conversations","CHATFM_YES-BUTTON":"Yes","CHATFM_NO-BUTTON":"No","CHATFM_WAITINGLIST-TITLE":"Waiting list","CHATFM_WAITINGLIST-EMPTY":"Waiting list is empty","CHATFM_WAITINGLIST-DELETE-TITLE":"Cancel invite?","CHATFM_MENTION_DESCRIPTION":"Write @ symbol to send email to user","CHATFM_MEMBER-DELETE-TITLE":"Remove member?","CHATFM_EDIT-NAME-UPDATED":"Successfully updated!","CHATFM_EDIT-NAME-TITLE":"Edit name","CHATFM_EDIT-NAME-INPUT":"Type a conversation name","CHATFM_EDIT-NAME-BUTTON":"Save","CHATFM_CHANNEL-ERROR-BACK-BUTTON":"Back to conversations","CHATFM_CHANNEL-ERROR-NO-ACCESS":"You don\\'t have access to this conversation.","CHATFM_CONTACT-MESSAGE":"To contact Files.fm support, go to the section %link% and send a message.","CHATFM_CONTACT-TITLE":"Contacts"},
                                showMessagesHeader: false,
                                allowAddNewMember: false,
                                allowSendAccessRequest: false,
                                initChannelId: null,
                                initChannelStatus: null,
                                initChannelType: null,
                                initChannelName: null,
                                showWaitinglist: false
                            };
                        </script>
<div id="gallery2__comments" class="gallery2__comments">
<a href="javascript:void(0)" onclick="hideGalleryMessages(); $(window).trigger('resize');" id="gallery2__comments_button_close" class="my_tooltip" my_title="Back to information">
<i class="fas fa-chevron-left"></i>
</a>
<div id="chatfm-app-wrapper">
<div id="chatfm-app" class="chatfm-app"><div class="chatfm"><div class="chatfm__loading"><div class="chatfm-spinner"></div></div></div></div>
</div>
</div>
</div>
<div id="gallery2__content__viewport">
<div id="gallery2__image-wrapper">
<div id="gallery2__swipe-wrapper"><i class="fa fa-spinner fa-spin gallery2__load-spinner"></i></div>
<div id="gallery2__controls_middle">
<div class="gallery2__controls_middle">
<div id="gallery_select_middle" onclick="checkToggleItem(event, $('#item_' + strCurrentFileHash))" class="my_tooltip" my_title="Select to save"><div class="gallery2__controls_middle_icon"></div></div>
<div id="gallery_vote_middle" class="gallery_vote gallery2__header__icon my_tooltip" onclick="voteForFile(strCurrentFileHash)" my_title="Mark as Like">
<div class="gallery2__controls_middle_icon"><span class="vote_count"></span></div>
</div>
<div id="gallery_comments_middle" onclick="if(!bolGallerySidebarVisible) {showGalleryInfo();} showGalleryMessages(); $(window).trigger('resize');" class="my_tooltip" my_title="Add a comment"><div class="gallery2__controls_middle_icon"></div></div>
<div id="gallery_edit_image_middle" class="edit_image gallery2__edit my_tooltip" my_title="Edit image"><div class="gallery2__controls_middle_icon"></div></div>
</div>
<div class="gallery2__controls_middle">
<div id="gallery2__header__zoom" onclick="openPanZoomImage()" class="my_tooltip" my_title="Zoom image preview"><div class="gallery2__controls_middle_icon"></div></div>
<div id="gallery2__header__view-original" onclick="showOrginal(strCurrentFileHash)" class="my_tooltip" my_title="Open original image in full quality"><div class="gallery2__controls_middle_icon"></div></div>
<div id="gallery2__header__fullscreen" onclick="galleryToggleFullScreen(document.body)" class="my_tooltip" my_title="Switch to fullscreen"><div class="gallery2__controls_middle_icon"></div></div>
<div id="gallery2__header__slideshow" onclick="enterSlideshow()" class="my_tooltip" my_title="Slideshow"><div class="gallery2__controls_middle_icon"></div></div>
</div>
</div>
<div id="gallery2__controls_doc_sign">
<span id="gallery2__controls_doc_sign_button">
<a href="javascript:void(0);">
<span>eSign</span>
</a>
</span>
</div>
<div id="gallery2__controls_left">
<a href="javascript:void(0);" id="gallery2__controls__prev" onclick="galleryOpenPrevItem()"></a>
</div>
<div id="gallery2__controls_right">
<a href="javascript:void(0);" id="gallery2__controls__next" onclick="galleryOpenNextItem()"></a>
</div>
</div>
<div id="gallery2__thumb-strip__hide_container">
<a href="javascript:void(0)" id="gallery2__thumb-strip__hide" onclick="toggleThumbs();"></a>
</div>
<div id="gallery2__thumb-strip">
<div id="gallery2__thumb-strip__buttons">
<a href="javascript:void(0)" id="gallery2__thumb-strip__prev" onclick="
                            var intMovementPx = parseInt($('#gallery2__image-wrapper').width()) / 2;
                            if (parseInt($('#gallery2__thumb-strip__inner').css('left')) + intMovementPx > 0) 
                            {
                                $('#gallery2__thumb-strip__inner').css({'left': 0});
                            } 
                            else 
                            {
                                $('#gallery2__thumb-strip__inner').css({'left': parseInt($('#gallery2__thumb-strip__inner').css('left')) + intMovementPx});
                            }; 
                            galleryLazyloadRecalc();">
</a>
<a href="javascript:void(0)" id="gallery2__thumb-strip__next" onclick="
                            var intMovementPx = parseInt($('#gallery2__image-wrapper').width()) / 2;
                            if (parseInt($('#gallery2__image-wrapper').width()) - parseInt($('#gallery2__thumb-strip__inner').width()) > parseInt($('#gallery2__thumb-strip__inner').css('left')) - intMovementPx) 
                            {
                                $('#gallery2__thumb-strip__inner').css({'left': parseInt($('#gallery2__image-wrapper').width()) - parseInt($('#gallery2__thumb-strip__inner').width())})
                            } 
                            else 
                            {
                                $('#gallery2__thumb-strip__inner').css({'left': parseInt($('#gallery2__thumb-strip__inner').css('left')) - intMovementPx})
                            };
                            galleryLazyloadRecalc();">
</a>
</div>
<div id="gallery2__thumb-strip__inner" style="width: 0; left: 0;">
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
    
    var bolStartAudioOnOpen = false;    
    var bolHashtagViewUseSemicolon = false;
	
	var bolGalleryIsVisible = false;
    var bolGallerySidebarVisible = false;
    var bolGalleryCommentsVisible = false;

	var intPreloadImagesCount = 1;
	var intPreloadThumbnailsCount = 2;
    
    var bolUseAsyncFileInfoDataLoad = false;
    var intPreloadFileInfoDataCount = 1;
	
    var strLinkToView = 'https://files.fm/u/2fq5c8j3mr';
    var strGalleryCloseHashtag = '';
	
    var intCurrentFileIndex = null;
    var strCurrentFileHash = null;
    var strCurrentFileName = null;
    
    var intNextIndex = null;
    var intPreviousIndex = null;
    
    var intThumbWidth = 110;
    
    var jqThumbViewport = null;
    var jqThumbContainer = null;

    var jqMainSlider = null;
    
    var objVideoIsLoading = {};

    var resVideoCheckInterval = null;

    var bolHaveToRedrawGallery = false;
    
    
    var bolIsOwner = Boolean();
    var bolCanEdit = Boolean(); 
    var bolCanDelete = Boolean(); 
    
    var bolCloseGalleryIfHashRemoved = false;
    
    var objMainShareParams = null;

    var arrMOVsWithH264Hashes = [];

    var strFolderName = null;
    
    var bolIsiOSDevice = window.navigator.userAgent.match(/(iPod|iPhone|iPad)/) && window.navigator.userAgent.match(/AppleWebKit/);
    
    var bolIsListViewForSpecificFile = Boolean(0);
    
    var objEmbedPlayerFileEventCallback = {};
    
    var strActiveCommentsEntityHash = "";

    var bolPopupOnlyGallery = false;
    
    var bolOpenGalleryCommentsBlock = false;

            var strSlideshowInterval = null;
        var strSlideshowUserActive = null;
        var bolActivateSlideshowOnOpen = false;
    
    var strPublicProfileHref = '';
    if ( typeof strUploadUserNameHref != 'undefined' && strUploadUserNameHref != '' )
    {
        strPublicProfileHref =  '/' + strUploadUserNameHref;
    }
    else if ( typeof PublicProfile != 'undefined' && typeof PublicProfile.strProfileName != 'undefined' )
    {
        strPublicProfileHref = '/' + PublicProfile.strProfileName;
    }

    function browserSupportsCanvas() {
        var elem = document.createElement('canvas');
        return !!(elem.getContext && elem.getContext('2d'));
    }

    window.addEventListener('message', function(data)
    {
        if ( data.data === "info" )
        {
            showGalleryInfo();
        }
    }, false);

        objMainShareParams = {"show_type_select":false,"type":"all_files","can_share":false,"all_files":{"view_url":"https:\/\/files.fm\/u\/2fq5c8j3mr","edit_url":"","upload_url":"","facebook":{"name":"Desktop 2024.08.06 - 19.03.46.03.mp4","picture_url":"https:\/\/files.fm\/images\/files.fm_300.png","description":"https:\/\/files.fm\/u\/2fq5c8j3mr","link":"https:\/\/files.fm\/u\/2fq5c8j3mr","return_link":"https:\/\/files.fm\/u\/2fq5c8j3mr?after_fb_share"},"twitter":{"text":"files.fm: Desktop 2024.08.06 - 19.03.46.03.mp4","link":"https:\/\/files.fm\/u\/2fq5c8j3mr"},"share_email":{"upload_hash":"2fq5c8j3mr","file_view_hash":""},"item_info":{"upload_hash":"2fq5c8j3mr","item_name":"Desktop 2024.08.06 - 19.03.46.03.mp4"}}};
    
    
        strFolderName = "Desktop 2024.08.06 - 19.03.46.03.mp4";
        
    var bolUseEmbedPlayer = WEBRTC_SUPPORT && (window.navigator.userAgent.indexOf("Edge") == -1);
    var viewItemIsDeleted = 1;

    var bolGalleryInitalizedState = null;
    function galleryInitalize()
    {
    	bolGalleryInitalizedState = 0;
    	
    	if( viewItemIsDeleted )
    	{
    				return;
    			}
    	
    	if ( bolIsListViewForSpecificFile )
        {
            $( '#gallery2' ).addClass( 'list_for_specific_file' );
        }

        $('body').append('<div id="gallery_panzoomdiv" style="overflow:hidden;height:100%;width:100%;position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 999999999; background: #666666; display: none;" height="100%" width="100%"></div>')

        window.oncontextmenu = function( event )
        {
            if (
                    $( event.target ).parents( '.gallery2__item' ).length
                    || $( event.target ).parents( '#gallery2__thumb-strip' ).length
                )
            {
                // Disabling the context menu for thumbnails
                event.preventDefault();
                event.stopPropagation();
                return false;
            }
        }

        $('.edit_wrapper_edit_button').click(function() {
            $(this).parent().find("textarea").focus();
        });

        $('#file_description_edit_wrapper textarea').on("keyup change", function(e) {
            autoGrow( this, '32px' );
            if ( bolIsOwner )
            {
                updateFileDescription();
            }
        });

        $('#file_name_edit_wrapper textarea').on("keyup", function(e) {
            $('#file_name_edit_wrapper textarea').removeClass('pulse');
            autoGrow( this, '32px' );
        });
        $('#file_name_edit_wrapper textarea').on("change", function(e) {
            $('#file_name_edit_wrapper textarea').removeClass('pulse');
            autoGrow( this, '32px' );
            if ( bolIsOwner )
            {
                updateFileName();
            }
        });
        
        $('#file_name_edit_wrapper textarea').keypress(function(event) {
            if (event.keyCode == 13) {
                event.preventDefault();
            }
        });

        $('#file_name_edit_wrapper textarea').on("focus", function(e) {
            var strFullName = $('#file_name_edit_wrapper textarea').val();
            var strExtension = '.' + arrExtensions[ intCurrentFileIndex ];
            var intIndex = strFullName.lastIndexOf(strExtension);
            strFullName = strFullName.slice(0, intIndex) + strFullName.slice(intIndex).replace(strExtension, '');

            $('#file_name_edit_wrapper textarea').val(strFullName);
        } )

        $('#file_name_edit_wrapper textarea').on("focusout", function(e) {
            $('#file_name_edit_wrapper textarea').removeClass('pulse');
        	$('#file_name_edit_wrapper textarea').val( $('#file_name_edit_wrapper textarea').val() + '.' + arrExtensions[ intCurrentFileIndex ] );
        } )


        $('#file_description_edit_wrapper textarea').on("focus", function(e) {

            $( "#file_description_edit_wrapper" ).removeClass("no-description");
        } )

        $('#file_description_edit_wrapper textarea').on("focusout", function(e) {
            if ( $('#file_description_edit_wrapper textarea').val() == '' )
            {
            	$( "#file_description_edit_wrapper" ).addClass("no-description");
            }
            else
            {
            	$( "#file_description_edit_wrapper" ).removeClass("no-description");
            }
        } )

        if ( bolIsOwner )
        {
            $('#gallery2__header__setprice').show();
        }

		if ( ! bolHideShareButtons )
		{
	        $('#gallery2__share').show();
		}
        
		if (arrHashes.length == 1)
		{
			hideThumbs();
            $('#gallery2__slideshow_middle, #gallery2__slideshow, #gallery2__header__slideshow').hide();
		}
		
		$('#gallery_file_tags_container .file_tags_input').tagsInput(
		{
			'autocomplete_url': './ajax/file_tag.php?autocomplete&PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3' ,
			'autocomplete': { selectFirst:false, autoFill:false},
			'height' : 'auto',
			'width' : '100%',
            'interactive' : bolIsOwner || ( window.location.href.indexOf( "filebrowser" ) !== -1 && 0 ),
			'defaultText' : 'Add tags',
			'onAddTag' : function(strTagName) 
			{
				$('#gallery_file_tags_container .file_tags_error').hide();
				
				$.ajax({
					type: "POST",
					dataType: "json",
					url: "./ajax/file_tag.php?PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3",
					data: 
					{
						'add_file_tag': true ,
						'file_hash' : strCurrentFileHash ,
						'tag_name': strTagName
					} ,
					success: function(data)
					{
						if (data['status'] == 'ok')
						{
							var intItemIndex = getItemIndex(strCurrentFileHash);
							arrTags[intItemIndex] += ';' + strTagName;
							// update tags in filebrowser
                            $('#sidebar_file_tags_container .file_tags_input').importTags(typeof arrTags[intItemIndex] === "undefined" ? "" : arrTags[intItemIndex]);
						}
						else
						{
							$('#gallery_file_tags_container .file_tags_error').show();
						}
					} ,
					error: function()
					{
						$('#gallery_file_tags_container .file_tags_error').show();
					}
				});
			} ,
			'onRemoveTag' : function(strTagName)
			{
				$('#gallery_file_tags_container .file_tags_error').hide();

				$.ajax({
					type: "POST",
					dataType: "json",
					url: "./ajax/file_tag.php?PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3",
					data: 
					{
						'delete_file_tag': true ,
						'file_hash' : strCurrentFileHash ,
						'tag_name': strTagName
					} ,
					success: function(data)
					{
						if (data['status'] == 'ok')
						{
							var intItemIndex = getItemIndex(strCurrentFileHash);
							arrTags[intItemIndex] = arrTags[intItemIndex].replace(strTagName, '');
							// update tags in filebrowser
                            $('#sidebar_file_tags_container .file_tags_input').importTags(typeof arrTags[intItemIndex] === "undefined" ? "" : arrTags[intItemIndex]);
						}
						else
						{
							$('#gallery_file_tags_container .file_tags_error').show();
						}
					} ,
					error: function()
					{
						$('#gallery_file_tags_container .file_tags_error').show();
					}
				});
			} ,
            'onSearchTag' : function(strTagName)
            {
                if ( typeof strUploadUserNameHref != 'undefined' && strUploadUserNameHref != '' )
                {
                    window.open('/' + strUploadUserNameHref + '#search='+  strTagName, '_self');
                }
                else if ( typeof PublicProfile != 'undefined' && typeof PublicProfile.strProfileName != 'undefined' )
                {
                    window.open('/' + PublicProfile.strProfileName + '#search='+  strTagName, '_self');
                }
            } ,
			'delimiter' : [';'] ,
			'removeWithBackspace' : false ,
			'minChars' : 1 ,
			'maxChars' : 245 ,
			'placeholderColor' : '#666666'
		});


        $('#gallery_file_tags_container .file_tags_input')

        if (( typeof strUploadUserNameHref != 'undefined' && strUploadUserNameHref != '' ) ||
            ( typeof PublicProfile != 'undefined' && typeof PublicProfile.strProfileName != 'undefined' ))
        {
            $('#gallery_file_tags_container .tagsinput').addClass('searchable');
        }
        else
        {
            $('#gallery_file_tags_container .tagsinput').removeClass('searchable');
        }

		function getFileShareParams()
        {
            if ( objMainShareParams )
            {
                var intItemIndex = getItemIndex( strCurrentFileHash );
    
                var objFileShareParams = {};
                for ( idx in objMainShareParams )
                {
                    objFileShareParams[ idx ] = objMainShareParams[ idx ];
                }
    
                if ( typeof( arrFileShareLinks ) != 'undefined' && typeof( arrFileShareLinks[ intItemIndex ] ) != 'undefined' )
                {
                    objFileShareParams[ 'view_url' ] = 'https://files.fm' + arrFileShareLinks[ intItemIndex ];
                }
                else
                {
                    objFileShareParams[ 'view_url' ] += '#/view/' + arrHashes[ intItemIndex ];
                }
    
                objFileShareParams[ 'can_share' ] = bolIsOwner;
                
                objFileShareParams[ 'show_type_select' ] = false;
                objFileShareParams[ 'type' ] = 'one_file';
                
                var strFileShareParams_PictureUrl = '';
                if ( arrFileTypes[ intItemIndex ] == 'image' )
                {
                    strFileShareParams_PictureUrl = 'https://files.fm/thumb_show.php?i=' + arrHashes[ intItemIndex ] + '&view&v=1&PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3';
                }
    
                var strFileViewLink = 'https://files.fm/f/' + strCurrentFileHash;

                var strFileEditLink = '';
                
                if ( bolCanDelete && typeof arrFileDeleteKeys != 'undefined' && arrFileDeleteKeys[ intItemIndex ] != '' )
                {
                	strFileEditLink = strFileViewLink + '?fk=' + arrFileDeleteKeys[ intItemIndex ];
                }

                var intVersion = 0;
                if ( typeof( arrFileVersion ) != 'undefined' && typeof( arrFileVersion[ intItemIndex ] ) != 'undefined' && arrFileVersion[ intItemIndex ] > 0 )
                {
                    intVersion = arrFileVersion[ intItemIndex ];
                }
    
                objFileShareParams[ 'one_file' ] = {
                    'view_url': strFileViewLink,
                    'edit_url': strFileEditLink,
                    'facebook': {
                        'name': strFileViewLink,
                        'picture_url': strFileShareParams_PictureUrl,
                        'description': strFileViewLink,
                        'link': strFileViewLink,
                        'return_link': objFileShareParams[ 'all_files' ][ 'facebook' ][ 'return_link' ]
                    },
                    'twitter': {
                        'text': DOMAIN_NAME + ': ',
                        'link': strFileViewLink
                    },
                    'share_email': {
                        'upload_hash': '',
                        'file_view_hash': strCurrentFileHash
                    },
                    'embed_player': {
                        'file_view_hash': null
                    },
                    'item_info': {
                    	'file_view_hash': strCurrentFileHash,
                    	'upload_hash': objFileShareParams[ 'all_files' ][ 'share_email' ][ 'upload_hash' ],
                    	'file_name': arrDisplayNames[ intItemIndex ],
                        'item_name': arrDisplayNames[ intItemIndex ],
                        'extension': arrExtensions[ intItemIndex ],
                        'file_version': intVersion,
                        'owner_logged_in': bolIsOwner,
                        'access_type': ( typeof arrFileAccessTypes != 'undefined' ? arrFileAccessTypes[ intItemIndex ] : '' ),
                        'parent_access_type': arrAccessType[ intItemIndex ]
                    }
                };
    
                if (
                        arrFeeDownloadPrice[ intItemIndex ] == null && 
                        ! currentFolderHasFeeDownload( intItemIndex ) &&
                        arrAllowDownload[ intItemIndex ] && 
                        ( arrAccessType[ intItemIndex ] == 'LINK' || arrAccessType[ intItemIndex ] == 'PUBLIC' ) && 
                        arrUploadPassword[ intItemIndex ] == '' && 
                        arrAllowPublicDownload[ intItemIndex ]
                    )
                {
                    objFileShareParams[ 'one_file' ][ 'embed_player' ] = {
                        'file_view_hash': strCurrentFileHash,
                        'file_extension': arrExtensions[ intItemIndex ],
                        'is_video': arrIsVideo[ intItemIndex ]
                    }
                }
    
                return objFileShareParams;
            }
            
            return null;
        }
        
        window.galleryGetFileShareParams = getFileShareParams;
    
        $( document ).on( 'click', '#gallery2__share', function ( e )
        {
            var objFileShareParams = getFileShareParams();
            if ( objFileShareParams !== null )
            {
                showSharePopup( e, objFileShareParams );
            }
        } );

        $( document ).on( 'click', '#gallery2__sign, #gallery2__sign_main, #gallery2__controls_doc_sign_button, #gallery2__left_info-button_sign', function ( e )
        {
        	if ( bolCanEdit )
        	{
	        	objEparakstsFileSigningForm.showForm( [ strCurrentFileHash ] );
        	}
	        else 
	        {
	        	fError( 'This link is for viewing the document only. To sign, please ask the file owner to send a link to edit the file - from the e-signature form.', 'Warning!' );
	        }
        } );

        
        
        $( document ).on( 'click', '.gallery2__edit', function ( e )
        {
            if ( canOpenFileInEditor( 'edit', arrExtensions[ intCurrentFileIndex ] ) )
            {
                                                        showCreateAccount();
                            }
            else
            {
                showImageEditorIframe( strCurrentFileHash, true,  );
            }
        } );

        $( document ).on( 'click', '.gallery2__edit_in_google', function ()
        {
            if (
                    [ 'doc','docx','xls','xlsx','ppt','pptx' ].includes( arrExtensions[ intCurrentFileIndex ] )
                    && true                )
            {
                                    
                    showCreateAccount();
                            }
        } );

                    $( document ).on( 'click', '.gallery2__button__buy-products', function ( e )
            {
                window.open( '/c/' + strUploadHash + '?h=' + strCurrentFileHash, '_blank' );
            } );
            $( document ).on( 'click', '.print_or_buy_popup__products', function ( e )
            {
                window.open( '/c/' + strUploadHash + '?h=' + strCurrentFileHash, '_blank' );
            } );
        
        $( document ).on( 'contextmenu', 'video', function ( e )
        {
        	e.preventDefault();
        } );
        
    
        $( document ).on( 'click', '#gallery2__sidebar__info_embed_button, #gallery2__sidebar__info_embed_button_middle', function ( e )
        {
            var objFileShareParams = getFileShareParams();
            
            if ( objFileShareParams !== null )
            {
                window.FileEmbedPopup.showPopup( e, objFileShareParams );
            }
        } );

        $( document ).on( 'click', '#copy_button_middle, #copy_button_left', function ( e )
        {
            var el = document.createElement( 'textarea' );
            el.value = $(this).prev().find( 'input' ).val();
            document.body.appendChild( el );
            el.select();
            document.execCommand( 'copy' );
            document.body.removeChild( el );

            $(this).addClass( 'copied' ).delay( 4000 ).queue( function( next )
            {
                $( this ).removeClass( 'copied' );
                next();
            } );
        } );
    
    
        $(window).resize(function() {

			if (!bolGalleryIsVisible)
			{
				bolHaveToRedrawGallery = true;
			}
			else
			{
    	    	recalculateGalleryForBanner(true);
			}
		});

                    $(window).mousemove(function() {
                if($('#gallery2__content-wrapper').hasClass( 'gallery__slideshow' )){
                    $('#gallery2__content-wrapper').addClass( 'gallery__slideshow_user_active' );
                    clearTimeout(strSlideshowUserActive);
                    strSlideshowUserActive = setTimeout(removeActiveClass, 1000);
                }
            });
        
		// Check video network state, if loading longer than 1+1 intervals, show thumbnail generation message
		var bolHasVideo = false;
		for ( idx in arrFileTypes)
		{
			if ( arrFileTypes[idx] == 'video' )
			{
				bolHasVideo = true;
			}
		}

		if (bolHasVideo)
		{
			if ( resVideoCheckInterval != null)
			{
				clearInterval(resVideoCheckInterval);
				resVideoCheckInterval = null;
			}
			
			resVideoCheckInterval = setInterval(function () {
				for ( idx in arrFileTypes)
				{
					if ( arrFileTypes[idx] == 'video' )
					{
						var domVideo = document.getElementById('video_' + arrHashes[idx]);
                        
						if ( domVideo )
						{
						    // iOS safari workaround - "play" gets fired when the play button is clicked => set video as loading
                            if(bolIsiOSDevice)
                            {
                                domVideo.addEventListener('play', function ()
                                {
                                    objVideoIsLoading[idx] = true;
                                });
                            }
                            
							var bolIsLoading = bolIsiOSDevice ? objVideoIsLoading[idx] : false;
                                    // iOS safari workaround: video has stopped loading when its duration attribute is > 0
                                    if (domVideo.duration > 0 && bolIsiOSDevice) 
                                    {
                                        bolIsLoading = false;
                                    }
                                    // If network connection active (2=NETWORK_LOADING) - this is broken in iOS safari
                                    else if (domVideo.networkState == 2)	
									{
										bolIsLoading = true;
									}									

							if ( bolIsLoading )
							{
								if (objVideoIsLoading[idx] == true)
								{
									$('#video_thumb_gen_'+ arrHashes[idx]).css({'visibility':'visible'});
								}
								objVideoIsLoading[idx] = true;
							}
							else if ( objVideoIsLoading[idx] )
							{
								objVideoIsLoading[idx] = false;
								$('.video_thumb_gen').css({'visibility':'hidden'});
							}
						}
					}
				}
			}, 3000);
		}

        // Close in item main element click
        $( '#gallery2' ).on( 'bx_slider_click', '.bx-viewport', function( e, domElement ){
            if ( $(domElement).hasClass('gallery2__item') )
            {
                closeGallery(strCurrentFileHash);
            }
        });

		bolGalleryInitalizedState = 1;
    }

    $(function (){
    	if ( bolGalleryInitalizedState === null )
    	{
    		galleryInitalize();
		}
	});

    $(document).on( "fullscreenchange", function () {
        adjustContentWidth( true );
    } );
    
	$(document).on("keydown", function(evt) {
        if (evt.altKey || evt.ctrlKey || evt.metaKey || $(evt.target).is(":input"))
        { 
            return; 
        }
        
        if ( ! bolGalleryIsVisible )
        {
        	return;	
		}
		
		if( 0)
        {
            return;
        }
        
        var key = evt.keyCode;
    
        if (key == 37 )
        {
            galleryOpenPrevItem();
        }
        else if (key == 39)
        {
        	galleryOpenNextItem();
		}
        else if (key == 27)
        {
        	closeGallery(strCurrentFileHash);
        }
    });
    
    function autoGrow( element, strMinHeight )
    {
        if( typeof strMinHeight === "undefined" )
        {
            strMinHeight = '32px';
        }
        
        element.style.height = strMinHeight;
        element.style.height = element.scrollHeight + "px";
        element.style.height = element.scrollHeight + 5 + "px";
    }
	
    function galleryCalculateOffset(el) {
	    var rect = el.getBoundingClientRect(),
	    scrollLeft = window.pageXOffset || document.documentElement.scrollLeft,
	    scrollTop = window.pageYOffset || document.documentElement.scrollTop;
	    return { top: rect.top + scrollTop, left: rect.left + scrollLeft }
	}
    
	window.getImageCountText = function() {
        return ( parseInt( intCurrentFileIndex ) + 1 ) + '/' + arrIDs.length;
    };

    function checkThumbStripArrows()
    {
        if ( parseInt( $('#gallery2__thumb-strip__inner').width() ) >  parseInt( $('#gallery2__thumb-strip').width() ) )
        {
            $('#gallery2__thumb-strip__buttons').show();
        }
        else
        {
            $('#gallery2__thumb-strip__buttons').hide();
        }
    }

    var bolHideShareButtons = false;
	var bolGalleryIsShowingItem = false;
    var clickedItemHash = null;
    function showGalleryItem( strHash )
    {
        if (arrHashes.length == 1)
		{
    		hideThumbs();
            $('#gallery2__slideshow_middle, #gallery2__slideshow, #gallery2__header__slideshow').hide();
		}
        else
        {
            showThumbs();
            $('#gallery2__slideshow_middle, #gallery2__slideshow, #gallery2__header__slideshow').show();
        }

		
        clickedItemHash = strHash;
		if ( bolGalleryIsShowingItem )
		{
			return;
		}
		bolGalleryIsShowingItem = true;

        var bolSimpleDownloadAllowed = false;

    	strCurrentFileHash = strHash;

        intCurrentFileIndex = getItemIndex ( strHash );
        strCurrentFileName = arrDisplayNames[intCurrentFileIndex];

        preloadImage( intCurrentFileIndex );
        preloadFileInfoData( intCurrentFileIndex );

		if ( ! bolGalleryIsVisible )
		{
			showGallery();
		}

		stopActiveContent();


		checkBeforeContentChange ();

        jqMainSlider.goToSlide( intCurrentFileIndex );
        checkAfterContentChange();

        if ($('#share_popup').is(":visible"))
        {
            hideSharePopup();
        }

        if ( typeof window.FileEmbedPopup !== 'undefined' )
        {
            window.FileEmbedPopup.hidePopup();
        }

        if ( arrFileTypes[intCurrentFileIndex] == 'image' && arrFeeDownloadPrice[intCurrentFileIndex] == null && ! currentFolderHasFeeDownload( intCurrentFileIndex ) )
        {
            $('#gallery2__header__view-original').show();
        }
        else
        {
            $('#gallery2__header__view-original').hide();
        }

        $('.gallery2__header__img-count').text( window.getImageCountText() );


		if (arrAllowDownload[intCurrentFileIndex] && ( typeof(bolHideDownloadButtons) === 'undefined' || ! bolHideDownloadButtons ) && ( typeof(arrHideDownloadButtons) === 'undefined' || ! arrHideDownloadButtons[intCurrentFileIndex] ))
		{
            bolSimpleDownloadAllowed = true;
			$('.gallery2__save_button').show();
			$('#gallery2__sidebar__info_embed_button, #gallery2__sidebar__info_embed_button_middle').show();
			$('#gallery2__share').show();
		}
		else
		{
            bolSimpleDownloadAllowed = false;
			$('.gallery2__save_button').hide();
			$('#gallery2__sidebar__info_embed_button, #gallery2__sidebar__info_embed_button_middle').hide();
			$('#gallery2__share').hide();
		}


        if ( !arrFileAttributes[ intCurrentFileIndex ][ 'readOnly' ] && bolCanDelete )
        {
            $('#gallery2__item_info_delete, #gallery2__item_info_delete_middle').css('display', 'flex');
        }
        else
        {
            $('#gallery2__item_info_delete, #gallery2__item_info_delete_middle').hide();
        }

        if( canSetAsThumb( strHash ) )
        {
            $('#gallery2__item_info_cover, #gallery2__item_info_cover_middle').show();
        }
        else
        {
            $('#gallery2__item_info_cover, #gallery2__item_info_cover_middle').hide();
        }
        


        $( '#gallery2__left_info__signers-list-container' ).hide();

        
        if (
            	bolCanEdit 
            	&& 
            	( 
                	typeof arrFileIsLockedByOtherUser == 'undefined' 
                	|| ! arrFileIsLockedByOtherUser[ intCurrentFileIndex ]
            	) 
        	)
        {
            $( '#gallery2__left_info-button_sign' ).show();
            $('#gallery2__sign').css('display', 'flex');

            if (
				arrExtensions[intCurrentFileIndex] == 'edoc'
				|| arrExtensions[intCurrentFileIndex] == 'pdf'
				|| arrExtensions[intCurrentFileIndex] == 'doc'
				|| arrExtensions[intCurrentFileIndex] == 'docx'
				|| arrExtensions[intCurrentFileIndex] == 'txt'
				|| arrExtensions[intCurrentFileIndex] == 'asice'
			)
		    {
                $('#gallery2__sign_main').css('display', 'flex');
                $('#gallery2__controls_doc_sign').addClass('document');
            }
            else
            {
                
                $('#gallery2__sign_main').hide();
                $('#gallery2__controls_doc_sign').removeClass('document');
            }
        }
        else
        {
            $( '#gallery2__left_info-button_sign' ).hide();
            $( '#gallery2__sign' ).hide();
            $('#gallery2__sign_main').hide();
            $('#gallery2__controls_doc_sign').removeClass('document');
        }

                
        

        $( '#gallery_edit_image_middle' ).hide();
        if ( bolCanEdit )
        {
            if ( canOpenFileInEditor( 'edit', arrExtensions[ intCurrentFileIndex ] ) )
            {
                $( '#gallery2__item_info_edit' )
                    .removeClass( 'edit_image' )
                    .text( 'Edit file' );
				
				$( '#gallery2__header__mid #gallery2__edit' )
                    .removeClass( 'edit_image' )
                    .find( '#gallery2__edit_button span' )
                        .text( 'Edit' );
                
                $( '.gallery2__edit' ).show();
            }
            else if ( canOpenImageInEditor( arrExtensions[ intCurrentFileIndex ] ) )
            {
                $( '#gallery2__item_info_edit' )
                    .addClass( 'edit_image' )
                    .text( 'Edit image' );

                $( '#gallery2__header__mid #gallery2__edit' )
                    .addClass( 'edit_image' )
                    .find( '#gallery2__edit_button span' )
                        .text( 'Edit image' );

                $( '.gallery2__edit' ).show();
                $( '#gallery_edit_image_middle' ).show();
            }
            else 
            {
                $( '.gallery2__edit' ).hide();
            }

            if (
                    [ 'doc','docx','xls','xlsx','ppt','pptx' ].includes( arrExtensions[ intCurrentFileIndex ] )
                    && true                )
            {
                $( '.gallery2__edit_in_google' ).show();
            }
            else
            {
                $( '.gallery2__edit_in_google' ).hide();
            }
        }
        else
        {
            $( '.gallery2__edit' ).hide();
            $( '.gallery2__edit_in_google' ).hide();
        }


        $( '#gallery2__item_info_replace_middle' ).hide();
                
        
        $( '.gallery2__button__buy-products' ).hide();
		        if ( canOrderProductGeneral( strCurrentFileHash ) || arrFileHasProductSelling[ intCurrentFileIndex ] == 1 )
        {
            $( '.gallery2__button__buy-products' ).show();
            if( arrFileHasProductSelling[ intCurrentFileIndex ] != 1 )
            {
                $( '#gallery2__buyproducts' ).hide();
            }
        }
                

        if( window.location.href.indexOf("filebrowser") === -1 && typeof arrReports != 'undefined' && typeof arrStatuses != 'undefined' && ! [3, 4].includes(arrStatuses[ intCurrentFileIndex ]) &&
            ( 
                typeof arrFileIsLockedByOtherUser == 'undefined' 
                || ! arrFileIsLockedByOtherUser[ intCurrentFileIndex ]
            )
        ) 
        {
            $( '.gallery2__report_button' ).show();
    
            if (arrReports[ intCurrentFileIndex ] == 0)
            {
                $( '.gallery2__report_button' ).click(function() {
                    showFileReportModal(this, strCurrentFileHash);
                });
            }
            else 
            {
                $( '.gallery2__report_button' ).click(function() {
                    showCancelFileReportModal(this, strCurrentFileHash);
                });
            }
            
        }
        else
        {
            $( '.gallery2__report_button' ).hide();
        }

        if (
                arrFileTypes[ intCurrentFileIndex ] === 'document'
                && 
                (
                    arrExtensions[ intCurrentFileIndex ] === 'pdf' 
                    || arrExtensions[ intCurrentFileIndex ] === 'odt' 
                    || arrExtensions[ intCurrentFileIndex ] === 'ods' 
                    || arrExtensions[ intCurrentFileIndex ] === 'odp'  
                    || isFileConvertable( 'pdf', intCurrentFileIndex )
                ) 
                && arrFeeDownloadPrice[ intCurrentFileIndex ] == null 
                && ! currentFolderHasFeeDownload( intCurrentFileIndex )
                && arrAllowDownload[ intCurrentFileIndex ] 
            )
        {
            $( "#gallery2__controls_left" ).css( {
                'margin-top': '32px',
                'height': 'calc(100% - 50px)'
            } );
            
            $( "#gallery2__controls_right" ).css( {
                'right': '15px',
                'margin-top': '32px',    
                'height': 'calc(100% - 50px)'
            } );
        }
        else
        {
            $( "#gallery2__controls_right" ).css( {
                'right': '0',
                'margin-top': '32px',
                'height': 'calc(100% - 50px)'
                
            } );
    
            $( "#gallery2__controls_left" ).css( {
                'margin-top': '32px',
                'height': 'calc(100% - 50px)'
            } );
        }

        if ( arrFileTypes[ intCurrentFileIndex ] !== 'image' )
        {
            $('#gallery2__controls_middle').removeClass('image');
            $('#gallery2__controls_zoom').css('display', 'none');
            $('#gallery2__content-wrapper').removeClass( 'gallery__only_image' );
            $('#gallery2__content-wrapper').removeClass( 'gallery__is_image' );
        }
        else
        {
            $('#gallery2__controls_middle').addClass('image');
            $('#gallery2__controls_zoom').css('display', 'block');
            $('#gallery2__content-wrapper').addClass( 'gallery__is_image' );
        }
        
        if ( arrFileTypes[ intCurrentFileIndex ] !== 'audio' )
        {
            $('#gallery2__header__fullscreen').show();
        }
        else
        {
            $('#gallery2__header__fullscreen').hide();
        }

        $('.gallery2__video_filename-download .gallery2__save_button').show();
        
        
        if (bolIsOwner)
        {
            $("#gallery2__buyfile").attr("onclick", "showSetPriceFormModal(strCurrentFileHash)");

                            $("#gallery2__buyall").attr("onclick", "showSetPriceFormModal(strUploadHash, 'folder')");
                        
            $(".print_or_buy_popup__buyfile").attr("onclick", "showSetPriceFormModal(strCurrentFileHash)");
        }
        else 
        {
            $("#gallery2__buyfile").attr("onclick", "showBuyFileFormModal(strCurrentFileHash)");
            
                            $("#gallery2__buyall").attr("onclick", "showBuyFileFormModal(strUploadHash, 'folder')");
            
            $(".print_or_buy_popup__buyfile").attr("onclick", "showBuyFileFormModal(strCurrentFileHash)");
        }

		// spec for public profile -> fee file count can be dynamic, assume it is > 0
        		
			if ( arrFeeDownloadPrice[ intCurrentFileIndex ] != null )
			{
				$( '.gallery2__buy_button' ).css( 'display', 'flex' );
                $( '.gallery2__save_button' ).hide();
                
                if ( bolIsOwner )
                {
                    $( '#gallery2__buyfile' ).show();
                    $( '#gallery2__buyall' ).hide();
                    $( '#gallery2__buyfile span.text' ).html('Change price');
                    $( '#gallery2__buyfile span.price' ).html(arrFeeDownloadPrice[ intCurrentFileIndex ] + ' $');
                    $( '#gallery2__buyall span.price' ).html('');
                    $( '.print_or_buy_popup__buyfile' ).show();
                    $( '.print_or_buy_popup__buyfile span.text' ).html('Change price');
                    $( '.print_or_buy_popup__buyfile span.price' ).html(arrFeeDownloadPrice[ intCurrentFileIndex ] + ' $');
                }
                else 
                {
                    $( '#gallery2__buyfile' ).hide();
                    $( '#gallery2__buyall' ).hide();
                    $( '.print_or_buy_popup__buyfile' ).hide();
                }
			}
			else if ( currentFolderHasFeeDownload( intCurrentFileIndex ) )
			{
    			$( '.gallery2__buy_button' ).hide();
    			$( '.gallery2__save_button' ).hide();
                if ( bolIsOwner )
                {
                    $( '#gallery2__buyfile span.text' ).html('Sell file');
                    $( '#gallery2__buyfile span.price' ).html('');
                    $( '#gallery2__buyfile' ).hide();
                    $( '#gallery2__buyall' ).hide();
                    
                    $( '.print_or_buy_popup__buyfile span.text' ).html('Sell file');
                    $( '.print_or_buy_popup__buyfile span.price' ).html('');
                    $( '.print_or_buy_popup__buyfile' ).hide();
                }
                else 
                {
                    $( '#gallery2__buyall' ).show();
                    $( '#gallery2__buyall span.price' ).html('0' + ' $');
                
                    $( '#gallery2__buyfile' ).hide();
                  
                    $( '.print_or_buy_popup__buyfile' ).hide();
                }
			}
			else 
    		{
    			$( '.gallery2__buy_button' ).hide();
    			$( '.gallery2__save_button' ).show();
    
                if ( typeof bolHideDownloadButtons != 'undefined' && bolHideDownloadButtons )
                {
                    $( '.gallery2__save_button' ).hide();
                }
    
                if ( bolIsOwner )
                {
                    $( '#gallery2__buyfile span.text' ).html('Sell file');
                    $( '#gallery2__buyfile span.price' ).html('');
                    $( '#gallery2__buyfile' ).hide();
                    $( '#gallery2__buyall' ).hide();
                    $( '.print_or_buy_popup__buyfile span.text' ).html('Sell file');
                    $( '.print_or_buy_popup__buyfile span.price' ).html('');
                    $( '.print_or_buy_popup__buyfile' ).hide();
                }
                else 
                {
                    $( '#gallery2__buyfile' ).hide();
                    $( '#gallery2__buyall' ).hide();
                    $( '.print_or_buy_popup__buyfile' ).hide();
                }
    		}
    		
				
		if (
				(arrExtensions[intCurrentFileIndex] == 'png' || arrExtensions[intCurrentFileIndex] == 'jpg' || arrExtensions[intCurrentFileIndex] == 'jpge')
				&& arrFeeDownloadPrice[intCurrentFileIndex] == null
				&& ! currentFolderHasFeeDownload( intCurrentFileIndex )
				&& bolSimpleDownloadAllowed
			)
		{
			$('#gallery2__item_info_order').show();
			$('#gallery2__order').css({display: 'flex'});

                        
                        if ( arrFileHasProductSelling[ intCurrentFileIndex ] == 1 )
            {
                $('#gallery2__order').hide();
                $('#gallery2__item_info_order').hide();
            }
            		}
		else
		{
			$('#gallery2__item_info_order').hide();
			$('#gallery2__order').hide();
		}

		if (intCurrentFileIndex == 0)
		{
			$('#gallery2__controls_left').hide();
		}
		else 
		{
			$('#gallery2__controls_left').show();
		}

		if (intCurrentFileIndex == arrIDs.length - 1)
		{
			$('#gallery2__controls_right').hide();
		}
		else 
		{
			$('#gallery2__controls_right').show();
		}

        if( arrFileTypes[intCurrentFileIndex] == 'audio' && $(window).width() <= 600 )
        {
            $('#gallery2__controls_left').hide();
            $('#gallery2__controls_right').hide();
        }

		
                bolHideShareButtons = false;
        $( '#gallery2__share' ).show();
        $( '#item_info_share' ).show();
        $( '#gallery2__sidebar__info_embed_button, #gallery2__sidebar__info_embed_button_middle' ).css( 'display', 'flex' );

        var strAccessType = '';

        if (typeof strAccessType != 'undefined')
        {
            strAccessType = arrAccessType[ intCurrentFileIndex ];
        }
        else 
        {
            strAccessType = 'LINK';
        }

        if(strAccessType != '') 
        {
            if (bolIsOwner)
            {
                $( '#gallery_upload-access-switch' ).show();
                $( '#gallery2_item_info_share-wrapper' ).show();
                var intItemIndex = getItemIndex( strCurrentFileHash );
                var strFileAccessType = ( typeof arrFileAccessTypes != 'undefined' ? arrFileAccessTypes[ intItemIndex ] : '' )
                var strUploadAccessType = ( typeof arrAccessType != 'undefined' ? arrAccessType[ intItemIndex ] : '' )
                
                if ( strFileAccessType == '' || strFileAccessType == null )
                {
                    strFileAccessType = strUploadAccessType;
                }
                
                if ( strFileAccessType == 'PRIVATE' && strUploadAccessType == 'LINK' )
                {
                    strFileAccessType = 'LINK';
                }

                var objGalleryUploadAccessSwitch = new UploadAccessSwitch(
                    $( '#gallery_upload-access-switch' ) ,
                    {
                        item_type : 'file' ,
                        file_hash : strCurrentFileHash ,
                        owner_logged_in : bolIsOwner ,
                        access_type : strFileAccessType ,
                        parent_access_type : strUploadAccessType,
                        upload_access_switch_type : 'modal_gallery'
                    }
                );
            }
            else 
            {
                $( '#gallery_upload-access-switch' ).hide();
                $( '#gallery2_item_info_share-wrapper' ).hide();
            }
        }
        else 
        {
            $( '#gallery_upload-access-switch' ).hide();
            $( '#gallery2_item_info_share-wrapper' ).hide();
        }

        
        $( document ).on( 'change', '#gallery2_file_info .upload-access-switch_type-select', function()
        {
            var strAccessSwitchType = $( this ).val();

            
            if ( strAccessSwitchType == 'link-can-view' )
            {
                updateSharePopupLink( 1 );
            }
            else if ( strAccessSwitchType == 'link-can-edit' )
            {
                updateSharePopupLink( 2 );
            }
            else if ( strAccessSwitchType == 'link-can-upload' )
            {
                updateSharePopupLink( 3 );
            }
        } );

        function updateSharePopupLink(intSelected)
        {
            
            var objFileShareParams = galleryGetFileShareParams();

            if ( intSelected == 2 && objFileShareParams[ 'one_file' ][ 'edit_url' ] != '' )
            {
                $( '#gallery_share_popup_url' ).val( objFileShareParams[ 'one_file' ][ 'edit_url' ] );
                $( '#gallery_share_popup_url' ).attr( 'data-clipboard-text', objFileShareParams[ 'one_file' ][ 'edit_url' ] );
            }
            else if( intSelected == 3 && objFileShareParams[ 'one_file' ][ 'upload_url' ] )
            {
                $( '#gallery_share_popup_url' ).val( objFileShareParams[ 'one_file' ][ 'upload_url' ] );
                $( '#gallery_share_popup_url' ).attr( 'data-clipboard-text', objFileShareParams[ 'one_file' ][ 'upload_url' ] );
            }
            else
            {
                $( '#gallery_share_popup_url' ).val( objFileShareParams[ 'one_file' ][ 'view_url' ] );
                $( '#gallery_share_popup_url' ).attr( 'data-clipboard-text', objFileShareParams[ 'one_file' ][ 'view_url' ] );
            }
        }

        
        checkThumbStripArrows();

        galleryUpdateVoteCount();

                    //add checkboxes to thumb strip and update middle menu
            galleryUpdateFileSelection();
        
        galleryLoadFileInfo();
        $( '#gallery2__comments-list__loadmore' ).remove();
        galleryLoadFileComments();

        setTimeout('gallerySelectThumb('+ intCurrentFileIndex +')', 100);
                 
        var bolLogViews = 0;

        // bolOwnerIsStorageSubscriber - comes from public.php, this overrides bolLogViews
        if( typeof bolOwnerIsStorageSubscriber !== 'undefined' ) {
            bolLogViews |= bolOwnerIsStorageSubscriber;
        }
        
        var bolLogFileView = true;

        if ( bolLogFileView )
            $.post('./fileView.php', {'h': strCurrentFileHash, 'p': bolLogViews});

		// Google Analytics
        if ( typeof _gaq != 'undefined' )
        {
            _gaq.push( [ '_trackPageview', window.location.href ] );
        }
    
        var jqGalleryContainer = $('#gallery2');
        
        if ( bolSimpleDownloadAllowed )
        {
            jqGalleryContainer.addClass( 'simple_download_allowed' );
        }
        else
        {
            jqGalleryContainer.removeClass( 'simple_download_allowed' );
        }
        
		bolGalleryIsShowingItem = false;
        if( bolStartAudioOnOpen )
        {
            $( "#audio_" + strCurrentFileHash ).trigger( 'play' );
            bolStartAudioOnOpen = false;
        }


        // Build main download button
        var intItemIndex = getItemIndexByHashOrName( strCurrentFileHash );
        var bolSimpleDownloadAllowed = canDownload( strCurrentFileHash );
        
        $( '#gallery-main-download-button' ).remove();
        
        if ( bolSimpleDownloadAllowed ) {

            var objDownloadButton = new DropdownButton ();

            if ( bolSimpleDownloadAllowed ) {
                objDownloadButton.addButton('gallery-download-simple-split-button', 'Download original file', 'Download original', '<img src="/images/UI_icons/white/download.svg" /> ', function (){
                    gaev('split-download-button-engagement', 'header-download-simple-click', 'Split button simple download click');
                    modalGalleryDownloadFileBtn( strCurrentFileHash )
                })
            }
            
            if ( isFileConvertable( 'pdf', intItemIndex ) )
            {
                objDownloadButton.addButton(
                    'gallery-download-simple-split-button' ,
                    'Download this file as PDF' ,
                    'Download as PDF' ,
                    '<img src="/images/UI_icons/white/download.svg" /> ' ,
                    function ()
                    {
                    	gaev( 'split-download-button-engagement', 'header-download-pdf-click', 'Split button pdf download click' );
	                    modalGalleryDownloadFileBtn( strCurrentFileHash, 'pdf' )
                } );
            }
            else if ( isFileConvertable( 'mp4', intItemIndex ) )
            {
                objDownloadButton.addButton(
                    'gallery-download-simple-split-button' ,
                    'Download as MP4' ,
                    'Download as MP4' ,
                    '<img src="/images/UI_icons/white/download.svg" /> ' ,
                    function ()
                    {
                    	gaev( 'split-download-button-engagement', 'header-download-mp4-click', 'Split button mp4 download click' );
	                    modalGalleryDownloadFileBtn( strCurrentFileHash, 'mp4' )
                } );
            }
            else if ( isFileConvertable( 'jpg', intItemIndex ) )
            {
                objDownloadButton.addButton(
                    'gallery-download-simple-split-button' ,
                    'Download smaller JPG' ,
                    'Download smaller JPG' ,
                    '<img src="/images/UI_icons/white/download.svg" /> ' ,
                    function ()
                    {
                    	gaev( 'split-download-button-engagement', 'header-download-jpg-click', 'Split button jpg download click' );
	                    modalGalleryDownloadFileBtn( strCurrentFileHash, 'jpg' )
                } );
            }
            else if ( arrFileTypes[ intItemIndex ] == 'video' && arrExtensions[ intItemIndex ] == 'mp4' && typeof arrBigThumbPath != 'undefined' && arrBigThumbPath[ intItemIndex ] == 1 )
            {
                objDownloadButton.addButton(
                    'gallery-download-simple-split-button' ,
                    'Download optimized MP4' ,
                    'Download optimized MP4' ,
                    '<img src="/images/UI_icons/white/download.svg" /> ' ,
                    function ()
                    {
                    	gaev( 'split-download-button-engagement', 'header-download-mp4-click', 'Split button mp4 download click' );
	                    modalGalleryDownloadFileBtn( strCurrentFileHash, 'mp4' )
                } );
            }

                            if ( bolSimpleDownloadAllowed && typeof(listDownloadSelectedFiles) === 'function' && ! bolIsiOSDevice )
                {
                    objDownloadButton.addButton('gallery-download-simple-split-button gallery-download-simple-select-button', 'Download all selected', 'Download all selected', '<img src="/images/UI_icons/white/download.svg" /> ', function (){
                        gaev('split-download-button-engagement', 'header-download-selected-click', 'Split button selected download click');
                        listDownloadSelectedFiles()
                    })
                }
            
            if ( bolSimpleDownloadAllowed && ! bolIsOwner && typeof objUploadCopyForm != 'undefined' && typeof strUploadHash != 'undefined' ) {
                objDownloadButton.addButton(
                    'gallery-download-myfiles-split-button', 
                    'Save to my account', 
                    'Save to my account', 
                    null, 
                    function (){
                    gaev('split-download-button-engagement', 'header-download-myfiles-click', 'Split button myfiles download click');
                    modalGalleryDownloadFileBtn( strCurrentFileHash, 'my-files' );
                    },
                    'Recommended!'
                )
            }
            
            var jqDownloadButton = objDownloadButton.build( 'gallery-download-split-button', 'gallery-main-download-button', 'Download' );

            $( '#gallery2__header__mid_content #gallery2__download_space' ).before( jqDownloadButton );

                            objSelectedFiles = getSelectedFiles();
                if ( typeof objSelectedFiles && objSelectedFiles.length != 0 )
                {
                    $( '.gallery-download-simple-select-button' ).show();
                }
                        
        }


        if ( ! objMainShareParams )
        {
            $('#gallery2__share').hide();
            $('#gallery2_item_info_share-wrapper').hide();
            $('#gallery2__sidebar__info_embed_button, #gallery2__sidebar__info_embed_button_middle').hide();
        }

        $( '#gallery2_info_head .thumbnail-wrapper' ).html( '' );
        $( '#gallery2_info_head .thumbnail-wrapper' ).removeClass("two-actions");
        $( '#gallery2_info_head .thumbnail-wrapper' ).removeClass("one-action");
        var strThumbnailActions = '';
        if( bolIsOwner && arrFileTypes[intCurrentFileIndex] != 'image' )
		{
            if ( arrThumbnails[intItemIndex] )
            {
                var strThumbPath = arrThumbnails[intItemIndex];
                
                strThumbHTML = '<img src="'+strThumbPath+'"/>';

            }
            else if ( typeof( arrIconSvg ) !== 'undefined' && arrIconSvg[intItemIndex] )
            {
                strThumbHTML = '<img src="/images/file_types_v2/'+arrIconSvg[ intItemIndex ]+'" />';
            }
            else
            {
                strThumbHTML = '<img src="/images/file_types_v2/default.svg" />';
            }

            $( '#gallery2_info_head .thumbnail-wrapper' ).html( '' );
            $( '#gallery2_info_head .thumbnail-wrapper' ).append(strThumbHTML);
            $( '#gallery2_info_head .thumbnail-wrapper' ).append('<div class="thumbnail-actions"></div>');

			
    		if ( arrFileAttributes[ intItemIndex ][ 'hasCustomThumb' ] )
    		{
                strThumbnailActions = 
                    '<a href="javascript:void(0)" onclick="modalGallery_changeFileThumbnail( \'' +  arrHashes[ intItemIndex ] + '\', ' + intItemIndex + ' )">' +
                        '<div class="thumbnail-actions-edit" title="Change file image"></div>' +
                    '</a>' +
                    '<a href="javascript:void(0)" onclick="modalGallery_removeFileThumbnail( \'' +  arrHashes[ intItemIndex ] + '\', ' + intItemIndex + ' )">' +
                        '<div class="thumbnail-actions-delete" title="Delete file image"></div>' +
                    '</a>';
                    
                $( '#gallery2_info_head .thumbnail-actions' ).append(strThumbnailActions);
                $( '#gallery2_info_head .thumbnail-wrapper' ).addClass("two-actions");

    		}
    		else
    		{
                strThumbnailActions = 
                    '<a href="javascript:void(0)" onclick="modalGallery_changeFileThumbnail( \'' +  arrHashes[ intItemIndex ] + '\', ' + intItemIndex + ' )">' +
                        '<div class="thumbnail-actions-edit" title="Set file preview image"></div>' +
                    '</a>';
                    
                $( '#gallery2_info_head .thumbnail-actions' ).append(strThumbnailActions);
                $( '#gallery2_info_head .thumbnail-wrapper' ).addClass("one-action");
    		}
		}
        else 
        {
            if ( typeof( arrIconSvg ) !== 'undefined' && arrIconSvg[intItemIndex] )
            {
                strThumbHTML = '<img src="/images/file_types_v2/'+arrIconSvg[ intItemIndex ]+'" />';
            }
            else
            {
                strThumbHTML = '<img src="/images/file_types_v2/default.svg" />';
            }

            $( '#gallery2_info_head .thumbnail-wrapper' ).html( '' );
            $( '#gallery2_info_head .thumbnail-wrapper' ).append(strThumbHTML);

        }

        var strName = arrDisplayNames[intItemIndex];
		if (strName == '')
		{
			strName = arrNames[intItemIndex];
		}
        
        $( ".gallery2__header__file_name_value" ).html( strName );

        if( bolIsOwner )
        {
            $(".not_owner_show").hide();
            $(".not_owner_hide").show();
        }
        else
        {
            $(".not_owner_show").show();
            $(".not_owner_hide").hide();
        }

                    if(bolActivateSlideshowOnOpen && arrHashes.length > 1)
            {
                enterSlideshow();
                bolActivateSlideshowOnOpen = false;
            }

            if(typeof(strSlideshowInterval) !== 'undefined' && strSlideshowInterval !== null)
            {
                if(arrFileTypes[intCurrentFileIndex] == 'video' && typeof(objVideoPlayers[intCurrentFileIndex]) !== 'undefined' )
                {
                    clearInterval(strSlideshowInterval);
                    strSlideshowInterval = 'reset';
                    objVideoPlayers[intCurrentFileIndex].objPlayer.loop(false);
                    objVideoPlayers[intCurrentFileIndex].objPlayer.play();
                }
                else if (arrFileTypes[intCurrentFileIndex] == 'audio' && typeof(objAudioPlayer) !== 'undefined')
                {
                    clearInterval(strSlideshowInterval);
                    strSlideshowInterval = 'reset';
                    objAudioPlayer._isSlideshowOn = true;
                    objAudioPlayer.play();
                }
            }
                
        if ( bolOpenGalleryCommentsBlock )
        {
            setTimeout( function()
            {
                if ( ! bolGallerySidebarVisible )
                {
                    showGalleryInfo();
                }
                
                showGalleryMessages();
                
                $( window ).trigger( 'resize' );
            }, 300 );
        }

        // check mobile footer visible elements and hide info button if overflow
        var visibleElemCount = 0;
        var visibleBtns = $( '#gallery2__header__mid_content span.gallery2__header_middle_button:visible' );
        visibleElemCount = visibleBtns.length;

        var bolSimpleDownloadAllowed = canDownload( strCurrentFileHash );

        if ( bolSimpleDownloadAllowed )
        {
            visibleElemCount += 1;
        }

        if ( visibleElemCount > 4 )
        {
            $( '#gallery2__info_middle' ).addClass( 'mobile-hide' );
            $(' #gallery2__info_more' ).addClass( 'mobile-show' );
        }
	}
	window.showGalleryItem = showGalleryItem;
	
	function stopActiveContent()
	{
		// Stop video
		var jqAllVideos = $("video");
		if (jqAllVideos.length>0)
		{
			jqAllVideos.each(function () {
				this.pause();
			});
		}
		// Stop audio
		var jqAllAudios = $("audio");
		if (jqAllAudios.length>0)
		{
			jqAllAudios.each(function () {
				this.pause();
			});
		}
	}
	
    function GalleryDeleteFile(strFileH, strFileName)
    {
        fConfirm( 'Do you really want to delete this file?</br><b>"' + strFileName + '"</b>', 'Delete', 'Yes, delete!', 'Cancel', function(r){
            if( r == true )
            {                
                $.ajax({
                    type: "POST",
                    dataType: "json",
                    url: "./ajax/delete_file.php?PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3",
                    data: {
                        'delete_user_file' : true ,
                        'f'             : strFileH ,
                        'source'		: 'filebrowser'
                    },
                    success: function( data ){
                        if( data['status'] == 'ok' )
                        {
                            if(bolGalleryIsVisible && intNextIndex != null && !isNaN( intNextIndex ))
                            {
                                galleryOpenNextItem();
                            }
                            else if (intPreviousIndex != null && !isNaN( intPreviousIndex ))
                            {
                                galleryOpenPrevItem();
                            }
                            fSuccess( "File \""+ strFileName +"\" has been <b>deleted</b>!", "" );
                            location.reload();
                        }
                        else
                        {
                            if( typeof data[ 'file_read_only' ] !== 'undefined' && data[ 'file_read_only' ] ) 
                            {
                                fError( "The file cannot be deleted because it is shared!", "Info" );
                            }
                            else if ( typeof data[ 'file_is_locked' ] !== 'undefined' && data[ 'file_is_locked' ] ) 
                            {
                                fError( "This file cannot be deleted because it is locked.", "Info" );
                            }
                            else
                            {
                                fError( "There was an error, the file was not deleted", "Info" );
                            }
                        }
                    }
                });
            }
        });
        return false;
    }

    function GalleryDeleteFileAnon(strKey, strFileH, strFileName)
    {
        fConfirm( 'Do you really want to delete this file?</br><b>"' + strFileName + '"</b>', 'Delete', 'Yes, delete!', 'Cancel', function(r){
			if( r == true )
			{
				$.ajax({
					type: "POST",
					dataType: "json",
					url: "./ajax/delete_file.php?PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3",
					data: {
						'delete_file': true,
						'fk'			 : strKey,
						'f'			 : strFileH ,
						'source'	 : 'list'
					},
					success: function( data ){
                        if( data['status'] == 'ok' )
                        {
                            if(bolGalleryIsVisible && intNextIndex != null && !isNaN( intNextIndex ))
                            {
                                galleryOpenNextItem();
                            }
                            else if (intPreviousIndex != null && !isNaN( intPreviousIndex ))
                            {
                                galleryOpenPrevItem();
                            }
                            fSuccess( "File \""+ strFileName +"\" has been <b>deleted</b>!", "" );
                            location.reload();
                        }
						else
						{
						    if( typeof data[ 'file_read_only' ] !== 'undefined' && data[ 'file_read_only' ] ) 
                            {
                                fError( "The file cannot be deleted because it is shared!", "Info" );
                            }
						    else if ( typeof data[ 'file_is_locked' ] !== 'undefined' && data[ 'file_is_locked' ] ) 
                            {
                                fError( "This file cannot be deleted because it is locked.", "Info" );
                            }
                            else
                            {
                                fError( "There was an error, the file was not deleted", "Info" );
                            }
						}
					}
				});
			}
		});
		return false;
    }

    function checkGalleryArrows()
    {
        if( $( window ).width() < 550 )
        {
            if( arrFileTypes[intCurrentFileIndex] == 'audio' || arrFileTypes[intCurrentFileIndex] == 'video' || arrFileTypes[intCurrentFileIndex] == 'document' )
            {
                $( '#gallery2__controls_left, #gallery2__controls_right' ).show();
                $( '#gallery2__controls_left a, #gallery2__controls_right a' ).css({
                    'top': 'initial',
                    'bottom': '0px'
                });
            }
            else
            {
                $( '#gallery2__controls_left, #gallery2__controls_right' ).hide();
            }
        }
        else
        {
            $( '#gallery2__controls_left a, #gallery2__controls_right a' ).removeAttr( 'style' );
            $( '#gallery2__controls_left, #gallery2__controls_right' ).show();
        }
    }
	
	function galleryLoadFileInfo(bolUpdateInfo)
	{
        if ( typeof(bolUpdateInfo) === 'undefined' && $(window).width() > 500 && ! bolGallerySidebarVisible )
        {
            return;	
        }

		var intItemIndex = getItemIndex ( strCurrentFileHash );

        
        if ( bolUseAsyncFileInfoDataLoad )
        {
            if ( ! arrIsFileInfoDataPreloaded[ intItemIndex ] )
            {
                $( '#gallery2__sidebar__info' ).hide();
                setTimeout( function() { galleryLoadFileInfo( bolUpdateInfo ) }, 1000 );
                return;
            }
            else
            {
                $( '#gallery2__sidebar__info' ).show();
            }
        }
        

        var strPublicProfileHref = '';
        if ( typeof strUploadUserNameHref != 'undefined' && strUploadUserNameHref != '' )
        {
            strPublicProfileHref =  '/' + strUploadUserNameHref;
        }
        else if ( typeof PublicProfile != 'undefined' && typeof PublicProfile.strProfileName != 'undefined' )
        {
            strPublicProfileHref = '/' + PublicProfile.strProfileName;
        }


        if ( typeof strUploadUserNameLink != 'undefined' )
		{
            $( '#gallery2__sidebar__info-owner-user .gallery2__sidebar__info-value' ).html( strUploadUserNameLink );
			$( '#gallery2__sidebar__info .header-owner_name' ).html( strUploadUserNameLink );
            if( typeof strUploadUserID != 'undefined' && strUploadUserID != '' && typeof strUploadUserLastProfileEditTimestamp != 'undefined')
            {
                $( '#gallery2__sidebar__info .header-owner .header-owner_image-wrapper' ).html( '<a class="header-owner_image" style="background-image: url( \'/avatars/thumb.php?i='+ strUploadUserID +'_'+ strUploadUserLastProfileEditTimestamp +'.jpg\' );"></a>' );
            }
            else 
            {
                $( '#gallery2__sidebar__info .header-owner .header-owner_image-wrapper' ).html( '<div class="header-owner_image"><img src="/images/list/unknown-owner.svg"></div>' );
            }
		}
		else if ( typeof PublicProfile != 'undefined' && typeof PublicProfile.strProfileName != 'undefined' )
		{
			$( '#gallery2__sidebar__info-owner-user .gallery2__sidebar__info-value' ).html( '<a href="/' + PublicProfile.strProfileName + '" target="_blank">' + PublicProfile.strProfileName + '</a>' );
			$( '#gallery2__sidebar__info .header-owner_name' ).html( '<a href="/' + PublicProfile.strProfileName + '" target="_blank">' + PublicProfile.strProfileName + '</a>' );
            if( typeof strUploadUserID  != 'undefined' && strUploadUserID != '' && typeof strUploadUserLastProfileEditTimestamp != 'undefined')
            {
                $( '#gallery2__sidebar__info .header-owner .header-owner_image-wrapper' ).html( '<a class="header-owner_image" style="background-image: url( \'/avatars/thumb.php?i='+ strUploadUserID +'_'+ strUploadUserLastProfileEditTimestamp +'.jpg\' );"></a>' );
            }
            else if( typeof PublicProfile.strAvatarPath  != 'undefined' && PublicProfile.strAvatarPath != '')
            {
                $( '#gallery2__sidebar__info .header-owner .header-owner_image-wrapper' ).html( '<a class="header-owner_image" style="background-image: url( \''+PublicProfile.strAvatarPath+'\' );"></a>' );
            }
            else
            {
                $( '#gallery2__sidebar__info .header-owner .header-owner_image-wrapper' ).html( '<div class="header-owner_image"><img src="/images/list/unknown-owner.svg"></div>' );
            }
		}
		else 
		{
			$( '#gallery2__sidebar__info-owner-user' ).hide();
			$( '#gallery2__sidebar__info .header-owner' ).hide();
		}

		$('#gallery2__sidebar__info-size .gallery2__sidebar__info-value').html(arrSizes[intItemIndex]);


        if ( typeof arrDatesCreated != 'undefined' )
        {
            $( '#gallery2__sidebar__info-date .gallery2__sidebar__info-value' ).html( arrDatesCreated[ intItemIndex ] );
        }
        else
        {
            $( '#gallery2__sidebar__info-date .gallery2__sidebar__info-value' ).html( arrDates[ intItemIndex ] );
        }

        if ( typeof arrFileDateCreated != 'undefined' && arrFileDateCreated[ intItemIndex ] != '' )
        {
            $( '#gallery2__sidebar__info-date-created .gallery2__sidebar__info-value' ).html( arrFileDateCreated[ intItemIndex ] );
        }
        else if ( typeof arrDatesCreated != 'undefined' )
        {
            $( '#gallery2__sidebar__info-date-created .gallery2__sidebar__info-value' ).html( arrDatesCreated[ intItemIndex ] );
        }
        else
        {
            $( '#gallery2__sidebar__info-date-created .gallery2__sidebar__info-value' ).html( arrDates[ intItemIndex ] );
        }

        if ( typeof arrDatesModified != 'undefined' )
        {
            $( '#gallery2__sidebar__info-moddate .gallery2__sidebar__info-value' ).html( arrDatesModified[ intItemIndex ] );
        }
        else
        {
            $( '#gallery2__sidebar__info-moddate .gallery2__sidebar__info-value' ).html( arrDates[ intItemIndex ] );
        }


		$('#gallery2__sidebar__info-views .gallery2__sidebar__info-value').html(arrViews[intItemIndex]);
		$('#gallery2__sidebar__info-downloads .gallery2__sidebar__info-value').html(arrDownloads[intItemIndex]);
		$('#gallery2__sidebar__info-comments .gallery2__sidebar__info-value').html(arrCommentCounts[intItemIndex]);

        $( '#gallery2__sidebar__info-dimensions' ).hide();
        if ( typeof arrWidths != 'undefined' && typeof arrHeights != 'undefined' && typeof arrWidths[intItemIndex] != 'undefined' && typeof arrHeights[intItemIndex] != 'undefined' && arrWidths[intItemIndex] != '' && arrHeights[intItemIndex] != '' && arrWidths[intItemIndex] != 'undefined' && arrHeights[intItemIndex] != 'undefined' )
        {
            if(arrFileTypes[ intItemIndex ] == 'video')
            {
                var strResolutionLabel = getResolutionLabel( arrWidths[ intItemIndex ], arrHeights[ intItemIndex ] );

                $('#gallery2__sidebar__info-dimensions .gallery2__sidebar__info-value').html(strResolutionLabel + arrWidths[intItemIndex] + ' x ' + arrHeights[intItemIndex] + ', ' + Math.round((arrWidths[intItemIndex]*arrHeights[intItemIndex]/1000000) * 100) / 100+ 'MP');
            }
            else
            {
                $('#gallery2__sidebar__info-dimensions .gallery2__sidebar__info-value').html(arrWidths[intItemIndex] + ' x ' + arrHeights[intItemIndex] + ', ' + Math.round((arrWidths[intItemIndex]*arrHeights[intItemIndex]/1000000) * 100) / 100+ 'MP');
            }
            $( '#gallery2__sidebar__info-dimensions' ).show();
        }
		
		$( '.gallery2__sidebar__info-metadata' ).hide();
        $( '.gallery2__sidebar__info-exif_tags' ).remove();
        $( '.gallery2__sidebar__info-one_line_buttons .disabled' )
            .removeClass( 'disabled' );
        $( '#gallery2__sidebar__info-metadata-tags' ).addClass( 'gallery2__sidebar__exif_tags-top-separator' );

        $( '.gallery2__sidebar__info-dropdown_button.easyocr-text_recognition' )
            .html(
                '<span class="gallery2__sidebar__info-dropdown_text">' +
                    'Find Text' +
                '</span>' +
                '<span class="gallery2__sidebar__info-dropdown_icon"></span>'
            );
            
        $( '.gallery2__sidebar__info-dropdown_button.google_cloud_vision-ocr' )
            .html(
                '<span class="gallery2__sidebar__info-dropdown_text">' +
                    'Find text PRO' +
                '</span>' +
                '<span class="gallery2__sidebar__info-dropdown_icon"></span>'
            );

        $( '.gallery2__sidebar__info-dropdown_button.yolo-object_detection' )
            .html(
                '<span class="gallery2__sidebar__info-dropdown_text">' +
                    'Find objects' +
                '</span>' +
                '<span class="gallery2__sidebar__info-dropdown_icon"></span>'
            );

        $('#gallery2__sidebar__info-mainexif .gallery2__sidebar__info-value .exif-grid div span').html('');
        $('#gallery2__sidebar__info-mainexif .gallery2__sidebar__info-value .exif-grid div').hide();
        $('#gallery2__sidebar__info-mainexif .gallery2__sidebar__info-value').hide();
		if ( typeof arrFileTitle != 'undefined' )
		{
    		$( '#gallery2__sidebar__info-metadata-title .gallery2__sidebar__info-value' ).html( arrFileTitle[ intItemIndex ] );
    		if ( arrFileTitle[ intItemIndex ] != '' ) $( '#gallery2__sidebar__info-metadata-title' ).show();
		}
		
		if ( typeof arrFileSubject != 'undefined' )
		{
            $( '#gallery2__sidebar__info-metadata-subject .gallery2__sidebar__info-value' ).html( arrFileSubject[ intItemIndex ] );
            if ( arrFileSubject[ intItemIndex ] != '' ) $( '#gallery2__sidebar__info-metadata-subject' ).show();
		}
		
		if ( typeof arrFileContentType != 'undefined' )
		{
            $( '#gallery2__sidebar__info-metadata-content_type .gallery2__sidebar__info-value' ).html( arrFileContentType[ intItemIndex ] );
            if ( arrFileContentType[ intItemIndex ] != '' ) $( '#gallery2__sidebar__info-metadata-content_type' ).show();
		}
		
		if ( typeof arrFileCategory != 'undefined' )
		{
            $( '#gallery2__sidebar__info-metadata-category .gallery2__sidebar__info-value' ).html('');

            if (strPublicProfileHref != '')
            {
                $( '#gallery2__sidebar__info-metadata-category .gallery2__sidebar__info-value' ).append('<a href="' + strPublicProfileHref + '#search='+  arrFileCategory[ intItemIndex ] +'" target="_self">' +  arrFileCategory[ intItemIndex ] + '</a>');
            }
            else
            {
                $( '#gallery2__sidebar__info-metadata-category .gallery2__sidebar__info-value' ).html( arrFileCategory[ intItemIndex ] );
            }
            
            if ( arrFileCategory[ intItemIndex ] != '' ) $( '#gallery2__sidebar__info-metadata-category' ).show();
		}
		
		if ( typeof arrFileCategories != 'undefined' )
		{           
            var arrCategories = arrFileCategories[ intItemIndex ].split(',')
            $( '#gallery2__sidebar__info-metadata-categories .gallery2__sidebar__info-value' ).html('');

            if (strPublicProfileHref != '')
            {
                arrCategories.forEach(function(elem, idx, array) {
                    if (idx != array.length - 1)
                    { 
                        $( '#gallery2__sidebar__info-metadata-categories .gallery2__sidebar__info-value' ).append('<a href="' + strPublicProfileHref + '#search='+ elem +'" target="_self">' + elem + ',</a> ');
                    }
                    else
                    {
                        $( '#gallery2__sidebar__info-metadata-categories .gallery2__sidebar__info-value' ).append('<a href="' + strPublicProfileHref + '#search='+ elem +'" target="_self">' + elem + '</a>');
                    }
                });
            }
            else
            {
                $( '#gallery2__sidebar__info-metadata-categories .gallery2__sidebar__info-value' ).html( arrFileCategories[ intItemIndex ] );
            }
            if ( arrFileCategories[ intItemIndex ] != '' ) $( '#gallery2__sidebar__info-metadata-categories' ).show();
		}
		
		if ( typeof arrFileKeywords != 'undefined' )
		{
            $( '#gallery2__sidebar__info-metadata-keywords .gallery2__sidebar__info-value' ).html( arrFileKeywords[ intItemIndex ] );
            if ( arrFileKeywords[ intItemIndex ] != '' ) $( '#gallery2__sidebar__info-metadata-keywords' ).show();
		}
		
		if ( typeof arrFileCreator != 'undefined' )
		{
            $( '#gallery2__sidebar__info-metadata-creator .gallery2__sidebar__info-value' ).html( arrFileCreator[ intItemIndex ] );
            if ( arrFileCreator[ intItemIndex ] != '' ) $( '#gallery2__sidebar__info-metadata-creator' ).show();
		}
		
		if ( typeof arrFilePublisher != 'undefined' )
		{
            $( '#gallery2__sidebar__info-metadata-publisher .gallery2__sidebar__info-value' ).html( arrFilePublisher[ intItemIndex ] );
            if ( arrFilePublisher[ intItemIndex ] != '' ) $( '#gallery2__sidebar__info-metadata-publisher' ).show();
		}
		
		if ( typeof arrFileContributor != 'undefined' )
		{
            $( '#gallery2__sidebar__info-metadata-contributor .gallery2__sidebar__info-value' ).html( arrFileContributor[ intItemIndex ] );
            if ( arrFileContributor[ intItemIndex ] != '' ) $( '#gallery2__sidebar__info-metadata-contributor' ).show();
		}
		
		if ( typeof arrFileCopyrights != 'undefined' )
		{
            $( '#gallery2__sidebar__info-metadata-copyrights .gallery2__sidebar__info-value' ).html( arrFileCopyrights[ intItemIndex ] );
            if ( arrFileCopyrights[ intItemIndex ] != '' ) $( '#gallery2__sidebar__info-metadata-copyrights' ).show();
		}
		
		if ( typeof arrFileLicenseType != 'undefined' )
		{
            $( '#gallery2__sidebar__info-metadata-license_type .gallery2__sidebar__info-value' ).html( arrFileLicenseType[ intItemIndex ] );
            if ( arrFileLicenseType[ intItemIndex ] != '' ) $( '#gallery2__sidebar__info-metadata-license_type' ).show();
		}
		
		if ( typeof arrFileLicenseDetails != 'undefined' )
		{
            $( '#gallery2__sidebar__info-metadata-license_details .gallery2__sidebar__info-value' ).html( arrFileLicenseDetails[ intItemIndex ] );
            if ( arrFileLicenseDetails[ intItemIndex ] != '' ) $( '#gallery2__sidebar__info-metadata-license_details' ).show();
		}
		
		if ( typeof arrFileLanguage != 'undefined' )
		{
            $( '#gallery2__sidebar__info-metadata-language .gallery2__sidebar__info-value' ).html( arrFileLanguage[ intItemIndex ] );
            if ( arrFileLanguage[ intItemIndex ] != '' ) $( '#gallery2__sidebar__info-metadata-language' ).show();
		}
		
		if ( typeof arrFileLocation != 'undefined' )
		{
            $( '#gallery2__sidebar__info-metadata-location .gallery2__sidebar__info-value' ).html( arrFileLocation[ intItemIndex ] );
            if ( arrFileLocation[ intItemIndex ] != '' ) $( '#gallery2__sidebar__info-metadata-location' ).show();
		}
		
        if ( typeof arrFileLocationLat !== 'undefined' && typeof arrFileLocationLong !== 'undefined' )
        {
            let strGpsLat = gpsDecimalToDMS( arrFileLocationLat[ intItemIndex ], true );
            let strGpsLong = gpsDecimalToDMS( arrFileLocationLong[ intItemIndex ], false );

            $( '#gallery2__sidebar__info-metadata-location_lat .gallery2__sidebar__info-value' )
                .html( '<a href="https://www.google.com/maps/place/' + encodeURIComponent( strGpsLat.replace( /\s/g, '' ) ) + '+' + encodeURIComponent( strGpsLong.replace( /\s/g, '' ) ) + '" target="_blank">' + strGpsLat + '</a>' );
            $( '#gallery2__sidebar__info-metadata-location_long .gallery2__sidebar__info-value' )
                .html( '<a href="https://www.google.com/maps/place/' + encodeURIComponent( strGpsLat.replace( /\s/g, '' ) ) + '+' + encodeURIComponent( strGpsLong.replace( /\s/g, '' ) ) + '" target="_blank">' + strGpsLong + '</a>' );

            if ( strGpsLat !== '' && strGpsLong !== '' )
            {
                $( '#gallery2__sidebar__info-metadata-location_lat' ).show();
                $( '#gallery2__sidebar__info-metadata-location_long' ).show();
            }
        }
		
		if ( typeof arrFileReferences != 'undefined' )
		{
            $( '#gallery2__sidebar__info-metadata-references .gallery2__sidebar__info-value' ).html( arrFileReferences[ intItemIndex ] );
            if ( arrFileReferences[ intItemIndex ] != '' ) $( '#gallery2__sidebar__info-metadata-references' ).show();
		}
		
		if ( typeof arrFileRelatesTo != 'undefined' )
		{
            $( '#gallery2__sidebar__info-metadata-relates_to .gallery2__sidebar__info-value' ).html( arrFileRelatesTo[ intItemIndex ] );
            if ( arrFileRelatesTo[ intItemIndex ] != '' ) $( '#gallery2__sidebar__info-metadata-relates_to' ).show();
		}
		
		if ( typeof arrFileFormat != 'undefined' )
		{
            $( '#gallery2__sidebar__info-metadata-format .gallery2__sidebar__info-value' ).html( arrFileFormat[ intItemIndex ] );
            if ( arrFileFormat[ intItemIndex ] != '' ) $( '#gallery2__sidebar__info-metadata-format' ).show();
		}
		
		if ( typeof arrFileDevice != 'undefined' )
		{
            $( '#gallery2__sidebar__info-mainexif .gallery2__sidebar__info-value .exif-grid .Model span' ).html( arrFileDevice[ intItemIndex ] );
            $( '#gallery2__sidebar__info-metadata-device .gallery2__sidebar__info-value' ).html( arrFileDevice[ intItemIndex ] );
            if ( arrFileDevice[ intItemIndex ] != '' )
            {
                $( '#gallery2__sidebar__info-metadata-device' ).show();
                $( '#gallery2__sidebar__info-mainexif .gallery2__sidebar__info-value .exif-grid .Model' ).show();
            }
		}
		
		if ( typeof arrFileSource != 'undefined' )
		{
            $( '#gallery2__sidebar__info-metadata-source .gallery2__sidebar__info-value' ).html( arrFileSource[ intItemIndex ] );
            if ( arrFileSource[ intItemIndex ] != '' ) $( '#gallery2__sidebar__info-metadata-source' ).show();
		}

        if ( typeof arrFileTypes != 'undefined' )
        {
            if ( arrFileTypes[ intItemIndex ] == 'image' )
            {
                $( '#gallery2__sidebar__info-exif_tags-button' ).show();

                if ( typeof arrExtensions != 'undefined' && [ 'jpg', 'jpeg', 'png' ].includes( arrExtensions[ intItemIndex ] ) )
                {
                    if (
                            bolIsOwner
                            || (
                                    typeof( bolIsAnonymousUpload ) == 'boolean'
                                    && bolIsAnonymousUpload
                                )
                        )
                    {
                        $( '#gallery2__sidebar__info-content_analyze-buttons' ).show();
                        $( '#gallery2__sidebar__info-metadata-tags' ).removeClass( 'gallery2__sidebar__exif_tags-top-separator' );
                    }

                    if ( !bolIsOwner )
                    {
                        $( '.gallery2__sidebar__info-dropdown_button.easyocr-text_recognition' ).hide();
                        $( '.gallery2__sidebar__info-dropdown_button.yolo-object_detection' ).hide();
                    }

                    if ( true )
                    {
                        $( '.gallery2__sidebar__info-dropdown_button.google_cloud_vision-ocr' ).hide();
                        $( '.gallery2__sidebar__info-dropdown_button.google_cloud-vision' ).hide();
                    }
                }
            }
        }

		if ( typeof arrDuration != 'undefined' &&  typeof arrDuration[ intItemIndex ] != 'undefined' && arrDuration[ intItemIndex ] != '' )
		{
            var strDuration = arrDuration[ intItemIndex ];

            if( strDuration < 600 )
            {
                strDuration = new Date(strDuration * 1000).toISOString().slice(15, 19);
            }
            else if( strDuration < 3600 )
            {
                strDuration = new Date(strDuration * 1000).toISOString().slice(14, 19);
            }
            else
            {
                strDuration = new Date(strDuration * 1000).toISOString().slice(11, 19);
            }
            
            $( '#gallery2__sidebar__info-metadata-duration .gallery2__sidebar__info-value' ).html( strDuration );
            if ( arrDuration[ intItemIndex ] != ''&& arrDuration[ intItemIndex ] != '0' ) $( '#gallery2__sidebar__info-metadata-duration' ).show();
		}

        if ( typeof arrFileGoogleCVText != 'undefined' && typeof arrFileGoogleCVText[ intItemIndex ] != 'undefined' )
        {
            $( '#gallery2__sidebar__info-google_cv_text .gallery2__sidebar__info-value' ).text( arrFileGoogleCVText[ intItemIndex ] );
            if ( arrFileGoogleCVText[ intItemIndex ] != '' && bolIsOwner )
            {
                $( '#gallery2__sidebar__info-google_cv_text' ).show();
                $( '.gallery2__sidebar__info-dropdown_button.google_cloud_vision-ocr' )
                    .addClass( 'disabled' );
            }
        }

        if ( typeof arrFileEasyOCRText != 'undefined' && typeof arrFileEasyOCRText[ intItemIndex ] != 'undefined' )
        {
            $( '#gallery2__sidebar__info-easyocr_text .gallery2__sidebar__info-value' ).text( arrFileEasyOCRText[ intItemIndex ] );
            if ( arrFileEasyOCRText[ intItemIndex ] != '' && bolIsOwner )
            {
                $( '#gallery2__sidebar__info-easyocr_text' ).show();
                $( '.gallery2__sidebar__info-dropdown_button.easyocr-text_recognition' )
                    .addClass( 'disabled' );
            }
        }


        if ( bolIsOwner && arrFileTypes[ intCurrentFileIndex ] == 'audio' )
        {
            $( '#gallery2__sidebar__info-google_cloud-speech_to_text-button .gallery2__sidebar__info-dropdown_button' )
                .html(
                    '<span class="gallery2__sidebar__info-dropdown_text">' +
                        'Recognize speech' +
                    '</span>' +
                    '<span class="gallery2__sidebar__info-dropdown_icon"></span>'
                )
                .removeClass( 'disabled' );;
            

            $( '#gallery2__sidebar__info-google_cloud-speech_to_text-button' )
                .show();

                $( '#gallery2__sidebar__info-metadata-tags' ).removeClass( 'gallery2__sidebar__exif_tags-top-separator' );
                    
        }

        if ( bolIsOwner && typeof arrFileAudioTranscription != 'undefined' && typeof arrFileAudioTranscription[ intItemIndex ] != 'undefined' )
        {
            $( '#gallery2__sidebar__info-google_cloud-speech_to_text-text .gallery2__sidebar__info-value' ).text( arrFileAudioTranscription[ intItemIndex ] );
            if ( arrFileAudioTranscription[ intItemIndex ] != '' )
            {
                $( '#gallery2__sidebar__info-google_cloud-speech_to_text-text' ).show();
                $( '#gallery2__sidebar__info-google_cloud-speech_to_text-button .gallery2__sidebar__info-dropdown_button' )
                    .addClass( 'disabled' );
            }
        }


        if (
                arrFileTypes[ intCurrentFileIndex ] == 'image'
                && (
                        bolIsOwner
                        || (
                                typeof( bolIsAnonymousUpload ) == 'boolean'
                                && bolIsAnonymousUpload
                            )
                    )
            )
        {
            $( '.gallery2__sidebar__info-dropdown_button.google_cloud-vision' )
                .html(
                    '<span class="gallery2__sidebar__info-dropdown_text">' +
                        'Find objects PRO' +
                    '</span>' +
                    '<span class="gallery2__sidebar__info-dropdown_icon"></span>'
                )
                .removeClass( 'disabled' );
        }


        var jqObjectTagsElem = $( '#gallery2__sidebar__info-object_tags .tags' );
        jqObjectTagsElem.empty();
        if (
                typeof arrObjectTags != 'undefined'
                && typeof arrObjectTags[ intItemIndex ] != 'undefined'
                && arrObjectTags[ intItemIndex ] != ''
            )
        {
            let arrTagsSplitted = arrObjectTags[ intItemIndex ].split( ';' );

            $.each( arrTagsSplitted, ( i, tag ) => {
                jqObjectTagsElem.append( '<span class="tag">' + tag + '</span>' );
            } );

            $( '#gallery2__sidebar__info-object_tags' ).show();
            $( '.gallery2__sidebar__info-dropdown_button.google_cloud-vision' ).addClass( 'disabled' );
        }


        if (
                typeof arrYoloObjectTags != 'undefined'
                && typeof arrYoloObjectTags[ intItemIndex ] != 'undefined'
                && arrYoloObjectTags[ intItemIndex ] != ''
            )
        {
            let arrExistingTags = jqObjectTagsElem.find( '.tag' ).map( function() {
                return $( this ).text();
            } ).get();

            let arrTagsSplitted = arrYoloObjectTags[ intItemIndex ].split( ';' );

            let arrTagsToBeAdded = arrTagsSplitted.filter( tag => ! arrExistingTags.includes( tag ) );

            $.each( arrTagsToBeAdded, ( i, tag ) => {
                jqObjectTagsElem.append( '<span class="tag">' + tag + '</span>' );
            } );

            $( '#gallery2__sidebar__info-object_tags' ).show();
            $( '.gallery2__sidebar__info-dropdown_button.yolo-object_detection' ).addClass( 'disabled' );
        }


        if (
                typeof arrLabelTags != 'undefined'
                && typeof arrLabelTags[ intItemIndex ] != 'undefined'
                && arrLabelTags[ intItemIndex ] != ''
            )
        {
            let jqTagsElem = $( '#gallery2__sidebar__info-label_tags .tags' );

            jqTagsElem.empty();

            let arrTagsSplitted = arrLabelTags[ intItemIndex ].split( ';' );

            $.each( arrTagsSplitted, ( i, tag ) => {
                jqTagsElem.append( '<span class="tag">' + tag + '</span>' );
            } );

            $( '#gallery2__sidebar__info-label_tags' ).show();
            $( '.gallery2__sidebar__info-dropdown_button.google_cloud-vision' ).addClass( 'disabled' );
        }


        $('.gallery2_share-input').val('https://files.fm/f/' + strCurrentFileHash  );

		if ( typeof arrDatesDelete == 'undefined' || arrDatesDelete[intItemIndex] == '' )
		{
			$('#gallery2__sidebar__info-date-delete').hide();
		}
		else
		{
			$('#gallery2__sidebar__info-date-delete .gallery2__sidebar__info-value').html( ( typeof arrDatesDelete != 'undefined' ? arrDatesDelete[intItemIndex] : '' ) );
			$('#gallery2__sidebar__info-date-delete').show();
		}
		
		var strName = arrDisplayNames[intItemIndex];
		if (strName == '')
		{
			strName = arrNames[intItemIndex];
		}

		var $name = $('#gallery2__sidebar__info-name .gallery2__sidebar__info-value');
        
        $name.val( strName );
        
        if( bolIsOwner )
        {
            autoGrow( $name.get( 0 ), '32px' );
            
            $(".not_owner_show").hide();
            $(".not_owner_hide").show();
        }
        else
        {
            $(".not_owner_show").show();
            $(".not_owner_hide").hide();
            
            $( ".gallery2__sidebar__file_name_value" ).html( strName );
            $( ".gallery2__header__file_name_value" ).html( strName );
        }

                
        var $desc = $('#gallery2__sidebar__info-description .gallery2__sidebar__info-value');

        var strDescriptionForInput = arrDescriptions[ intItemIndex ].replaceAll('&#10;', String.fromCharCode(13, 10));
        var strDescriptionForHtml = arrDescriptions[ intItemIndex ].replaceAll('&#10;', '<br/>');
        
        $desc.val( strDescriptionForInput );
        var strDescription = strDescriptionForInput;
        
        if ( strDescription == '' || typeof strDescription == 'undefined' )
        {
            strDescription = '';
            $desc.html( strDescription );
        }
        else
        {
            $( ".gallery2__sidebar__file_description_value" ).html( strDescription );
        }
        
        if( bolIsOwner )
        {
            autoGrow( $desc.get( 0 ), '32px' );
            
            $(".not_owner_show").hide();
            $(".not_owner_hide").show();

            if ( strDescription == '' )
            {
            	$( "#file_description_edit_wrapper" ).addClass("no-description");
            }
            else
            {
            	$( "#file_description_edit_wrapper" ).removeClass("no-description");
            }
        }
        else
        {
            
            $("#file_description_edit_wrapper").click(function () {
                if( window.location.href.indexOf("filebrowser") === -1 )
                {
                    showSignIn();
                }
            });
            
            $( ".gallery2__sidebar__file_description_value" ).html( strDescriptionForHtml );

            if ( strDescription == '' )
            {
            	$( "#gallery2__sidebar__info-description" ).hide();
            	$( ".gallery2__sidebar__file_description_value, label[for='gallery2__sidebar__file_description_value']" ).hide();
            	$( ".gallery2__sidebar__file_description_value" ).css('padding-bottom', '');
            }
            else
            {
            	$( "#gallery2__sidebar__info-description" ).show();
            	$( ".gallery2__sidebar__file_description_value, label[for='gallery2__sidebar__file_description_value']" ).show();
            	$( ".gallery2__sidebar__file_description_value" ).css('padding-bottom', '5px');
            }

            $(".not_owner_show").show();
            $(".not_owner_hide").hide();
        }
        
        
		// regenerate tagsInput in filebrowser
		if(window.location.href.indexOf( "filebrowser" ) !== -1 )
        {
        	// user can browse folders without reloading filebrowser, recheck if user owns file has to be done for each file
            $('#gallery_file_tags_container .file_tags_input').html('');
            $('#gallery_file_tags_container .file_tags_input').removeAttr('data-tagsinput-init');
            $('#gallery_file_tags_container .file_tags_input').removeAttr('id');
            $('#gallery_file_tags_container .tagsinput').remove();

            $('#gallery_file_tags_container .file_tags_input').tagsInput(
            {
                'autocomplete_url': './ajax/file_tag.php?autocomplete&PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3' ,
                'autocomplete': { selectFirst:false, autoFill:false},
                'height' : 'auto',
                'width' : '100%',
                'interactive' : bolIsOwner || ( window.location.href.indexOf( "filebrowser" ) !== -1 && 0 ),
                'defaultText' : 'Add tags',
                'onAddTag' : function(strTagName) 
                {
                    $('#gallery_file_tags_container .file_tags_error').hide();
                    
                    $.ajax({
                        type: "POST",
                        dataType: "json",
                        url: "./ajax/file_tag.php?PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3",
                        data: 
                        {
                            'add_file_tag': true ,
                            'file_hash' : strCurrentFileHash ,
                            'tag_name': strTagName
                        } ,
                        success: function(data)
                        {
                            if (data['status'] == 'ok')
                            {
                                var intItemIndex = getItemIndex(strCurrentFileHash);
                                arrTags[intItemIndex] += ';' + strTagName;
                                // update tags in filebrowser
                                $('#sidebar_file_tags_container .file_tags_input').importTags(typeof arrTags[intItemIndex] === "undefined" ? "" : arrTags[intItemIndex]);
                            }
                            else
                            {
                                $('#gallery_file_tags_container .file_tags_error').show();
                            }
                        } ,
                        error: function()
                        {
                            $('#gallery_file_tags_container .file_tags_error').show();
                        }
                    });
                } ,
                'onRemoveTag' : function(strTagName)
                {
                    $('#gallery_file_tags_container .file_tags_error').hide();

                    $.ajax({
                        type: "POST",
                        dataType: "json",
                        url: "./ajax/file_tag.php?PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3",
                        data: 
                        {
                            'delete_file_tag': true ,
                            'file_hash' : strCurrentFileHash ,
                            'tag_name': strTagName
                        } ,
                        success: function(data)
                        {
                            if (data['status'] == 'ok')
                            {
                                var intItemIndex = getItemIndex(strCurrentFileHash);
                                arrTags[intItemIndex] = arrTags[intItemIndex].replace(strTagName, '');
	                            // update tags in filebrowser
                                $('#sidebar_file_tags_container .file_tags_input').importTags(typeof arrTags[intItemIndex] === "undefined" ? "" : arrTags[intItemIndex]);
                            }
                            else
                            {
                                $('#gallery_file_tags_container .file_tags_error').show();
                            }
                        } ,
                        error: function()
                        {
                            $('#gallery_file_tags_container .file_tags_error').show();
                        }
                    });
                } ,
                'onSearchTag' : function(strTagName)
                {
                    if (strPublicProfileHref != '')
                    {
                        window.open(strPublicProfileHref + '#search='+  strTagName, '_self');
                    }
                    
                } ,
                'delimiter' : [';'] ,
                'removeWithBackspace' : false ,
                'minChars' : 1 ,
                'maxChars' : 245 ,
                'placeholderColor' : '#666666'
            });
        }

        if (strPublicProfileHref != '')
        {
            $('#gallery_file_tags_container .tagsinput').addClass('searchable');
        }
        else
        {
            $('#gallery_file_tags_container .tagsinput').removeClass('searchable');
        }

		$('#gallery_file_tags_container .file_tags_input').importTags(typeof arrTags[intItemIndex] === "undefined" ? "" : arrTags[intItemIndex]);

		if ( ( arrTags[ intItemIndex ] == '' || typeof arrTags[intItemIndex] === "undefined" ) && ! bolIsOwner )
		{
			$( '#gallery2__sidebar__info-tags' ).hide();
			$( '#gallery2__sidebar__info-metadata-tags' ).hide();
            
		}
		else
		{
			$( '#gallery2__sidebar__info-tags' ).show();
			$( '#gallery2__sidebar__info-metadata-tags' ).show();
		}


		if( bolIsOwner && arrFileTypes[intCurrentFileIndex] != 'image' )
		{
			$( '#gallery2__sidebar__info-set-custom-thumbnail' ).html( '' );
			
    		if ( arrFileAttributes[ intItemIndex ][ 'hasCustomThumb' ] )
    		{
    			$( '#gallery2__sidebar__info-set-custom-thumbnail' ).append( '<div class="gallery2__sidebar__info-button no-background" onclick="modalGallery_changeFileThumbnail( \'' +  arrHashes[ intItemIndex ] + '\', ' + intItemIndex + ' )"><i class="fal fa-image"></i> Change file image</div>' );
    			$( '#gallery2__sidebar__info-set-custom-thumbnail' ).append( '<div class="gallery2__sidebar__info-button no-background" onclick="modalGallery_removeFileThumbnail( \'' +  arrHashes[ intItemIndex ] + '\', ' + intItemIndex + ' )"><i class="fal fa-times"></i> Delete file image</div>' );
    		}
    		else
    		{
    			$( '#gallery2__sidebar__info-set-custom-thumbnail' ).append( '<div class="gallery2__sidebar__info-button no-background" onclick="modalGallery_changeFileThumbnail( \'' +  arrHashes[ intItemIndex ] + '\', ' + intItemIndex + ' )"><i class="fal fa-image"></i> Set file preview image</div>' );
    		}

			$( '#gallery2__sidebar__info-set-custom-thumbnail' ).show();
		}
		else
		{
			$( '#gallery2__sidebar__info-set-custom-thumbnail' ).hide();
		}

        
        if( bolIsOwner )
        {
            $( "#gallery2__item_info_delete, #gallery2__item_info_delete_middle" ).on( 'click', function()
            {
                GalleryDeleteFile(arrHashes[ intItemIndex ], strName );
            });
        }
        else if( bolCanDelete && typeof arrFileDeleteKeys != 'undefined' && arrFileDeleteKeys[ intCurrentFileIndex ] != '' )
        {
            $( "#gallery2__item_info_delete, #gallery2__item_info_delete_middle" ).on( 'click', function()
            {
                GalleryDeleteFileAnon( arrFileDeleteKeys[ intCurrentFileIndex ], arrHashes[ intCurrentFileIndex ], strName );
            });
        }
       

		$( '#gallery2__sidebar__info-price, #gallery2__sidebar__info-price_middle' ).html( '' );
		$( '#gallery2__sidebar__info-price, #gallery2__sidebar__info-price_middle' ).hide();
		$( '#gallery2__item_info_save' ).hide();
		
		if ( arrFeeDownloadPrice[ intCurrentFileIndex ] != null )
		{
			if ( bolIsOwner )
			{
				$("#gallery2__sidebar__info-price, #gallery2__sidebar__info-price_middle").attr("onclick", "showSetPriceFormModal(strCurrentFileHash)")
                $("#gallery2__sidebar__info-price, #gallery2__sidebar__info-price_middle").append("Change price")
                $( '#gallery2__item_info_save' ).show();
                $('#gallery2__buyfile span.text').html('Change price');
                $('.print_or_buy_popup__buyfile span.text').html('Change price');
                $( '#gallery2__sidebar__info-price, #gallery2__sidebar__info-price_middle' ).append( ' (' + arrFeeDownloadPrice[ intCurrentFileIndex ] + ' $)' );
            }
			else
			{
				$("#gallery2__sidebar__info-price, #gallery2__sidebar__info-price_middle").attr("onclick", "showBuyFileFormModal(strCurrentFileHash)")
                $("#gallery2__sidebar__info-price, #gallery2__sidebar__info-price_middle").append("<span class='text'>Buy</span>")
                $('#gallery2__buyfile span.text').html('Buy');
                $('.print_or_buy_popup__buyfile span.text').html('Buy');
                $( '#gallery2__item_info_save' ).hide();
                $( '#gallery2__sidebar__info-price, #gallery2__sidebar__info-price_middle' ).append( '<span class="price">' + arrFeeDownloadPrice[ intCurrentFileIndex ] + ' $</span>' );
			}
			
			$( '#gallery2__sidebar__info-price, #gallery2__sidebar__info-price_middle' ).show();
		}
		else
		{
            if ( bolIsOwner )
            {
                $("#gallery2__sidebar__info-price, #gallery2__sidebar__info-price_middle").attr("onclick", "showSetPriceFormModal(strCurrentFileHash)")
                $("#gallery2__sidebar__info-price, #gallery2__sidebar__info-price_middle").append("Sell")	
                $('#gallery2__buyfile span.text').html('Sell');
                $('.print_or_buy_popup__buyfile span.text').html('Sell');
                $( '#gallery2__sidebar__info-price, #gallery2__sidebar__info-price_middle' ).show();
                $( '#gallery2__item_info_save' ).show();
            }
            else 
            {
                if (    arrFeeDownloadPrice[ intItemIndex ]==null && 
                		! currentFolderHasFeeDownload( intItemIndex ) &&
                        arrAllowDownload[ intItemIndex ] && 
                        ( typeof(bolHideDownloadButtons) === 'undefined' || ! bolHideDownloadButtons ) && 
                        ( typeof(arrHideDownloadButtons) === 'undefined' || ! arrHideDownloadButtons[ intItemIndex ] ))
                {
                    $( '#gallery2__item_info_save' ).show();
                    $( '.gallery2__save_button' ).show();
                }
                else
                {
                    $( '#gallery2__item_info_save' ).hide();
                    $( '.gallery2__save_button' ).hide();

                }
            }
		}		
		
		autosize.update($('#file_description_edit_wrapper textarea'));
		autosize.update($('#file_name_edit_wrapper textarea'));
        
        bolGalleryCommentsVisible = true;
        galleryLoadFileComments();

        if (! bolGallerySidebarVisible )
		{
            bolGalleryCommentsVisible = false;
		}
	}

    function galleryLoadFileComments()
    {
        if (!bolGalleryCommentsVisible || strActiveCommentsEntityHash == strCurrentFileHash)
        {
            return;
        }
    
        // Check if global variable is available
        if (typeof window.ChatFM === 'undefined')
        {
            setTimeout(function() {
                galleryLoadFileComments()
            }, 100)
            return
        }
        
        strActiveCommentsEntityHash = strCurrentFileHash;
    
        ChatFM.resetChat();
        ChatFM.setNewEntityChat(strCurrentFileHash, "1");
    }

    function galleryUpdateVoteCount()
    {
		var intItemIndex = getItemIndex ( strCurrentFileHash );
		
		$('.gallery_vote .vote_count').text( arrVoteCounts[intItemIndex] );
		var strVoteIcon = null;
		if ( arrHasVoted[intItemIndex] )
		{
            strVoteIcon = '/images/gallery/heart_red.svg';
			$('.gallery_vote').addClass('has_voted');
		}
		else
		{
            strVoteIcon = '/images/gallery/heart_hollow.svg';
			$('.gallery_vote').removeClass('has_voted');	
		}
		
		if( typeof objAudioPlayer !== "undefined" && objAudioPlayer !== null )
        {
            objAudioPlayer.afterVote();
        }

        var jqImage = $('#main_image_' + strCurrentFileHash);
	}

    function galleryUpdateFileSelection()
    {
                    var objSelectedFiles = getSelectedFiles();
               

        $('#gallery2__thumb-strip__inner a').removeClass('selected');
        $('#gallery_select_middle').removeClass('selected');
        objSelectedFiles.forEach((strHash) => {
            $('#gallery2__thumb-strip__inner a[file_hash="' + strHash + '"]').addClass('selected');

            if(strHash == strCurrentFileHash)
            {
                $('#gallery_select_middle').addClass('selected')
            }
        });
        
	}


	function galleryChangeLocation ( strLocation, bolAuto )
    {
        
        if ( window.location.hash === strLocation )
        {
            setTimeout( "galleryCheckLocation ();", 50 );
        }
        else
        {
            var bolChangeLocation = true;
            
            
            if ( bolChangeLocation )
            {
                if ( window.location.hash.indexOf( ';/action/send_message' ) != -1 )
                {
                    bolOpenGalleryCommentsBlock = true;
                }
                
                if(window.location.hash.indexOf('#') != -1)
                {
                    window.location.replace(('' + window.location).split('#')[0] + strLocation)
                }
                else
                {
                    window.location.replace(('' + window.location) + '#' + strLocation)
                }

                if(typeof(bolAuto) === 'undefined' && typeof(strSlideshowInterval) !== 'undefined' && strSlideshowInterval !== null)
                {
                    var domVideo = document.getElementById('video_' + arrHashes[intCurrentFileIndex]);

                    clearInterval(strSlideshowInterval);
                    strSlideshowInterval = null;
                    if (!strSlideshowInterval)
                    {
                        strSlideshowInterval = setInterval(nextSlide, 4000);
                    }
                }
            }
        }
            }

    var bolCheckLocationRunning = false;
    function galleryCheckLocation ()
    {
        if ( bolCheckLocationRunning )
            return;

        bolCheckLocationRunning = true;

    	var intFileIndex = null;


        if (window.location.hash.indexOf(';/view/') != -1)
        {
            bolHashtagViewUseSemicolon = true;
        }
        else
        {
            bolHashtagViewUseSemicolon = false;
        }

        var intIndexOfView = window.location.hash.indexOf('/view/');
        if (intIndexOfView != -1)
        {
            var strViewLink = window.location.hash.slice(intIndexOfView, window.location.hash.length);
            var intIndexOfFileNameEnd = strViewLink.indexOf(';');
            if ( intIndexOfFileNameEnd == -1 )
            {
                intIndexOfFileNameEnd = strViewLink.length;
            }
            var strItemHashOrName = strViewLink.slice(6, intIndexOfFileNameEnd);
            intFileIndex = getItemIndexByHashOrName ( strItemHashOrName );
        }
        else
        {
            if( strCurrentFileHash && ! bolIsListViewForSpecificFile  ) closeGallery(strCurrentFileHash);
            if(bolGalleryOpened)
            {
	            // if user goes backwards in history, add the entry of /u/ page again
                bolPushWhenOpen = true; 
            }
        }



		if (window.location.hash.indexOf(';zoom') == -1)
		{
            $('#gallery_panzoomdiv').css('display', 'none');
        }

		if ( typeof intFileIndex !== "undefined" && intFileIndex !== null )
		{
			$('#gallery2').show();
			if ( strCurrentFileHash !== arrHashes[ intFileIndex ]  )
            {
                setTimeout( "showGalleryItem( '" + arrHashes[ intFileIndex ] + "')", 0 );
            }
		}
        else
        {
            if ( bolGalleryIsVisible && bolCloseGalleryIfHashRemoved )
            {
                closeGallery(strCurrentFileHash);
            }
        }

        bolCheckLocationRunning = false;
	}

    var galleryCheckHashtag = galleryCheckLocation;

    if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent))
    {
        var mql = window.matchMedia("(orientation: portrait)");
        // If there are matches, we're in portrait
        // Add a media query change listener
        mql.addListener(function(m) {
            if(m.matches) {
                // Changed to portrait
                $('#gallery2__content-wrapper').removeClass( 'gallery__only_image' );
            }
            else {
                // Changed to landscape
                $('#gallery2__content-wrapper').addClass( 'gallery__only_image' );
            }
            setTimeout( function() {
                var evt = document.createEvent('UIEvents');
                evt.initUIEvent('resize', true, false,window,0);
                window.dispatchEvent(evt);
            }, 300 );
        });
    }

    $(window).bind('hashchange', galleryCheckLocation);
        
    function galleryDestroyMainSlider ()
    {
    	if ( jqMainSlider )
    	{
    		jqMainSlider.destroySlider();	
    		jqMainSlider = null;
		}
	}
    
    function galleryReinitalize ()
    {
    	galleryDestroyMainSlider ();
    	$( '#gallery2__swipe-wrapper .gallery2__item' ).remove();
    	$( '#gallery2__thumb-strip__inner' ).html('');
        $('#gallery2__controls_doc_sign').removeClass('document');

        $( '#gallery2__info_middle' ).removeClass( 'mobile-hide' );
        $(' #gallery2__info_more' ).removeClass( 'mobile-show' );

        if ( bolIsOwner )
        {
            $('#gallery2__header__setprice').show();
            $('#gallery2__sign').show();
            $('#gallery2__sign_main').show();
            $('.gallery2__edit').show();
        }
        else
        {
            $('#gallery2__header__setprice').hide();
            $('#gallery2__sign').hide();
            $('#gallery2__sign_main').hide();
            $('.gallery2__edit').hide();
        }
        
        if ( bolUseAsyncFileInfoDataLoad )
        {
            arrFileTitle = [];
            arrFileSubject = [];
            arrFileContentType = [];
            arrFileCategory = [];
            arrFileCategories = [];
            arrFileKeywords = [];
            arrFileCreator = [];
            arrFilePublisher = [];
            arrFileContributor = [];
            arrFileCopyrights = [];
            arrFileLicenseType = [];
            arrFileLicenseDetails = [];
            arrFileLanguage = [];
            arrFileLocation = [];
            arrFileLocationLat = [];
            arrFileLocationLong = [];
            arrFileReferences = [];
            arrFileRelatesTo = [];
            arrFileFormat = [];
            arrFileDevice = [];
            arrFileSource = [];
            arrTags = [];
            arrObjectTags = [];
            arrYoloObjectTags = [];
            arrLabelTags = [];
            arrFileGoogleCVText = [];
            arrFileEasyOCRText = [];
            arrFileAudioTranscription = [];
            arrIsFileInfoDataPreloaded = [];
            }
	}

    var objVideoPlayers = {};
    
    function initVideoPlayer (intFileIndex)
    {
        var logoHref = "https://files.fm";
        var logoImgUrL = logoHref;
    
                logoImgUrL += "/images/logo/white/filesfm_logo_full.svg";
                
        var player = new FilesFm_VideoJS( "video_" + arrHashes[ intFileIndex ], {
            autoplay: false,
            posterHref: 'https://' + arrFileHost[ intFileIndex ]  + '/thumb_video_picture.php?i=' + arrHashes[intFileIndex] + '&PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3' ,
        } );

        objVideoPlayers[intFileIndex] = player;

        player.objPlayer.on( 'ready', function() {
            var domVideo = $( '#' + player.strContainerId + ' video' )[ 0 ];
            var objQualitySelector = player.objPlayer.controlBar.qualitySelector;
            var objPlaybackRateMenuButton = player.objPlayer.controlBar.playbackRateMenuButton;


            // Add title to PlaybackRateMenuButton
            $( objPlaybackRateMenuButton.menu.el() )
                .prepend( '<div class="vjs-menu-title bx_allow_events">Speed</div>' );

            // Close QualitySelector and PlaybackRateMenuButton when any of CenterButtons is clicked.
            // Event 'touchend' is specifically for touchscreens.
            // Mouse click is implemented in VideoJS by default.
            player.objPlayer.getChild( 'CenterButtons' ).children().forEach( button => {
                $( button.el() ).on( 'touchend', () => {
                    objQualitySelector.unpressButton();
                    objPlaybackRateMenuButton.unpressButton();
                } );
            } );


            // Do not make further changes to QualitySelector
            //     if there is no source of the original video.
            if ( player.objPlayer.currentSources().length != 2 )
            {
                return;
            }


            function onMetadataLoaded()
            {
                domVideo.removeEventListener( 'loadedmetadata', onMetadataLoaded );

                // If preview and original video resolutions are the same, remove QualitySelector
                if (
                        typeof arrWidths != 'undefined'
                        && typeof arrHeights != 'undefined'
                        && arrWidths[ intFileIndex ] == domVideo.videoWidth
                        && arrHeights[ intFileIndex ] == domVideo.videoHeight
                    )
                {
                    objQualitySelector.el().remove();
                    return;
                }

                styleQualitySelector( player, intFileIndex );

                $( objPlaybackRateMenuButton.el() ).addClass( 'vjs-quality-selector-available' );
                $( objQualitySelector.menu.el() ).find( '*' ).addClass( 'bx_allow_events' );


                
                    var jqQualitySelectorList = $( objQualitySelector.menu.contentEl() );
                    var jqOriginalQualityBTN = $( objQualitySelector.items[ 1 ].el() );

                    jqOriginalQualityBTN.remove();

                    // Create plain copy of element (to prevent any event listeners and other stuff)
                    jqOriginalQualityBTN = $( jqOriginalQualityBTN[ 0 ].outerHTML );

                    jqQualitySelectorList.append( jqOriginalQualityBTN );

                    jqOriginalQualityBTN.on( 'click touchend', function() {
                        player.objPlayer.pause();

                        
                            showCreateAccount();

                                            } );

                            }

            if ( domVideo.readyState == 0 )
            {
                domVideo.addEventListener( 'loadedmetadata', onMetadataLoaded );
            }
            else
            {
                onMetadataLoaded();
            }
        } );

        player.objPlayer.on( 'qualityRequested', function( event, newSource ) {
            $( event.target )
                .find( '.vjs-control-bar .vjs-quality-selector .vjs-quality-selector-value' )
                .text( newSource.resolutionLabel );
        } );

        player.objPlayer.on("ended", (event) => {
            if ( bolGalleryIsVisible )
            {
                var intNextSlideIndex = intNextIndex;

                if(intNextIndex == null || isNaN( intNextIndex ) && arrHashes[0] != null)
                {
                    intNextSlideIndex = getItemIndex ( arrHashes[0] );
                }

                if ( intNextSlideIndex != null && !isNaN( intNextSlideIndex ) )
                {
                    if (strSlideshowInterval === 'reset')
                    {
                        objVideoPlayers[intCurrentFileIndex].objPlayer.loop(true);
                        galleryChangeLocation ( getItemLink ( arrHashes[intNextSlideIndex] ) );
                    }
                }
            }
        });
        
        fitVideoPlayer( $( "#video_" + arrHashes[ intFileIndex ] ) );
    
        $( "#video_" + arrHashes[ intFileIndex ] ).find( "*" ).addClass( "bx_allow_events" );

        $( "#video_" + arrHashes[ intFileIndex ] ).addClass( 'ffm_video_fallback' );

        $( "#video_" + arrHashes[ intFileIndex ] + ' .vjs-loading-spinner .vjs-control-text' ).text( 'Wait for the mp4 video preview to be created for playback in the browser. This takes time, depending on the length of the video. If the video does not start, refresh the page or download the original.' );

        // let's not resize the player anymore
        player.setFluid( false );
    }

    function styleQualitySelector( player, intFileIndex )
    {
        var strDefaultQualityLabel = 'HD';

        var domVideo = $( '#' + player.strContainerId + ' video' )[ 0 ];
        var objQualitySelector = player.objPlayer.controlBar.qualitySelector;

        $( objQualitySelector.menu.el() )
            .prepend( '<div class="vjs-menu-title">Quality</div>' );


        // PREVIEW QUALITY BUTTON
        var jqPreviewQualityText = $( objQualitySelector.items[ 0 ].el() ).find( '.vjs-menu-item-text' );
        jqPreviewQualityText.html( '<div>Preview</div>' );

        var intPreviewWidth = domVideo.videoWidth;
        var intPreviewHeight = domVideo.videoHeight;

        if (
                typeof intPreviewWidth == 'number'
                && typeof intPreviewHeight == 'number'
                && intPreviewWidth > 0
                && intPreviewHeight > 0
            )
        {
            var strPreviewResolutionLabel = getResolutionLabel( intPreviewWidth, intPreviewHeight, true );
            if ( strPreviewResolutionLabel === '' )
            {
                strPreviewResolutionLabel = 'SD ';
            }

            jqPreviewQualityText.append(
                '<div>' +
                    strPreviewResolutionLabel + intPreviewWidth + 'x' + intPreviewHeight +
                '</div>'
            );
            
            $( objQualitySelector.el() ).prepend( '<div class="vjs-quality-selector-value">' + strPreviewResolutionLabel + '</div>' );

            player.objPlayer.currentSources()[ 0 ].resolutionLabel = strPreviewResolutionLabel;
        }
        else
        {
            $( objQualitySelector.el() ).prepend( '<div class="vjs-quality-selector-value">' + strDefaultQualityLabel + '</div>' );

            player.objPlayer.currentSources()[ 0 ].resolutionLabel = strDefaultQualityLabel;
        }

        // ORIGINAL QUALITY BUTTON
        var jqOriginalQualityText = $( objQualitySelector.items[ 1 ].el() ).find( '.vjs-menu-item-text' );
        jqOriginalQualityText.html(
            '<div>' +
                'Original ' +
                '<span class="pro_flag">PRO</span>' +
            '</div>'
        );

        if (
                typeof arrWidths != 'undefined'
                && typeof arrHeights != 'undefined'
                && arrWidths[ intFileIndex ] != ''
                && arrHeights[ intFileIndex ] != ''
            )
        {
            var strOriginalResolutionLabel = getResolutionLabel( arrWidths[ intFileIndex ], arrHeights[ intFileIndex ], true );
            if ( strOriginalResolutionLabel === '' )
            {
                strOriginalResolutionLabel = 'SD ';
            }

            jqOriginalQualityText.append(
                '<div>' +
                    strOriginalResolutionLabel + arrWidths[ intFileIndex ] + 'x' + arrHeights[ intFileIndex ] +
                '</div>'
            );

            player.objPlayer.currentSources()[ 1 ].resolutionLabel = strOriginalResolutionLabel;
        }
        else
        {
            player.objPlayer.currentSources()[ 1 ].resolutionLabel = strDefaultQualityLabel;
        }
    }

    function getVideoSize($video) 
    {
        $video = $($video);
        
        var $viewPort = $video.closest( ".gallery2__video_container" );
    
        var viewportHeight = $viewPort.height() - 100;
        var viewportWidth = $viewPort.width();
        
        var minHeight = 240;
    
        var videoHeight = $video.get( 0 ).offsetHeight;
        var videoWidth = $video.get( 0 ).offsetWidth;
    
        var widthToHeight = $video.attr( 'data-wth' );
    
        if ( typeof widthToHeight === "undefined" || !widthToHeight )
        {
            widthToHeight = Math.floor( videoWidth / videoHeight * 100 ) / 100;
            $video.attr( 'data-wth', widthToHeight );
        }
        
        if( widthToHeight == 0 )
        {
            widthToHeight = 1;
        }
    
        var maxHeight = viewportHeight;
    
        if ( maxHeight * widthToHeight >= viewportWidth )
        {
            maxHeight = Math.round( viewportWidth / widthToHeight );
        }
        
        if( maxHeight > viewportHeight )
        {
            maxHeight = viewportHeight;
        }
    
        if ( maxHeight < minHeight )
        {
            maxHeight = minHeight;
        }
        
        var w = Math.floor( widthToHeight * maxHeight );
        
        return {
            height: maxHeight + 'px',
            width: !isNaN(w) ? (w + "px") : "0px"
        };
    }
    
    function fitVideoPlayer( $video )
    {
        $video = $($video);
        
        var size = getVideoSize( $video );

        $video.css( {
            paddingTop: size.height,
            width: size.width,
            height: 0
        } );
        
        $video.find( "video" ).css( 'width', '100%' );
    }

    function fitEmbedPlayer( $video )
    {
        $video = $( $video );
        var size = getVideoSize( $video );

        if ( size.width !== "0px" )
        {
            $video.closest( ".gallery2__video_container__embed_palyer" ).css( {
                'maxWidth': size.width
            } );
    
            $video.closest( ".filesfm__embed_player__container" ).css( {
                height: "100%"
            } );
        }
    
        $video.find( "video" ).css( 'width', '100%' );
    }
    
    var bolGalleryIsOpening = false;
    var arrThumbWidth = [];
    function showGallery()
    {
    	if ( bolGalleryIsOpening )
    	{
    		return;
		}

		bolGalleryIsOpening = true;

        $( 'html' ).css( 'overflow', 'hidden' );
        $( '#gallery2' ).show();

        $('#tawkchat-iframe-container').hide();

        if( $( '#gallery2__swipe-wrapper .gallery2__item' ).length == 0 )
        {
            if (jqThumbContainer == null)
            {
                jqThumbContainer = $('#gallery2__thumb-strip__inner');

                var intAllThumbCount = $( 'A', jqThumbContainer ).length;
            }
            var intThumbsW = 0;

            var arrItems = [];
            var arrThumbs = [];
            for( idx in arrIDs )
            {
            	// Removed jQuery from content composing
				var strItemHTML = '<span class="gallery2__item" id="gallery2__item-' + idx + '"></span>';
				
                strAddress = '';
                
                var strThumbHTML = '';
                var strClass = null;
                if ( arrThumbnails[idx] )
                {
                    var strThumbPath = arrThumbnails[idx];
                    
                    strThumbHTML = '<img src="/images/gallery-image-icon.png" data-original="'+strThumbPath+'" id="thumb_strip_img_'+arrHashes[idx]+'" class="lazyload-image-gallery" />';
                }
                else if ( typeof( arrIconSvg ) !== 'undefined' && arrIconSvg[idx] )
                {
                    strThumbHTML = '<span class="gallery2__item__thumbnail '+ arrExtensions[ idx ].toLowerCase() +' thumb-svg-icon"><img src="/images/file_types_v2/'+arrIconSvg[ idx ]+'" data-original="/images/file_types_v2/'+arrIconSvg[ idx ]+'" style="max-width: 35px" /><span class="gallery2__item__thumbnail-ext">'+ arrExtensions[ idx ].toUpperCase() +'</span></span>';
                }
                else if ( arrIconClass[idx] )
                {
                    strThumbHTML = '<span class="gallery2__item__thumbnail '+ arrExtensions[ idx ].toLowerCase() +'"><i class="' + arrIconClass[idx] + '"></i><span class="gallery2__item__thumbnail-ext">'+ arrExtensions[ idx ].toUpperCase() +'</span></span>';
                    strClass = 'doc-icon';
                }
                else
                {
                    strThumbHTML = '<span class="gallery2__item__thumbnail '+ arrExtensions[ idx ].toLowerCase() +'"><i class="fal fa-file"></i><span class="gallery2__item__thumbnail-ext">'+ arrExtensions[ idx ].toUpperCase() +'</span></span>';
                    strClass = 'doc-icon';
                }
                
                var strThumbItemHTML = '<a href="javascript:void(0)" class="thumb_' + arrHashes[idx] + ''+ (strClass ? ' '+strClass : '') +'" file_hash="'+arrHashes[idx]+'" onclick="galleryChangeLocation ( getItemLink ( \''+arrHashes[idx]+'\' ) )" ';
                if( !arrThumbnails[idx] )
                {
                    strThumbItemHTML += 'style="min-width:65px;"';
                }
                strThumbItemHTML += '><!--<div class="thumb-loader">Loading</div>--><div class="thumb-wrapper">'+ strThumbHTML +'</div><div class="checkbox"></div></a>';
                
                arrItems.push(strItemHTML);
                arrThumbs.push(strThumbItemHTML);
            }
            
            $( '#gallery2__swipe-wrapper' )[0].innerHTML = arrItems.join('');
            jqThumbContainer[0].innerHTML = arrThumbs.join('');
            
            arrItems = null;
            arrThumbs = null;
        }

                    //add checkboxes to thumb strip and update middle menu
            galleryUpdateFileSelection();
        

        
		
		if (jqThumbContainer == null)
		{
			jqThumbContainer = $('#gallery2__thumb-strip__inner');
		}
		
		if (jqThumbViewport == null)
		{
			jqThumbViewport = $('#gallery2__thumb-strip');
		}

        if( jqMainSlider == null )
        {
            recalculateGalleryForBanner();
            var bolTouchEnabled = true;

                            if(arrIDs.length == 1)
                {
                    bolTouchEnabled = false;
                }
                        
            jqMainSlider = $( '#gallery2__swipe-wrapper' ).bxSlider({
                slideSelector: 'span.gallery2__item',
                infiniteLoop: false,
                hideControlOnEnd: true,
                preventDefaultSwipeX: true,
                video: true,
                pager: false,
                controls: false,
                slideWidth: 9999,
                useCSS: true,
                speed: 0,
                animationSpeed: 0,
                touchEnabled: bolTouchEnabled ,
                onSlideBefore: function( $slide, oldIDx, newIDx ){

                    galleryChangeLocation ( getItemLink ( arrHashes[newIDx] ) );

                    if( !$slide.hasClass( 'content_ready' ) )
                    {
                        loadSlideContent( $slide, newIDx );
                    }
                },
                onSlideAfter: function( $slide, oldIDx, newIDx ){
                    var slidePrevIDx = parseInt( newIDx ) - 1;
                    var slideNextIDx = parseInt( newIDx ) + 1;

                    if( slidePrevIDx >= 0 )
                    {
                        $slidePrev = $( '#gallery2__item-' + slidePrevIDx );

                        if( $slidePrev.length > 0 && !$slidePrev.hasClass( 'content_ready' ) )
                        {
                            loadSlideContent( $slidePrev, slidePrevIDx );
                        }
                    }

                    if( slideNextIDx < jqMainSlider.getSlideCount() )
                    {
                        $slideNext = $( '#gallery2__item-' + slideNextIDx );

                        if( $slideNext.length > 0 && !$slideNext.hasClass( 'content_ready' ) )
                        {
                            loadSlideContent( $slideNext, slideNextIDx );
                        }
                    }
    
                    if ( $slide.find( ".gallery2__item__audio-wrapper" ).length )
                    {
                        objAudioPlayer.appendTo( $slide.find( ".gallery2__item__audio-wrapper" ) );
                        objAudioPlayer.setCurrentTrackByHash( arrHashes[ newIDx ] );
                    }
                }
            });

            var obj = document.getElementById('gallery2__swipe-wrapper');
            obj.addEventListener('touchmove', function(event) {
                if(event.targetTouches.length > 1)
                {
                    $( '#gallery2__swipe-wrapper' ).attr('data-multi-touch', true)
                }
                else
                {
                    $( '#gallery2__swipe-wrapper' ).attr('data-multi-touch', false)
                }
            }, false);
            
        }
        else if (bolHaveToRedrawGallery)
        {
        	recalculateGalleryForBanner(true);
        	bolHaveToRedrawGallery = false;
        }
        
        // At the beginning we need fixed size for lazyload to work
        $( 'img.lazyload-image-gallery', jqThumbContainer).css( {'width': 'auto', 'height':'73px'} ).addClass('image-not-loaded');

        $(function(){

            var intAllThumbCount = $( 'A', jqThumbContainer ).length;

            // After preload image is loaded - set auto size for original images.
            $( 'img.lazyload-image-gallery', jqThumbContainer ).on( 'load', function (){

                var intW = this.naturalWidth;
                if ( intW < intThumbWidth )
                    intW = intThumbWidth;
                arrThumbWidth.push( intW );
                var intLoadedThumbCount = 0;
                var intLoadedThumbWidthSum = 0;
                for ( var i = 0; i<arrThumbWidth.length; i++ )
                {
                    intLoadedThumbCount++;
                    intLoadedThumbWidthSum += arrThumbWidth[i];
                }

                var intAllThumbCount = $( 'A', jqThumbContainer ).length;

                this.className = this.className + ' image-loaded';
            } );

            $( document ).on( 'click', function( e )
            {
                var jqTarget = $( e.target );
                
                if (
                    jqTarget.parents( '#gallery2__header__mobile_menu' ).size()==0 && 
                    jqTarget.attr( 'id' )!='gallery2__header__mobile_menu' && 
                    jqTarget.parents( '#gallery2__header__right_more' ).size()==0 && 
                    jqTarget.attr( 'id' )!='gallery2__header__right_more' 
                )
                {
                    $( '#gallery2__header__right_more' ).removeClass('open');
                }
                if (
                    jqTarget.parents( '#gallery-main-download-button' ).size()==0 && 
                    jqTarget.attr( 'id' )!='gallery-main-download-button'
                )
                {
                    $( '#gallery-main-download-button' ).removeClass('open');
                }
            });

            $( '#gallery2__header__mobile_menu > .gallery2__header_middle_button:not(#gallery2__sidebar__info_embed_button_middle)' )
                .on( 'click', function ()
                {
                    $( '#gallery2__header__right_more' ).removeClass('open');
                } );
        });

		$( 'img.lazyload-image-gallery' ).lazyload({
			container: jqThumbViewport,
			skip_invisible: true,
			event: 'scroll touchmove thumb-scroll',
			threshold: parseInt(intPreloadThumbnailsCount * intThumbWidth)
		});
		
		bolGalleryIsVisible = true;

        $( function() {
            if(typeof(bolOpenPopupInGallery) !== 'undefined' && bolOpenPopupInGallery)
            {
                if( intPopupType == 2) 
                {
                    objPopupForm.showForm();
                    bolPopupOnlyGallery = true;
                }
                else
                {
                    setTimeout(function() {
                        objPopupForm.showForm();
                        bolPopupOnlyGallery = true;
                    }, 2000);
                }
            }
        } );

		setTimeout("$('#info_tooltip_global').hide();", 100);

		        if ( objMainShareParams )
            $('#gallery2__share').show();
                
		bolGalleryIsOpening = false;

        var bolIsMobile = navigator.userAgent.match( '/Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/i' )
        if ( !bolIsMobile && $( window ).width() >= 1400 && !bolGallerySidebarVisible )
        {
            showGalleryInfo();
        }
    }

    
    function galleryLazyloadRecalc()
    {
		// Optimization for lazy load to work faster on large set of images.
		// Trigger lazy load recalc event for 5 images before loaded images and 5 after.
		var arrPreElements = [];
		var arrPostElements = [];
		var bolPassedLoadedImages = false; 
		$('img.lazyload-image-gallery').each (function (){
			var jqImage = $(this);
			if ( jqImage.hasClass('image-loaded') )
			{
				bolPassedLoadedImages = true;
			}
			if ( bolPassedLoadedImages == false )
			{
				arrPreElements.unshift( jqImage );
				if (arrPreElements.length == intPreloadThumbnailsCount)
				{
					delete arrPreElements[intPreloadThumbnailsCount-1];
				}
			}
			else
			{
				if (arrPostElements.length < intPreloadThumbnailsCount)
				{
					arrPostElements.push( jqImage );
				}
			}
		});

        jqThumbViewport.trigger('scroll');
		
	}

	function openPanZoomImage ()
    {
        if ( arrFileTypes[intCurrentFileIndex] !== 'image' )
            return;

        var strImageURL = 'https://'+ arrFileHost[ intCurrentFileIndex ]  +'/thumb_show.php?i=' + arrHashes[intCurrentFileIndex] + '&view&v=1&PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3';
        if (arrFeeDownloadPrice[intCurrentFileIndex] > 0 || currentFolderHasFeeDownload( intCurrentFileIndex ) )
        {
            strImageURL += '&wm=103';
        }

        if ( typeof( arrFileVersion ) != 'undefined' && typeof( arrFileVersion[ intCurrentFileIndex ] ) != 'undefined' && arrFileVersion[ intCurrentFileIndex ] > 0 )
        {
            strImageURL += '&version=' + arrFileVersion[ intCurrentFileIndex ];
        }

        var srNewPanZoomLink = getItemLink ( strCurrentFileHash );

       
        if( !window.location.hash.includes(';zoom') )
        {
            if ( window.location.hash.length > 0 )
            {
                srNewPanZoomLink += ';zoom';
            }
            else
            {
                srNewPanZoomLink += '#;zoom';
            }
        }
        galleryChangeLocation ( srNewPanZoomLink );

        var strHtml = '<img id="gallery_panzoomdiv_content" src="' + strImageURL + '" onload="initPanZoomImage(this)" />';

        strHtml += '<div id="gallery_panzoomdiv_info" style="position: absolute; top: 0px; left: 0px; font-size: 12px; color: #fff; padding: 10px;"></div>';


        var resCloseTimeout = null;
        $('#gallery_panzoomdiv')
            .html( strHtml )
            .css('display', 'block')
            .on('mouseup', function (e){
                resCloseTimeout = setTimeout( function (){
                    $('#gallery_panzoomdiv').css('display', 'none');
                }, 50);
            })
            .on('mousemove', function (e){
                if ( resCloseTimeout )
                {
                    clearTimeout( resCloseTimeout );
                    resCloseTimeout = null;
                }
            });

        $('#gallery_panzoomdiv_close').on('click', function () {
            $('#gallery_panzoomdiv').css('display', 'none');
        });
    }

    function initPanZoomImage (dom)
    {
        var intBodyHeight = $('body').outerHeight();

        var panzoom_instance = panzoom(dom, {
            transformOrigin: {x: 0.5, y: 0.5},
            maxZoom: 8,
            minZoom: 0.25,
            onTouch: function(e) {
                return false;
            }
        });
        var container_width = $('#gallery_panzoomdiv').width();
        var container_height = $('#gallery_panzoomdiv').height();
        var width = $('#gallery_panzoomdiv_content').width();
        var height = $('#gallery_panzoomdiv_content').height();

        panzoom_instance.moveTo((width - container_width)/-2, (height - container_height)/-2);

        var jqHead = $( 'head' );
        jqHead.find( 'meta[name=viewport]' ).remove();
        jqHead.prepend( '<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0" />' );
    }

    var arrIframeTimers = [];
    var objAudioPlayer = null;

    function getBackgroundSize(elem) {
        var objElemComputedStyle = getComputedStyle(elem),
        objImage = new Image(),
        strElemSrc = objElemComputedStyle.backgroundImage.replace(/url\((['"])?(.*?)\1\)/gi, '$2'),
        intElemWidth = parseInt(objElemComputedStyle.width.replace('px', ''), 10),
        intElemHeight = parseInt(objElemComputedStyle.height.replace('px', ''), 10);
        objImage.src = strElemSrc;
        
        var intBackgroundWidth, intBackgroundHeight;
        var intRatioWidth = objImage.width / intElemWidth;
        var intRatioHeight = objImage.height / intElemHeight;

        if (intRatioWidth > intRatioHeight)
        {
            intBackgroundHeight = objImage.height / intRatioWidth;
            intBackgroundWidth = intElemWidth;
        }
        else
        {
            intBackgroundWidth = objImage.width / intRatioHeight;
            intBackgroundHeight = intElemHeight;
        }
        return {
            width: intBackgroundWidth,
            height: intBackgroundHeight
        };
    }

    function loadSlideContent( $jqSlideElem, intFileIndex )
    {
		var strHttpCacheKey = '';
		if ( typeof(arrHttpCacheKeys) != 'undefined' && typeof(arrHttpCacheKeys[intFileIndex]) != 'undefined' )
		{
			strHttpCacheKey = '' + arrHttpCacheKeys[intFileIndex];
		}

        if ( arrFileAttributes && arrFileAttributes[ intFileIndex ] && arrFileAttributes[ intFileIndex ][ 'readOnly' ] )
        {
            $( '#gallery2__header__mid_content' ).hide();
        }
        else
        {
            $( '#gallery2__header__mid_content' ).show();
        }

        
    	var strFileType = arrFileTypes[intFileIndex];
    	
    	var bolIsFileConvertableToPdf = isFileConvertable( 'pdf', intFileIndex );

    	if ( bolIsFileConvertableToPdf )
    	{
    		strFileType = 'pdf_converted';
    	}
    	
        
        switch( strFileType )
        {
            default:
                var bolSimpleDownloadAllowed = false;
                if ( arrAllowDownload[ intFileIndex ]
                    && arrFeeDownloadPrice[ intFileIndex ] == null
                    && ! currentFolderHasFeeDownload( intFileIndex )
                    && ( typeof(bolHideDownloadButtons) === 'undefined' || ! bolHideDownloadButtons ) && ( typeof(arrHideDownloadButtons) === 'undefined' || ! arrHideDownloadButtons[ intFileIndex ] )
                ) {
                    bolSimpleDownloadAllowed = true;
                }

                var jqThumb;

                if ( arrFileAttributes[ intFileIndex ][ 'hasCustomThumb' ] )
                {
                	jqThumbInner = $( "<div>" )
                    .css({
                        'background-image': 'url("/thumb.php?i=' + arrHashes[ intFileIndex ] + '&v=1")',
                        'height': function() 
                        {
                        }
                    })
                    .addClass( 'gallery2__item__custom_thumb' );

                    if ( arrFeeDownloadPrice[intFileIndex] > 0 )
                    {
                        if (bolIsOwner)
                        {
                            jqThumbInner.attr( 'onclick', 'showSetPriceFormModal(strCurrentFileHash)' );
                        }
                        else 
                        {
                            jqThumbInner.attr( 'onclick', 'showBuyFileFormModal(strCurrentFileHash)' );
                        }
                    	jqThumbInner.addClass( 'bx_allow_events' );
                    	jqThumbInner.addClass( 'has_price' );
                    }

                    jqThumb = jqThumbInner;
                }

                $jqSlideElem.append( '<span class="gallery2__vertical-helper"></span><span class="gallery2__item__doc-wrapper' + ( arrFileAttributes[ intFileIndex ][ 'hasCustomThumb' ] ? ' has_custom_thumb' : '' ) + '"></span>' );
                $( '.gallery2__item__doc-wrapper', $jqSlideElem ).append( jqThumb );

                var strIconHtml = '<i class="fa-5x fa ' + arrIconClass[ intFileIndex ] + '"></i>';
                if ( typeof( arrIconSvg ) !== 'undefined' && arrIconSvg[ intFileIndex ] )
                {
                    strIconHtml = '<img src="/images/file_types_v2/'+arrIconSvg[ intFileIndex ]+'" class="ext-icon" />';
                }
                jqThumbIcon = $( '<span class="gallery2__item__doc-icon ' + arrExtensions[ intFileIndex ].toLowerCase() + '">' + strIconHtml + '</span>' );
                $( '.gallery2__item__doc-wrapper', $jqSlideElem ).append( jqThumbIcon );
                $('.gallery2__item__doc-wrapper', $jqSlideElem).append('<div class="gallery2__item__information-wrapper"><p class="gallery2__item__doc-filename">' + arrDisplayNames[intFileIndex] + '</p></div>');
                

                $( '.gallery2__item__doc-wrapper', $jqSlideElem ).append( '<p class="gallery2__item__doc-nopreview"></p>' );

                $( '.gallery2__item__doc-wrapper', $jqSlideElem ).append(jqButtonContainer);
                break;

            case 'image':
                    var strImageURL = 'https://' + arrFileHost[ intFileIndex ] + '/thumb_show.php?i=' + arrHashes[intFileIndex] + '&view&v=1&PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3';
                    if (arrFeeDownloadPrice[intFileIndex] > 0 || currentFolderHasFeeDownload( intFileIndex ) )
                    {
                        strImageURL += '&wm=103';
                    }

                    if ( typeof( arrFileVersion ) != 'undefined' && typeof( arrFileVersion[ intFileIndex ] ) != 'undefined' && arrFileVersion[ intFileIndex ] > 0 )
                    {
                        strImageURL += '&version=' + arrFileVersion[ intFileIndex ];
                    }

					var strHtml = '' +
						'<span class="gallery2__vertical-helper"></span>' +
						'<i class="fa fa-spinner fa-spin gallery2__load-spinner" id="main_image_load-spinner_'+ arrHashes[intFileIndex] +'"></i>' +
                        '<img class="gallery2__item__img gallery2__item__base-width-on bx_allow_events ' + ((arrWidths[intFileIndex] >= 1500 || arrHeights[intFileIndex] >= 1500 ) ? 'stretch_image' : '') + '" src="" alt="" id="main_image_'+ arrHashes[intFileIndex] +'" />' +
                        '<div class="print_or_buy_popup">' +
                            '<div class="print_or_buy_popup_close bx_allow_events" onclick="$(\'.print_or_buy_popup\').hide();"></div>' +
                            '<div class="print_or_buy_popup_desc">You can buy this file or print-on-demand products:</div>' +
                            '<span class="print_or_buy_popup__buyfile print_or_buy_popup_button" style="display:none"  onclick="showSetPriceFormModal(strCurrentFileHash)">' +
                                '<a href="javascript:void(0);">' +
                                ' <span class="text">Buy</span>' +
                                    '<span class="price"></span>' +
                                '</a>' +
                            '</span>' +
                            '<span class="print_or_buy_popup__products print_or_buy_popup_button">' +
                                '<a href="javascript:void(0);">' +
                                    '<span class="text">View products</span>' +
                                '</a>' +
                            '</span>' +
                        '</div>' +
                        '</div>';
                     $jqSlideElem.append( strHtml );

                     var bolImageLoaded = false;
                     var strImageFileHash = arrHashes[intFileIndex];
                     $( 'img', $jqSlideElem ).attr( 'src', strImageURL ).on( 'load', function(){
                     	 bolImageLoaded = true;
                         $( this ).css( 'opacity', '1' );
                         $('#main_image_load-spinner_'+ strImageFileHash).hide();

                         $(this).attr( 'data-image-loaded', true );
                         
                         var intImageWidth =  $( 'img', $jqSlideElem ).width();
                         if(intImageWidth>=$('#gallery2__image-wrapper').width())
                         {
                            intImageWidth=intImageWidth-20;
                         }
                         $('img', $jqSlideElem).siblings('.gallery2__item__desc-wrapper, .gallery2__item__information-wrapper').width( intImageWidth );
                     }).on('click', function (){
                        if($( this ).hasClass( "bx_allow_events" ))
                        {
                            if ( arrFeeDownloadPrice[intFileIndex] > 0 )
                            {
                                                                    if ( arrFileHasProductSelling[ intCurrentFileIndex ] == 1 )
                                    {
                                        $( this ).siblings(".print_or_buy_popup").toggle();
                                    }
                                    else
                                    {
                                        if (bolIsOwner)
                                        {
                                            showSetPriceFormModal(strCurrentFileHash);
                                        }
                                        else 
                                        {
                                            showBuyFileFormModal(strCurrentFileHash);
                                        }
                                    }
                                                            }
                            else 
                            {
                                                                if ( arrFileHasProductSelling[ intCurrentFileIndex ] == 1 )
                                {
                                    window.open( '/c/' + strUploadHash + '?h=' + strCurrentFileHash, '_blank' );
                                }
                                                            }
                        }
                        else
                        {
                            $('#gallery2__content-wrapper').toggleClass( 'gallery__only_image' );
                        }
                     });

                     setTimeout("var domImg=document.getElementById('main_image_"+ arrHashes[intFileIndex] +"');  if ( ! domImg.complete ) { $( domImg ).css( 'opacity', '0.6' );}", 300);

                break;

            case 'document':
            case 'code':
            case 'pdf_converted':
            	var jqThumb;

                if ( arrFileAttributes[ intFileIndex ][ 'hasCustomThumb' ] )
                {
                    jqThumb = $( "<div>" ).css( 'background-image', 'url("/thumb.php?i=' + arrHashes[ intFileIndex ] + '&v=1")' ).addClass( 'gallery2__item__custom_thumb gallery2__item__base-width-on' );

                    if ( arrFeeDownloadPrice[intFileIndex] > 0 )
                    {
                        if (bolIsOwner)
                        {
                            jqThumb.attr( 'onclick', 'showSetPriceFormModal(strCurrentFileHash)' );
                        }
                        else 
                        {
                            jqThumb.attr( 'onclick', 'showBuyFileFormModal(strCurrentFileHash)' );
                        }
                    	jqThumb.addClass( 'bx_allow_events' );
                    	jqThumb.addClass( 'has_price' );
                    }
                }
                else
                {
                    jqThumb = $( '<i />' ).addClass( 'fa-5x fa ' + arrIconClass[intFileIndex] );
                    if ( typeof( arrIconSvg ) !== 'undefined' && arrIconSvg[ intFileIndex ] )
                    {
                        jqThumb = $( '<img />' ).attr('src', '/images/file_types_v2/' + arrIconSvg[ intFileIndex ]).addClass( 'gallery2__item__base-width-on ext-icon' );
                    }
                }

                var bolSimpleDownloadAllowed = false;
                if ( arrAllowDownload[ intFileIndex ]
                    && arrFeeDownloadPrice[ intFileIndex ] == null
                    && ! currentFolderHasFeeDownload( intFileIndex )
                    && ( typeof(bolHideDownloadButtons) === 'undefined' || ! bolHideDownloadButtons ) && ( typeof(arrHideDownloadButtons) === 'undefined' || ! arrHideDownloadButtons[ intFileIndex ] )) {

                    bolSimpleDownloadAllowed = true;
                }
                $jqSlideElem.append( '<span class="gallery2__vertical-helper"></span><span class="gallery2__item__doc-wrapper' + ( arrFileAttributes[ intFileIndex ][ 'hasCustomThumb' ] ? ' has_custom_thumb' : '' ) + '"></span>' );
                $( '.gallery2__item__doc-wrapper', $jqSlideElem ).append( jqThumb );
                if (!arrFileAttributes[ intFileIndex ][ 'hasCustomThumb' ]) 
                {
                    $('.gallery2__item__doc-wrapper', $jqSlideElem).append('<div class="gallery2__item__information-wrapper"><p class="gallery2__item__doc-filename">' + arrDisplayNames[intFileIndex] + '</p></div>');
                }
    
                var jqButtonContainer = $('<div />').css({'white-space': 'normal'});
                jqButtonContainer.append('<div class="gallery2__item__desc-wrapper"><p class="gallery2__item__desc-wrapper-text">' + arrDescriptions[intFileIndex] + '</p></div>');
                
                if ( arrExtensions[ intFileIndex ] == 'pdf' || bolIsFileConvertableToPdf )
                {
                    var bolForbidDirectDownload = false;
                    
                	if ( typeof( arrForbidDirectDownload ) != 'undefined' && arrForbidDirectDownload[ intFileIndex ] == true )
                	{
                		bolForbidDirectDownload = true;
                	}
                	

                    if (
                            arrFeeDownloadPrice[ intFileIndex ] == null
                            && ! currentFolderHasFeeDownload( intFileIndex )
                            && arrAllowDownload[ intFileIndex ] 
                            && browserSupportsCanvas() 
                            && ! bolForbidDirectDownload 
                            && arrSizesInBytes[ intFileIndex ] < 104857600                        )
                    {
                        ( function()
                        {
                            $( this ).attr( 'disabled', 'disabled' );
            
                            var $jqSlideElem = $( this ).closest( ".gallery2__item" );
                            var intFileIndex = $jqSlideElem.attr( 'id' ).split( "-" ).slice( -1 )[ 0 ];
            
                            $jqSlideElem.prepend(
                                '<div class="gallery2__item__iframe-wrapper" id="gallery2__item__iframe-wrapper__' + intFileIndex + '">' +
	                                '<div class="gallery2__item__iframe-loading">' +
    		                            '<span class="gallery2__vertical-helper"></span>' +
    		                            '<div class="gallery2__item__iframe-loading__wrapper">' +
	            		                    '<i class="fa fa-spinner fa-spin gallery2__item__iframe-loading__icon"></i>' +
    	                            		'<span class="gallery2__item__iframe-loading__text">Wait while the preview is being created.<br/> This will take longer for large files. Download to view the original.</span>' +
	                            		'</div>' +
                    	            '</div>' +
                        	        '<iframe src=""></iframe>' +
                                '</div>'
                            );

                            var strPdfSrc;

                            if ( bolIsFileConvertableToPdf ) 
                            {
                                var strDateModified = ( typeof arrDatesModified != 'undefined' ? arrDatesModified[ intFileIndex ] : ( typeof arrModDate != 'undefined' ? arrModDate[ intFileIndex ] : '' ) );
                            	strPdfSrc = 'https://' + arrFileHost[ intFileIndex ] + '/api/file/get_thumb_pdf.php?i=' + arrHashes[ intFileIndex ] + '&PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3&dm=' + strDateModified + '&v=102&n=' + arrDisplayNames[ intFileIndex ] + '.pdf';
                            }
                            else 
                            {
                            	strPdfSrc = 'https://' + arrFileHost[ intFileIndex ] + '/down.php?pdf=1&truemimetype=1&i=' + arrHashes[ intFileIndex ] + '&PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3&n=' + arrDisplayNames[ intFileIndex ];
                            }
                            
                            // There is an issue if user on mobile Chrome requests desktop version, User-Agent becomes similar
                            let strChromeDesktopRegex = /^Mozilla\/5\.0\s+\(.*\)\s+AppleWebKit\/\d+\.\d+\s+\(KHTML,\s+like\s+Gecko\)\s+Chrome\/\d+\.\d+\.\d+\.\d+\s+Safari\/\d+\.\d+$/;
                            if ( strChromeDesktopRegex.test( navigator.userAgent ) && arrExtensions[ intFileIndex ] === 'pdf' )
                            {
                                var strDocumentIframeSource = encodeURI( strPdfSrc ) + '&view';
                            }
                            else
                            {
                                var strDocumentIframeSource = '/js/pdfjs-v4/web/viewer.html#' + encodeURI( strPdfSrc );
                            }
                            
                        	$.ajax(
                        	{
                                type: "GET",
                                url: strPdfSrc,
                                success: function()
                                {
                                    $( 'iframe', $jqSlideElem )
                                        .attr( 'src', strDocumentIframeSource )
                                        .addClass( 'gallery2__item__base-width-on' )
                                        .css(
                                        {
                                            'height': function()
                                            {
                                                return '100%';
                                            }
                                        } )
                                    .on( 'load', function ()
                                    {
                                        if ( ! bolSimpleDownloadAllowed )
                                        {
                                            $( this ).contents().find( '#print' ).hide();
                                            $( this ).contents().find( '#download' ).hide();
                                        }
                                    } );
                            	} ,
                            	error: function(data)
                            	{
                            		var stErrorText = 'Sorry, we were unable to create file preview. Please try again by refreshing the page or contact [email protected]. You can download the file to view it.';
                            		
                                	if ( data.status == 405 )
                                	{
                                		stErrorText = 'There is no preview available for this file. Download the file to view it.';
                                	}

                                	$( 'iframe', $jqSlideElem ).replaceWith(
                                    	'<div class="gallery2__item__msg_has_no_preview">' + 
	                                    	'<span class="gallery2__vertical-helper"></span>' +
    	                                	'<div>' + stErrorText + '</div>' +
	                                	'</div>'
                                	);

                                	$( '.gallery2__item__msg_has_no_preview' )
                                        .addClass( 'gallery2__item__base-width-on' )
                                        .css(
                                        {
                                            'height': function()
                                            {
                                                return '100%';
                                            }
                                        } );

                                    $( '.gallery2__item__iframe-loading', $jqSlideElem ).hide();
                            	}
                            } );
                        } ).apply( $jqSlideElem );
                    }
                }
                else if (
                            [ 'txt', 'csv' ].indexOf( arrExtensions[ intFileIndex ] ) !== -1
                            && arrFeeDownloadPrice[ intFileIndex ] == null
                            && ! currentFolderHasFeeDownload( intFileIndex )
                            && arrAllowDownload[ intFileIndex ]
                        )
                {
                    var fnLoadIframe = function ()
                    {
                        $( this ).attr( 'disabled', 'disabled' );
        
                        var $jqSlideElem = $( this ).closest( ".gallery2__item" );
                        var intFileIndex = $jqSlideElem.attr( 'id' ).split( "-" ).slice( -1 )[ 0 ];
        
                        $jqSlideElem.prepend( '<div class="gallery2__item__iframe-wrapper" id="gallery2__item__iframe-wrapper__' + intFileIndex + '"><div class="gallery2__item__iframe-loading"><span class="gallery2__vertical-helper"></span><i class="fa fa-spinner fa-spin"></i></div><iframe src="" class="modal_gallery_simple_iframe"></iframe><div class="gallery2__item__information-wrapper"><p class="gallery2__item__doc-filename">' + arrDisplayNames[ intFileIndex ] + '</p></div><div class="gallery2__item__desc-wrapper"><p class="gallery2__item__desc-wrapper-text">' + arrDescriptions[intFileIndex] + '</p></div></div>' );
        
                        arrIframeTimers[ intFileIndex ] = setTimeout( function ()
                        {
                            $( '#gallery2__item__iframe-wrapper__' + intFileIndex ).hide();
                        }, 30000 );

                       
                        $( 'iframe', $jqSlideElem )
                            .attr( 'src', 'https://' + arrFileHost[ intFileIndex ] + '/down.php?i=' + arrHashes[ intFileIndex ] + '&PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3&plain_text&view&pv=1' )
                            .attr( 'onload', 'clearTimeout( arrIframeTimers[ ' + intFileIndex + ' ] );' )
                            .css({
                                'height': function(){
                                    return '100%';
                                },
                                "background": "white"
                            })
                            .addClass( 'gallery2__item__base-width-on' )
                    };
                    
                    fnLoadIframe.apply( $jqSlideElem );
                }
                // Highlighting code syntax
                else if (
                            [ 'asp','asm','c','h','cc','m','cpp','css','html','java','jsp','js','json','php','pl','py','rb','script','sh','vb','xml','ini' ].indexOf( arrExtensions[ intFileIndex ] ) !== -1
                            // Excluded extensions that highlight.js is not able to recognize and highlight properly
                            && [ 'asp', 'asm', 'm', 'script' ].indexOf( arrExtensions[ intFileIndex ] ) === -1
                            && arrFeeDownloadPrice[ intFileIndex ] == null
                            && ! currentFolderHasFeeDownload( intFileIndex )
                            && arrAllowDownload[ intFileIndex ]
                        )
                {
                    var fnLoadCode = function ()
                    {
                        $( this ).attr( 'disabled', 'disabled' );

                        var $jqSlideElem = $( this ).closest( ".gallery2__item" );
                        var intFileIndex = $jqSlideElem.attr( 'id' ).split( "-" ).slice( -1 )[ 0 ];

                        $jqSlideElem.prepend(
                            '<div class="gallery2__item__code-wrapper" id="gallery2__item__code-wrapper__' + intFileIndex + '">' +
                                '<div class="gallery2__item__code-loading">' +
                                    '<span class="gallery2__vertical-helper"></span>' +
                                    '<i class="fa fa-spinner fa-spin"></i>' +
                                '</div>' +
                                '<div class="modal_gallery_code_container" style="display: none;">' +
                                    '<pre>' +
                                        '<code></code>' +
                                    '</pre>' +
                                '</div>' +
                                '<div class="gallery2__item__information-wrapper">' +
                                    '<p class="gallery2__item__doc-filename">' +
                                        arrDisplayNames[ intFileIndex ] +
                                    '</p>' +
                                '</div>' +
                                '<div class="gallery2__item__desc-wrapper">' +
                                    '<p class="gallery2__item__desc-wrapper-text">' +
                                        arrDescriptions[ intFileIndex ] +
                                    '</p>' +
                                '</div>' +
                            '</div>'
                        );

                        $.ajax( {
                            type: 'GET',
                            url: 'https://' + arrFileHost[ intFileIndex ] + '/down.php?i=' + arrHashes[ intFileIndex ] + '&PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3&code_highlighter&plain_text&view&pv=1',
                            success: function ( data ) {
                                var jqCodeContainer = $( '.modal_gallery_code_container', $jqSlideElem );
                                var jqCodeHighlightElem = $( 'pre code', jqCodeContainer );

                                jqCodeHighlightElem
                                    .text( data )
                                    .addClass( 'gallery2__item__base-width-on' );

                                // Forcing helper classname for highlight.js to properly detect syntax
                                let strHljsCodeClass;
                                switch ( arrExtensions[ intFileIndex ] )
                                {
                                    case 'js':
                                        strHljsCodeClass = 'language-javascript';
                                        break;

                                    case 'html':
                                        strHljsCodeClass = 'language-xml';
                                        break;

                                    case 'cc':
                                    case 'c':
                                    case 'h':
                                        strHljsCodeClass = 'language-cpp';
                                        break;

                                    case 'jsp':
                                        strHljsCodeClass = 'language-java';
                                        break;

                                    case 'pl':
                                        strHljsCodeClass = 'language-perl';
                                        break;

                                    case 'py':
                                        strHljsCodeClass = 'language-python';
                                        break;

                                    case 'rb':
                                        strHljsCodeClass = 'language-ruby';
                                        break;

                                    case 'sh':
                                        strHljsCodeClass = 'language-bash';
                                        break;

                                    case 'vb':
                                        strHljsCodeClass = 'language-vbnet';
                                        break;

                                    case 'php':
                                    case 'cpp':
                                    case 'css':
                                    case 'java':
                                    case 'json':
                                    case 'xml':
                                    case 'ini':
                                        strHljsCodeClass = 'language-' + arrExtensions[ intFileIndex ];
                                        break;
                                }

                                /*
                                    If new extension has been added to FILE_TYPE_CODE, highlight.js won't fail,
                                    it will try to determine to which file type the syntax looks most likely
                                    (out of available types in compiled highlight.min.js script)
                                */
                                if ( typeof( strHljsCodeClass ) !== 'undefined' )
                                {
                                    jqCodeHighlightElem.addClass( strHljsCodeClass );
                                }

                                hljs.highlightElement( jqCodeHighlightElem[ 0 ] );

                                if ( ! false )
                                {
                                    jqCodeHighlightElem.addClass( 'bx_allow_events' );
                                    $( '*', jqCodeHighlightElem ).addClass( 'bx_allow_events' );
                                }

                                jqCodeContainer.show();
                            },
                            error: function () {
                                $( '#gallery2__item__code-wrapper__' + intFileIndex ).hide();
                            },
                        } );
                    };

                    fnLoadCode.apply( $jqSlideElem );
                }
                else
                {
                    if (
                            arrFeeDownloadPrice[ intFileIndex ] == null 
                            && ! currentFolderHasFeeDownload( intFileIndex )
                            && arrSizesInBytes[ intFileIndex ] < 50 * 1024 * 1024 
                            && arrUploadPassword[ intFileIndex ] == '' 
                            && arrAccessType[ intFileIndex ] == 'LINK' 
                        )
                    {
                        var fnLoadIframe = function ()
                        {
                            $( this ).attr( 'disabled', 'disabled' );
            
                            var $jqSlideElem = $( this ).closest( ".gallery2__item" );
                            var intFileIndex = $jqSlideElem.attr( 'id' ).split( "-" ).slice( -1 )[ 0 ];
            
                            $jqSlideElem.prepend(
                                '<div class="gallery2__item__iframe-wrapper" id="gallery2__item__iframe-wrapper__' + intFileIndex + '">' + 
                                '<div class="gallery2__item__iframe-loading">' +
                                '<span class="gallery2__vertical-helper"></span>' + 
                                '<i class="fa fa-spinner fa-spin"></i>' + 
                                '</div>' + 
                                '<iframe src=""></iframe>' + 
                                '</div>'
                            );

                            arrIframeTimers[ intFileIndex ] = setTimeout( function ()
                            {
                                $( '#gallery2__item__iframe-wrapper__' + intFileIndex ).hide();
                            }, 30000 );


                            if ( arrExtensions[intFileIndex] == "dwg" || arrExtensions[intFileIndex] == "dxf" )
                            {
                                $.ajax( {
                                    type: "GET",
                                    url: "/api/embed_urls.php",
                                    data: {
                                        'i': arrHashes[ intFileIndex ]
                                    },
                                    success: function ( data )
                                    {
                                        data = JSON.parse( data );

                                        $( 'iframe', $jqSlideElem )
                                        .attr( 'src', 'https://sharecad.org/cadframe/load?url='+data[ 'path_access_url' ] )
                                        .attr( 'onload', 'clearTimeout( arrIframeTimers[ ' + intFileIndex + ' ] );' );
                                    }
                                } );
                            }
                            else if ( arrExtensions[intFileIndex] == "rtf" || arrSizesInBytes[ intFileIndex ] > 10 * 1024 * 1024 )
                            {
                                $( 'iframe', $jqSlideElem )
                                .attr( 'src', 'https://docs.google.com/viewerng/viewer?embedded=true&url=https://api.files.fm/down.php?i=' + arrHashes[ intFileIndex ] + '&gpv=1' )
                                .attr( 'onload', 'clearTimeout( arrIframeTimers[ ' + intFileIndex + ' ] );' );
                            }
                            else
                            {
                                $( 'iframe', $jqSlideElem )
                                .attr( 'src', 'https://view.officeapps.live.com/op/embed.aspx?src=https://api.files.fm/down.php?i=' + arrHashes[ intFileIndex ] + '&gpv=1' )
                                .attr( 'onload', 'clearTimeout( arrIframeTimers[ ' + intFileIndex + ' ] );' );
                            }

                            $( 'iframe', $jqSlideElem )
                            .css({
                                'height': function(){
                                    return '100%';
                                }
                            })
                            .addClass( 'gallery2__item__base-width-on' )
                    
                        };
                        
                        var jqPreviewButton = $( '<a />' ).attr( {
                            'href': 'javascript:void(0);',
                            'title': 'View',
                            'class': 'gallery2__item__doc-wrapper__download_button gallery2__save_button gallery2__item__doc-wrapper__download_button gallery2__preview_button'
                        } ).html( 'Preview this file' )
                            .click( function() {
                              
                                if ( arrExtensions[intFileIndex] == "dwg" || arrExtensions[intFileIndex] == "dxf" )
                                {
                                                                            showSignIn();
                                                                    }
                                else
                                {
                                    fnLoadIframe.apply( $jqSlideElem );
                                    var jqDownloadButton = $( '<a />' ).attr( {
                                        'href': 'javascript:void(0);',
                                        'onclick': 'modalGalleryDownloadFileBtn( "' + arrHashes[ intFileIndex ] + '" )',
                                        'title': 'Download',
                                        'class': 'gallery2__item__doc-wrapper__download_button gallery2__save_button'
                                    } ).html( 'Download original file' );

                                    $( '.gallery2__item__information-wrapper', $jqSlideElem ).append( jqDownloadButton );
                                }
                            } )
        
                        $( '.gallery2__item__information-wrapper', $jqSlideElem ).append( jqPreviewButton );
                    }
                }
                
                $(".gallery2__item__custom_thumb" ).each(function() 
                {
                    var objBackground = getBackgroundSize(this);    
                    if(objBackground.width>=$('#gallery2__image-wrapper').width())
                    {
                        objBackground.width=objBackground.width-20; 
                    }
                    $(this).siblings('.gallery2__item__desc-wrapper, .gallery2__item__information-wrapper').width( objBackground.width );
                    $(this).parent().siblings('.gallery2__item__desc-wrapper, .gallery2__item__information-wrapper').width( objBackground.width );
                }); 
                $("img").each(function() 
                {
                    var intImageWidth = $(this).width();
                    if(intImageWidth>=$('#gallery2__image-wrapper').width())
                    {
                        intImageWidth=intImageWidth-20; 
                    }
                    $(this).siblings('.gallery2__item__desc-wrapper, .gallery2__item__information-wrapper').width( intImageWidth );
                });      
                $("iframe", ".gallery2__item__iframe-wrapper" ).each(function() 
                {
                    var intIframeWidth = $(this).width();
                    if(intIframeWidth>=$('#gallery2__image-wrapper').width())
                    {
                        intIframeWidth=intIframeWidth-20;   
                    }
                    $(this).siblings('.gallery2__item__desc-wrapper, .gallery2__item__information-wrapper').width( intIframeWidth );
                });
                $( '.modal_gallery_code_container', '.gallery2__item__code-wrapper' ).each( function ()
                {
                    let intCodeContainerWidth = $( this ).width();
                    if( intCodeContainerWidth >= $( '#gallery2__image-wrapper' ).width() )
                    {
                        intCodeContainerWidth = intCodeContainerWidth - 20;
                    }
                    $( this ).siblings( '.gallery2__item__desc-wrapper, .gallery2__item__information-wrapper' ).width( intCodeContainerWidth );
                } );
                break;
    
            case 'video':
                var bolThisVideoUseEmbedPlayer = false;
        
                var strHtml = '';
                strHtml += '<span class="gallery2__vertical-helper"></span>';
                strHtml += '<div class="gallery2__video_container">';

                if ( useEmbedPlayer( intFileIndex ) )
                {
                    bolThisVideoUseEmbedPlayer = true;
                }
        
                strHtml += "<div class='gallery2__video_wrapper //'>";
    
                if ( !arrFileAttributes[ intFileIndex ][ 'canDownload' ] && ( arrFileAttributes[ intFileIndex ][ 'isForSale' ] || currentFolderHasFeeDownload( intFileIndex ) ) && !arrFileAttributes[ intFileIndex ][ 'hasPreviewVideo' ] )
                {
                    $jqSlideElem.append( '<span class="gallery2__vertical-helper">' );
                    $jqSlideElem.append( '<img src="/thumb_video_picture.php?i=' + arrHashes[ intFileIndex ] + '&PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3">' );

                    var objVideoPlayBuyButton = $( '<span class="gallery2__video-play-button bx_allow_events">' );
                    
                    if ( bolIsOwner )
                    {
                        objVideoPlayBuyButton.attr( 'onclick', 'showSetPriceFormModal( strCurrentFileHash )' );
                    }
                    else if ( currentFolderHasFeeDownload( intFileIndex ) )
                    {
                        if ( typeof arrParentHashes != 'undefined' )
                        {
                            objVideoPlayBuyButton.attr( 'onclick', 'showBuyFileFormModal( arrParentHashes[ getItemIndex ( strCurrentFileHash ) ], "folder" )' );
                        }
                        else if ( typeof strUploadHash != 'undefined' )
                        {
                            objVideoPlayBuyButton.attr( 'onclick', 'showBuyFileFormModal( strUploadHash, "folder" )' );
                        }
                    }
                    else
                    {
                        objVideoPlayBuyButton.attr( 'onclick', 'showBuyFileFormModal( strCurrentFileHash )' );
                    }
                    
                    $jqSlideElem.append( objVideoPlayBuyButton );
                    
                    break;
                }
                
                if ( bolThisVideoUseEmbedPlayer )
                {
                    var strAutoload = 'off';

                	if ( arrExtensions[ intFileIndex ] == 'mp4' )
                	{
                		strAutoload = 'on';
                	}
                    
                    strHtml += '<div class="gallery2__video_container__embed_palyer">';
                    strHtml += '<script type="text/javascript" src="/embed/playerv2?hash=' + arrHashes[ intFileIndex ] + 
                        '&autoload=' + strAutoload + '&autoplay=off&w=auto&h=auto&poster_src=/thumb_video_picture.php?i=' + arrHashes[ intFileIndex ] + '&PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3' +
                        '" ' +
                        'id="filesfm_embed_js__' + arrHashes[ intFileIndex ] + '"><' + '/script>';
                    strHtml += '</div>';
                }
                else
                {
                    var strVideoSrc = 'https://' + arrFileHost[ intFileIndex ]  + '/thumb_video/' + arrHashes[ intFileIndex ] + '' + strHttpCacheKey + '.mp4?v=1728548278&PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3';

                    
                        if (
                                (
                                    arrExtensions[ intFileIndex ] == 'mp4'
                                    || arrMOVsWithH264Hashes.includes( arrHashes[ intFileIndex ] )
                                )
                                // If the video does not have a preview (0) or preview is being generated (2)
                                && [ 0, 2 ].includes( arrFileAttributes[ intFileIndex ][ 'hasVideoThumb' ] )
                                && arrFeeDownloadPrice[ intFileIndex ] == null
                                && ! currentFolderHasFeeDownload( intFileIndex )
                            )
                        {
                            // If the video does not have a preview
                            if ( ! arrFileAttributes[ intFileIndex ][ 'hasVideoThumb' ] )
                            {
                                // Send a request with an empty callback just to trigger generation of preview video
                                $.get( strVideoSrc, function() {} );
                            }

                            strVideoSrc = 'https://' + arrFileHost[ intFileIndex ]  + '/down.php?i=' + arrHashes[ intFileIndex ] + '&PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3&pv=1&' + strHttpCacheKey + '.mp4';
                        }

                                     
                    strHtml += '<video playsinline id="video_' + arrHashes[ intFileIndex ] + '" preload="none">';
                    strHtml += '<div class="video_thumb_gen" style="visibility: hidden;" id="video_thumb_gen_' + arrHashes[ intFileIndex ] + '">Video preview is being created,<br /> please wait!<br /><br /><i class="fa fa-spin fa-spinner"></i></div>';
                    strHtml += '<source src="' + strVideoSrc + '" type="video/mp4" label="Preview" selected="true">';

                    if (
                            (
                                arrExtensions[ intFileIndex ] == 'mp4'
                                || arrMOVsWithH264Hashes.includes( arrHashes[ intFileIndex ] )
                            )
                            && arrFileAttributes[ intFileIndex ][ 'hasVideoThumb' ] == 1
                        )
                    {
                        var strOriginalVideoSrc = 'https://' + arrFileHost[ intFileIndex ]  + '/down.php?i=' + arrHashes[ intFileIndex ] + '&PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3&pv=1&' + strHttpCacheKey + '.mp4';

                        strHtml += '<source src="' + strOriginalVideoSrc + '" type="video/mp4" label="Original">';
                    }

                    strHtml += 'Your browser does not support the video tag.';
                    strHtml += '</video>';
                    strHtml += '<script type="text/javascript">';
                    strHtml += 'document.getElementById("video_' + arrHashes[ intFileIndex ] + '").addEventListener("error", function(){' +
                        '        var me_ = this;' +
                        '        if (me_.src.indexOf("' + arrHashes[ intFileIndex ] + '") === -1) return;' +
                        '        last_video_src = me_.src;' +
                        '        me_.src = "";' +
                        '        setTimeout(function(){me_.src=last_video_src}, 2000);' +
                        '    });';
                    strHtml += '<'+'/script>';
                }

                strHtml += "<div class='gallery2__video_wrapper_bottom'>";
                strHtml += '</div>';
                strHtml += "</div>";

                strHtml += "</div>";

                $jqSlideElem.append( strHtml );

                if ( arrFileTypes[ intFileIndex ] === 'video' )
                {
                    if ( !useEmbedPlayer( intFileIndex ) )
                    {
                        initVideoPlayer( intFileIndex );
                    }
                }
                break;
    
            case 'audio':
                
                    if ( arrAllowDownload[ intFileIndex ] || ( false && arrFileAttributes[ intFileIndex ].hasPreviewVideo ) || arrFileAttributes[ intFileIndex ].readOnly || arrFileAttributes[ intFileIndex ].hasPreviewVideo )
                    {
                        var strAllHashes = '';
                        for ( var strHash in arrHashes )
                        {
                            strAllHashes += ',' + strHash;
                        }
                        if( objAudioPlayer === null || ( objAudioPlayer.getAllUploadFileHashes() !== strAllHashes ) )
                        {
                            if ( objAudioPlayer !== null )
                            {
                                objAudioPlayer.destroy();
                                objAudioPlayer = null;
                            }

                            objAudioPlayer = new AudioPlayer();
                            objAudioPlayer.loadTracksFromGlobalArrays();
                            if ( objMainShareParams != null && typeof( objMainShareParams['all_files'] ) !== 'undefined')
                            {
                                if ( typeof PublicProfile != 'undefined' && PublicProfile.openFolderDisplayName != '' )
                                {
	                            	objAudioPlayer.setPlayListTitle( PublicProfile.openFolderDisplayName );
                                }
                                else if ( typeof PublicProfile != 'undefined' && PublicProfile.strProfileName != '' )
                                {
	                            	objAudioPlayer.setPlayListTitle( PublicProfile.strProfileName );
                                }
                                else
                                {
	                                objAudioPlayer.setPlayListTitle( strFolderName );
                                }
                            }
                            objAudioPlayer.setCurrentTrackByHash( arrHashes[ intFileIndex ] );
                            objAudioPlayer.setAllUploadFileHashes( strAllHashes );
                            objAudioPlayer.setIsPlayerForOneFile( arrHashes.length == 1 );
                            objAudioPlayer.getElem().addEventListener( 'audioTrackLoaded', function ( data )
                                {
                                    var hash = data.detail.strHash;
                                    
                                    if( arrHashes.indexOf( hash ) !== -1 && arrHashes[ intCurrentFileIndex ] !== hash )
                                    {
                                        galleryChangeLocation ( getItemLink( hash ) );
                                    }
                                }
                            );
                            objAudioPlayer.getElem().addEventListener( 'audioTrackLikeChange', function ( data )
                                {
                                    var hash = data.detail.track.strHash;
                                    var bolState = data.detail.state;
                                    var intFileIdx;
        
                                    if ( strCurrentFileHash === hash )
                                    {
                                        intFileIdx = intCurrentFileIndex;
                                    }
                                    else
                                    {
                                        for ( var i in arrHashes )
                                        {
                                            if ( arrHashes.hasOwnProperty( i ) && arrHashes[ i ] === hash )
                                            {
                                                intFileIdx = +i;
                                                break;
                                            }
                                        }
                                    }
        
                                    bolState ? arrVoteCounts[ intFileIdx ]++ : arrVoteCounts[ intFileIdx ]--;
                                    arrHasVoted[ intFileIdx ] = bolState ? 1 : 0;
                                    galleryUpdateVoteCount();
                                }
                            );
                            objAudioPlayer.getElem().addEventListener( 'audioTrackEnded', function ( data )
                                {
                                    if ( bolGalleryIsVisible )
                                    {
                                        var intNextSlideIndex = intNextIndex;

                                        if(intNextIndex == null || isNaN( intNextIndex ) && arrHashes[0] != null)
                                        {
                                            intNextSlideIndex = getItemIndex ( arrHashes[0] );
                                        }

                                        if ( intNextSlideIndex != null && !isNaN( intNextSlideIndex ) )
                                        {
                                            if (strSlideshowInterval === 'reset')
                                            {
                                                objAudioPlayer._isSlideshowOn = false;
                                                galleryChangeLocation ( getItemLink ( arrHashes[intNextSlideIndex] ) );
                                            }
                                        }
                                    }
                                    
                                }
                            );
                        }
                        $jqSlideElem.append( "<span class=\"gallery2__vertical-helper\"></span>" );
                        var jqItemAudioWrapper = $( "<div class=\"gallery2__item__audio-wrapper\"></div>" );

                        jqItemAudioWrapper.appendTo( $jqSlideElem );

                        objAudioPlayer.appendTo( jqItemAudioWrapper );
	                }
	                else
	                {
	                    var jqThumb = $( '<i />' ).addClass( 'fa-5x fa ' + arrIconClass[intFileIndex] );
                        if ( typeof( arrIconSvg ) !== 'undefined' && arrIconSvg[ intFileIndex ] )
                        {
                            jqThumb = $( '<img />' ).attr('src', '/images/file_types_v2/' + arrIconSvg[ intFileIndex ]).addClass('ext-icon');
                        }
	                    $jqSlideElem.append( '<span class="gallery2__vertical-helper"></span><span class="gallery2__item__doc-wrapper"></span>' );
	                    $( '.gallery2__item__doc-wrapper', $jqSlideElem ).append( jqThumb );
	                    $( '.gallery2__item__doc-wrapper', $jqSlideElem ).append( '<div class="gallery2__item__information-wrapper"><p class="gallery2__item__doc-filename">' + arrDisplayNames[intFileIndex] + '</p></div>' );
                        if( arrDescriptions[intFileIndex] )
                        {
                            $( '.gallery2__item__doc-wrapper', $jqSlideElem ).append( '<div class="gallery2__item__desc-wrapper"><p class="gallery2__item__desc-wrapper-text">' + arrDescriptions[intFileIndex] + '</p></div>');
	                    }
	                }
                    
                    function updateAudioDescriptionWidth()
                    {
                        $('i, .audio_player ').each(function()
                        {
                            var intVideoWidth = $(this).outerWidth();
                            if(intVideoWidth>=$('#gallery2__image-wrapper').width())
                            {
                                intVideoWidth=intVideoWidth-20;   
                            }
                            $(this).parent().find('.gallery2__item__desc-wrapper, .gallery2__item__information-wrapper').width(intVideoWidth);
                        });        
                    }
                    updateAudioDescriptionWidth();
                break;

                case 'image-raw':
                        
                    // Main container for file info/buttons/etc.
                    var $jqMainContainerHelper = $( '<span class="gallery2__vertical-helper"></span>' );
                    var $jqMainContainer = $( '<span class="gallery2__item__doc-wrapper"></span>' );

                    // Icon container
                    var $jqIconContainer = $( '<span class="gallery2__item__doc-icon ' + arrExtensions[ intFileIndex ].toLowerCase() + '"></span>' );

                    // File type icon
                    var $jqIcon = $('<i class="fa-5x fa ' + arrIconClass[ intFileIndex ] + '"></i>');
                    if ( typeof( arrIconSvg ) !== 'undefined' && arrIconSvg[ intFileIndex ] )
                    {
                        $jqIcon = $( '<img />' ).attr('src', '/images/file_types_v2/' + arrIconSvg[ intFileIndex ]).addClass('ext-icon');
                    }
                    $jqIconContainer.append($jqIcon);

                    // Loading icon
                    var $jqLoadingIcon = $('<i class="fa-5x fa fa-spinner fa-spin"></i>').hide();
                    $jqIconContainer.append($jqLoadingIcon);

                    // Error icon
                    var $jqErrorIcon = $('<i class="fa-5x fa fa-times"></i>').hide();
                    $jqIconContainer.append($jqErrorIcon);

                    // Add the icon container to the main container
                    $jqMainContainer.append( $jqIconContainer );

                    // Filename
                    var $jqFileName = $( '<p class="gallery2__item__doc-filename">' + arrDisplayNames[ intFileIndex ] + '</p>' );
                    $jqMainContainer.append( $jqFileName );

                    // A container for buttons/actions
                    var $jqButtonContainer = $('<div />').css({'white-space': 'normal'});
        
                    // Download button 
                    var $jqDownloadButton = $( '<a />' ).attr( {
                        'href': 'javascript:void(0);',
                        'onclick': 'modalGalleryDownloadFileBtn( "' + arrHashes[ intFileIndex ] + '" )',
                        'title': 'Download',
                        'class': 'gallery2__item__doc-wrapper__download_button gallery2__save_button'
                
                    } ).html( 'Download original file' );

                    // Add the download button to the button container
                    $jqButtonContainer.append( $jqDownloadButton );
                    
    
                    // Holds the load image timeout
                    var intLoadImageTimeout;

                    // Holds the image
                    var $jqImg;

                    var fnLoadImageFailed = function()
                    {
                        clearTimeout(intLoadImageTimeout);
                        $jqImg.remove();

                        $jqIcon.hide();
                        $jqErrorIcon.show();
                        $jqLoadingIcon.hide();
                    }
                    
                    var fnLoadImageSucceeded = function()
                    {
                        clearTimeout(intLoadImageTimeout);

                        $jqMainContainer.empty().append($jqImg);
                    }

                    var fnLoadImage = function()
                    {
                        $jqPreviewButton.hide();

                        $jqIcon.hide();
                        $jqErrorIcon.hide();
                        $jqLoadingIcon.show();

                        var strImageURL = 'https://'+ arrFileHost[ intFileIndex ] +'/thumb_show.php?i=' + arrHashes[intFileIndex] + '&view&v=1&PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3';
                        if (arrFeeDownloadPrice[intFileIndex] > 0 || currentFolderHasFeeDownload( intFileIndex ) )
                        {
                            strImageURL += '&wm=103';
                        }

                        if ( typeof( arrFileVersion ) != 'undefined' && typeof( arrFileVersion[ intFileIndex ] ) != 'undefined' && arrFileVersion[ intFileIndex ] > 0 )
                        {
                            strImageURL += '&version=' + arrFileVersion[ intFileIndex ];
                        }

                        $jqImg = $('<img>').attr('src', strImageURL);

                        intLoadImageTimeout = setTimeout(function() {
                            fnLoadImageFailed();
                        }, 30000);

                        $jqImg.on('load', function() 
                        {
                            if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth == 0) 
                            {
                                fnLoadImageFailed();
                            } else {
                                fnLoadImageSucceeded();
                            }
                        });
                        
                    }

                    var $jqPreviewButton = $( '<a />' );

                    $jqPreviewButton.attr( {
                                'href': 'javascript:void(0);',
                                'title': 'Download',
                                'class': 'gallery2__item__doc-wrapper__download_button gallery2__save_button gallery2__item__doc-wrapper__download_button gallery2__preview_button'
                            } );
                    
                    $jqPreviewButton.css( "marginLeft", "0px" );

                    $jqPreviewButton.html( 'Preview this file' );
                    
                    $jqPreviewButton.click( function() { fnLoadImage(); } );
                                
                    
                    $jqButtonContainer.append("<br />");

                    // Add the preview button to the button container
                    $jqButtonContainer.append( $jqPreviewButton );


                    // Add the buttons container to the main item info container
                    $jqMainContainer.append($jqButtonContainer);

                    // Add the helper and the main container to the DOM
                    $jqSlideElem.append( $jqMainContainerHelper );
                    $jqSlideElem.append( $jqMainContainer );


                    break;

                case 'url' :
                {
            		var jqThumb;
                    
                    if ( arrFileAttributes[ intFileIndex ][ 'hasCustomThumb' ] )
                    {
                        jqThumb = $( "<div>" ).css({
                            'background-image': 'url("/thumb.php?i=' + arrHashes[ intFileIndex ] + '&v=1")',
                            'height': function(){
                            }
                        })
                        .addClass( 'gallery2__item__custom_thumb gallery2__item__base-width-on' );
                    }
                    else
                    {
                        jqThumb = $( '<i />' ).addClass( 'fa-5x fa ' + arrIconClass[intFileIndex] );
                        if ( typeof( arrIconSvg ) !== 'undefined' && arrIconSvg[ intFileIndex ] )
                        {
                            jqThumb = $( '<img />' ).attr('src', '/images/file_types_v2/' + arrIconSvg[ intFileIndex ]).addClass( 'gallery2__item__base-width-on ext-icon' );
                        }
                    }

                    if ( arrFeeDownloadPrice[intFileIndex] > 0 )
                    {
                    	if (bolIsOwner)
                        {
                            jqThumb.attr( 'onclick', 'showSetPriceFormModal(strCurrentFileHash)' );
                        }
                        else 
                        {
                            jqThumb.attr( 'onclick', 'showBuyFileFormModal(strCurrentFileHash)' );
                        }
                    	jqThumb.addClass( 'bx_allow_events' );
                    	jqThumb.addClass( 'has_price' );
                    }


                    $jqSlideElem.append( '<span class="gallery2__vertical-helper"></span><span class="gallery2__item__doc-wrapper' + ( arrFileAttributes[ intFileIndex ][ 'hasCustomThumb' ] ? ' has_custom_thumb' : '' ) + '"></span>' );
                    $( '.gallery2__item__doc-wrapper', $jqSlideElem ).append( jqThumb );
                    
        
                    var jqButtonContainer = $('<div />').css({'white-space': 'normal'});

                    if ( arrFeeDownloadPrice[ intFileIndex ] == null && ! currentFolderHasFeeDownload( intFileIndex ) )
                	{
                        var $jqSlideElem = $( $jqSlideElem ).closest( ".gallery2__item" );
                        var intFileIndex = $jqSlideElem.attr( 'id' ).split( "-" ).slice( -1 )[ 0 ];
            			
                        $jqSlideElem.prepend( '<div class="gallery2__item__iframe-wrapper" id="gallery2__item__iframe-wrapper__' + intFileIndex + '"><div class="gallery2__item__iframe-loading"><span class="gallery2__vertical-helper"></span><i class="fa fa-spinner fa-spin"></i></div><iframe class="gallery2__item__base-width-on" src=""></iframe><div class="gallery2__item__desc-wrapper"><p class="gallery2__item__desc-wrapper-text">' + arrDescriptions[intFileIndex] + '</p></div></div>' );
            			
                        arrIframeTimers[ intFileIndex ] = setTimeout( function ()
                        {
                            $( '#gallery2__item__iframe-wrapper__' + intFileIndex ).hide();
                        }, 30000 );
    
                        $.get( 'https://'+ arrFileHost[ intFileIndex ]  + '/down.php?i=' + arrHashes[ intFileIndex ] + '&gpv=1&view=1&truemimetype=1&PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3', function( strFileContent )
                        {
                        	$( 'iframe', $jqSlideElem )
                                .attr( 'src', strFileContent )
                                .attr( 'onload', 'clearTimeout( arrIframeTimers[ ' + intFileIndex + ' ] );' )
                                .css({
                                    'height': function()
                                    {
                                        if ( arrDescriptions[intFileIndex] )
                                        {
                                            return 'calc( 100% - 60px )';
                                        }
                                        else 
                                        {
                                            return 'calc( 100% - 60px )';
                                        }
                                    },
                                    "background": "white",
                                })
                    	} );
                	} 
                    else 
                    {
                        $( '.gallery2__item__doc-wrapper', $jqSlideElem ).append( '<div class="gallery2__item__information-wrapper"><p class="gallery2__item__doc-filename">' + arrDisplayNames[intFileIndex] + '</p></div>' );
                        $( '.gallery2__item__doc-wrapper', $jqSlideElem ).append( '<div class="gallery2__item__desc-wrapper"><p class="gallery2__item__desc-wrapper-text">' + arrDescriptions[intFileIndex] + '</p></div>');
                    }
                    if( !arrDescriptions[intFileIndex] )
                    {
                        $('.gallery2__item__desc-wrapper', $jqSlideElem).hide();
                    }
                    
                    function updateURLDescriptionWidth()
                    {
                        $(".gallery2__item__base-width-on" ).each(function() {
                            switch(this.tagName) 
                            {
                                case 'IMG':
                                    intElementWidth =  $( this ).width();
                                    break;
                                case 'DIV':
                                    var objBackground = getBackgroundSize(this);
                                    intElementWidth = objBackground.width;
                                    break;
                                case 'IFRAME':
                                    intElementWidth =  $( this ).width();
                                    break;
                                default:
                                    intElementWidth =  $( this ).width();
                                    break;
                            }
                            if(intElementWidth>=$('#gallery2__image-wrapper').width())
                            {
                                intElementWidth=intElementWidth-20;   
                            }
                            $(this).siblings('.gallery2__item__desc-wrapper, .gallery2__item__information-wrapper').width( intElementWidth );   
                        }); 
                                   
                    }
                    updateURLDescriptionWidth();
                	break;
                }
        }

        if ( arrFileTypes[ intCurrentFileIndex ] !== 'audio' )
        {
            var jqPreviewButton = $( '<a />' ).attr( {
                'href': 'javascript:void(0);',
                'title': function() {
                            if (bolIsOwner)
                            {
                                return 'Sell';
                            }
                            else 
                            {
                                return 'Buy';
                            }
                        },
                'class': 'gallery2__buy_button',
                'style': "display:none;"
            } ).html( function(){
                if ( arrFeeDownloadPrice[ intCurrentFileIndex ] )
                    {
                        return 'Buy (' + arrFeeDownloadPrice[ intCurrentFileIndex ] + ' $)';
                    }
                    else 
                    {
                        return 'Buy';
                    }
            } )
                .click( function() { 
                    if (bolIsOwner)
                    {
                        return showSetPriceFormModal(strCurrentFileHash);
                    }
                    else 
                    {
                        return showBuyFileFormModal(strCurrentFileHash);
                    }
            } )

            $( '.gallery2__item__information-wrapper', $jqSlideElem ).append( jqPreviewButton );
        }
        
        if ($('.gallery2__item__information-wrapper', $jqSlideElem).find('.gallery2__preview_button').length<1) 
        {
            var jqDownloadButton = $( '<a />' ).attr( {
                'href': 'javascript:void(0);',
                'onclick': 'modalGalleryDownloadFileBtn( "' + arrHashes[ intFileIndex ] + '" )',
                'title': 'Download',
                'class': 'gallery2__item__doc-wrapper__download_button gallery2__save_button'
            } ).html( 'Download original file' );

            $( '.gallery2__item__information-wrapper', $jqSlideElem ).append( jqDownloadButton );
        }
        
        $('a', $jqSlideElem).addClass( 'bx_allow_events' );
        $('a', $jqSlideElem).find( "*" ).addClass( 'bx_allow_events' );
        $('.gallery2__video_downloadbutton', $jqSlideElem).find( "*" ).addClass( 'bx_allow_events' );

        $jqSlideElem.addClass( 'content_ready' );
    }

    function adjustDescriptionWidth() 
    {
        var intElementWidth;
        $(".gallery2__item__base-width-on").each(function() 
        {
            switch(this.tagName) 
            {
                case 'IMG':
                case 'IFRAME':
                    intElementWidth =  $( this ).width();
                    break;
                case 'DIV':
                    var objBackground = getBackgroundSize(this);
                    intElementWidth = objBackground.width;
                    break;
                default:
                intElementWidth =  $( this ).width();
                    break;
            }
            if(intElementWidth>=$('#gallery2__image-wrapper').width())
            {
                intElementWidth=intElementWidth-20;   
            }
            $(this).siblings('.gallery2__item__desc-wrapper, .gallery2__item__information-wrapper').width( intElementWidth );            
        });

        $('.vjs-poster, .filesfm__embed_player__container, .audio_player').each(function() 
        {
            intElementWidth =  $( this ).outerWidth();
            if(intElementWidth>=$('#gallery2__image-wrapper').width())
            {
                intElementWidth=intElementWidth-20;   
            }
            $(this).parent().parent().find('.gallery2__item__desc-wrapper, .gallery2__item__information-wrapper').width(intElementWidth);
        });
    }
    adjustDescriptionWidth();

    function resizeend()
    {
        adjustDescriptionWidth();
    }

    var intTimer;
    window.addEventListener('resize', function()
    {
        clearTimeout(intTimer);
        intTimer = setTimeout(resizeend, 300);
        adjustDescriptionWidth();
        checkThumbStripArrows();
    });
    
    function registerEmbedPlayerFileEventCallback( strFileHash, fncCallback )
    {
        var intEmbedPlayerFileIndex = getItemIndex ( strFileHash );
        if ( intEmbedPlayerFileIndex !== null && typeof fncCallback === 'function' )
        {
            objEmbedPlayerFileEventCallback[ intEmbedPlayerFileIndex ] = fncCallback;
        }
    }
    
    function callEmbedPlayerFileEventCallback( strEventCode, intFileIndex )
    {
        if ( typeof( objEmbedPlayerFileEventCallback[intFileIndex] ) === 'function' )
        {
            objEmbedPlayerFileEventCallback[intFileIndex]( strEventCode );
        }
    }
    
    function galleryOpenPrevItem()
    {
    	if ( intPreviousIndex != null && !isNaN( intPreviousIndex ))
		{
            galleryChangeLocation ( getItemLink ( arrHashes[intPreviousIndex] ) );
            adjustDescriptionWidth();
		}
	}
    function galleryOpenNextItem()
    {
    	if ( bolGalleryIsVisible && intNextIndex != null && !isNaN( intNextIndex ))
		{
            galleryChangeLocation ( getItemLink ( arrHashes[intNextIndex] ) );
            adjustDescriptionWidth();
		}
	}

	var resThumbLoadTimeout;

    function gallerySelectThumb( intItemIndex )
    {
		if ( bolGalleryIsVisible && bolGalleryInitalizedState < 1 )
		{
			// If dom not loaded yet, wait for it to load.
			setTimeout('gallerySelectThumb( '+ intItemIndex +' )', 100);
			return;
		}
		if (jqThumbViewport == null)
		{
			jqThumbViewport = $('#gallery2__thumb-strip');
		}
		var intViewportWidthPx = jqThumbViewport.width();

		if (jqThumbContainer == null)
		{
			jqThumbContainer = $('#gallery2__thumb-strip__inner');
		}

		var jqThumb = $('A.thumb_' + arrHashes[intItemIndex], jqThumbContainer);

		function onThumbReady()
        {
            var intThumbPossitionLeftPx = jqThumb.position().left;
            // If scrollable on mobile
            if (jqThumbViewport.css('overflow-x')=='auto')
            {
                var intThumbPossitionLeftPx = jqThumb[0].offsetLeft;
                var intThumbOffsetLeftPx = galleryCalculateOffset(jqThumb[0]).left;
                var intScrollLeft = jqThumbViewport.scrollLeft();

                var jqThImg = $('IMG', jqThumb);
                var intThisThumbWidth = intThumbWidth;
                
                if ( intThisThumbWidth < intThumbWidth )
                    intThisThumbWidth = intThumbWidth;

                if ( intThumbOffsetLeftPx + intScrollLeft > intViewportWidthPx + intScrollLeft - intThisThumbWidth )
                {
                    jqThumbViewport.scrollLeft( intThumbOffsetLeftPx + intScrollLeft - intViewportWidthPx + intThisThumbWidth );
                }
                else if (intThumbOffsetLeftPx < 0)
                {
                    jqThumbViewport.scrollLeft( intThumbPossitionLeftPx  );
                }

            }
            else
            {
                var intThumbOffsetLeftPx = jqThumb.offset().left;

                var jqThumbStrip = $('#gallery2__thumb-strip');
                var jqThumbStripInner = $('#gallery2__thumb-strip__inner');

                var intThumbWidthSum = 0;
                $('A', jqThumbStripInner).each(function (){
                    intThumbWidthSum += $(this).width();
                });

                var bolThumbsAreOutside = false;
                if (
                    jqThumbStrip.width() <= intThumbWidthSum
                )
                {
                    bolThumbsAreOutside = true;
                }

                if ( $( '#gallery2' ).hasClass( 'gallery__sidebar-visible' ) )
                {
                    intThumbOffsetLeftPx = intThumbOffsetLeftPx -360;
                }

                if ( ! bolThumbsAreOutside )
                {
                    jqThumbContainer.css({'left': '0px'});
                }
                else
                {
                    // If outside viewport
                    // If outside to the right
                    if ( intThumbOffsetLeftPx < 0 )
                    {
                        var jqThImg = $('IMG', jqThumb);
                        var intThisThumbWidth = intThumbWidth;
                        
                        if ( intThisThumbWidth < intThumbWidth )
                            intThisThumbWidth = intThumbWidth;

                        var intSetLeftPx = (-1*intThumbPossitionLeftPx + intThisThumbWidth );

                        if (intSetLeftPx > 0) 
                        {
                            jqThumbContainer.css({'left': 0});
                        } 
                        else 
                        {
                            jqThumbContainer.css({'left': intSetLeftPx + 'px'});
                        };
                       
                    }
                    // else - outside to left
                    else if ( intThumbOffsetLeftPx > intViewportWidthPx - 360 )
                    {

                        var jqThImg = $('IMG', jqThumb);
                        var intThisThumbWidth = intThumbWidth;
                        
                        if ( intThisThumbWidth < intThumbWidth )
                            intThisThumbWidth = intThumbWidth;

                        var intSetLeftPx = -1*intThumbPossitionLeftPx + intViewportWidthPx - intThisThumbWidth - intThumbWidth;

                        if (parseInt($('#gallery2__image-wrapper').width()) - parseInt($('#gallery2__thumb-strip__inner').width()) > intSetLeftPx) 
                        {
                            jqThumbContainer.css({'left': parseInt($('#gallery2__image-wrapper').width()) - parseInt($('#gallery2__thumb-strip__inner').width())})
                        } 
                        else 
                        {
                            jqThumbContainer.css({'left': intSetLeftPx + 'px'});
                        };
                    }
                }
                checkThumbStripArrows();
            }

            $('A.active', jqThumbContainer).removeClass('active');
            jqThumb.addClass('active');

            setTimeout("checkThumbStripArrows()", 500);
            setTimeout("galleryLazyloadRecalc()", 500);
        }

        if ( $('IMG', jqThumb).length===0 || ( $('IMG', jqThumb)[0].complete && $('IMG', jqThumb).attr('src')===$('IMG', jqThumb).attr('data-original') ) )
        {
            onThumbReady();
        }
        else
        {
            $('IMG', jqThumb).on('load', function (){
                if ($(this).attr('src') === $(this).attr('data-original'))
                {
                    onThumbReady();
                }
            });

            var intElementIndex = jqThumb.index();
            if (jqThumbViewport.css('overflow-x') == 'auto')
            {
                jqThumbViewport.scrollLeft(intElementIndex * intThumbWidth);
            }
            else
            {
                jqThumbContainer.css({'left': (-1 * (intElementIndex + 2) * intThumbWidth) + 'px'});
            }

            galleryLazyloadRecalc();
            setTimeout( function (){ galleryLazyloadRecalc(); }, 1000);
            setTimeout( function (){ galleryLazyloadRecalc(); }, 5000);
        }
	}
    
    function closeGallery(strScrollHash)
    {
        if ( ! bolGalleryIsVisible )
            return;

        $( 'html' ).css( 'overflow', 'auto' );
        $( '#gallery2' ).fadeOut( 'fast' );

        $('#gallery_panzoomdiv').css('display', 'none');
        $('#gallery2__content-wrapper').removeClass( 'gallery__only_image' );
        $('#gallery2__content-wrapper').removeClass( 'gallery__is_image' );
        
                    exitSlideshow();
        
        if(bolPopupOnlyGallery)
        {
            hideModal( 'popup_form' );
        }
        
        if ( strGalleryCloseHashtag )
        {
            window.location.hash = strGalleryCloseHashtag;
        }
		else
		{
            if ( window.location.href.indexOf( "filebrowser" ) !== -1 )
            {
                var intIndexOfView = window.location.hash.indexOf(';/view/');
                if (intIndexOfView == -1)
                {
                    intIndexOfView = window.location.hash.indexOf('/view/');
                    if (intIndexOfView == -1)
                    {
                        intIndexOfView = window.location.hash.length;
                    }
                }
    
                history.replaceState( null, '', ('' + window.location).split('#')[0] + window.location.hash.slice(0, intIndexOfView))
            }
            else
            {
                                history.replaceState( 'gallery', document.title, ('' + window.location).split('#')[0] );
                            }
		}
        
		bolGalleryIsVisible = false;
        strCurrentFileHash = null;

		stopActiveContent();
		
		if ($('#share_popup').is(":visible"))
        {
            hideSharePopup();
        }
    
        if ( typeof window.FileEmbedPopup !== 'undefined' )
        {
            window.FileEmbedPopup.hidePopup();
        }
        
                
        if ( strActiveCommentsEntityHash != "" ) {
            ChatFM.resetChat();
            strActiveCommentsEntityHash = "";
        }


        
        if($("#item_"+strScrollHash).length)
        {
            if ( window.location.href.indexOf( "filebrowser" ) !== -1 )
            {
                var myElem = document.getElementById("item_"+strScrollHash);
                let topOffset = myElem.getBoundingClientRect().top;

                while (myElem != document.documentElement) {
                    myElem = myElem.parentElement;
                    topOffset += myElem.scrollTop;
                }
                
                $(".main_content").animate({scrollTop: topOffset - $(".main_content").height() / 2});
            }
            else
            {
                $(document.body).animate({
                    scrollTop: $("#item_"+strScrollHash).offset().top - window.innerHeight / 2
                }, 1000);
            }
            $("#item_"+strScrollHash).addClass('active-hover');
        }

        if($('.hide-not-selected').length && typeof showSelectedFiles === 'function')
        {
            showSelectedFiles();
        }

    }

            function nextSlide()
        {
            if ( bolGalleryIsVisible )
            {
                var intNextSlideIndex = intNextIndex;

                if(intNextIndex == null || isNaN( intNextIndex ) && arrHashes[0] != null)
                {
                    intNextSlideIndex = getItemIndex ( arrHashes[0] );
                }

                if ( intNextSlideIndex != null && !isNaN( intNextSlideIndex ) )
                {
                    if(arrFileTypes[intNextSlideIndex] == 'image')
                    {
                        var domImg = document.getElementById('main_image_'+ arrHashes[intNextSlideIndex]);
                        
                        if( domImg !== null )
                        {
                            if ( domImg.complete )
                            {
                                galleryChangeLocation ( getItemLink ( arrHashes[intNextSlideIndex] ), true );
                            }
                            else
                            {
                                clearInterval(strSlideshowInterval);
                                strSlideshowInterval = null;

                                domImg.onload = function () {
                                    galleryChangeLocation ( getItemLink ( arrHashes[intNextSlideIndex] ), true );
                                    if (!strSlideshowInterval)
                                    {
                                        strSlideshowInterval = setInterval(nextSlide, 4000);
                                    }
                                }
                            }
                        }
                        else
                        {
                            galleryChangeLocation ( getItemLink ( arrHashes[intNextSlideIndex] ), true );
                        }
                    }
                    else if ( arrFileTypes[intNextSlideIndex] == 'video' )
                    {
                        galleryChangeLocation ( getItemLink ( arrHashes[intNextSlideIndex] ), true );
                    }
                    else if ( arrFileTypes[intNextSlideIndex] == 'audio' )
                    {
                        galleryChangeLocation ( getItemLink ( arrHashes[intNextSlideIndex] ), true );
                    }
                    else
                    {
                        galleryChangeLocation ( getItemLink ( arrHashes[intNextSlideIndex] ), true );
                    }
                }
            }
        }
        function pauseSlideshow()
        {
            $('#gallery2__content-wrapper').addClass( 'gallery__slideshow_paused' );
            clearInterval(strSlideshowInterval);
            strSlideshowInterval = null;
        }
        function resumeSlideshow()
        {
            $('#gallery2__content-wrapper').removeClass( 'gallery__slideshow_paused' );
            if (!strSlideshowInterval)
            {
                strSlideshowInterval = setInterval(nextSlide, 4000);
            }
        }
        function exitSlideshow()
        {
            pauseSlideshow();
            $('#gallery2__content-wrapper').removeClass( 'gallery__slideshow_paused' );
            $('#gallery2__content-wrapper').removeClass( 'gallery__slideshow' );
            if (!((document.fullScreenElement !== undefined && document.fullScreenElement === null) || (document.msFullscreenElement !== undefined && document.msFullscreenElement === null) || (document.mozFullScreen !== undefined && !document.mozFullScreen) || (document.webkitIsFullScreen !== undefined && !document.webkitIsFullScreen)))
            {
                galleryToggleFullScreen(document.body)
            }
        }
        function enterSlideshow()
        {
            if($( '#gallery2__content' ).hasClass( 'gallery__sidebar-visible' ) )
            {
                showGalleryInfo();
                $(window).trigger('resize');
            }
            $('#gallery2__content-wrapper').addClass( 'gallery__slideshow' );
            galleryToggleFullScreen(document.body)
            resumeSlideshow();
        }
        function removeActiveClass()
        {
            $('#gallery2__content-wrapper').removeClass( 'gallery__slideshow_user_active' );
        }
    
    function showGalleryInfo()
    {
        var $gallery_content = $( '#gallery2__content' );
        if( $gallery_content.hasClass( 'gallery__sidebar__info-visible' ) && $gallery_content.hasClass( 'gallery__sidebar-visible' ) )
        {
        	bolGallerySidebarVisible = false;
            bolGalleryCommentsVisible = false;
            $gallery_content.removeClass( 'gallery__sidebar-visible' );
            $( '#gallery2' ).removeClass( 'gallery__sidebar-visible' );
        }
        else
        {
            $gallery_content.removeClass( 'gallery__sidebar__comments-visible' ).addClass( 'gallery__sidebar__info-visible' );

            if( !$gallery_content.hasClass( 'gallery__sidebar-visible' ) )
            {
                $gallery_content.addClass( 'gallery__sidebar-visible' );
                $( '#gallery2' ).addClass( 'gallery__sidebar-visible' );
            }
            
        	bolGallerySidebarVisible = true;
        	galleryLoadFileInfo();
        }
        
        adjustContentWidth(true);
        
        loadGalleryInfoAd();
    }

    function showGalleryMessages()
    {
        $( '#gallery2__content' ).addClass( 'gallery__sidebar__comments-visible' ).addClass( 'gallery__sidebar__info-visible' );
    }

    function hideGalleryMessages()
    {
        $( '#gallery2__content' ).removeClass( 'gallery__sidebar__comments-visible' ).addClass( 'gallery__sidebar__info-visible' );
    }
    
    var bolGalleryInfoAdLoaded = false;
    function loadGalleryInfoAd()
    {
    	if ( bolGalleryInfoAdLoaded ) return;
    	
    	if ( typeof fncDynamicLoadBanner_gallery2__sidebar__banner == 'function' )
    	{
	    	fncDynamicLoadBanner_gallery2__sidebar__banner();
    	}
    	
    	bolGalleryInfoAdLoaded = true;
    }

    function hideSidebar()
    {
        $( '#gallery2__content' ).removeClass( 'gallery__sidebar-visible' );
        $( '#gallery2' ).removeClass( 'gallery__sidebar-visible' );
        bolGallerySidebarVisible = false;
        bolGalleryCommentsVisible = false;
        adjustContentWidth(true);
    }

    function toggleThumbs()
    {
        $( '#gallery2__content' ).toggleClass( 'gallery__thumbs-visible' );
        
        // fire resize event after transition, so audio player knows to resize
        if( typeof objAudioPlayer !== "undefined" )
        {
            setTimeout( function() {
                var evt = document.createEvent('UIEvents');
                evt.initUIEvent('resize', true, false,window,0);
                window.dispatchEvent(evt);
            }, 300 );
        }
    }

    function hideThumbs()
    {
        $( '#gallery2__content' ).removeClass( 'gallery__thumbs-visible' );
        $( '#gallery2__thumb-strip__hide_container' ).hide();
    }

    function showThumbs()
    {
        $( '#gallery2__content' ).addClass( 'gallery__thumbs-visible' );
        $( '#gallery2__thumb-strip__hide_container' ).show();
    }
    

    function getItemLink ( strHash )
    {
    	var intIndex = null;
    	for (idx in arrIDs)
    	{
    		if (arrHashes[idx] == strHash)
    		{
    		 	intIndex = idx;
    		 	break;	
			}
		}
		
        
                
        
		var strHashtag = window.location.hash;
		var intIndexOfView = strHashtag.indexOf(';/view/');
		if (intIndexOfView != -1)
	    {
	    	strHashtag = strHashtag.slice(0, intIndexOfView);
		}
		else
		{
			var intIndexOfView = strHashtag.indexOf('/view/');
			if (intIndexOfView != -1)
		    {
	    		strHashtag = strHashtag.slice(0, intIndexOfView);
			}
		}
		var intIndexOfDelimiter = strHashtag.indexOf(';/view/');
		if (intIndexOfDelimiter != -1)
	    {
	    	strHashtag = strHashtag.slice(0, intIndexOfDelimiter);
		}
		
		strHashtag = strHashtag + ( bolHashtagViewUseSemicolon ? ';' : '') + '/view/' + arrHashes[intIndex];
		
		return strHashtag;
	}
    function getItemIndex ( strHash )
    {
    	var intIndex = null;
    	for (idx in arrIDs)
    	{
    		if (arrHashes[idx] == strHash)
    		{
    		 	intIndex = idx;
    		 	break;	
			}
		}
		return intIndex;
	}
	
    function getItemIndexByHashOrName ( strHashOrName )
    {
        if( typeof arrHashes === "undefined" )
        {
            return null;
        }
        // edit: before comparisons, urldecode both strings
        strHashOrName = decodeURIComponent( strHashOrName.replace( /\+/g, ' ' ) );
    	var intIndex = null;
        for (idx in arrHashes)
        {
            if ( decodeURIComponent( arrHashes[ idx ].replace( /\+/g, ' ' ) ) === strHashOrName )
            {
                intIndex = idx;
                break;
            }
        }

        if ( intIndex === null )
        {
            var intIndex = null;
            for (idx in arrNames)
            {
                if ( decodeURIComponent( arrNames[ idx ].replace( /\+/g, ' ' ) ) === strHashOrName )
                {
                    intIndex = idx;
                    break;
                }
            }
        }

		return intIndex;
	}

    function getNextIndex ( strHash )
    {
    	var intIndex = null;
    	var intNextIndex = null;
    	for (idx in arrIDs)
    	{
    		if ( intIndex !== null )
    		{
    			intNextIndex = idx;
    			break;	
			}
    		if (arrHashes[idx] == strHash)
    		{
    		 	intIndex = idx;
			}
		}
		return parseInt(intNextIndex);
	}

    function getPreviousIndex ( strHash )
    {
    	var intPreviousIndex = null;
    	for (idx in arrIDs)
    	{
    		if (arrHashes[idx] == strHash)
    		{
    		 	break;
			}
			else
			{
				intPreviousIndex = idx;
			}
		}
		return parseInt(intPreviousIndex);
	}
	
	function preloadImage ( intIndex )
	{
		if (typeof arrIsPreloaded == 'undefined')
			arrIsPreloaded = {};

		if (typeof arrIsPreloaded[intIndex] == 'undefined')
			arrIsPreloaded[intIndex]	

		if ( arrFileTypes[intIndex] == 'image' && arrIsPreloaded[intIndex] != true )
		{
			var strHash = arrHashes[intIndex];
			var strImageURL = 'https://'+ arrFileHost[ intIndex ] +'/thumb_show.php?i=' + strHash + '&view&v=1&PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3';
			if (arrFeeDownloadPrice[intIndex] > 0 || currentFolderHasFeeDownload( intIndex ) )
			{
       			strImageURL += '&wm=103';
			}

            if ( typeof( arrFileVersion ) != 'undefined' && typeof( arrFileVersion[ intIndex ] ) != 'undefined' && arrFileVersion[ intIndex ] > 0 )
            {
                strImageURL += '&version=' + arrFileVersion[ intIndex ];
            }

			$("<img />").attr("src", strImageURL);
			arrIsPreloaded[intIndex] = true;
		}
	}
    
    function preloadFileInfoData( intIndex )
    {
        if ( ! bolUseAsyncFileInfoDataLoad )
        {
            return false;
        }
        
        if ( typeof arrIsFileInfoDataPreloaded == 'undefined' )
        {
            arrIsFileInfoDataPreloaded = [];
        }

        if ( ! arrIsFileInfoDataPreloaded[ intIndex ] )
        {
            var strHash = arrHashes[ intIndex ];

            $.ajax( {
                type : "POST",
                dataType : "json",
                url : "./ajax/modal_gallery/get_file_info_data.php?PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3",
                data :
                {
                    'hash' : strHash
                } ,
                success : function( arrResponse )
                {
                    if ( arrResponse[ 'success' ] )
                    {
                        var arrFileInfoData = arrResponse[ 'data' ];
                        
                        if ( typeof arrFileTitle == 'undefined' ) arrFileTitle = [];
                        if ( typeof arrFileSubject == 'undefined' ) arrFileSubject = [];
                        if ( typeof arrFileContentType == 'undefined' ) arrFileContentType = [];
                        if ( typeof arrFileCategory == 'undefined' ) arrFileCategory = [];
                        if ( typeof arrFileCategories == 'undefined' ) arrFileCategories = [];
                        if ( typeof arrFileKeywords == 'undefined' ) arrFileKeywords = [];
                        if ( typeof arrFileCreator == 'undefined' ) arrFileCreator = [];
                        if ( typeof arrFilePublisher == 'undefined' ) arrFilePublisher = [];
                        if ( typeof arrFileContributor == 'undefined' ) arrFileContributor = [];
                        if ( typeof arrFileCopyrights == 'undefined' ) arrFileCopyrights = [];
                        if ( typeof arrFileLicenseType == 'undefined' ) arrFileLicenseType = [];
                        if ( typeof arrFileLicenseDetails == 'undefined' ) arrFileLicenseDetails = [];
                        if ( typeof arrFileLanguage == 'undefined' ) arrFileLanguage = [];
                        if ( typeof arrFileLocation == 'undefined' ) arrFileLocation = [];
                        if ( typeof arrFileLocationLat == 'undefined' ) arrFileLocationLat = [];
                        if ( typeof arrFileLocationLong == 'undefined' ) arrFileLocationLong = [];
                        if ( typeof arrFileReferences == 'undefined' ) arrFileReferences = [];
                        if ( typeof arrFileRelatesTo == 'undefined' ) arrFileRelatesTo = [];
                        if ( typeof arrFileFormat == 'undefined' ) arrFileFormat = [];
                        if ( typeof arrFileDevice == 'undefined' ) arrFileDevice = [];
                        if ( typeof arrFileSource == 'undefined' ) arrFileSource = [];
                        if ( typeof arrTags == 'undefined' ) arrTags = [];
                        if ( typeof arrObjectTags == 'undefined' ) arrObjectTags = [];
                        if ( typeof arrYoloObjectTags == 'undefined' ) arrYoloObjectTags = [];
                        if ( typeof arrLabelTags == 'undefined' ) arrLabelTags = [];
                        if ( typeof arrFileGoogleCVText == 'undefined' ) arrFileGoogleCVText = [];
                        if ( typeof arrFileEasyOCRText == 'undefined' ) arrFileEasyOCRText = [];
                        if ( typeof arrFileAudioTranscription == 'undefined' ) arrFileAudioTranscription = [];
                        
                        arrFileTitle[ intIndex ] = arrFileInfoData[ 'title' ];
                        arrFileSubject[ intIndex ] = arrFileInfoData[ 'subject' ];
                        arrFileContentType[ intIndex ] = arrFileInfoData[ 'contentType' ];
                        arrFileCategory[ intIndex ] = arrFileInfoData[ 'category' ];
                        arrFileCategories[ intIndex ] = arrFileInfoData[ 'categories' ];
                        arrFileKeywords[ intIndex ] = arrFileInfoData[ 'keywords' ];
                        arrFileCreator[ intIndex ] = arrFileInfoData[ 'creator' ];
                        arrFilePublisher[ intIndex ] = arrFileInfoData[ 'publisher' ];
                        arrFileContributor[ intIndex ] = arrFileInfoData[ 'contributor' ];
                        arrFileCopyrights[ intIndex ] = arrFileInfoData[ 'copyrights' ];
                        arrFileLicenseType[ intIndex ] = arrFileInfoData[ 'licenseType' ];
                        arrFileLicenseDetails[ intIndex ] = arrFileInfoData[ 'licenseDetails' ];
                        arrFileLanguage[ intIndex ] = arrFileInfoData[ 'language' ];
                        arrFileLocation[ intIndex ] = arrFileInfoData[ 'location' ];
                        arrFileLocationLat[ intIndex ] = arrFileInfoData[ 'locationLat' ];
                        arrFileLocationLong[ intIndex ] = arrFileInfoData[ 'locationLong' ];
                        arrFileReferences[ intIndex ] = arrFileInfoData[ 'references' ];
                        arrFileRelatesTo[ intIndex ] = arrFileInfoData[ 'relatesTo' ];
                        arrFileFormat[ intIndex ] = arrFileInfoData[ 'format' ];
                        arrFileDevice[ intIndex ] = arrFileInfoData[ 'device' ];
                        arrFileSource[ intIndex ] = arrFileInfoData[ 'source' ];
                        arrTags[ intIndex ] = arrFileInfoData[ 'tags' ];
                        arrObjectTags[ intIndex ] = arrFileInfoData[ 'objectTags' ];
                        arrYoloObjectTags[ intIndex ] = arrFileInfoData[ 'yoloObjectTags' ];
                        arrLabelTags[ intIndex ] = arrFileInfoData[ 'labelTags' ];
                        arrFileGoogleCVText[ intIndex ] = arrFileInfoData[ 'googleCVText' ];
                        arrFileEasyOCRText[ intIndex ] = arrFileInfoData[ 'easyOCRText' ];
                        arrFileAudioTranscription[ intIndex ] = arrFileInfoData[ 'audioTranscription' ];
                        
                        arrIsFileInfoDataPreloaded[ intIndex ] = true;
                    }
                } ,
                error : function() { }
            } );
        }
    }
	
	function checkBeforeContentChange ()
	{
		intNextIndex = getNextIndex ( strCurrentFileHash );
		intPreviousIndex = getPreviousIndex ( strCurrentFileHash );
		
		if ( intNextIndex != null && !isNaN( intNextIndex ) )
		{
			$('#gallery2__controls_right').show();
		}
		else
		{
			$('#gallery2__controls_right').hide();
		}
		
		if ( intPreviousIndex != null && !isNaN( intPreviousIndex ) )
		{
			$('#gallery2__controls_left').show();
		}
		else
		{
			$('#gallery2__controls_left').hide();
		}
	}
	
	function useEmbedPlayer( intFileIndex )
    {
	    
	    var bolUseEmbedPlayerForThisFiles = false;

	    if ( arrFileAttributes[ intFileIndex ][ 'readOnly' ] )
	    {
	    	bolUseEmbedPlayerForThisFiles = true;
	    }
	    else if (
                typeof ( bolUseEmbedPlayer ) == 'boolean' 
                && bolUseEmbedPlayer 
                && typeof ( bolIsAnonymousUpload ) == 'boolean' 
                && arrFeeDownloadPrice[ intFileIndex ] == null 
                && ! currentFolderHasFeeDownload( intFileIndex )
                && arrAllowDownload[ intFileIndex ] 
                && arrAllowPublicDownload[ intFileIndex ] 
            )
	    {
		    if ( ( [ 'm4a', 'webm', 'ogg' ] ).indexOf( arrExtensions[ intFileIndex ] ) !== -1 )
		    {
		    	bolUseEmbedPlayerForThisFiles = true;
		    }
		    else if ( arrExtensions[ intFileIndex ] == 'mp4' )
		    {
			    if ( arrViews[ intFileIndex ] < 1000 )
			    { 
			    	bolUseEmbedPlayerForThisFiles = false;
			    }
			    else 
			    {
			    	bolUseEmbedPlayerForThisFiles = true;
			    }
		    }
	    }

        return bolUseEmbedPlayerForThisFiles;
    }
	
	function checkAfterContentChange ()
	{
		if ( ! intNextIndex )
		{
			intNextIndex = getNextIndex ( strCurrentFileHash );
		}
		if ( ! intPreviousIndex )
		{
			intPreviousIndex = getPreviousIndex ( strCurrentFileHash );
		}
		
		if ( intNextIndex != null && !isNaN( intNextIndex ) )
		{
			$('#gallery2__controls_right').show();
		}
		else
		{
			$('#gallery2__controls_right').hide();
		}
		
		if ( intPreviousIndex != null && !isNaN( intPreviousIndex ) )
		{
			$('#gallery2__controls_left').show();
		}
		else
		{
			$('#gallery2__controls_left').hide();
		}
		
		// do preloading
		for (var int=0; int<intPreloadImagesCount; int++)
		{
			var intPrev = intPreviousIndex - int;
			if (intPrev  >= 0)
			{
				if ( arrFileTypes[intPrev] == 'image' )
				{
					setTimeout('preloadImage ('+intPrev+')',300);
				}
			}
			var intNext = intNextIndex + int;
			if (intNext  < arrHashes.length)
			{
				if ( arrFileTypes[intNext] == 'image' )
				{
					setTimeout('preloadImage ('+intNext+')',300);
				}
			}
		}

        for ( var int = 0; int < intPreloadFileInfoDataCount; int++ )
        {
            var intPrev = intPreviousIndex - int;
            
            if ( intPrev  >= 0 )
            {
                setTimeout( 'preloadFileInfoData(' + intPrev + ')', 300 );
            }
            
            var intNext = intNextIndex + int;
            
            if ( intNext  < arrHashes.length )
            {
                setTimeout( 'preloadFileInfoData(' + intNext + ')', 300 );
            }
        }
	}

    function galleryToggleFullScreen(elem)
	{
	    if ((document.fullScreenElement !== undefined && document.fullScreenElement === null) || (document.msFullscreenElement !== undefined && document.msFullscreenElement === null) || (document.mozFullScreen !== undefined && !document.mozFullScreen) || (document.webkitIsFullScreen !== undefined && !document.webkitIsFullScreen)) {
	        if (elem.requestFullScreen) {
	            elem.requestFullScreen();
	        } else if (elem.mozRequestFullScreen) {
	            elem.mozRequestFullScreen();
	        } else if (elem.webkitRequestFullScreen) {
	            elem.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
	        } else if (elem.msRequestFullscreen) {
	            elem.msRequestFullscreen();
	        }
	    } else {
	        if (document.cancelFullScreen) {
	            document.cancelFullScreen();
	        } else if (document.mozCancelFullScreen) {
	            document.mozCancelFullScreen();
	        } else if (document.webkitCancelFullScreen) {
	            document.webkitCancelFullScreen();
	        } else if (document.msExitFullscreen) {
	            document.msExitFullscreen();
	        }
	    }
	}

	function updateFileDescription()
	{
		$('#file_description_edit_wrapper').removeClass('has_error');
		
		$.ajax({
			type: "POST",
			dataType: "json",
			url: "./ajax/file_info.php?PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3",
			data: 
			{
				'update_file_description': true ,
				'file_hash' : strCurrentFileHash ,
				'file_description' : $('#file_description_edit_wrapper textarea').val()
			} ,
			success: function(data)
			{
				if (data['status'] == 'ok')
				{
					var intItemIndex = getItemIndex(strCurrentFileHash);
					arrDescriptions[intItemIndex] = $('#file_description_edit_wrapper textarea').val();
				}
				else
				{
					$('#file_description_edit_wrapper').addClass('has_error');
				}
			} ,
			error: function()
			{
				$('#file_description_edit_wrapper').addClass('has_error');
			}
		});
	}

	function updateFileName()
	{
		$('#file_name_edit_wrapper').removeClass('has_error');
		
		$.ajax({
			type: "POST",
			dataType: "json",
			url: "./ajax/file_info.php?PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3",
			data: 
			{
                'without_extension': 1 ,
				'update_file_name': true ,
				'file_hash' : strCurrentFileHash ,
				'file_name' : $('#file_name_edit_wrapper textarea').val()
			} ,
			success: function(data)
			{
				if (data['status'] == 'ok')
				{
					var intItemIndex = getItemIndex(strCurrentFileHash);
					arrDisplayNames[intItemIndex] = $('#file_name_edit_wrapper textarea').val();
                    $('.gallery2__header__file_name_value').html(arrDisplayNames[intItemIndex]);
                    $( '#gallery2__item-' + intItemIndex + ' .gallery2__item__doc-filename' ).html(arrDisplayNames[intItemIndex]);
				}
				else
				{
					$('#file_name_edit_wrapper').addClass('has_error');
				}
			} ,
			error: function()
			{
				$('#file_name_edit_wrapper').addClass('has_error');
			}
		});
	}

	function showOrginal(strCurrentFileHash) 
	{
	    var intFileIndex = getItemIndexByHashOrName( strCurrentFileHash );
		window.open('https://'+ arrFileHost[ intFileIndex ]  +'/down.php?i='+ strCurrentFileHash +'&view&n=' + arrDisplayNames[ intFileIndex ], '_blank');
	}


    function adjustContentWidth (bolOnResize)
    {
        var intGalleryHeight = $('#gallery2').height();
        var intGalleryWidth = $('#gallery2').width();

        var intImageWrapperWidth = intGalleryWidth;
        var intThumbStripWidth = intGalleryWidth;
        var intGalleryHeaderWidth = intGalleryWidth;
        var intBannerInnerPaddingTop = 0;

        var intBannerWidth = 0;
        var intBannerHeight = 0;
        var intLeftSideWidth = 0;
        if ( bolGallerySidebarVisible || bolGalleryCommentsVisible )
        {
            intLeftSideWidth = 360;
        }
            
        if (intGalleryWidth >= 800 && intGalleryHeight >= 600)
        {
            
            if (intGalleryHeight > ( 600 + 196 + 95 ) )
            {
                intBannerInnerPaddingTop = ( (intGalleryHeight - 600 - 196 - 95) / 2 ) + 196;
            }
            else 
            {
                intThumbStripWidth = intImageWrapperWidth;

                if (intGalleryHeight < (600 + 196) )
                {
                    intGalleryHeaderWidth = intImageWrapperWidth;
                    intBannerInnerPaddingTop = 0;
                }
                else
                {
                    intBannerInnerPaddingTop = 196;
                }
            }
        }
        else
        {
            intBannerWidth = 0;
        }
        
        intImageWrapperWidth = intGalleryWidth - intBannerWidth - intLeftSideWidth;
        
        $('#gallery2__image-wrapper').width(intImageWrapperWidth + 'px');

        $('#gallery2__thumb-strip').width(intThumbStripWidth + 'px');

        $('#gallery2__banner__inner').css('padding-top', intBannerInnerPaddingTop +'px');

        $('#gallery2__header').width(intGalleryHeaderWidth +'px');
        
        
        if (bolOnResize)
        {
            jqMainSlider.redrawSlider();
        }
    
        if ( arrFileTypes[ intCurrentFileIndex ] === "video" )
        {
            if ( !useEmbedPlayer( intCurrentFileIndex ) )
            {
                var $video = $( "#video_" + arrHashes[ intCurrentFileIndex ] );
                if( $video.length)
                {
                    fitVideoPlayer( $video );
                }
            }
        }
    }

    function repositionHeartButton ()
    {
        if ( ! jqMainSlider )
            return;

        if ( strCurrentFileHash !== arrHashes[ jqMainSlider.getCurrentSlide() ] )
            return;

        var jqImage = $('#main_image_' + arrHashes[ jqMainSlider.getCurrentSlide() ]);

        if ( jqImage.length )
        {
            var objImgPosition = jqImage.offset();
            $('#vote_heart_on_image').css({
                top: (jqImage[0].y + jqImage.height() -110) + 'px',
                left: (objImgPosition.left + jqImage.width() -50) + 'px'
            });

            if ( jqImage.attr('data-image-loaded') )
            {
                $('#vote_heart_on_image').show();
            }
        }
    }
    
	function recalculateGalleryForBanner(bolOnResize)
	{
        return adjustContentWidth (bolOnResize);
	}


    function modalGalleryDownloadFileP2PBtn( intItemIndex )
    {
        if ( typeof(bolHideDownloadButtons) !== 'undefined' && bolHideDownloadButtons )
        {
            return;
        }

        if ( ! bolIsListViewForSpecificFile )
        {
            window.location = '/f/' + arrHashes[ intItemIndex ] + '?start_p2p_download';
        }
        else
        {
    
            if (
                typeof ( objWebTorrentDownloadForm ) === 'object'
                && arrFeeDownloadPrice[ intItemIndex ] == null
                && ! currentFolderHasFeeDownload( intItemIndex )
                && arrAllowDownload[ intItemIndex ]
                && ( arrAccessType[ intItemIndex ] === 'LINK' || arrAccessType[ intItemIndex ] === 'PUBLIC' )
                && arrUploadPassword[ intItemIndex ] === ''
                && arrAllowPublicDownload[ intItemIndex ]
            )
            {
                var strFileExtension = arrExtensions[ intItemIndex ];
        
                var arrExecutableExtensions = ['exe','com','dll','pif','scr','bat','bin','pl','sh','scf','sct','shs','vb','lnk','jnlp','apk','vbs','js','msi','jse','jar','dmg','bin','wsf'];
        
                if ( arrExecutableExtensions.indexOf( strFileExtension ) === -1 )
                {
                    objWebTorrentDownloadForm.showForm( 'file', arrHashes[ intItemIndex ] );
                }
                else
                {
                    fConfirm( 'This file was checked with antivirus on the serverside, but executable files may contain potentially dangerous code that antivirus software is yet unable to detect. Use it only if you trust the sender. If not sure, use Virustotal.com to double-check. Do you want to save this file?', '', 'OK', 'Cancel', function ( r )
                    {
                        if ( r )
                        {
                            objWebTorrentDownloadForm.showForm( 'file', arrHashes[ intItemIndex ] );
                        }
                    } );
                }
            }
            else
            {
                modalGalleryDownloadFileBtn( arrHashes[ intItemIndex ] );
            }
        }
    }
    
    function modalGalleryDownloadFileBtn( strFileHash, strDownloadType="simple" )
    {
        var intItemIndex = getItemIndex( strFileHash );

        if ( typeof(bolHideDownloadButtons) !== 'undefined' && bolHideDownloadButtons )
        {
            return;
        }

        if ( typeof(arrHideDownloadButtons) !== 'undefined' && arrHideDownloadButtons[intItemIndex] )
        {
            return;
        }

        var intItemIndex = getItemIndex( strFileHash );

        
        
        
        var bolUserIsAuthenticated = false;
        
        if (
            typeof(arrForbidDirectDownload) != 'undefined'
            && typeof(arrForbidDirectDownload_Authenticated) != 'undefined'
            && arrForbidDirectDownload[ intItemIndex ]
        	&& ! arrForbidDirectDownload_Authenticated[ intItemIndex ]
            && ! bolUserIsAuthenticated
        )
        {
            if ( ! bolIsListViewForSpecificFile )
                closeGallery(strCurrentFileHash);
            
            var jqSigninErrorContainer = $('#signin-modal-content-error');
            
            $('.alert_main_text', jqSigninErrorContainer)
                .html('Direct download limit reached. Please, login or signup to directly download this file');
    
            jqSigninErrorContainer.show();
            
            showSignIn();
        
        }
        else if (
            typeof(arrForbidDirectDownload) != 'undefined'
            && typeof(arrForbidDirectDownload_Authenticated) != 'undefined'
            && arrForbidDirectDownload[ intItemIndex ]
            && arrForbidDirectDownload_Authenticated[ intItemIndex ]
        )
        {
            modalGalleryDownloadFileP2PBtn(intItemIndex);
        }
        else if ( strDownloadType == 'pdf' )
        {
        	var strDateModified = ( typeof arrDatesModified != 'undefined' ? arrDatesModified[ intItemIndex ] : ( typeof arrModDate != 'undefined' ? arrModDate[ intItemIndex ] : '' ) );
            window.location = '/api/file/get_thumb_pdf.php?i=' + strFileHash + '&PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3&dm=' + strDateModified + '&v=102&n=' + arrDisplayNames[ intItemIndex ] + '.pdf';
        }
        else if ( strDownloadType == 'mp4' )
        {
        	var strDateModified = ( typeof arrDatesModified != 'undefined' ? arrDatesModified[ intItemIndex ] : ( typeof arrModDate != 'undefined' ? arrModDate[ intItemIndex ] : '' ) );
            window.location = '/thumb_video/' + strFileHash + '.mp4?PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3&dm=' + strDateModified + '&v=102&n=' + arrDisplayNames[ intItemIndex ] + '.mp4';
        }
        else if ( strDownloadType == 'jpg' )
        {
        	var strDateModified = ( typeof arrDatesModified != 'undefined' ? arrDatesModified[ intItemIndex ] : ( typeof arrModDate != 'undefined' ? arrModDate[ intItemIndex ] : '' ) );
            window.location = '/thumb_show.php?i=' + strFileHash + '&PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3&dm=' + strDateModified + '&download&n=' + arrDisplayNames[ intItemIndex ] + '.jpg';
        }
        else if ( strDownloadType == 'my-files' )
        {
        	objUploadCopyForm.showForm(
    			strUploadHash ,
    			false ,
    			[ strFileHash ] ,
    			[] ,
    			true ,
    			'' ,
    			function( strTargetUploadHash )
    			{
    				window.location = '/filebrowser?u=' + strTargetUploadHash;
    			}
        	);
        }
        else
        {
            var strFileExtension = arrExtensions[ intItemIndex ];
    
            var arrExecutableExtensions = ['exe','com','dll','pif','scr','bat','bin','pl','sh','scf','sct','shs','vb','lnk','jnlp','apk','vbs','js','msi','jse','jar','dmg','bin','wsf'];
    
            if ( arrExecutableExtensions.indexOf( strFileExtension ) == -1 )
            {
                window.location = 'https://'+ arrFileHost[ intItemIndex ]  +'/down.php?i=' + strFileHash + '&n=' + arrDisplayNames[ intItemIndex ];
            }
            else
            {
                fConfirm( 'This file was checked with antivirus on the serverside, but executable files may contain potentially dangerous code that antivirus software is yet unable to detect. Use it only if you trust the sender. If not sure, use Virustotal.com to double-check. Do you want to save this file?', '', 'OK', 'Cancel', function( r )
                {
                    if ( r )
                    {
                        window.location = 'https://'+ arrFileHost[ intItemIndex ]  +'/down.php?i=' + strFileHash + '&n=' + arrDisplayNames[ intItemIndex ];
                    }
                } );
            }
        }
	}


	function modalGallery_changeFileThumbnail( strFileHash, intItemIndex )
    {
        var $input;
        
        $( "<form method='post'>" )
            .append( $input = $( "<input type='file' name='image' accept='image/png, image/jpeg' required>" ) );
        
        $input.change( function ( event )
        {
            var data = new FormData();
            
            if ( !event.target.files.length )
            {
                return;
            }
            
            var file = event.target.files[ 0 ];
            
            data.append( 'image', file, file.name );
            data.append( 'file_hash', strFileHash );
            
            var xhr = new XMLHttpRequest();
            //post file data for upload
            xhr.open( 'POST', '/api/file/set_thumb.php', true );
            xhr.send( data );
            
            xhr.onload = function ()
            {
                //get response and show the uploading status
                var response = JSON.parse( xhr.responseText );
                if ( xhr.status === 200 && response.success )
                {
                    $( '#gallery2__item-' + intItemIndex + ' .gallery2__item__custom_thumb' ).remove();
                    $( '#gallery2__item-' + intItemIndex + ' .fa:first-child' ).remove();
                    $( '#gallery2__item-' + intItemIndex + ' .gallery2__item__doc-wrapper' ).prepend( $( "<div>" ).css( 'background-image', 'url("/thumb.php?i=' + strFileHash + '&t=' + ( new Date ).getTime() + '")' ).addClass( 'gallery2__item__custom_thumb' ) );
                    $( '#gallery2__item-' + intItemIndex + ' .gallery2__item__doc-wrapper' ).addClass( 'has_custom_thumb' );

                    $( '#' + ( $( '#gallery2__item-' + intItemIndex + ' .filesfm__embed_player__container' ).attr( 'id' ) + '_poster' ) ).attr( 'src', '/thumb_video_picture.php?i=' + strFileHash + '&PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3&t=' + ( new Date ).getTime() );
                    $( '#gallery2__item-' + intItemIndex + ' .gallery2__item__audio-wrapper .audio_image' ).css( 'background-image', 'url("/thumb.php?i=' + strFileHash + '&t=' + ( new Date ).getTime() + '")' );

                    $( '.thumb_' + strFileHash ).removeClass( 'doc-icon' );
                    $( '.thumb_' + strFileHash ).css( 'min-width', '' );
                    $( '.thumb_' + strFileHash ).html( '<div class="thumb-wrapper"><img src="/thumb.php?i=' + strFileHash + '&t=' + ( new Date ).getTime() + '" data-original="/thumb.php?i=' + strFileHash + '&t=' + ( new Date ).getTime() + '" id="thumb_strip_img_' + strFileHash + '" class="lazyload-image-gallery image-not-loaded image-loaded" style="width: auto; height: 73px; display: inline;"></div>' );

                    $( '#gallery2__sidebar__info-set-custom-thumbnail' ).html( '' );
                    $( '#gallery2__sidebar__info-set-custom-thumbnail' ).append( '<div class="gallery2__sidebar__info-button no-background" onclick="modalGallery_changeFileThumbnail( \'' +  strFileHash + '\', ' + intItemIndex + ' )"><i class="fal fa-image"></i> Change file image</div>' );
        			$( '#gallery2__sidebar__info-set-custom-thumbnail' ).append( '<div class="gallery2__sidebar__info-button no-background" onclick="modalGallery_removeFileThumbnail( \'' +  strFileHash + '\', ' + intItemIndex + ' )"><i class="fal fa-times"></i> Delete file image</div>' );

                    strThumbnailActions = 
                    '<a href="javascript:void(0)" onclick="modalGallery_changeFileThumbnail( \'' +  arrHashes[ intItemIndex ] + '\', ' + intItemIndex + ' )">' +
                        '<div class="thumbnail-actions-edit" title="Change file image"></div>' +
                    '</a>' +
                    '<a href="javascript:void(0)" onclick="modalGallery_removeFileThumbnail( \'' +  arrHashes[ intItemIndex ] + '\', ' + intItemIndex + ' )">' +
                        '<div class="thumbnail-actions-delete" title="Delete file image"></div>' +
                    '</a>';
                    
                    $( '#gallery2_info_head .thumbnail-wrapper img' ).remove();
                    $( '#gallery2_info_head .thumbnail-wrapper' ).prepend( '<img src="/thumb.php?i=' + strFileHash + '&t=' + ( new Date ).getTime() + '" id="thumb_strip_img_' + strFileHash + '" class="lazyload-image-gallery image-not-loaded image-loaded">' );
                    $( '#gallery2_info_head .thumbnail-actions' ).html('');
                    $( '#gallery2_info_head .thumbnail-actions' ).append(strThumbnailActions);
                    $( '#gallery2_info_head .thumbnail-wrapper' ).addClass("two-actions");
                    $( '#gallery2_info_head .thumbnail-wrapper' ).removeClass("one-action");
                    
                    fSuccess( 'The image has been successfully changed!', '', 'OK' );
                }
                else
                {
                    if( typeof response.bad_file !== "undefined" && response.bad_file )
                    {
                        fError( 'Please choose an image file!', '', 'OK' );
                    }
                    else if( typeof response.too_big !== "undefined" && response.too_big )
                    {
                        fError( 'The size of image must not exceed 5MB!', '', 'OK' );
                    }
                    else
                    {
                        fError( 'Failed to change file image! Please try again later!', '', 'OK' );
                    }
                }
            };
        } );
        
        $input.click();
    };

    function modalGallery_removeFileThumbnail( strFileHash, intItemIndex )
    {
        fConfirm(
            'Are you sure you want to remove the image?',
            '',
            'Yes',
            'No',
            function ( ok )
            {
                if ( !ok )
                {
                    return;
                }
                
                var data = { file_hash: strFileHash };
                
                var successCB = function ()
                {
                    $( '#gallery2__item-' + intItemIndex + ' .gallery2__item__custom_thumb' ).remove();
                    $( '#gallery2__item-' + intItemIndex + ' .gallery2__item__doc-wrapper' ).removeClass( 'has_custom_thumb' );

                    $( '#gallery2__item-' + intItemIndex + ' .gallery2__item__audio-wrapper .audio_image' ).css( 'background-image', 'url("/thumb_audio_picture.php?i=' + strFileHash + '&t=' + ( new Date ).getTime() + '")' );
                   
                    $objSliderThumb = $( '.thumb_' + strFileHash );
                    $objSliderThumb.empty();

                    var strThumbHTML = '';
                    var strClass = null;
                    if ( arrFileTypes[intItemIndex] == 'video' )
                    {
                        var strThumbPath = 'https://' + arrFileHost[ intItemIndex ]  + '/thumb_video_picture.php?i=' + arrHashes[intItemIndex] + '&PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3' ,
                        strThumbHTML = '<img src="'+strThumbPath+'" data-original="'+strThumbPath+'" id="thumb_strip_img_'+arrHashes[intItemIndex]+'" class="lazyload-image-gallery" />';
                    }
                    else if ( typeof( arrIconSvg ) !== 'undefined' && arrIconSvg[intItemIndex] )
                    {
                        strThumbHTML = '<span class="gallery2__item__thumbnail '+ arrExtensions[ intItemIndex ].toLowerCase() +' thumb-svg-icon"><img src="/images/file_types_v2/'+arrIconSvg[ intItemIndex ]+'" data-original="/images/file_types_v2/'+arrIconSvg[ intItemIndex ]+'" style="max-width: 35px" /><span class="gallery2__item__thumbnail-ext">'+ arrExtensions[ intItemIndex ].toUpperCase() +'</span></span>';
                    }
                    else if ( arrIconClass[intItemIndex] )
                    {
                        strThumbHTML = '<span class="gallery2__item__thumbnail '+ arrExtensions[ intItemIndex ].toLowerCase() +'"><i class="' + arrIconClass[intItemIndex] + '"></i><span class="gallery2__item__thumbnail-ext">'+ arrExtensions[ intItemIndex ].toUpperCase() +'</span></span>';
                        strClass = 'doc-icon';
                    }
                    else
                    {
                        strThumbHTML = '<span class="gallery2__item__thumbnail '+ arrExtensions[ intItemIndex ].toLowerCase() +'"><i class="fal fa-file"></i><span class="gallery2__item__thumbnail-ext">'+ arrExtensions[ intItemIndex ].toUpperCase() +'</span></span>';
                        strClass = 'doc-icon';
                    }
                    $objSliderThumb.addClass(strClass)
                    if( !arrFileTypes[intItemIndex] == 'video' )
                    {
                        $objSliderThumb.css('min-width', '65px');
                    }
                    
                    strThumbItemHTML = '<div class="thumb-wrapper">'+ strThumbHTML +'</div><div class="checkbox"></div>';
                    $objSliderThumb.append(strThumbItemHTML);

                    
                    $( '#gallery2__sidebar__info-set-custom-thumbnail' ).html( '' );
        			$( '#gallery2__sidebar__info-set-custom-thumbnail' ).append( '<div class="gallery2__sidebar__info-button no-background" onclick="modalGallery_changeFileThumbnail( \'' +  strFileHash + '\', ' + intItemIndex + ' )"><i class="fal fa-image"></i> Set file preview image</div>' );

                    strThumbnailActions = 
                    '<a href="javascript:void(0)" onclick="modalGallery_changeFileThumbnail( \'' +  arrHashes[ intItemIndex ] + '\', ' + intItemIndex + ' )">' +
                        '<div class="thumbnail-actions-edit" title="Set file preview image"></div>' +
                    '</a>';

                    $( '#gallery2_info_head .thumbnail-wrapper img' ).remove();
                    if ( arrFileTypes[intItemIndex] == 'video' )
                    {
                        $( '#gallery2_info_head .thumbnail-wrapper' ).prepend(strThumbHTML);
                    }
                    else
                    {
                        $( '#gallery2_info_head .thumbnail-wrapper' ).prepend( '<img src="/images/file_types_v2/'+arrIconSvg[ intItemIndex ]+'" />' );
                    }
                   
                    $( '#gallery2_info_head .thumbnail-actions' ).html('');
                    $( '#gallery2_info_head .thumbnail-actions' ).append(strThumbnailActions);
                    $( '#gallery2_info_head .thumbnail-wrapper' ).removeClass("two-actions");
                    $( '#gallery2_info_head .thumbnail-wrapper' ).addClass("one-action");
                    
                    fSuccess( 'The image has been successfully removed!', '', 'OK' );
                };
                
                var failCB = function ()
                {
                    fError( 'Failed to remove file image! Please try again later!', '', 'OK' );
                };
                
                jQuery.post(
                    '/api/file/remove_thumb.php',
                    data,
                    successCB,
                    'JSON'
                ).fail( failCB );
            }
        );
    }

    
    function isFileConvertable( strConverToFormat, intItemIndex )
    {
    	var bolIsFileConvertable = false;

    	if ( strConverToFormat == 'pdf' )
    	{
        	
        	if (
        	    	[ 'asice','edoc','zip' , 'doc','docx','odp','ods','odt','pps','ppsx','ppt','pptx','rtf','xls','xlsx','dotx' ].indexOf( arrExtensions[ intItemIndex ] ) != -1
    	    		&& arrSizesInBytes[ intItemIndex ] < 104857600        		)
        	{
            	var bolIsDocTempFile = false
    
            	if (
                		[ 'doc','docx','odp','ods','odt','pps','ppsx','ppt','pptx','rtf','xls','xlsx','dotx' ].indexOf( arrExtensions[ intItemIndex ] ) != -1
                		&& arrDisplayNames[ intItemIndex ].substring( 0, 2 ) == '~$'
            		)
            	{
            		bolIsDocTempFile = true;
            	}
    
        		if ( ! bolIsDocTempFile )
        		{
    	    		bolIsFileConvertable = true;
        		}
        	}
    	}
    	else if ( strConverToFormat == 'mp4' )
    	{
        	if ( arrFileTypes[ intItemIndex ] == 'video' && arrExtensions[ intItemIndex ] != 'mp4' )
        	{
        		bolIsFileConvertable = true;
        	}
    	}
        else if ( strConverToFormat == 'jpg' )
    	{
        	if ( arrFileTypes[ intItemIndex ] == 'image' && arrExtensions[ intItemIndex ] != 'jpg' )
        	{
        		bolIsFileConvertable = true;
        	}
            else if ( arrExtensions[ intItemIndex ] == 'jpg' && ( arrWidths[ intItemIndex ] > 3000 || arrHeights[ intItemIndex ] > 3000 ) )
            {
                bolIsFileConvertable = true;
            }
    	}
    	
    	return bolIsFileConvertable;
    }

    
    function fileCanBeSigned( strFileExtension, intFileSize )
    {
    	var bolFileCanBeSigned = false;
    	
    	if (
	    		[ 'edoc', 'pdf', 'asice' ].indexOf( strFileExtension ) != -1
	    		&& ( intFileSize / 1024 / 1024 ) < 50
    		)
    	{
    		bolFileCanBeSigned = true;
    	}

    	return bolFileCanBeSigned;
    }

    function getFileIcon (strFileHash)
    {
        var strFileIcon = 'default.svg';
        var intFileIndex = getItemIndexByHashOrName( strFileHash );

        if ( typeof( arrIconSvg ) !== 'undefined' && arrIconSvg[intFileIndex] )
        {
            strFileIcon = arrIconSvg[ intFileIndex ];
        }

        return strFileIcon;
    }
    function canBeReported (strFileHash)
    {
        var bolCanBeReported = false;

        var intFileIndex = getItemIndexByHashOrName( strFileHash );

        if( window.location.href.indexOf("filebrowser") === -1 && typeof arrReports != 'undefined' && typeof arrStatuses != 'undefined' && ! [3, 4].includes(arrStatuses[ intFileIndex ]) &&
            ( 
                typeof arrFileIsLockedByOtherUser == 'undefined' 
                || ! arrFileIsLockedByOtherUser[ intFileIndex ]
            )
        ) 
        {
           bolCanBeReported = true; 
        }

        return bolCanBeReported;
    }
    function hasReported (strFileHash)
    {
        var bolHasReported = false;
        var intFileIndex = getItemIndexByHashOrName( strFileHash );

        if( window.location.href.indexOf("filebrowser") === -1 && typeof arrReports != 'undefined' && typeof arrStatuses != 'undefined' && ! [3, 4].includes(arrStatuses[ intFileIndex ]) &&
            ( 
                typeof arrFileIsLockedByOtherUser == 'undefined' 
                || ! arrFileIsLockedByOtherUser[ intFileIndex ]
            )
        ) 
        {
            if (arrReports[ intFileIndex ] == 0)
            {
                bolHasReported = false;
            }
            else 
            {
                bolHasReported = true;
            }
        }
        return bolHasReported;
    }
    function canOrderPrints( strFileHash )
    {
        var bolCanOrderPrints = false;

        var intFileIndex = getItemIndexByHashOrName( strFileHash );
         
                
        return bolCanOrderPrints;
    }

    function canOrderProductGeneral( strFileHash )
    {
        var bolCanOrderProductGeneral = false;
        var intFileIndex = getItemIndexByHashOrName( strFileHash );
                        return bolCanOrderProductGeneral;
    }

	function canOrderProducts( strFileHash )
    {
    	var bolCanOrderProducts = false;
        var intFileIndex = getItemIndexByHashOrName( strFileHash );
                if ( arrFileHasProductSelling[ intFileIndex ] == 1 )
        {
            bolCanOrderProducts = true;
        }
                return bolCanOrderProducts;
    }

	function canBuyFile( strFileHash )
    {
    	var bolCanBuyFile = false;
        var intFileIndex = getItemIndexByHashOrName( strFileHash );


        if ( arrFeeDownloadPrice[ intFileIndex ] != null )
		{
			if ( ! bolIsOwner )
			{
				bolCanBuyFile = true;
			}
		}
    	return bolCanBuyFile;
    }

    function canSellFile( strFileHash )
    {
    	var bolCanSellFile = false;
        var intFileIndex = getItemIndexByHashOrName( strFileHash );


        if ( bolIsOwner )
        {
            bolCanSellFile = true;
        }
		
    	return bolCanSellFile;
    }

    function canSetAsThumb( strFileHash )
    {
    	var bolCanSetAsThumb = false;
        var intFileIndex = getItemIndexByHashOrName( strFileHash );

        if ( arrFileTypes[ intFileIndex ] == 'image' )
        {
            bolCanSetAsThumb = true;
        }

        if ( ! bolIsOwner )
        {
            bolCanSetAsThumb = false;
        }
		
    	return bolCanSetAsThumb;
    }
    
    function canOpenSlideshow()
    {
		
    	var bolCanOpenSlideshow = true;
        if ( arrHashes.length <= 1 )
        {
            bolCanOpenSlideshow = false;
        }
    	return bolCanOpenSlideshow;
    }

    function getFileLink( strFileHash )
    {
    	var strShareLink = '';

        strShareLink = 'https://files.fm/f/' + strFileHash;
		
    	return strShareLink;
    }

    function getFileEditLink( strFileHash )
    {
    	var strShareEditLink = '';
        var intFileIndex = getItemIndexByHashOrName( strFileHash );
        var strFileViewLink = 'https://files.fm/f/' + strFileHash;

        if ( bolCanDelete && typeof arrFileDeleteKeys != 'undefined' && arrFileDeleteKeys[ intFileIndex ] != '' )
        {
            strShareEditLink = strFileViewLink + '?fk=' + arrFileDeleteKeys[ intFileIndex ];
        }	
    	return strShareEditLink;
    }

    
    function canOpenFileInEditor( strMode, strFileExtension )
    {
    	var bolcanOpenFileInEditor = false;
    	
    	if ( strMode == 'edit' && [ 'odt','fodt','ott','doc','dot','docx','docm','rtf','txt','odm','otm','oth','ods','fods','ots','xls','xla','xlsx','xlsb','xlsm','dif','slk','csv','dbf','odp','fodp','otp','ppt','pot','pptx','pptm','potx','potm','ppsx','odg','fodg','otg' ].indexOf( strFileExtension ) != -1 )
    	{
    		bolcanOpenFileInEditor = true;
    	}

    	return bolcanOpenFileInEditor;
    }

    function canOpenImageInEditor( strFileExtension )
    {
        var bolCanOpenImageInEditor = false;

        if (
                [ 'jpg','jpeg','gif','png','bmp','svg','webp','ico','jfif','heic','heif','tiff','tif' ].indexOf( strFileExtension ) !== -1
                || [ 'cr3','cr2','nef','arw','pef','rw2','orf','raf','nrw','dng' ].indexOf( strFileExtension ) !== -1
            )
        {
            bolCanOpenImageInEditor = true;
        }

        return bolCanOpenImageInEditor;
    }
    
    function canDownload( strFileHash )
    {
        var bolCanDownload = false;

        var intItemIndex = getItemIndexByHashOrName( strFileHash );
        
        if  (
                arrFeeDownloadPrice[ intItemIndex ] == null
                && ! currentFolderHasFeeDownload( intItemIndex )
                && arrAllowDownload[ intItemIndex ]
                &&
                (
                    typeof( bolHideDownloadButtons ) === 'undefined'
                    || ! bolHideDownloadButtons
                )
                &&
                (
                    typeof( arrHideDownloadButtons ) === 'undefined'
                    || ! arrHideDownloadButtons[ intItemIndex ]
                )
            )
        {
            bolCanDownload = true;
        }
        
        return bolCanDownload;
    }
    
    function currentFolderHasFeeDownload( intFileIndex )
    {
    	var bolVal = false;
    	
    	if ( typeof bolUploadHasFeeDownload != 'undefined' )
    	{
    		bolVal = bolUploadHasFeeDownload;
    	}
    	else if ( typeof PublicProfile != 'undefined' )
    	{
            bolVal = arrParentFolderIsForSale[ intFileIndex ];
		}
		else
		{
			bolVal = false;
		}
		
		return bolVal;
	}
    

    function loadExifTags()
    {
        var imageTag = $( '#main_image_' + strCurrentFileHash )[ 0 ];

        var jqExifTagsButton = $( '#gallery2__sidebar__info-exif_tags-button' );

        var arrExifTable = ['Model', 'ISO', 'Lens Model', 'Focal Length', 'Aperture Value', 'Exposure Time'];

        EXIF.getData( imageTag, function ()
        {
            var strExifTags = EXIF.pretty( this );

            var arrExifTags = strExifTags.split( '\r\n' );

            arrExifTags = arrExifTags.map( ( item ) =>
            {
                if ( item != '' )
                {
                    var arrKeyValuePair = item.split( ' : ' );
                    return arrKeyValuePair;
                }
            } );

            var jqPrevExifTagRow = null;
            
            arrExifTags.forEach( ( item ) =>
            {
                var jqNewExifTagRow = $( '<tr class="gallery2__sidebar__info-exif_tags"><td class="gallery2__sidebar__exif_tags-key"></td><td class="gallery2__sidebar__exif_tags-value"></td></tr>' );

                if ( typeof( item ) != 'undefined' )
                {
                    if(arrExifTable.includes(item[ 0 ]))
                    {
                        if ( item[ 0 ] != 'Model' || (item[ 0 ] == 'Model' && $('#gallery2__sidebar__info-mainexif .gallery2__sidebar__info-value .exif-grid .Model span').html() == '') ) {
                            $('#gallery2__sidebar__info-mainexif .gallery2__sidebar__info-value .exif-grid .' + item[ 0 ].replace(/\s+/g, '') + ' span').html( item[ 1 ] );
                            $('#gallery2__sidebar__info-mainexif .gallery2__sidebar__info-value .exif-grid .' + item[ 0 ].replace(/\s+/g, '')).show();
                            $('#gallery2__sidebar__info-mainexif .gallery2__sidebar__info-value').show();
                        }
                    }
                    else
                    {
                        jqNewExifTagRow.children( '.gallery2__sidebar__exif_tags-key' ).html( item[ 0 ] );
                        jqNewExifTagRow.children( '.gallery2__sidebar__exif_tags-value' ).html( item[ 1 ] );

                        if ( jqPrevExifTagRow )
                        {
                            jqPrevExifTagRow.after( jqNewExifTagRow );
                        }
                        else
                        {
                            jqExifTagsButton.after( jqNewExifTagRow );
                        }

                        jqPrevExifTagRow = jqNewExifTagRow;
                    }
                }
            } );

            if ( typeof arrWidths != 'undefined' && typeof arrHeights != 'undefined' && typeof arrWidths[intCurrentFileIndex] != 'undefined' && typeof arrHeights[intCurrentFileIndex] != 'undefined' && arrWidths[intCurrentFileIndex] != '' && arrHeights[intCurrentFileIndex] != '' && arrWidths[intCurrentFileIndex] != 'undefined' && arrHeights[intCurrentFileIndex] != 'undefined' )
            {
                $('#gallery2__sidebar__info-mainexif .gallery2__sidebar__info-value .exif-grid .size span').html(arrWidths[intCurrentFileIndex] + ' x ' + arrHeights[intCurrentFileIndex]);
                $('#gallery2__sidebar__info-mainexif .gallery2__sidebar__info-value .exif-grid .size').show();
                $('#gallery2__sidebar__info-mainexif .gallery2__sidebar__info-value .exif-grid .mp span').html(Math.round((arrWidths[intCurrentFileIndex]*arrHeights[intCurrentFileIndex]/1000000) * 100) / 100+ ' MP');
                $('#gallery2__sidebar__info-mainexif .gallery2__sidebar__info-value .exif-grid .mp').show();
                $('#gallery2__sidebar__info-mainexif .gallery2__sidebar__info-value').show();
            }    
            

            jqExifTagsButton.hide();
        } );
    }


    function gpsDecimalToDMS( mixGpsDecimal, bolLatitude )
    {
        var dblGpsDecimal = Number( mixGpsDecimal )
        if ( mixGpsDecimal === '' || isNaN( dblGpsDecimal ) )
        {
            return '';
        }

        var strGpsPole;
        if ( bolLatitude )
        {
            strGpsPole = ( dblGpsDecimal < 0 ) ? 'S' : 'N';
        }
        else
        {
            strGpsPole = ( dblGpsDecimal < 0 ) ? 'W' : 'E';
        }
        dblGpsDecimal = Math.abs( dblGpsDecimal );

        var intGpsDegrees = Math.trunc( dblGpsDecimal );
        dblGpsDecimal -= intGpsDegrees;

        var intGpsMinutes = Math.trunc( dblGpsDecimal * 60 );
        dblGpsDecimal -= intGpsMinutes / 60;

        var intGpsSeconds = ( dblGpsDecimal * 3600 ).toFixed( 2 );

        return `${ intGpsDegrees }\u00B0 ${ intGpsMinutes }' ${ intGpsSeconds }" ${ strGpsPole }`;
    }


    function ocrAnalyze( objButton, strModel )
    {
        var jqButton = $( objButton );
        if ( jqButton.hasClass( 'disabled' ) )
        {
            return;
        }

        jqButton.addClass( 'disabled' );

        var strButtonText = jqButton.text();

        jqButton.text( strButtonText + ' (0s)' );
        var intStartTimestamp = Date.now();
        var stopwatch = setInterval( () => {
            jqButton.html( strButtonText + ' (' + Math.trunc( ( Date.now() - intStartTimestamp ) / 1000 ) + 's)' );
        }, 1000 );

        $.ajax( {
            type: 'GET',
            dataType: 'json',
            crossDomain: true,
            url: './ajax/image_ocr_processing.php?PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3',
            data:
            {
                hash: strCurrentFileHash,
                model: strModel,
            },
            success: function ( data )
            {
                clearInterval( stopwatch );

                if ( ! data[ 'success' ] )
                {
                    fError( data[ 'error' ] );
                    return;
                }

                if ( strModel == 'easyocr' && typeof arrFileEasyOCRText != 'undefined' )
                {
                    arrFileEasyOCRText[ intCurrentFileIndex ] = data[ 'text' ];

                    $( '#gallery2__sidebar__info-easyocr_text .gallery2__sidebar__info-value' ).text( arrFileEasyOCRText[ intCurrentFileIndex ] );
                    if ( arrFileEasyOCRText[ intCurrentFileIndex ] != '' ) $( '#gallery2__sidebar__info-easyocr_text' ).show();
                }
                else if ( strModel == 'googlecv' && typeof arrFileGoogleCVText != 'undefined' )
                {
                    arrFileGoogleCVText[ intCurrentFileIndex ] = data[ 'text' ];

                    $( '#gallery2__sidebar__info-google_cv_text .gallery2__sidebar__info-value' ).text( arrFileGoogleCVText[ intCurrentFileIndex ] );
                    if ( arrFileGoogleCVText[ intCurrentFileIndex ] != '' ) $( '#gallery2__sidebar__info-google_cv_text' ).show();
                }
            },
        } );
    }


    function speechToText( objButton )
    {
        var jqButton = $( objButton );
        if ( jqButton.hasClass( 'disabled' ) )
        {
            return;
        }

        jqButton.addClass( 'disabled' );

        var strButtonText = jqButton.text();

        jqButton.text( strButtonText + ' (0s)' );
        var intStartTimestamp = Date.now();
        var stopwatch = setInterval( () => {
            jqButton.html( strButtonText + ' (' + Math.trunc( ( Date.now() - intStartTimestamp ) / 1000 ) + 's)' );
        }, 1000 );

        $.ajax( {
            type: 'GET',
            dataType: 'json',
            crossDomain: true,
            url: './ajax/speech_to_text.php?PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3',
            data:
            {
                hash: strCurrentFileHash,
            },
            success: function ( data )
            {
                clearInterval( stopwatch );

                if ( ! data.success )
                {
                    fError( data.error );
                    return;
                }

                arrFileAudioTranscription[ intCurrentFileIndex ] = data.text;

                $( '#gallery2__sidebar__info-google_cloud-speech_to_text-text .gallery2__sidebar__info-value' )
                    .text( arrFileAudioTranscription[ intCurrentFileIndex ] );

                if ( arrFileAudioTranscription[ intCurrentFileIndex ] != '' )
                {
                    $( '#gallery2__sidebar__info-google_cloud-speech_to_text-text' ).show();
                }
            },
        } );
    }


    function objectsLabelsDetection( objButton )
    {
        var jqButton = $( objButton );
        if ( jqButton.hasClass( 'disabled' ) )
        {
            return;
        }

        jqButton.addClass( 'disabled' );

        var strButtonText = jqButton.text();

        jqButton.text( strButtonText + ' (0s)' );
        var intStartTimestamp = Date.now();
        var stopwatch = setInterval( () => {
            jqButton.html( strButtonText + ' (' + Math.trunc( ( Date.now() - intStartTimestamp ) / 1000 ) + 's)' );
        }, 1000 );

        $.ajax( {
            type: 'GET',
            dataType: 'json',
            crossDomain: true,
            url: './ajax/object_label_detection.php?PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3',
            data:
            {
                hash: strCurrentFileHash,
            },
            success: function ( data )
            {
                clearInterval( stopwatch );

                if ( ! data.success )
                {
                    fError( data.error );
                    return;
                }

                arrObjectTags[ intCurrentFileIndex ] = data.text.objects;

                if ( arrObjectTags[ intCurrentFileIndex ] != '' )
                {
                    let jqObjectTagsElem = $( '#gallery2__sidebar__info-object_tags .tags' );

                    let arrExistingTags = jqObjectTagsElem.find( '.tag' ).map( function() {
                        return $( this ).text();
                    } ).get();

                    let arrObjectTagsSplitted = arrObjectTags[ intCurrentFileIndex ].split( ';' );

                    let arrTagsToBeAdded = arrObjectTagsSplitted.filter( tag => ! arrExistingTags.includes( tag ) );

                    $.each( arrTagsToBeAdded, ( i, tag ) => {
                        jqObjectTagsElem.append( '<span class="tag">' + tag + '</span>' );
                    } );

                    if ( arrObjectTags[ intCurrentFileIndex ] != '' )
                    {
                        $( '#gallery2__sidebar__info-object_tags' ).show();
                    }
                }


                arrLabelTags[ intCurrentFileIndex ] = data.text.labels;

                let jqLabelTagsElem = $( '#gallery2__sidebar__info-label_tags .tags' );

                jqLabelTagsElem.empty();

                let arrLabelTagsSplitted = arrLabelTags[ intCurrentFileIndex ].split( ';' );
                $.each( arrLabelTagsSplitted, ( i, tag ) => {
                    jqLabelTagsElem.append( '<span class="tag">' + tag + '</span>' );
                } );

                if ( arrLabelTags[ intCurrentFileIndex ] != '' )
                {
                    $( '#gallery2__sidebar__info-label_tags' ).show();
                }
            },
        } );
    }


    function objectDetection( objButton )
    {
        var jqButton = $( objButton );
        if ( jqButton.hasClass( 'disabled' ) )
        {
            return;
        }

        jqButton.addClass( 'disabled' );

        var strButtonText = jqButton.text();

        jqButton.text( strButtonText + ' (0s)' );
        var intStartTimestamp = Date.now();
        var stopwatch = setInterval( () => {
            jqButton.html( strButtonText + ' (' + Math.trunc( ( Date.now() - intStartTimestamp ) / 1000 ) + 's)' );
        }, 1000 );

        $.ajax( {
            type: 'GET',
            dataType: 'json',
            crossDomain: true,
            url: './ajax/object_detection.php?PHPSESSID=9ec2943be38ec1b81485a61c5596edc86d31d3d3',
            data: {
                hash: strCurrentFileHash,
            },
            success: function ( data )
            {
                clearInterval( stopwatch );

                if ( ! data.success )
                {
                    fError( data.error );
                    return;
                }

                arrYoloObjectTags[ intCurrentFileIndex ] = data.objects;

                if ( arrYoloObjectTags[ intCurrentFileIndex ] == '' )
                {
                    return;
                }

                let jqObjectTagsElem = $( '#gallery2__sidebar__info-object_tags .tags' );

                let arrExistingTags = jqObjectTagsElem.find( '.tag' ).map( function() {
                    return $( this ).text();
                } ).get();

                let arrObjectTagsSplitted = arrYoloObjectTags[ intCurrentFileIndex ].split( ';' );

                let arrTagsToBeAdded = arrObjectTagsSplitted.filter( tag => ! arrExistingTags.includes( tag ) );

                $.each( arrTagsToBeAdded, ( i, tag ) => {
                    jqObjectTagsElem.append( '<span class="tag">' + tag + '</span>' );
                } );

                $( '#gallery2__sidebar__info-object_tags' ).show();
            },
        } );
    }


</script>
<link rel="stylesheet" type="text/css" media="all" href="css/list.v2/main.css?v=5027">
<div class="deleted_wrapper">
<div class="deleted_inner">
<div class="deleted_vertical_center clearfix">
<div class="deleted_inner_left">
<img src="/images/list/deleted/files.svg">
</div>
<div class="deleted_inner_right">
<h1>Files are deleted</h1>
<p>Possible reasons:</p>
<ul>
<li><img src="/images/UI_icons/blue/check.svg" alt="✓">Expiry date is over</li>
<li><img src="/images/UI_icons/blue/check.svg" alt="✓">Owner has deleted files</li>
<li><img src="/images/UI_icons/blue/check.svg" alt="✓">The link is incorrect</li>
</ul>
</div>
</div>
</div>
</div>
<div class="undelete__wrapper">
<div class="undelete__inner">
<div class="undelete_msg__wrapper">
<div class="undelete_msg__header">
Restore files </div>
<div class="undelete_msg__info_txt">
<div>
<b>These files have been permanently removed and cannot be restored.</b> </div>
</div>
</div>
<div class="undelete__preloader">
<i class="fa fa-spinner fa-spin"></i>
<span>Please wait...</span>
</div>
</div>
</div>
<div class="deleted_footer__pricing_container">
<link rel="stylesheet" type="text/css" media="all" href="/css/elements/storage_plan_cards.css?v=14">
<div class="plan_cards monthly personal business">
<div class="plan_card_wrapper personal business ">
<div class="plan_card">
<div class="plan_title">Basic account</div>
<div class="plan_price annual hidden"><b></b> /month</div>
<div class="plan_price monthly hidden"><b></b> /month</div>
<div class="plan_pricedesc free ">Free</div>
<div class="plan_bullets">
<div class="plan_bullet">
<span>20GB storage a month</span>
</div>
<div class="plan_bullet">
<span>Store and share documents</span>
</div>
<div class="plan_bullet">
<span>Convert docs to PDF</span>
</div>
<div class="plan_bullet">
<span>Antivirus protection</span>
</div>
</div>
<a href="#" class="plan_button standart buttonwithoutprice red" onclick="gaev( 'upload_view', 'Free', 'Signup-Free' ); $( '.login_return_url' ).val( 'storage-plans#subscribe' ); showCreateAccount(); return false;">
Create account </a>
</div>
</div>
<div class="plan_card_wrapper personal highlighted">
<div class="top_bar" style="background: #F23047;">
<div class="top_bar_desc">Most popular features</div>
</div>
<div class="plan_card">
<div class="discount_annual">You’ll Save 24$</div>
<div class="plan_title">PRO</div>
<div class="plan_price annual "><b>$7,9</b> /month</div>
<div class="plan_price monthly "><b>$9,9</b> /month</div>
<div class="plan_pricedesc  "><span class="crossed">118,8$<svg><line x1="0" y1="70%" x2="120%" y2="0"></line></svg></span> 94,80$ yearly</div>
<div class="plan_bullets">
<div class="plan_bullet">
<span>Three times faster upload</span>
</div>
<div class="plan_bullet">
<span>2TB cloud storage + add more</span>
</div>
<div class="plan_bullet">
<span>20GB file size</span>
</div>
<div class="plan_bullet">
<span>Share without Ads</span>
</div>
<div class="plan_bullet">
<span>Password-protected links</span>
</div>
<div class="plan_bullet">
<span>Set delete date</span>
</div>
<div class="plan_bullet">
<span>File recovery for 30 days</span>
</div>
<div class="plan_bullet">
<span>Realtime Document editor</span>
</div>
<div class="plan_bullet">
<span>Image editor</span>
</div>
<div class="plan_bullet">
<span>Medadata: XMP, IPTC, Exif</span>
</div>
<div class="plan_bullet">
<span>AI image recognition</span>
</div>
<div class="plan_bullet">
<span>AI speech to text</span>
</div>
</div>
<div class="plan_button_wrapper">
<a href="#" class="plan_button annual " onclick="gaev( 'upload_view', 'Pro2TB', 'Signup-Pro2TB' ); $( '.login_return_url' ).val( 'storage-plans#subscribe' ); showCreateAccount(); return false;">Subscribe</a>
<a href="#" class="plan_button monthly " onclick="gaev( 'upload_view', 'Pro2TB', 'Signup-Pro2TB' ); $( '.login_return_url' ).val( 'storage-plans#subscribe' ); showCreateAccount(); return false;">Subscribe</a>
</div>
</div>
</div>
<div class="plan_card_wrapper business ">
<div class="plan_card">
<div class="discount_annual">You’ll Save 72$</div>
<div class="plan_title">TEAM</div>
<div class="plan_price annual "><b>$19</b> /month</div>
<div class="plan_price monthly "><b>$25</b> /month + VAT</div>
<div class="plan_pricedesc  "><span class="crossed">300$<svg><line x1="0" y1="70%" x2="120%" y2="0"></line></svg></span> 228$ + VAT yearly</div>
<div class="plan_bullets">
<div class="plan_bullet">
<span>2TB+ and 4 users included</span>
</div>
<div class="plan_bullet">
<span>More powerful servers</span>
</div>
<div class="plan_bullet">
<span>E-signing of documents</span>
</div>
<div class="plan_bullet">
<span>200GB+ file size</span>
</div>
<div class="plan_bullet">
<span>File Versioning</span>
</div>
<div class="plan_bullet">
<span>File recovery up to 1 year</span>
</div>
<div class="plan_bullet">
<span>2FA and security settings</span>
</div>
<div class="plan_bullet">
<span>Audit Trails and Activity Logs</span>
</div>
<div class="plan_bullet">
<span>Technical support</span>
</div>
</div>
<div class="plan_button_wrapper">
<a href="#" class="plan_button annual " onclick="gaev( 'upload_view', 'Team2TB', 'Signup-Team2TB' ); $( '.login_return_url' ).val( 'storage-plans#subscribe' ); showCreateAccount(); return false;">Subscribe</a>
<a href="#" class="plan_button monthly " onclick="gaev( 'upload_view', 'Team2TB', 'Signup-Team2TB' ); $( '.login_return_url' ).val( 'storage-plans#subscribe' ); showCreateAccount(); return false;">Subscribe</a>
</div>
</div>
</div>
<div class="plan_card_wrapper business ">
<div class="plan_card">
<div class="discount_annual">You’ll Save 312$</div>
<div class="plan_title">BUSINESS</div>
<div class="plan_price annual "><b>$99</b> /month</div>
<div class="plan_price monthly "><b>$125</b> /month + VAT</div>
<div class="plan_pricedesc  "><span class="crossed">1500$<svg><line x1="0" y1="70%" x2="120%" y2="0"></line></svg></span> 1188$ + VAT yearly</div>
<div class="plan_bullets">
<div class="plan_bullet">
<span>5TB+ and 10 users</span>
</div>
<div class="plan_bullet">
<span>Business storage tier</span>
</div>
<div class="plan_bullet">
<span>Business features and invoicing</span>
</div>
<div class="plan_bullet">
<span>400GB+ file size</span>
</div>
<div class="plan_bullet">
<span>File Versioning</span>
</div>
<div class="plan_bullet">
<span>File recovery up to 5 years</span>
</div>
<div class="plan_bullet">
<span>2FA and security settings</span>
</div>
<div class="plan_bullet">
<span>Activity and file access log</span>
</div>
<div class="plan_bullet">
<span>Business technical support</span>
</div>
<div class="plan_bullet">
<span>User group management</span>
</div>
<div class="plan_bullet">
<span>Bulk content recognition and search</span>
</div>
</div>
<div class="plan_button_wrapper">
<a href="#" class="plan_button annual " onclick="gaev( 'upload_view', 'Business5TB', 'Signup-Business5TB' ); $( '.login_return_url' ).val( 'storage-plans#subscribe' ); showCreateAccount(); return false;">Subscribe</a>
<a href="#" class="plan_button monthly " onclick="gaev( 'upload_view', 'Business5TB', 'Signup-Business5TB' ); $( '.login_return_url' ).val( 'storage-plans#subscribe' ); showCreateAccount(); return false;">Subscribe</a>
</div>
</div>
</div>
</div>
<script>
		var bolUserHasBusinessAccount = false;
		let unix_timestamp = 1728634678;
	</script>
<script src="js/storage_plan_cards.js?v=3"></script>
</div>
<div class="deleted_footer__faq_container">
<link rel="stylesheet" type="text/css" media="all" href="/css/elements/faq.css?v=2">
<div id="faq">
<h1>Frequently asked questions with file storage, data security and features</h1>
<div class="faq-list">
<div class="storage_plans_left">
<div class="faq-list__item faq-list__item_open">
<div class="faq-list__item__q">
Are my files private? </div>
<div class="faq-list__item__a">
The files are available in your account and are stored in secure data centers in the European Union. Each folder and file is automatically assigned a unique Internet link. Links have access rights: Private, Link, Public. If the link rights have not been set to private, then when you open the link, its content will be available.
<br><br>
File access settings are available both for the entire account and for each folder and file. </div>
</div>
<div class="faq-list__item">
<div class="faq-list__item__q">
What is the Files.fm platform for? </div>
<div class="faq-list__item__a">
Anyone looking to store and share their files with ease. Upload files of up to 5 GB for free and share unique links with anyone, anytime. </div>
</div>
<div class="faq-list__item">
<div class="faq-list__item__q">
Where are the files stored? How are they available? </div>
<div class="faq-list__item__a">
The files are available in your account and are stored in secure data centers in the European Union. Each folder and file is automatically assigned a unique link. Links have access rights: Private, Link, Public. If the link rights have not been set to private, then when you open the link, its content will be available.
<br><br>
File access settings are available both for the entire account and for each folder and file. </div>
</div>
<div class="faq-list__item">
<div class="faq-list__item__q">
What file types can I store? </div>
<div class="faq-list__item__a">
Upload, store and share all types of files - documents, photos, video, audio and other. The system preserves original file sizes. Select and upload multiple files at once.
<br><br>
Basic account user have a 5 GB upload limit, Pro - 20 GB and Business accounts have a 50 GB limit. Use Sync for unlimited uploads. </div>
</div>
<div class="faq-list__item">
<div class="faq-list__item__q">
What to do if there are complaints about the content published on the platform? </div>
<div class="faq-list__item__a">
Yes. Please submit your complaint (a DMCA type application) for file removal using <a href="/content-review" target="_blank"> this form </a>. </div>
</div>
<div class="faq-list__item faq-list__item_open">
<div class="faq-list__item__q">
Payment methods </div>
<div class="faq-list__item__a">
We support VISA, Mastercard, bank transfer and internal Files.fm tokens.
<br><br>
We do not have access, nor do we store your credit card data. All payments are made via banks and secure PCI-DSS certified payment institutions. </div>
</div>
</div>
<div class="storage_plans_right">
<div class="faq-list__item faq-list__item_open">
<div class="faq-list__item__q">
Data security </div>
<div class="faq-list__item__a">
Files are uploaded, shared and encrypted securely.
<br><br>
Use the "Backup" tool to create private encrypted backup copies stored in a secure data center. Otherwise, data arrays are reserved, <b>but no additional backups are made for your files</b>. </div>
</div>
<div class="faq-list__item">
<div class="faq-list__item__q">
How long are files stored for free users? </div>
<div class="faq-list__item__a">
This depends - <b>unregistered</b> users can access and share uploaded files for up to 60 days.
<br><br>
Pro and Business account users have free permanent file storage space, with access to upload details, access statistics and file privacy management. </div>
</div>
<div class="faq-list__item">
<div class="faq-list__item__q">
How can I delete files? </div>
<div class="faq-list__item__a">
You can. To delete files, provide an e-mail address for file management in the first field of the file upload form. The "delete-file" link will be sent to this email.
<br><br>
Registered users can delete their uploads in the "My files" section. In case of uploading files before logging-in, see the uploads made from
your device in the login page (or contact support). </div>
</div>
<div class="faq-list__item">
<div class="faq-list__item__q">
Do I get a sharing link immediately after starting upload? </div>
<div class="faq-list__item__a">
Yes. Your sharing link should appear at the top of the file upload window right after you click "Start file upload".
<br><br>
For registered users, the uploaded file link also appears as the latest entry in "My files" section. </div>
</div>
<div class="faq-list__item">
<div class="faq-list__item__q">
Why can′t we refund payments? </div>
<div class="faq-list__item__a">
Because payments are processed automatically. As soon as a payment is made, the system reserves disk space, unlocks instant features and/or grants access to paid content.
<br><br>
To see if this is for you, try the Business account for free for 14 days. </div>
</div>
<div class="faq-list__item faq-list__item_open">
<div class="faq-list__item__q">
How much data can I store? </div>
<div class="faq-list__item__a">
Store as much as you need - rent more storage space as you go.
<br><br>
Your received Files.fm tokens also add to your permanent disk space. </div>
</div>
</div>
</div>
</div>
<script type="text/javascript">

	$(window).bind("load", function() {

		$(".faq-list__item__q").click(function (){
            var $this = $(this).closest(".faq-list__item");
            var strOpenClass = "faq-list__item_open";
		    
		    if( $this.hasClass(strOpenClass) ) 
		    {
		       $this.removeClass(strOpenClass);
            }
            else 
            {
                $this.addClass(strOpenClass);
            }           
        });
	});

</script></div>
<style type="text/css">
    #center {
        min-height: 0 !important;
    }
</style>
<script type="text/javascript">

	function restoreItem( strItemType, strItemHash )
    {
        $( '.undelete_msg__button' ).hide();
        $( '.undelete__preloader' ).show();
        
        var strAjax_Url;
        
        if ( strItemType == 'FILE' )
        {
        	strAjax_Url = '/api/undelete_file.php';
        }
        else 
        {
        	strAjax_Url = '/api/undelete_folder.php';
        }
        

        $.ajax(
        {
            type : 'POST' ,
            dataType : 'json' ,
            url : strAjax_Url ,
            data :
            {
                hash :  strItemHash ,
                return_new_path : false
            } ,
            success : function( data )
            {
                if ( data.status === 'ok' )
                {
                   window.location.reload();
                }
                else
                {
                    $( '.undelete_msg__button' ).show();
                    $( '.undelete__preloader' ).hide();
                    fError( 'Failed to restore. Please try again! If the error persists, contact [email protected]' );
                }
            } ,
            error : function()
            {
                $( '.undelete_msg__button' ).show();
                $( '.undelete__preloader' ).hide();
                fError( 'Failed to restore. Please try again! If the error persists, contact [email protected]' );
            }
        } );
    }
	
	function showCreateAccountWithRedirect()
    {
        $('.dont_redirect_after_login').val('');
        $('.login_return_url').val(window.location.pathname);
        
        showCreateAccount();
    }

</script>
</div>
<link rel="stylesheet" type="text/css" media="all" href="/css/footer.css?v=15">
<div id="footer_container">
<div id="footer" class="clearfix">
<div class="footer_block footer_block_left">
<div class="float_left">
<p class="header">2008 - 2024 <img src="images/european-flag.svg" width="24" height="24" alt="Files.fm EU Cloud storage">
EU Files.fm cloud storage </p>
<p>The Files.fm cloud storage platform offers comprehensive solutions for storing, sharing, publishing, and even selling various types of content, including photos, videos, music, applications, books, and documents.</p>
<div id="files_socials">
<a class="social_icon facebook" href="https://www.facebook.com/Filesfm/" target="_blank"></a>
<a class="social_icon linkedin" href="https://lv.linkedin.com/company/files.fm" target="_blank"></a>
<a class="social_icon instagram" href="https://www.instagram.com/files.fm/" target="_blank"></a>
<a class="social_icon twitter" href="https://twitter.com/files_fm" target="_blank"></a>
<a class="social_icon tiktok" href="https://www.tiktok.com/@files.fm" target="_blank"></a>
</div>

</div>
</div>
<div class="footer_block_right">
<div class="footer_block">
<div class="footer_title">
Get started </div>
<ul>
<li>
<a href="" onclick="showCreateAccount(); return false;">Create account / Login</a>
</li>
<li>
<a href="storage-plans">Pricing</a>
</li>
<li>
<a href="/business">Business</a>
</li>
<li>
<a href="/data-security" target="_blank">Data security</a>
</li>
<li>
<a href="terms">Terms</a>
</li>
<li>
<a href="questions-about-online-file-storage">Questions</a>
</li>
<li>
<a href="/token">Files.fm Token</a>
</li>
</ul>
</div>
<div class="footer_block">
<div class="footer_title">
Solutions </div>
<ul>
<li>
<a href="/sync-share">File sync</a>
</li>
<li>
<a href="/backup">Encrypted Backups</a>
</li>
<li>
<a href="upload-form" target="_blank">File upload form</a>
</li>
<li>
<a href="https://files.fm/servers" target="_blank">Virtual servers</a>
</li>
<li>
<a href="/sell-files">Content sales e-commerce</a>
</li>
<li>
<a href="/public-profiles" target="_blank">Content publishing</a>
</li>
</ul>
</div>
<div class="footer_block">
<div class="footer_title">
Apps </div>
<ul>
<li>
Mobile:
<a href="https://play.google.com/store/apps/details?id=com.files.fm" target="_blank"> Android </a>
 |
<a href="https://apps.apple.com/in/app/files-fm-cloud-storage/id1636301796" target="_blank"> Apple iOS </a>
</li>
<li>
Sync:
<a href="/sync-share#setup">Windows | MacOS</a>
</li>

<li>
<a href="?convert-to-pdf">Convert to PDF</a> | <a href="?convert-to-mp4">Convert to MP4</a>
</li>
<li>
<a href="/webdav-info">Webdav network drive</a>
</li><li>
<a href="https://files.fm/library" target="_blank">Files.fm Library</a>
</li>
</ul>
</div>
<div class="footer_block">
<div class="footer_title">
Support </div>
<ul>
<li>
<a href="https://forum.files.fm/" target="_blank">User forum</a>
</li>
<li>
<a href="https://discord.gg/BCTJyNZABJ" target="_blank">Discord chat</a>
</li>
<li>
<a href="./contacts">Contact us</a>
</li>
<li>
<a href="about">About Files.fm</a>
</li>
<li>
<a href="./api.php">API for Developers</a>
</li>
</ul>
</div>
</div>
<p class="header_below">2008 - 2024 EU Files.fm cloud storage</p>
</div>

</div>
</div>
<div id="info_tooltip_global"></div>
<script>
    function CloseSuggestion(id) {
        
        if (id == 'suggest_lang') {
            $.get("includes/suggest_language.php", {sLang: 1});
        }
        else if (id == 'suggest_register'){
            $.get("includes/suggest_language.php", {sReg: 1});
        }
        
        document.getElementById(id).style.display='none';
    }
</script>
<script>
        
        $(window).bind("load", function() {
            $( "#register_from_ico" ).val( 0 );
            if	(window.location.hash == '#sign_up') {
                
                showCreateAccount();
            }
            else if	(window.location.hash == '#log_in') {
                
                showSignIn();
            }
            else if	(window.location.hash == '#forgot_password') {
                
                showForgotPassword();
            }
        });
    
    </script>
<div id="files_970x90_sticky_anchorad_responsive" data-google-query-id="CNiJhZOwg4kDFXxBpAQdZBEsxw" style="position: fixed; z-index: 2147483647; left: 50%; transform: translateX(-50%); width: 100%; background: rgba(255, 255, 255, 0); text-align: center; padding: 5px 0px; display: block; visibility: visible; bottom: 0px; border-top: 1px solid rgba(170, 170, 170, 0); transition: bottom 0.3s ease 0s;">

<div id="google_ads_iframe_/19238985/files_320x100_sticky_anchorad_mobile_0__container__" style="border: 0pt none;"><iframe id="google_ads_iframe_/19238985/files_320x100_sticky_anchorad_mobile_0" name="google_ads_iframe_/19238985/files_320x100_sticky_anchorad_mobile_0" title="3rd party ad content" width="320" height="100" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" aria-label="Advertisement" tabindex="0" allow="private-state-token-redemption" style="border: 0px; vertical-align: bottom; margin: auto; width: 320px; height: 100px;" data-load-complete="true" data-google-container-id="2"></iframe></div><div id="stpd_close" style="right: 0px; position: absolute; z-index: 2147483647; cursor: pointer; margin-bottom: -1px; width: 30px; height: 30px; border: 5px solid red; border-radius: 50%; background: rgb(255, 255, 255); top: -40px;"><!--?xml version='1.0' encoding='utf-8'?-->  <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="30px" height="30px" viewBox="0 0 512 512" enable-background="new 0 0 512 512" xml:space="preserve"> <g> <g fill="black"> <polygon points="405,136.798 375.202,107 256,226.202 136.798,107 107,136.798 226.202,256 107,375.202 136.798,405 256,285.798 375.202,405 405,375.202 285.798,256 "></polygon> </g> </g> </svg></div></div>
<script>
    window.addEventListener("stpdRendered", function (e) {
        var adName =  e.detail.name;
        var adWinner = e.detail.winner;
        var cleanEventName = adName.split('/')[2];

        if ( ( (cleanEventName == "files_970x90_sticky_anchorad_desktop") || (cleanEventName == "files_320x100_sticky_anchorad_mobile") ) && (adWinner != "passback")  ) {
            setTimeout(function () {
                var anchorParent = top.document.querySelector("#files_970x90_sticky_anchorad_responsive");
                var anchorIframe = top.document.querySelector("#files_970x90_sticky_anchorad_responsive > div > iframe");
                var anchorClose = top.document.querySelector("#stpd_close");
                if(window.innerWidth > 1000) {
                    anchorParent.style.cssText += "width: " + (anchorIframe.clientWidth + 100) + "px";
                    anchorClose.style.cssText += "width: 40px; height: 35px; padding-top: 5px; border-top: unset; border-left: unset; border: 5px solid red; border-radius: 50%; background: rgb(255 255 255);";
                } else {
                    anchorClose.style.cssText += "width: 30px; height: 30px; border-top: unset; border-left: unset; border: 5px solid red; border-radius: 50%; background: rgb(255 255 255); top: -40px;";
                }
            }, 50);
        }
    });
</script>
<div id="failiem_970x90_sticky_anchorad_responsive">
<script>
                    if ( typeof googletag != 'undefined' && typeof googletag.cmd != 'undefined' )
                    {
						googletag.cmd.push(function() { googletag.display('failiem_970x90_sticky_anchorad_responsive'); });
					}
				</script>
</div>
<script>
    window.addEventListener("stpdRendered", function (e) {
        var adName =  e.detail.name;
        var adWinner = e.detail.winner;
        var cleanEventName = adName.split('/')[2];

        if ( ( (cleanEventName == "failiem_970x90_sticky_anchorad_desktop") || (cleanEventName == "failiem_320x100_sticky_anchorad_mobile") ) && (adWinner != "passback")  ) {
            setTimeout(function () {
                var anchorParent = top.document.querySelector("#failiem_970x90_sticky_anchorad_responsive");
                var anchorIframe = top.document.querySelector("#failiem_970x90_sticky_anchorad_responsive > div > iframe");
                var anchorClose = top.document.querySelector("#stpd_close");
                if(window.innerWidth > 1000) {
                    anchorParent.style.cssText += "width: " + (anchorIframe.clientWidth + 100) + "px";
                    anchorClose.style.cssText += "width: 40px; height: 35px; padding-top: 5px; border-top: unset; border-left: unset; border: 5px solid red; border-radius: 50%; background: rgb(255 255 255);";
                } else {
                    anchorClose.style.cssText += "width: 30px; height: 30px; border-top: unset; border-left: unset; border: 5px solid red; border-radius: 50%; background: rgb(255 255 255); top: -40px;";
                }
            }, 50);
        }
    });
</script>
<div id="float_div">
<div id="float_div_close" onclick="gaev('Corner-Poster', 'Content-Closed', 'Click'); $(this).parent().remove(); document.cookie='Corner-Poster_closed=1; max-age=600'"></div>
<div class="float_div_content" id="float_div_content">
<div id="files_300x250_desktop_left_sticky" data-google-query-id="CMPe8JSwg4kDFW9JHQkdTtgYXw" style="display: none;">
<script>
              if ( typeof googletag != 'undefined' && typeof googletag.cmd != 'undefined' )
              {
                  googletag.cmd.push(function() { googletag.display('files_300x250_desktop_left_sticky'); });
              }
		  </script>
<div id="google_ads_iframe_/19238985/files_300x250_desktop_left_sticky_0__container__" style="border: 0pt none; width: 300px; height: 0px;"></div></div>
</div>
</div>
<script>
        window.addEventListener('stpdRendered', function(e) {
            setTimeout(function() {
                var adName = e.detail.name;
                var adWinner = e.detail.winner;
                var cleanEventName = adName.split('/')[2];

                if (cleanEventName == 'files_300x250_desktop_left_sticky' && adWinner != 'passback') {
                    var div = document.getElementById('float_div');
                    if (div != null) {
                        div.style.display = 'block';
                    }
                }
            });
        });
    </script>
<style>
	   @media(min-width: 100px) {
		  #float_div {
			width: 300px;
			height: 250px;
			position: fixed;
			display: none;
			background-color: rgba(0,0,0,0.5);
			z-index: 2147483648;
			bottom: 0;
			left: 0;
		  }
		  #float_div_close {
			position: absolute;
			font-size: 0;
			border: 2px solid white;
			border-radius: 20px;
			background: url(/images/popups/close-shadow3.svg) center no-repeat;
			cursor: pointer;
			z-index: 1;
			background-size: contain;
			height: 20px;
			width: 20px;
			padding: 0;
			margin: 0;
			background-color: rgba(0,0,0,0.3);
			right: 0;
		  }
	   }
	</style>
<script type="text/javascript">
		gaev('Corner-Poster', 'Content-Shown', 'true');

		$(document).ready( function() {

		  setTimeout(function() {
			  var overiFrame = -1;
			  $('iframe').hover( function() {
				  overiFrame = $(this).closest('.float_div_content').attr('id');
			  }, function() {
				  overiFrame = -1
			  });

			  $(window).blur( function() {
				  if( overiFrame != -1 ) {
					  gaev('Corner-Poster', 'Content-Opened', 'Click');  
					  $('.float_div').remove(); 
					  document.cookie='Corner-Poster_closed=1; max-age=600'
				  }
			  });
		  }, 1000);

		});
		
		// JV:remove banner box if there was a click on top of it
		document.addEventListener('DOMContentLoaded', function() {
			// Get the div by its ID
			var floatDiv = document.getElementById('float_div');
			
			// Attach a click event listener to the div
			floatDiv.addEventListener('click', function() {
				// Remove the div from the DOM when clicked
				// floatDiv.parentNode.removeChild(floatDiv);
				floatDiv.remove();
				
				document.cookie='Corner-Poster_closed=1; max-age=600';
			});
		});
 
	</script>

<div id="footer_bottom_floating_line" class="footer_bottom_floating_line__listphp  cookies_msg_active ">
<div id="footer_bottom_floating_line__cookies">
<div id="footer_bottom_floating_line__cookies__text">
By using this website, you agree to Files.fm <a href="https://files.fm/terms" target="_blank">terms</a> and <a href="https://files.fm/privacy-policy" target="_blank">cookie policy.</a> </div>
<button id="footer_bottom_floating_line__cookies__ok_btn" onclick="gaev('CookiePolicy', 'CloseButton', ''); $('#footer_bottom_floating_line__cookies').hide(); document.cookie='cookie_info_closed=true; max-age=31536000'; $( '#footer_bottom_floating_line' ).removeClass( 'cookies_msg_active' );">
OK </button>
</div>
</div>
<script src="/js/inputs.js?v=1715343640"></script>
<script src="/ts/chat/dist/index.js?v=1715343647"></script>
<script defer="" src="https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" integrity="sha512-ZpsOmlRQV6y907TI0dKBHq9Md29nnaEIPlkf84rnaERnq6zvWvPUqr2ft8M1aS28oN72PdrCzSjY4U6VaAw1EQ==" data-cf-beacon="{&quot;rayId&quot;:&quot;8d052d29de57215f&quot;,&quot;version&quot;:&quot;2024.8.0&quot;,&quot;serverTiming&quot;:{&quot;name&quot;:{&quot;cfExtPri&quot;:true,&quot;cfL4&quot;:true}},&quot;token&quot;:&quot;920d49a89d024a45b0d7a0081fbadb80&quot;,&quot;b&quot;:1}" crossorigin="anonymous"></script>


</div><iframe src="https://gum.criteo.com/syncframe?origin=publishertag&amp;topUrl=files.fm#{&quot;uid&quot;:{&quot;origin&quot;:0},&quot;lwid&quot;:{&quot;origin&quot;:0},&quot;bundle&quot;:{&quot;origin&quot;:0},&quot;optout&quot;:{&quot;value&quot;:false,&quot;origin&quot;:0},&quot;sid&quot;:{&quot;origin&quot;:0},&quot;tld&quot;:&quot;files.fm&quot;,&quot;topUrl&quot;:&quot;files.fm&quot;,&quot;version&quot;:144,&quot;cw&quot;:true,&quot;lsw&quot;:true,&quot;origin&quot;:&quot;publishertag&quot;,&quot;requestId&quot;:&quot;0.3126701858549543&quot;}" width="0" height="0" frameborder="0" title="Criteo GUM iframe" style="border-width: 0px; margin: 0px; display: none;"></iframe></body><iframe sandbox="allow-scripts allow-same-origin" id="61c8d28cd147152" frameborder="0" allowtransparency="true" marginheight="0" marginwidth="0" width="0" hspace="0" vspace="0" height="0" style="height:0px;width:0px;display:none;" scrolling="no" src="https://eb2.3lift.com/sync?gdpr=&amp;cmp_cs=&amp;us_privacy=&amp;redir=https%3A%2F%2Fprebid-stag.setupad.net%2Fsetuid%3Fbidder%3Dtriplelift%26gdpr%3D%26gdpr_consent%3D%26gpp%3D%26gpp_sid%3D%26f%3Db%26uid%3D%24UID">
    </iframe><iframe sandbox="allow-scripts allow-same-origin" id="1421d76547e644a" frameborder="0" allowtransparency="true" marginheight="0" marginwidth="0" width="0" hspace="0" vspace="0" height="0" style="height:0px;width:0px;display:none;" scrolling="no" src="https://adxbid.info/sync-all.html?gdpr=0&amp;gdpr_consent=&amp;us_privacy=">
    </iframe><iframe sandbox="allow-scripts allow-same-origin" id="1431af9902f60cce" frameborder="0" allowtransparency="true" marginheight="0" marginwidth="0" width="0" hspace="0" vspace="0" height="0" style="height:0px;width:0px;display:none;" scrolling="no" src="https://eb2.3lift.com/sync?">
    </iframe><iframe sandbox="allow-scripts allow-same-origin" id="1447c4592f794aac" frameborder="0" allowtransparency="true" marginheight="0" marginwidth="0" width="0" hspace="0" vspace="0" height="0" style="height:0px;width:0px;display:none;" scrolling="no" src="https://eb2.3lift.com/sync?">
    </iframe><iframe sandbox="allow-scripts allow-same-origin" id="145326256a9bcce6" frameborder="0" allowtransparency="true" marginheight="0" marginwidth="0" width="0" hspace="0" vspace="0" height="0" style="height:0px;width:0px;display:none;" scrolling="no" src="https://prebid.a-mo.net/isyn?gdpr_consent=&amp;gdpr=0&amp;us_privacy=&amp;gpp=&amp;gpp_sid=">
    </iframe></html>