Your IP : 172.28.240.42


Current Path : /var/www/html/clients/rebirth.e-nk.ru/jscripts/
Upload File :
Current File : /var/www/html/clients/rebirth.e-nk.ru/jscripts/ips_attach.js

var ipsattach=new ips_attach();function ips_attach(){this.iframe_id='ips--iframe-obj-attach';this.iframe_obj=null;this.iframe_init_url='';this.iframe_remove_url='';this.iframe_add_to_div='ips-attach-div-iframe';this.iframe_add_to_div_obj=null;this.iframe_parent_div='ips-attach-div-parent';this.iframe_parent_div_obj=null;this.status_div='ips-attach-div-status';this.status_div_obj=null;this.dropdown_text='ips-attach-menu-text';this.dropdown_text_obj=null;this.iframe_height=300;this.iframe_classname='attach-iframe';this.message_div_id='ips-attach-message';this.message_div_obj=null;this.message_span_id='ips-attach-message-span';this.message_span_obj=null;this.status_msg='';this.status_is_error='';this.current_items=new Array();this.current_item_menu='ips-attach-menu';this.current_item_menu_obj=null;this.images_url=null;this.lang=new Array();this.css_menu_row='attach-menu-row';this.css_menu_row_over='attach-menu-row-over';this.show_attach_menu=1;this.onload_function='';this.has_upload_pending=0;this.init=function(){this.iframe_add_to_div_obj=document.getElementById(this.iframe_add_to_div);this.iframe_parent_div_obj=document.getElementById(this.iframe_parent_div);this.message_div_obj=document.getElementById(this.message_div_id);this.message_span_obj=document.getElementById(this.message_span_id);this.status_div_obj=document.getElementById(this.status_div);this.dropdown_text_obj=document.getElementById(this.dropdown_text);if(this.show_attach_menu){this.current_item_menu_obj=document.getElementById(this.current_item_menu);ipsmenu.register(this.current_item_menu);this.current_item_menu_obj._onclick=this.current_item_menu_obj.onclick;this.current_item_menu_obj.onmouseover=this.current_item_menu_obj.onmouseout=this.current_item_menu_obj.onclick=this.current_menu_mouseover;ipsmenu.menu_registered[this.current_item_menu]._open=ipsmenu.menu_registered[this.current_item_menu].open;ipsmenu.menu_registered[this.current_item_menu].open=this.current_menu_button_show;}};this.init_current_menu=function(obj){var menu='';try{menu=document.getElementById(ipsattach.current_item_menu+'_menu');menu.innerHTML='';}catch(error){menu=document.createElement('div');}var _items=0;menu.id=ipsattach.current_item_menu+'_menu';menu.className='attach-popupmenu';menu.style.display='none';menu.style.cursor='default';menu.style.padding='3px';menu.style.width='auto';menu.style.overflow='auto';for(var i in ipsattach.current_items){var option=document.createElement('div');option.innerHTML=ipsattach.current_items[i];option.style.width=ipsattach.current_item_menu_obj.style.width;option.className='attach-menu-row';option.onmouseover=option.onmouseout=ipsattach.menu_onmouse_event;menu.appendChild(option);_items++;}if(!_items){var option=document.createElement('div');option.innerHTML=ipsattach.lang['no_items'];option.style.width=ipsattach.current_item_menu_obj.style.width;option.className='attach-menu-row';option.onmouseover=option.onmouseout=ipsattach.menu_onmouse_event;menu.appendChild(option);}ipsattach.set_attach_count_status(_items);ipsattach.iframe_parent_div_obj.appendChild(menu);ipsclass.set_unselectable(menu);};this.set_attach_count_status=function(_items){if(!ipsattach.show_attach_menu){return;}if(typeof(_items)=='undefined'){_items=0;for(var i in ipsattach.current_items){_items++;}}try{ipsattach.dropdown_text_obj.innerHTML=" ("+_items+")";}catch(error){}};this.add_current_item=function(attach_id,attach_name,attach_size,attach_image){if(attach_name.length>22){var _ext=attach_name.replace( /^.*\.(\S+?)$/,"$1");var _main=attach_name.replace( /^(.*)\.\S+?$/,"$1");var _a=_main.substr(0,8);var _b=_main.substr(_main.length-8,_main.length);attach_name=_a+'...'+_b+'.'+_ext;}var html='';html+='<img onclick="ipsattach.add_attachment_into_editor('+attach_id+', \''+attach_name+'\')" src="'+this.images_url+'/folder_attach_images/attach_add.png" title="'+this.lang['attach_insert']+'" style="vertical-align:middle" border="0" alt="" /> &nbsp;';html+='<img onclick="ipsattach.remove_attachment('+attach_id+');" src="'+this.images_url+'/folder_attach_images/attach_remove.png" title="'+this.lang['attach_remove']+': ['+attach_id+']'+'" style="vertical-align:middle" border="0" alt="" />&nbsp;';html+='<img src="'+this.images_url+'/'+attach_image+'" style="vertical-align:middle" border="0" alt="" /> &nbsp;';html+='<span style="font-weight:bold" onclick="ipsattach.add_attachment_into_editor('+attach_id+', \''+attach_name+'\')">'+attach_name+'</span>';html+=' <span class="desctext">&nbsp;('+attach_size+')</span>';this.current_items[this.current_items.length]=html;};this.add_attachment_into_editor=function(id,name){var tag="[attachment="+id+":"+name+"]";ipsclass.add_editor_contents(tag);};this.remove_attachment=function(id){menu_action_close();if(confirm(ipsattach.lang['remove_warn']+' ['+id+']')){ipsattach.iframe_obj.src=ipsattach.iframe_remove_url+"&attach_id="+id;ipsattach.iframe_on_un_load('attach_removal');}};this.show_attach_box=function(){var iheight=parseInt(this.iframe_add_to_div_obj.style.height);var iwidth=this.iframe_add_to_div_obj.style.width;if(!this.iframe_obj){this.iframe_obj=document.createElement('IFRAME');this.iframe_obj.src=this.iframe_init_url;this.iframe_obj.id=this.iframe_id;this.iframe_obj.name=this.iframe_id;this.iframe_obj.scrolling='no';this.iframe_obj.frameBorder='no';this.iframe_obj.border='0';this.iframe_obj.className=this.iframe_classname;this.iframe_obj.style.width=iwidth?iwidth:'100%';this.iframe_obj.style.height=iheight?iheight-5+'px':this.iframe_height+'px';this.iframe_obj.style.overflow='hidden';this.iframe_obj.style.display='';this.iframe_obj.msg_open=1;this.iframe_obj.iframe_loaded=0;this.iframe_obj.iframe_init=0;this.iframe_add_to_div_obj.appendChild(this.iframe_obj);if(is_ie){this.iframe_obj.style.backgroundColor='transparent';this.iframe_obj.allowTransparency=true;this.iframe_obj.onreadystatechange=this.iframe_on_load_ie;}else{this.iframe_obj.onload=this.iframe_onload;}if(is_safari){this.iframe_parent_div_obj.style.display='';}else{this.iframe_parent_div_obj.style.display='none';}}if(typeof this.message_div_obj!='undefined'){this.message_div_obj.style.width=typeof this.iframe_parent_div_obj.style.width!='undefined'?this.iframe_parent_div_obj.style.width:'100%';this.message_div_obj.style.height=this.iframe_parent_div_obj.offsetHeight?this.iframe_parent_div_obj.offsetHeight:'120px';this.message_div_obj.style.position='relative';this.message_div_obj.style.display='none';}this.show_message(this.lang['init_progress']);};this.init_status_bar=function(){var _html='';if(typeof ipsattach.status_div_obj!='undefined'){try{ipsattach.status_msg=ipsattach.lang[ipsattach.status_msg];}catch(error){}if(ipsattach.status_msg){if(ipsattach.status_is_error){_html+="<img src='"+this.images_url+"/folder_attach_images/attach_error.png' border='0' style='vertical-align:middle' alt='"+ipb_global_lang['general_error']+"' />&nbsp;"+ipsattach.status_msg;}else{_html+="<img src='"+this.images_url+"/folder_attach_images/attach_ok.png' border='0' style='vertical-align:middle' alt='"+ipb_global_lang['general_OK']+"' />&nbsp;"+ipsattach.status_msg;}}ipsattach.status_div_obj.innerHTML=_html;}ipsattach.has_upload_pending=0;};this.iframe_on_un_load=function(msg){msg=typeof(msg)!='undefined'?ipsattach.lang[msg]:ipsattach.lang['uploading_file'];if(this.iframe_obj.iframe_loaded){this.iframe_obj.iframe_loaded=0;this.iframe_obj.msg_open=1;ipsattach.show_message(msg);}};this.iframe_onload=function(e){if(!this.iframe_init){this.iframe_init=1;this.iframe_loaded=1;if(this.msg_open){this.msg_open=0;ipsattach.hide_message();}window.frames[this.id].document.onmousedown=menu_action_close;}else{this.iframe_loaded=1;window.frames[this.id].document.onmousedown=menu_action_close;if(this.msg_open){this.msg_open=0;ipsattach.hide_message();}if(ipsattach.onload_function){ipsattach.onload_function();}}ipsattach.init_status_bar();ipsattach.set_attach_count_status();};this.iframe_on_load_ie=function(e){if(this.readyState=='complete'){if(!this.iframe_init){this.iframe_init=1;this.iframe_loaded=1;window.frames[this.id].document.onmousedown=menu_action_close;if(this.msg_open){this.msg_open=0;ipsattach.hide_message();}}else{this.iframe_loaded=1;window.frames[this.id].document.onmousedown=menu_action_close;if(this.msg_open){this.msg_open=0;ipsattach.hide_message();}}window.frames[this.id].document.getElementsByTagName('html')[0].style.background='transparent';if(ipsattach.onload_function){ipsattach.onload_function();}ipsattach.init_status_bar();ipsattach.set_attach_count_status();}};this.show_message=function(msg){if(is_safari){return;}if(typeof ipsattach.message_div_obj!='undefined'){ipsattach.message_div_obj.style.display='';ipsattach.message_span_obj.innerHTML=msg;ipsattach.iframe_parent_div_obj.style.display='none';}};this.hide_message=function(){if(is_safari){return;}if(typeof ipsattach.message_div_obj!='undefined'){ipsattach.message_div_obj.style.display='none';ipsattach.message_span_obj.innerHTML='';ipsattach.iframe_parent_div_obj.style.display='';}};this.current_menu_mouseover=function(e){e=ipsclass.cancel_bubble(e,true);if(e.type=='click'){this._onclick(e);}};this.current_menu_button_show=function(obj){ipsattach.init_current_menu(obj);this._open(obj);};this.menu_onmouse_event=function(e){e=ipsclass.cancel_bubble(e,true);if(e.type=='mouseover'){this.className=ipsattach.css_menu_row_over;}else if(e.type=='mouseout'){this.className=ipsattach.css_menu_row;}};}