/* Функции открытия сплывающих окон при просмотре картинок и какого-либо текста.   

## INetUa PopUp Window ## base core INetUa SiteManager 2.3
<!-- $Id: js_popup.js,v 1.20 2004/12/21 16:35:00 inetua Exp $ -->
*/

// Задания:
// 1. в функции открытия файлов доработать метод печати содержимого фрейма в Опере

function popUpIMG(url, name, width, height, scroller){
   width = width + 0;
   height = height + 25;
   var outStr = 'height=' + height + ',width=' + width;
   if (scroller != 'true') {
   outStr = outStr + ',menubar=no,toolbar=no,location=no,directories=no,status=no,resizable=no,';
       }
       else {
       outStr = outStr + ',menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no';
       }
         imageWindow = window.open(url, '', outStr);
         imageWindow.document.open();
         imageWindow.document.write("<html><head><title>© 2004 Компания Горизонт - ");
         imageWindow.document.write(name);
         imageWindow.document.write("</title><link rel='stylesheet' type='text/css' href='inc/css_pages.css'>");
         imageWindow.document.write("<script language='javascript'>");
         imageWindow.document.write("function vision() {");
         imageWindow.document.write("if(document.all) { document.all.loading.style.visibility='hidden';");
         imageWindow.document.write("} else { document.layers.loading.visibility='hide'; }");
         imageWindow.document.write("}</script>");
         imageWindow.document.write("</head>");
         imageWindow.document.write("<style type='text/css'><!--body {margin:0;}//--></style>");
         imageWindow.document.write("<body onLoad='vision()'; leftmargin='0' topmargin='0' marginwidth='0' marginheight='0' bgcolor='#ffffff'>");
         imageWindow.document.write("<div id='loading' style='position:absolute; left:0; top:0; width:100%; height:100%;'><table width='100%' height='100%' bgcolor='#e6e6e6'><tr><td align='center' valign='middle'><img src='img/loading.gif' alt='' width=123 height=8 border=0></td></tr></table></div>");
         imageWindow.document.write("<table cellpadding='0' cellspacing='0' width='100%' height='25'>");
         imageWindow.document.write("<tr><td align=left height=24 bgcolor='#e6e6e6'><img src='img/gallery.gif' width=25 height=22 border=0></td><td align=right height=24 bgcolor='#e6e6e6'><img src='img/icon-x.gif' width=12 height=12 hspace='3' align='absbottom' border=0><a class=\"Links\" href='javascript:self.close();'>Закрыть</a>&nbsp;</td></tr><tr><td colspan=2 bgcolor='#979797' height=1><img src='img/dot_w.gif' width=1 height=1 border=0></td></tr></table>");
         imageWindow.document.write("<table cellpadding='0' cellspacing='0' width='100%'><tr><td align='center'><img src='");
         imageWindow.document.write(url);
         imageWindow.document.write("' alt='");
         imageWindow.document.write(name);
         imageWindow.document.write("'></td></tr></table>");
         imageWindow.document.write("</body></html>");
         if (parseInt(navigator.appVersion) >= 4) { imageWindow.focus(); }
         imageWindow.document.close();
}

function popUpFile(url, name, width, height, scroller){
   width = width + 0;
   height = height + 25;
   var outStr = 'height=' + height + ',width=' + width;
   if (scroller != 'true') {
   outStr = outStr + ',menubar=no,toolbar=no,location=no,directories=no,status=no,resizable=no,';
       }
       else {
       outStr = outStr + ',menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no';
       }
         fileWindow = window.open(url, '', outStr);
         fileWindow.document.open();
         fileWindow.document.write("<html><head>\n<title>© 2004 Компания Горизонт - ");
         fileWindow.document.write(name);
         fileWindow.document.write("</title>\n<link rel='stylesheet' type='text/css' href='inc/css_pages.css'>\n");
         fileWindow.document.write("<style type='text/css'><!--body {margin:0;}//--></style>\n"); 
         fileWindow.document.write("<script language='javascript'>\n");
         fileWindow.document.write(" function vision(){\n");
         fileWindow.document.write("   if(document.all){\n     document.all.loading.style.visibility='hidden';\n");
         fileWindow.document.write("   }else{\n     document.layers.loading.visibility='hide';}\n");
         fileWindow.document.write(" }\n</script>\n");
         fileWindow.document.write("</head>\n");      
         fileWindow.document.write("<body onLoad='vision()'; leftmargin='0' topmargin='0' marginwidth='0' marginheight='0' bgcolor='#ffffff'>\n");
         fileWindow.document.write("<div id='loading' style='position:absolute; left:0; top:0; width:100%; height:100%;'><table width='100%' height='100%' bgcolor='#e6e6e6'><tr><td align='center' valign='middle'><img src='img/loading.gif' alt='' width=123 height=8 border=0></td></tr></table></div>\n");
         fileWindow.document.write("<table border='0' cellpadding='0' cellspacing='0' width='100%' height='25' bgcolor='#e6e6e6'>\n <tr>\n");
         fileWindow.document.write("<td width='22' height='24'><a href='javascript:window.bodypage.print();'><img align='middle' src='admin/images/print.gif' width=22 height=22 hspace='1' border=0></a></td><td align='left' width='140' nowrap><a class='link' href='javascript:window.bodypage.print();'>Распечатать страницу</a></td>\n");
         fileWindow.document.write("<th align='center' width='60%'><h3>");
         fileWindow.document.write(name);
         fileWindow.document.write("</h3</th>\n");         
         fileWindow.document.write("<td width='15' height='24'><a href='javascript:self.close();'><img align='middle' src='img/icon-x.gif' width=15 height=15 hspace='1' border=0></a></td><td align='left' width='40'><a class='link' href='javascript:self.close();'>Закрыть</a></td></tr>\n");
         fileWindow.document.write("<tr><td colspan='5' bgcolor='#979797' height='1'></td></tr></table>\n");
         fileWindow.document.write("<table cellpadding='0' cellspacing='0' width='100%'><tr><td align='center'>\n<iframe name='bodypage' src='");
         fileWindow.document.write(url+"' width='"+width+"' height='"+height); 
         fileWindow.document.write("' frameborder='0'></iframe>\n</td></tr></table>\n");
         fileWindow.document.write("</body></html>");
         if (parseInt(navigator.appVersion) >= 4) { fileWindow.focus(); }
         fileWindow.document.close();
}

// пример написания ссылки  с картинкой <a href="javascript:popUpIMG('img/partners/jaluzi/50_2.jpg','Vision',600,544,'')"> <img src="" width="" height="" alt="" border=0> </a>
// пример написания ссылки на файл <a href="javascript:popUpFile('img/partners/jaluzi/50_2.jpg','Vision',600,544,'')"> bla bla </a>