//<script type="text/javascript">

var int_ffm_modal_height_utaxbx56 = 200;
var int_ffm_modal_width_utaxbx56 = 500;

function FilesFmEmbedUploadInit_utaxbx56 ()
{

    /*** POPUP ***/
    var objPopupWrapperStyle = {
        display: 'none',
    	position: 'absolute',
    	zIndex: '100000',
    	top: 0,
    	left: 0,
    	width: '532px',
    	height: '274px',
        backgroundColor: 'transparent',
        border: 'none',
        borderRadius: 0,
        boxShadow: 'none',
        overflow: 'hidden'
    };
    
    var objPopupBodyStyle = {
        border: 0,
    	width: '500px',
    	height: '200px',
    	margin: '0 15px',
        color: '#555',
        overflow: 'hidden',
        backgroundColor: '#fff'
            };
    
    var objPopupTitleStyle = {
        padding: 0,
        margin: 0,
        backgroundColor: 'transparent',
        border: 'none',
        height: '14px'
    }
    var objPopupTitleCloseStyle = {
        position: 'absolute',
        fontSize: '20px',
        border: 0,
        background: 'none',
        cursor: 'pointer' ,
        opacity: 0.5 ,
        zIndex: 1 ,
                top: '15px',
        right: '14px',
        color: '#636363',
            }
    
    var objOverlyStyle = {
        display: 'none',
    	position: 'fixed',
    	zIndex: '99999',
    	top: 0,
    	left: 0,
    	right: 0,
    	bottom: 0,
    	backgroundColor: '#000' ,
    	filter: 'alpha(opacity=75)',
    	'-moz-opacity': '0.75',
    	opacity: '0.75'
    }

    var objIframeStyle = {
        border: 0,
    	width: '500px',
    	height: '200px',
    	margin: 0,
    	'max-width': 'none !important'
    }
    
    var domPopupWrapper = document.createElement('div');
    domPopupWrapper.id = 'filefm_upload_popup_wrapper_utaxbx56';
    domPopupWrapper.className = 'filefm_upload_popup_wrapper';
    for (strProp in objPopupWrapperStyle)
        domPopupWrapper.style[strProp] = objPopupWrapperStyle[strProp];

    var domPopupTitle = document.createElement('div');
    domPopupTitle.id = 'filefm_upload_popup_title_utaxbx56';
    domPopupTitle.className = 'filefm_upload_popup_title';
    for (strProp in objPopupTitleStyle)
        domPopupTitle.style[strProp] = objPopupTitleStyle[strProp];
        
        
    var domPopupCloseButton = document.createElement('button');
    domPopupCloseButton.type='button';
    domPopupCloseButton.onclick = function(){
        FilesFmEmbedUploadHide_utaxbx56 ();
    };
    domPopupCloseButton.className = 'fa fa-times-circle';
    for (strProp in objPopupTitleCloseStyle)
        domPopupCloseButton.style[strProp] = objPopupTitleCloseStyle[strProp];

    domPopupTitle.appendChild(domPopupCloseButton);
    domPopupWrapper.appendChild(domPopupTitle);
    
    var domPopupBody = document.createElement('div');
    domPopupBody.id = 'filefm_upload_popup_body_utaxbx56';
    domPopupBody.className = 'filefm_upload_popup_body';
    for (strProp in objPopupBodyStyle)
        domPopupBody.style[strProp] = objPopupBodyStyle[strProp];
        
    var domBodyIframe = document.createElement('iframe');
    domBodyIframe.id='filefm_upload_popup_iframe_utaxbx56';
    domBodyIframe.frameborder='0';
    var strStyleText = '';
    for (strProp in objIframeStyle)
    {
    	strStyleText += strProp + ':' + objIframeStyle[strProp] + ';';
	}
    strStyleText += 'position: absolute; top: 0; left: 0;';
	domBodyIframe.style.cssText = strStyleText;

	var domBodyIframeLoading = document.createElement('div');
	domBodyIframeLoading.id='filefm_upload_popup_iframe_loading_utaxbx56';
	domBodyIframeLoading.style.cssText = 'width: 498px; height: 198px; margin: 0; border: 1px solid #B5B5B5; text-align: center; position: absolute; top: 0; left: 0; background: white;';

    var domBodyIframeLoadingImage = document.createElement('img');
    domBodyIframeLoadingImage.src = '//files.fm:443/web_module/js/v1/assets/images/spinner.gif';
    domBodyIframeLoading.appendChild(domBodyIframeLoadingImage);

    var domBodyIframeWrapper = document.createElement('div');
    domBodyIframeWrapper.id='filefm_upload_popup_iframe_wrapper_utaxbx56';
    domBodyIframeWrapper.style.cssText = 'width: 500px; height: 200px; margin: 0; position: relative; display: inline-block;';

    domBodyIframeWrapper.appendChild(domBodyIframeLoading);
    domBodyIframeWrapper.appendChild(domBodyIframe);

    domPopupBody.appendChild(domBodyIframeWrapper);
    
    domPopupWrapper.appendChild(domPopupBody);
    
    /** Overly **/
    
    var domOverly = document.createElement('div');
    domOverly.id = 'filefm_upload_overly_utaxbx56';
    domOverly.className = 'filefm_upload_overly';
    domOverly.onclick = function(){
        FilesFmEmbedUploadHide_utaxbx56 ();
    };
    for (strProp in objOverlyStyle)
        domOverly.style[strProp] = objOverlyStyle[strProp];
    
    document.body.appendChild(domOverly);
    document.body.appendChild(domPopupWrapper);
    
    /****/
    /******/
    
        /*** Button ***/
    
        var objFilesFmUploadButtonStyle = {
		height: '34px',
        display: 'inline-block',
        padding: '6px 20px',
        background: '#3995c4',
        color: '#fff',
        fontSize: '16px',
        fontWeight: 'normal',
        border: '2px solid #3995c4',
        cursor: 'pointer',
        textShadow: 'none',
        borderRadius: '20px',
        margin: '0 30px 0 30px',
        textTransform: 'none'
    };
    
    var objFilesFmUploadButtonImageStyle = {
        float: 'left',
        width: '24px',
        marginTop: '0',
        marginRight: '15px'
    }
    var objFilesFmUploadButtonSpanStyle = {
        display: 'inline-block',
        padding: '0'
    }
    
    var domUploadButton = document.createElement('button');
    domUploadButton.id = 'filefm_upload_button_utaxbx56';
    domUploadButton.className = 'filefm_upload_button';
    domUploadButton.onclick = function(){
        FilesFmEmbedUploadShow_utaxbx56 ();
    }; 
    
    for (strProp in objFilesFmUploadButtonStyle)
        domUploadButton.style[strProp] = objFilesFmUploadButtonStyle[strProp];
    
    var domUploadButtonImage = document.createElement('img');
    for (strProp in objFilesFmUploadButtonImageStyle)
        domUploadButtonImage.style[strProp] = objFilesFmUploadButtonImageStyle[strProp];
    
    domUploadButtonImage.src = '//files.fm:443/web_module/js/v1/assets/images/upload_to_cloud.svg';
    domUploadButton.appendChild(domUploadButtonImage);
    
    
    var domUploadButtonSpan = document.createElement('span');
    for (strProp in objFilesFmUploadButtonSpanStyle)
        domUploadButtonSpan.style[strProp] = objFilesFmUploadButtonSpanStyle[strProp];
    domUploadButtonSpan.appendChild(document.createTextNode("File upload"));
    domUploadButton.appendChild(domUploadButtonSpan);
    
        var domScriptNode = document.getElementById('files_fm_upload_script_tag');
    domScriptNode.parentNode.insertBefore(domUploadButton, domScriptNode);
            /*******/
    
    /***/

    
    if (window.addEventListener) {
    	window.addEventListener('resize', FilesFmEmbedUploadPopupPosition_utaxbx56, false);
    	window.addEventListener('keydown', FilesFmEmbedUploadKeyDown, false);
    } else {
    	window.attachEvent('onresize', FilesFmEmbedUploadPopupPosition_utaxbx56);
    	window.attachEvent('onkeydown', FilesFmEmbedUploadKeyDown);
    }
    /***/
    
   if (window.location.hash.toLowerCase() == '#filebox') {
   	
	    FilesFmEmbedUploadShow_utaxbx56();
   }
    
}

