1 | var last_id = 0; |
---|
2 | |
---|
3 | function openwindow(url){ |
---|
4 | var window_features = "scrollbars=yes,resizable=yes,location=no,menubar=no," + |
---|
5 | "personalbar=no,status=no,titlebar=no,toolbar=no," + |
---|
6 | "screenX=0,screenY=0,top=0,left=0,width=" + |
---|
7 | screen.width + ",height=" + screen.height/5*3; |
---|
8 | |
---|
9 | window.open(url,'', window_features); |
---|
10 | } |
---|
11 | |
---|
12 | var Main_pre_load = document.body.onload; |
---|
13 | var ccSearch, ccTree; |
---|
14 | var Main_load = function () |
---|
15 | { |
---|
16 | Connector.setProgressBox(Element('cc_loading'), true); |
---|
17 | Connector.setProgressHolder(Element('cc_loading_inner')); |
---|
18 | /* Associate the Quick Add Button with the Plugin */ |
---|
19 | |
---|
20 | |
---|
21 | /* Create the Search Object */ |
---|
22 | var search_params = new Array(); |
---|
23 | search_params['holder'] = Element('cc_panel_search_call'); |
---|
24 | search_params['total_width'] = '280px'; |
---|
25 | search_params['input_width'] = '200px'; |
---|
26 | search_params['progress_top'] = '150px'; |
---|
27 | search_params['progress_left'] = '-260px'; |
---|
28 | search_params['progress_color'] = '#3978d6'; |
---|
29 | search_params['progress_width'] = '250px'; |
---|
30 | search_params['conn_1_msg'] = Element('cc_loading_1').value; |
---|
31 | search_params['conn_2_msg'] = Element('cc_loading_2').value; |
---|
32 | search_params['conn_3_msg'] = Element('cc_loading_3').value; |
---|
33 | search_params['button_text'] = Element('cc_panel_search_text').value; |
---|
34 | search_params['Connector'] = Connector; |
---|
35 | |
---|
36 | ccSearch = new ccSearchClass(search_params); |
---|
37 | ccSearch.DOMresult.style.visibility = 'hidden'; |
---|
38 | ccSearch.onSearchFinish = ccSearchUpdate; |
---|
39 | |
---|
40 | Connector.setProgressBox(Element('cc_loading'), true); |
---|
41 | Connector.setProgressHolder(Element('cc_loading_inner')); |
---|
42 | |
---|
43 | /* Create the Tree Object */ |
---|
44 | ccTree = new ccCatalogTree({name: 'ccTree', id_destination: 'cc_tree', afterSetCatalog: 'ccSearchHidePanel(); updateCards()'}); |
---|
45 | |
---|
46 | ccTree.Connector = Connector; |
---|
47 | } |
---|
48 | var menuStarted = false; |
---|
49 | function findPosY(obj) |
---|
50 | { |
---|
51 | var curtop = 0; |
---|
52 | if (obj.offsetParent) |
---|
53 | { |
---|
54 | while (obj.offsetParent) |
---|
55 | { |
---|
56 | curtop += obj.offsetTop |
---|
57 | obj = obj.offsetParent; |
---|
58 | } |
---|
59 | } |
---|
60 | else if (obj.y) |
---|
61 | curtop += obj.y; |
---|
62 | return curtop; |
---|
63 | } |
---|
64 | var _timeout = ''; |
---|
65 | var menu = function () { |
---|
66 | |
---|
67 | if(! this.menuStarted) |
---|
68 | this.menuStarted = true; |
---|
69 | |
---|
70 | submenu = []; |
---|
71 | textmenu = []; |
---|
72 | |
---|
73 | textmenu[0] = ["Contato [Adição Rápida]","Contato [Completo]","Grupo"] |
---|
74 | textmenu[1] = ["cc_quick_add", "cc_full_add", "cc_add_group"]; |
---|
75 | function show(){ |
---|
76 | clearTimeout(_timeout); |
---|
77 | button = document.getElementById("cc_button_new"); |
---|
78 | |
---|
79 | this.style.top = 19 + findPosY(button) + "px"; |
---|
80 | this.style.visibility='visible'; |
---|
81 | } |
---|
82 | function hide(){ _timeout = setTimeout("menu.style.visibility='hidden';",200); }; |
---|
83 | |
---|
84 | if(document.getElementById) { |
---|
85 | menu = document.getElementById("Layer1"); |
---|
86 | |
---|
87 | for (i=0; i< textmenu[0].length; i++) { |
---|
88 | textmenu[0][i] = "<span onclick= 'menu.onmouseout();'>" + textmenu[0][i] + "</span><br>"; |
---|
89 | submenu[i] = document.createElement("DIV"); |
---|
90 | submenu[i].innerHTML = textmenu[0][i]; |
---|
91 | submenu[i].id = textmenu[1][i]; |
---|
92 | submenu[i].onmouseover = function () {this.style.backgroundColor = 'LIGHTYELLOW';this.style.color = 'DARKBLUE';}; |
---|
93 | submenu[i].onmouseout = function () { this.style.backgroundColor = '#DCDCDC'; this.style.color = '#006699';}; |
---|
94 | submenu[i].setAttribute("className", "special"); |
---|
95 | submenu[i].setAttribute("class", "special"); |
---|
96 | submenu[i].style.padding = "5px"; |
---|
97 | menu.appendChild(submenu[i]); |
---|
98 | } |
---|
99 | |
---|
100 | menu.onmouseover = show; |
---|
101 | menu.onmouseout = hide; |
---|
102 | } |
---|
103 | |
---|
104 | ccQuickAdd.associateAsButton(Element('cc_quick_add')); |
---|
105 | ccAddGroup.associateAsButton(Element('cc_add_group')); |
---|
106 | document.getElementById("cc_full_add").onclick= newContact; |
---|
107 | |
---|
108 | |
---|
109 | ccQuickAdd.afterSave = function () |
---|
110 | { |
---|
111 | updateCards(); |
---|
112 | } |
---|
113 | |
---|
114 | ccAddGroup.load = function () |
---|
115 | { |
---|
116 | editGroup(); |
---|
117 | } |
---|
118 | |
---|
119 | ccAddGroup.afterSave = function () |
---|
120 | { |
---|
121 | updateCards(); |
---|
122 | } |
---|
123 | |
---|
124 | return true; |
---|
125 | } |
---|
126 | |
---|
127 | if (is_ie) |
---|
128 | { |
---|
129 | |
---|
130 | document.body.onload = function (e) |
---|
131 | { |
---|
132 | Main_pre_load(); |
---|
133 | Main_load(); |
---|
134 | |
---|
135 | } |
---|
136 | } |
---|
137 | else |
---|
138 | { |
---|
139 | Main_load(); |
---|
140 | |
---|
141 | } |
---|
142 | |
---|
143 | // BEGIN: FUNCTION RESIZE WINDOW |
---|
144 | var _showBar = showBar; |
---|
145 | var _hideBar = hideBar; |
---|
146 | |
---|
147 | function __showBar(){ |
---|
148 | _showBar(); |
---|
149 | resizeWindow(); |
---|
150 | } |
---|
151 | |
---|
152 | function __hideBar(){ |
---|
153 | _hideBar(); |
---|
154 | resizeWindow(); |
---|
155 | } |
---|
156 | showBar = __showBar; |
---|
157 | hideBar = __hideBar; |
---|
158 | |
---|
159 | var _onResize = window.onresize; |
---|
160 | window.onresize = resizeWindow; |
---|
161 | var defaultHeight = 0; |
---|
162 | function setDefaultHeight(){ |
---|
163 | |
---|
164 | var bar = Element("toolbar"); |
---|
165 | var offset = 0; |
---|
166 | if(bar.style.visibility != 'hidden') |
---|
167 | offset = (bar.offsetHeight ? bar.offsetHeight : bar.clientHeight); |
---|
168 | |
---|
169 | var screenHeight = document.body.clientHeight ? document.body.clientHeight : document.body.offsetHeight; |
---|
170 | defaultHeight = screenHeight - offset; |
---|
171 | Element("cc_tree").style.height = defaultHeight - 68; |
---|
172 | Element("cc_left_main").style.height = defaultHeight - 68; |
---|
173 | } |
---|
174 | |
---|
175 | function resizeWindow(){ |
---|
176 | setDefaultHeight(); |
---|
177 | Element("divScrollMain").style.height = defaultHeight - 108; |
---|
178 | if (!is_ie) |
---|
179 | Element('tableDivAppbox').width = '100%'; |
---|
180 | } |
---|
181 | document.body.scroll="no"; |
---|
182 | document.body.style.overflow ="hidden"; |
---|
183 | setDefaultHeight(); |
---|
184 | Element('cc_main').style.height = defaultHeight; |
---|
185 | function buildWarningMsg(_version) { |
---|
186 | var screenWidth = document.body.clientWidth ? document.body.clientWidth: document.body.offsetWidth; |
---|
187 | var _div = document.createElement("DIV"); |
---|
188 | _div.innerHTML += "<DIV id='warning_msg' style='background:LIGHTYELLOW;position:absolute;"+ |
---|
189 | "border:1px solid black;left:"+(screenWidth - 330)+";top:10px;width:300px;padding:10px;"+ |
---|
190 | (document.body.clientWidth ? "-moz-border-radius: 9px 9px 9px 9px;'>" : "")+ |
---|
191 | "<font color='RED' size='2'>Aviso: Versão muito antiga do Firefox ("+_version+")</font><BR>"+ |
---|
192 | "<font color='black' size='2'><p style='text-align:justify'> Para que essa aplicação funcione <u>corretamente</u> "+ |
---|
193 | "é necessário atualizar o seu navegador Firefox para uma versão mais nova (versão > 1.5). "+ |
---|
194 | "Instale agora clicando no link abaixo ou caso queira atualizar mais tarde (não recomendável), clique em Fechar.</p></font><div style='width:100%' align='center'>"+ |
---|
195 | "<a title='Instalar agora' href='http://br.mozdev.org/firefox/download.html' target='_blank'>Instalar nova versão do Firefox</a>"+ |
---|
196 | " "+ |
---|
197 | "<a title='Fechar' href='javascript:void(0)' onclick='javascript:myOpacity.toggle()'>Fechar</a></div>"+ |
---|
198 | "</DIV>"; |
---|
199 | |
---|
200 | document.body.appendChild(_div); |
---|
201 | |
---|
202 | myOpacity = new fx.Opacity('warning_msg', {duration: 600}); |
---|
203 | document.getElementById("warning_msg").style.visibility = 'hidden'; |
---|
204 | myOpacity.now = 0; |
---|
205 | setTimeout("myOpacity.toggle()",3000); |
---|
206 | } |
---|
207 | // Verifica versão do Firefox |
---|
208 | var agt=navigator.userAgent.toLowerCase(); |
---|
209 | if(agt.indexOf('firefox/1.0') != -1 && agt.indexOf('firefox/0.')) |
---|
210 | buildWarningMsg(agt.substring(agt.indexOf('firefox/')+8,agt.indexOf('firefox/')+13)); |
---|