PageRenderTime 177ms CodeModel.GetById 95ms app.highlight 5ms RepoModel.GetById 76ms app.codeStats 0ms

/IZWebFileManager/resources/BorderedPanel.js

http://izwebfilemanager.googlecode.com/
JavaScript | 50 lines | 42 code | 8 blank | 0 comment | 15 complexity | c7e4b8e7f3296fc6b849b87e16b03c5e MD5 | raw file
 1function BorderedPanel_SetStyle(ClientID, ImagesArray, CssClass) {
 2    var panel = document.getElementById(ClientID);
 3    if(panel == null)
 4        return;
 5    if (panel.normalClass == null)
 6        panel.normalClass = panel.className;
 7    panel.className = CssClass;
 8
 9    BorderedPanel_SetBackImage(ClientID+'_BorderT', ImagesArray[0]);
10    BorderedPanel_SetBackImage(ClientID+'_BorderL', ImagesArray[1]);
11    BorderedPanel_SetBackImage(ClientID+'_BorderR', ImagesArray[2]);
12    BorderedPanel_SetBackImage(ClientID+'_BorderB', ImagesArray[3]);
13
14    BorderedPanel_SetBackImage(ClientID+'_BorderLT', ImagesArray[4]);
15    BorderedPanel_SetBackImage(ClientID+'_BorderLB', ImagesArray[5]);
16    BorderedPanel_SetBackImage(ClientID+'_BorderRT', ImagesArray[6]);
17    BorderedPanel_SetBackImage(ClientID+'_BorderRB', ImagesArray[7]);
18    
19}
20
21function BorderedPanel_SetBackImage(ClientID, Image) {
22    var el = document.getElementById(ClientID);
23    if(el) {
24        if (el.normalBackgroundImage == null)
25            el.normalBackgroundImage = el.style.backgroundImage;
26        el.style.backgroundImage = Image ? 'url(' + Image + ')' : 'none';
27    }
28}
29
30function BorderedPanel_RestoreStyle(ClientID) {
31    var panel = document.getElementById(ClientID);
32	if (panel != null && panel.normalClass != null)
33		panel.className = panel.normalClass;
34
35    BorderedPanel_RestoreBackImage(ClientID+'_BorderT');
36    BorderedPanel_RestoreBackImage(ClientID+'_BorderL');
37    BorderedPanel_RestoreBackImage(ClientID+'_BorderR');
38    BorderedPanel_RestoreBackImage(ClientID+'_BorderB');
39
40    BorderedPanel_RestoreBackImage(ClientID+'_BorderLT');
41    BorderedPanel_RestoreBackImage(ClientID+'_BorderLB');
42    BorderedPanel_RestoreBackImage(ClientID+'_BorderRT');
43    BorderedPanel_RestoreBackImage(ClientID+'_BorderRB');
44}
45
46function BorderedPanel_RestoreBackImage(ClientID) {
47    var el = document.getElementById(ClientID);
48	if (el != null && el.normalBackgroundImage != null)
49        el.style.backgroundImage = el.normalBackgroundImage;
50}