/* * Ext JS Library 1.1 Beta 1 * Copyright(c) 2006-2007, Ext JS, LLC. * licensing@extjs.com * * http://www.extjs.com/license */ Ext.BLANK_IMAGE_URL = '../../resources/images/default/s.gif'; Ext.example = function(){ var msgCt; function createBox(t, s){ return ['
', '
', '

', t, '

', s, '
', '
', '
'].join(''); } return { msg : function(title, format){ if(!msgCt){ msgCt = Ext.DomHelper.insertFirst(document.body, {id:'msg-div'}, true); } msgCt.alignTo(document, 't-t'); var s = String.format.apply(String, Array.prototype.slice.call(arguments, 1)); var m = Ext.DomHelper.append(msgCt, {html:createBox(title, s)}, true); m.slideIn('t').pause(1).ghost("t", {remove:true}); }, init : function(){ var s = Ext.get('extlib'), t = Ext.get('exttheme'); if(!s || !t){ // run locally? return; } var lib = Cookies.get('extlib') || 'ext', theme = Cookies.get('exttheme') || 'aero'; if(lib){ s.dom.value = lib; } if(theme){ t.dom.value = theme; Ext.get(document.body).addClass('x-'+theme); } s.on('change', function(){ Cookies.set('extlib', s.getValue()); setTimeout(function(){ window.location.reload(); }, 250); }); t.on('change', function(){ Cookies.set('exttheme', t.getValue()); setTimeout(function(){ window.location.reload(); }, 250); }); } }; }(); Ext.onReady(Ext.example.init, Ext.example); // old school cookie functions grabbed off the web var Cookies = {}; Cookies.set = function(name, value){ var argv = arguments; var argc = arguments.length; var expires = (argc > 2) ? argv[2] : null; var path = (argc > 3) ? argv[3] : '/'; var domain = (argc > 4) ? argv[4] : null; var secure = (argc > 5) ? argv[5] : false; document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : ""); }; Cookies.get = function(name){ var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; var j = 0; while(i < clen){ j = i + alen; if (document.cookie.substring(i, j) == arg) return Cookies.getCookieVal(j); i = document.cookie.indexOf(" ", i) + 1; if(i == 0) break; } return null; }; Cookies.clear = function(name) { if(Cookies.get(name)){ document.cookie = name + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT"; } }; Cookies.getCookieVal = function(offset){ var endstr = document.cookie.indexOf(";", offset); if(endstr == -1){ endstr = document.cookie.length; } return unescape(document.cookie.substring(offset, endstr)); };