var FilesFmEmbedUploadKeyDown = function (e){
    e = e || window.event;
    var keyCode = e.which || e.keyCode;
    if (keyCode === 27) {
        FilesFmEmbedUploadHide_utaxbx56();
    }
};
    
function FilesFmEmbedUploadExtendObject (to, from) {
    for (var p in from) {
      if (from.hasOwnProperty(p)) {
        to[p] = from[p];
      }
    }
    return to;
};

function FilesFmEmbedUploadPopupPosition_utaxbx56 () {
    var domPopupWrapper = document.getElementById('filefm_upload_popup_wrapper_utaxbx56');
	var int_win_width = window.innerWidth || document.documentElement.clientWidth;
	var int_win_height = window.innerHeight || document.documentElement.clientHeight
	var int_scroll_x = window.pageXOffset || document.documentElement.scrollLeft;
	var int_scroll_y = window.pageYOffset || document.documentElement.scrollTop;
	
    var top = int_scroll_y + Math.max(0, (int_win_height - int_ffm_modal_height_utaxbx56 - 50 ) / 2);
    var left = int_scroll_x + Math.max(0, (int_win_width - int_ffm_modal_width_utaxbx56 - 32 ) / 2);
	
    FilesFmEmbedUploadExtendObject(domPopupWrapper.style, {
        top: top + 'px',
        left: left + 'px'
    });
}

function FilesFmEmbedUploadShow_utaxbx56 () 
{
    FilesFmEmbedUploadPopupPosition_utaxbx56();

	var strIframeSrc = 'https://files.fm:443/upload_iframe.php?uid=15873376&uid_hash=a19a49be368c5f5544b21c31dd10f1ee';
    
    document.getElementById('filefm_upload_popup_iframe_utaxbx56').src = strIframeSrc;
    
    document.getElementById('filefm_upload_overly_utaxbx56').style.display = 'block';
    document.getElementById('filefm_upload_popup_wrapper_utaxbx56').style.display = 'block';
}
function FilesFmEmbedUploadHide_utaxbx56 () 
{
    document.getElementById('filefm_upload_popup_iframe_utaxbx56').src = '';
    document.getElementById('filefm_upload_overly_utaxbx56').style.display = 'none';
    document.getElementById('filefm_upload_popup_wrapper_utaxbx56').style.display = 'none';
}


var objFilesFmEmbedUploadData_utaxbx56 = null;

function FilesFmEmbedUploadChangeHash_utaxbx56 ( objFilesFmEmbedUploadData )
{
	objFilesFmEmbedUploadData_utaxbx56 = objFilesFmEmbedUploadData;
}

FilesFmEmbedUploadInit_utaxbx56();
