Файл: alinar.ru/JS/windows_v01.js
Строк: 106
<?php
// JavaScript Document
function message_window (type,header,message,buttons,address) {
d('popup').style.display = '';
d('back').style.width = '100%';
d('back').style.height = document.body.scrollHeight+'px';
d('popup').style.width = '100%';
d('popup').style.height = '100%';
d('back').style.display = '';
d('popup').style.top = document.body.scrollTop;
if (type=='alert') { font = '#AA0000' }
else if (type=='success') { font = '#009900' }
else if (type=='confirm') { font = '#333333' }
buttons = buttons.split('|');
buts = '';
for (a=0,b=buttons.length;a<b;a++){
if (buttons[a]=='accept') {
addr = address.split('|');
if (addr[0]=='click') {buts += '<input type="button" style="width:100px;" value="применить" onclick="'+addr[1]+'"> '}
else if (addr[0]=='href') { buts += '<input type="button" style="width:100px;" value="применить" onclick="document.location=''+addr[1]+''"> ' }
}
else if (buttons[a]=='cancel') { buts += '<input type="button" style="width:100px;" value="отмена" onclick="close_window();"> ' }
else if (buttons[a]=='ok') {
addr = address.split('|');
if (addr.length>1 && addr[0]=='click') { buts += '<input type="button" style="width:100px;" value="ок" onclick="'+addr[0]+'"> ' }
else { buts += '<input type="button" value="ок" style="width:100px;" onclick="close_window();"> ' }
}
}
document.getElementById('popup').innerHTML = '<table width=100% height=100% border=0><tr><td align=center valign=middle><div style="width:300px; background-color:#EEEEEE; border:1px solid #AAAAAA; margin:5px;"><div style="font-size:14px; text-align:center; font-weight:900; color:'+font+';">'+header+'</div><div style="font-size:12px; padding-top:5px; padding-bottom:5px;" id="popup_inner_content">'+message+'</div><div style="text-align:center;">'+buts+'</div></div></td></tr></table>';
}
function close_window () {
document.getElementById('popup').style.display = 'none';
document.getElementById('back').style.display = 'none';
}
function init_timer (time) {
info = time.split('|');
window.timer = parseInt(info[0]);
message_window ('success','Выполняется действие',info[1]+'<div id="internal_timer"></div>','ok','click|javascript:void()');
work_timer ();
}
function work_timer () {
if (window.timer>0) {
document.getElementById("internal_timer").innerHTML = '<center>...еще '+window.timer+' сек...</center>';
window.timer = window.timer - 1;
setTimeout("work_timer ("+window.timer+");",1000);
}
else {
close_window();
}
}
?>