Updated styles for dialog and object forms
[ajatus.git] / js / ajatus.layout.js
blob458c47bd4a8a6d1438bff2be233fcd1ffefa70ce
1 /*
2  * This file is part of
3  *
4  * Ajatus - Distributed CRM
5  * @requires jQuery v1.2.1
6  * 
7  * Copyright (c) 2007 Jerry Jalava <jerry.jalava@gmail.com>
8  * Copyright (c) 2007 Nemein Oy <http://nemein.com>
9  * Website: http://ajatus.info
10  * Licensed under the GPL license
11  * http://www.gnu.org/licenses/gpl.html
12  * 
13  */
15 (function($){
16     $.ajatus = $.ajatus || {};
17     $.ajatus.layout = $.ajatus.layout || {};
18     
19     $.ajatus.layout
20     
21     $.ajatus.layout.body = {
22     };
23     $.extend($.ajatus.layout.body, {
24         set_class: function(new_class) {
25             $('body').attr('class', new_class);
26         },
27         append_class: function(class_name) {
28             $('body').addClass(class_name);
29         }
30     });
31     
32     $.ajatus.layout.styles = {
33         loaded: []
34     };
35     $.extend($.ajatus.layout.styles, {
36         load: function(style) {
37             if ($.ajatus.layout.styles.loaded[style]) {
38                 return;
39             }
40             
41             $.ajatus.layout.styles.loaded[style] = true;
42             
43             var style_tag = $('<link rel="stylesheet" href="' + style + '" type="text/css">');
44             
45             if ($.browser.mozilla) {
46                 $('head').prepend(style_tag);
47             } else {
48                 style_tag.prependTo($.ajatus.application_element);                
49             }
50         }
51     });
52     
53 })(jQuery);