function pop_up_source_Onload(id){
            if(document.getElementById('body_'+id) && document.getElementById('frame_source_'+id)){
                if (typeof(IFrame) != "object") { var IFrame = document.getElementById('frame_source_'+id); }
                var doc;
                if( IFrame.contentDocument )
                    // For NS6
                    doc = IFrame.contentDocument; 
                else if( IFrame.contentWindow ) 
                    // For IE5.5 and IE6
                    doc = IFrame.contentWindow.document;
                else if( IFrame.document )
                    // For IE5
                    doc = IFrame.document;
                else //other browser
                    doc = IFrame.document;
             
                if(doc.getElementById(id)){
                    frame_src = doc.getElementById(id).innerHTML;
                    document.getElementById('body_'+id).innerHTML = frame_src;
                }else{
                    document.getElementById('body_'+id).innerHTML = "Не удалость получить контент iframe";
                }
            }else{
                if(document.getElementById('body_'+id)){
                    document.getElementById('body_'+id).innerHTML = "Ошибка на странице! Ваш браузер не поддерживает iframe!";
                } 
            }    
        }
        
        function PopUpWrite(id, message){
            if(document.getElementById(id)){
                if(document.getElementById(id).title) {
                    window_name =  document.getElementById(id).title;
                } else { 
                    window_name = '';
                }
                if(document.getElementById(id).style.width){ 
                    width = document.getElementById(id).style.width; 
                } else { 
                    width = '500px';
                }
                if(document.getElementById(id).style.height) { 
                    height = document.getElementById(id).style.height; 
                } else { 
                    height = '500px';
                }
                if(document.getElementById(id).style.height) { 
                    style = 'height:'+height+';overflow:auto;'; 
                } else { 
                    style = '';
                }
                pop_up_write = '<table class="popup" style="background-color: #fff;border: 1px solid #A4A4A4;" width="'+width+'">';
                pop_up_write += '<tr class="popup_header" style="background-color: #e5dec6;">'+
                                    '<td id="td1" class="setmoveable" style="cursor:move;">'+
                                        '&nbsp<b>'+window_name+'</b>'+
                                    '</td>'+
                                    '<td class="setmoveable" width="1%" align="right" style="cursor:move;">'+
                                        '<img src="/images/icon_close.gif" onclick="PopUpClose(\''+id+'\')" style="cursor:default">'+
                                    '</td>'+
                                 '</tr>';
                                 
                if(message!='') {
                    pop_up_write += '<tr><td colspan="2">'+message+'</td></tr>';
                }
                pop_up_write += '<tr class="popup_footer" style="background-color: #e5dec6;">'+
                                       '<td colspan="2" class="setmoveable" align="center">'+
                                           '<a href="javascript:PopUpClose(\''+id+'\');">'+
                                               '<b>закрыть</b>'+
                                           '</a>'+
                                       '</td>'+
                                 '</tr>';
                pop_up_write += '</table>';
                document.getElementById(id).innerHTML = pop_up_write;
            }
        }
        
        function PopUpCentering(objID)
        {
            pos = new Array(2);
            pos = ScrollPositionXY();
            var obj = document.getElementById(objID);
            try{
                tx = parseInt(obj.style.left+0,10);
                ty = parseInt(obj.style.top+0,10);
            
                obj.style.left =  tx + 'px';
                if(pos[1]==0) shift=ty;
                else shift = 10;
                obj.style.top = shift+pos[1]+ 'px';
            }catch(E){
                alert(E);
            }   
        }
        
        function ScrollPositionXY() {
          var scrOfX = 0, scrOfY = 0;
          if( typeof( window.pageYOffset ) == 'number' ) {
            //Netscape compliant
            scrOfY = window.pageYOffset;
            scrOfX = window.pageXOffset;
          } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
            //DOM compliant
            scrOfY = document.body.scrollTop;
            scrOfX = document.body.scrollLeft;
          } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
            //IE6 standards compliant mode
            scrOfY = document.documentElement.scrollTop;
            scrOfX = document.documentElement.scrollLeft;
          }
          return [ scrOfX, scrOfY ];
        }
        
        function PopUpClose(id){
            if(document.getElementById(id)){
                if(document.getElementById('frame_source_'+id)) document.getElementById('frame_source_'+id).src='';
                if(document.getElementById('body_'+id)) document.getElementById('body_'+id).innerHTML = '';
                document.getElementById(id).innerHTML = '';
                document.getElementById(id).style.display='none'; 
            }
        }
