var mainurl = "http://ampills.com/utils/widgets/"; var winit = false; try { if (loader == undefined) winit = true; } catch (e) { winit = true; } if(winit == true){ var cfg = {}; var loader = new function(){ this.loadData = function(ids, aid, said, wid){ var s = document.createElement("script"); s.type = "text/javascript"; s.content = "text/javascript; charset=UTF-8"; s.charset = "utf-8"; s.src = mainurl+"get-items.php?items="+ids+"&aid="+aid+"&said="+said+"&wid="+wid; (document.getElementsByTagName("head"))[0].appendChild(s); } this.responseData = function(resp){ var items = resp.items; for(var i = 0, cnt = items.length; i < cnt; i++){ this.addBlock(items[i].title, items[i].html, resp.wid); } glWidget.init(resp.wid); } this.addBlock = function(titl, html, wid){ //var cls = 'close'; var cls = 'open'; if(cfg[wid].loaded == false){ cls = 'open'; cfg[wid].loaded = true;} var s = document.createElement('div'); s.className = "gl-item-"+cls; s.innerHTML = ''+titl+''+html+''; document.getElementById(wid).appendChild(s); //if(cls == "open") s.style.height = cfg[wid].h+'px'; if(cls == "open") s.style.height = '100%'; } } var glWidget = new function(){ this.speed = 25; this.titleClick = function(){ /* if(this.parentNode.className == "gl-item-close") { glWidget.openBlock(this.parentNode); } */ } this.openBlock = function(block){ var wid = block.parentNode.id; cfg[wid].clEl = cfg[wid].opEl; cfg[wid].opEl = block; var clblock = cfg[wid].clEl; var clH = cfg[wid].h; var opH = 20; var speed = this.speed; var handl = function(){ clH = clH - 10; opH = opH + 10; if(clH < 20) clH = 20; if(opH > cfg[wid].h) opH = cfg[wid].h; //clblock.style.height = clH+"px"; //block.style.height = opH+"px"; if(clH == 20){ clblock.className = "gl-item-close"; block.className = "gl-item-open"; } else { setTimeout(handl, speed); } } setTimeout(handl, speed); } // init click handlers this.init = function(wid){ var r = document.getElementById(wid); var els = r.getElementsByTagName("span"); for(var i = 0, cnt = els.length; i < cnt; i++){ if(els[i].className == "title"){ els[i].onmouseup = glWidget.titleClick; els[i].style.color = cfg[wid].tcl; els[i].style.background = cfg[wid].tbg; if(els[i].parentNode.className == "gl-item-open") cfg[wid].opEl = els[i].parentNode; } } } } } cfg["gl-widget-1280648106"] = { h: "150", w: "175", tcl: "#FFFFFF", tbg: "#003571", loaded: false, clEl: null, opEl: null } document.write('