[1575] | 1 | var progressBar; |
---|
| 2 | |
---|
| 3 | if (document.all) |
---|
| 4 | { |
---|
| 5 | navigator.userAgent.toLowerCase().indexOf('msie 5') != -1 ? is_ie5 = true : is_ie5 = false; |
---|
| 6 | is_ie = true; |
---|
| 7 | is_moz1_6 = false; |
---|
| 8 | is_mozilla = false; |
---|
| 9 | is_ns4 = false; |
---|
| 10 | } |
---|
| 11 | else if (document.getElementById) |
---|
| 12 | { |
---|
| 13 | navigator.userAgent.toLowerCase().match('mozilla.*rv[:]1\.6.*gecko') ? is_moz1_6 = true : is_moz1_6 = false; |
---|
| 14 | is_ie = false; |
---|
| 15 | is_ie5 = false; |
---|
| 16 | is_mozilla = true; |
---|
| 17 | is_ns4 = false; |
---|
| 18 | } |
---|
| 19 | else if (document.layers) |
---|
| 20 | { |
---|
| 21 | is_ie = false; |
---|
| 22 | is_ie5 = false |
---|
| 23 | is_moz1_6 = false; |
---|
| 24 | is_mozilla = false; |
---|
| 25 | is_ns4 = true; |
---|
| 26 | } |
---|
| 27 | |
---|
| 28 | /****************************************** Connector Class *************************************************/ |
---|
| 29 | // Constructor |
---|
| 30 | function cConnector() |
---|
| 31 | { |
---|
| 32 | this.requests = new Array(); |
---|
| 33 | this.oxmlhttp = null; |
---|
| 34 | this.isVisibleBar = false; |
---|
| 35 | this.tid = 0; |
---|
| 36 | this.progressBar = null; |
---|
| 37 | this.oldX = 0; |
---|
| 38 | this.oldY = 0; |
---|
| 39 | this.updateVersion = ""; |
---|
| 40 | } |
---|
| 41 | cConnector.prototype.buildBar = function() |
---|
| 42 | { |
---|
| 43 | var div = document.getElementById('divProgressBar'); |
---|
| 44 | |
---|
| 45 | if(! div) { |
---|
| 46 | div = document.createElement("DIV"); |
---|
| 47 | div.style.visibility = "hidden"; |
---|
| 48 | div.style.width = "103px"; |
---|
| 49 | div.id = 'divProgressBar'; |
---|
| 50 | div.align = "center"; |
---|
| 51 | div.innerHTML = ' <font face="Verdana" size="2" color="WHITE">'+get_lang('loading')+'...</font> '; |
---|
| 52 | div.style.background = "#cc4444"; |
---|
| 53 | div.style.position = 'fixed'; |
---|
| 54 | div.style.top = '0px'; |
---|
| 55 | div.style.right = '0px'; |
---|
| 56 | document.body.appendChild(div); |
---|
| 57 | |
---|
| 58 | if(is_ie) { |
---|
| 59 | var elem = document.all[div.id]; |
---|
| 60 | elem.style.position="absolute"; |
---|
| 61 | var root = document.body; |
---|
| 62 | var posX = elem.offsetLeft-root.scrollLeft; |
---|
| 63 | var posY = elem.offsetTop-root.scrollTop; |
---|
| 64 | root.onscroll = function() { |
---|
| 65 | elem.style.right = '0px'; |
---|
| 66 | elem.style.top = (posY + root.scrollTop) + "px"; |
---|
| 67 | }; |
---|
| 68 | } |
---|
| 69 | } |
---|
| 70 | } |
---|
| 71 | |
---|
| 72 | cConnector.prototype.hideProgressBar = function () |
---|
| 73 | { |
---|
| 74 | var div = document.getElementById('divProgressBar'); |
---|
| 75 | div.style.visibility = 'hidden'; |
---|
| 76 | this.isVisibleBar = false; |
---|
| 77 | } |
---|
| 78 | |
---|
| 79 | cConnector.prototype.showProgressBar = function(){ |
---|
| 80 | var div = document.getElementById('divProgressBar'); |
---|
| 81 | if (! div){ |
---|
| 82 | connector.buildBar(); |
---|
| 83 | connector.showProgressBar(); |
---|
| 84 | return; |
---|
| 85 | } |
---|
| 86 | |
---|
| 87 | div.style.visibility = 'visible'; |
---|
| 88 | |
---|
| 89 | this.isVisibleBar = true; |
---|
| 90 | } |
---|
| 91 | |
---|
| 92 | function XMLTools() |
---|
| 93 | { |
---|
| 94 | this.path = ""; |
---|
| 95 | } |
---|
| 96 | var connector = new cConnector(); |
---|
| 97 | |
---|
| 98 | function cExecuteForm(url, form, handler){ |
---|
| 99 | connector.showProgressBar(); |
---|
| 100 | var iframe_el = document.getElementById('nullFrame'); |
---|
| 101 | if (!iframe_el) |
---|
| 102 | { |
---|
| 103 | iframe_el = document.createElement('IFRAME'); |
---|
| 104 | iframe_el.id = "nullFrame"; |
---|
| 105 | } |
---|
| 106 | iframe_el.style.width = "0px"; |
---|
| 107 | iframe_el.style.height = "0px"; |
---|
| 108 | iframe_el.style.border = '0px'; |
---|
| 109 | iframe_el.name = "nullFrame"; |
---|
| 110 | iframe = document.body.appendChild(iframe_el); |
---|
| 111 | iframe_el.setAttribute('onload', 'javascript:'+handler+'()'); |
---|
| 112 | form.target = "nullFrame"; |
---|
| 113 | form.submit(); |
---|
| 114 | } |
---|
| 115 | |
---|
| 116 | function cExecute(requestURL,handler){ |
---|
| 117 | var AjaxRequest = function () { |
---|
| 118 | Ajax = false; |
---|
| 119 | if (window.XMLHttpRequest) //Gecko |
---|
| 120 | Ajax = new XMLHttpRequest(); |
---|
| 121 | else |
---|
| 122 | if (window.ActiveXObject) //Other nav. |
---|
| 123 | try |
---|
| 124 | { |
---|
| 125 | Ajax = new ActiveXObject("Msxml12.XMLHTTP"); |
---|
| 126 | } catch (e) |
---|
| 127 | { |
---|
| 128 | Ajax = new ActiveXObject("Microsoft.XMLHTTP"); |
---|
| 129 | } |
---|
| 130 | } |
---|
| 131 | var responseRequest = function (){ |
---|
| 132 | if (Ajax.readyState == 4) |
---|
| 133 | if (Ajax.status == 200) |
---|
| 134 | handler(Ajax.responseText); |
---|
| 135 | else |
---|
| 136 | alert("Erro temporario de conexão"); |
---|
| 137 | } |
---|
| 138 | |
---|
| 139 | |
---|
| 140 | AjaxRequest(); |
---|
| 141 | if (!Ajax){ |
---|
| 142 | alert("Erro ao conectar-se"); |
---|
| 143 | return; |
---|
| 144 | } |
---|
| 145 | |
---|
| 146 | Ajax.onreadystatechange = responseRequest; |
---|
| 147 | if (typeof(method) == 'undefined') |
---|
| 148 | method = 'GET'; |
---|
| 149 | Ajax.open(method, requestURL, true); |
---|
| 150 | Ajax.send(null); |
---|
| 151 | } |
---|
| 152 | |
---|