opera_nav = (navigator.userAgent.indexOf('Opera') != -1) ? true : false;
ie_nav = (navigator.userAgent.indexOf('MSIE') != -1 && !opera_nav) ? true : false;
mozilla_nav = (navigator.userAgent.indexOf('Gecko') != -1) ? true : false;
function preloadImg(imgEl, src) {
var img = document.createElement("img");
img.setAttribute("src", src);
//    img.src = src;
img.onload = function() {
imgEl.setAttribute("src", img.src);
imgEl.onload = null;
};
imgEl.style.display = 'inline';
}
function loadImg(src) {
var img = new Image();
img.src = src;
}
function deleteEl(el) {
if(el && el.parentNode) {
el.parentNode.removeChild(el);
}
}
function clone(obj) {
if((typeof(obj) != 'object') || (obj == null)) {
return obj;
}
if(obj.length == undefined) {
var newObj = {}
for(var i in obj) {
newObj[i] = clone(obj[i]);
}
} else {
var newObj = []
for(var i=0; i<obj.length; i++) {
newObj[i] = clone(obj[i]);
}
}
return newObj;
}
function swap(a, b) {
var tmp = a;
a = b;
b = tmp;
}
function elById(id) {
return document.getElementById(id);
}
function showEl(el) {
el.style.display = 'block';
}
function hideEl(el) {
el.style.display = 'none';
}
function clearEl(el) {
el.innerHTML = '';
}
function info(txt) {
document.getElementById("info").innerHTML = txt;
}
function px2int(px) {
return parseInt(px.substring(0,px.length-2));
}
function getMousePos(e) {
var px;
var py;
if (mozilla_nav) {
px = e.pageX;
py = e.pageY;
} else {
px = event.clientX + document.body.scrollLeft;
py = event.clientY + document.body.scrollTop;
}
return {left:px, top:py};
}
function isPosInObj(pos, obj) {
var left = getLeft(obj);
var top = getTop(obj);
if((pos.left > left) &&
(pos.left < obj.offsetWidth + left) &&
(pos.top > top) &&
(pos.top < obj.offsetHeight + top)) {
return true;
}
return false;
}
function getLeft(obj) {
var curleft = 0;
if (obj.offsetParent) {
while (obj.offsetParent) {
curleft += obj.offsetLeft;
obj = obj.offsetParent;
}
} else if (obj.x) curleft += obj.x;
return curleft;
}
function getTop(obj) {
var curtop = 0;
if (obj.offsetParent) {
while (obj.offsetParent) {
curtop += obj.offsetTop;
obj = obj.offsetParent;
}
} else if (obj.y) curtop += obj.y;
return curtop;
}
function getElPos(el) {
var left = 0;
var top = 0;
if (el.offsetParent) {
while (el.offsetParent) {
left += el.offsetLeft;
top += el.offsetTop;
el = el.offsetParent;
}
} else
if (el.y) {
left += el.x;
top += el.y;
}
return {left:left, top:top};
}
function setElPos(el, pos) {
el.style.left = pos.left + "px";
el.style.top = pos.top + "px";
}
function trim(s) {
if(s && s.replace) {
return s.replace(/^\s*(.+?)\s*$/, "$1").replace(/'/g, "").replace(/"/g, "");
} else {
return "";
}
}
function arraySearch(needle, data) {
for(var i = 0; i<data.length; i++) {
if(data[i] == needle) {
return i;
}
}
return undefined;
}
function arrayFirstFree(data) {
var id = arraySearch(undefined, data);
if(id != undefined) {
return id;
} else {
return data.length;
}
}
function getDir(url) {
if(url) {
return url.substring(0, url.lastIndexOf("/"));
} else {
return "";
}
}
function getDomain(url) {
if(url) {
var tmp = url.split("//");
return (tmp[1] != undefined) ? tmp[1].split("/")[0] : tmp[0].split("/")[0];
} else {
return "";
}
}
function wordWrap(txt) {
var w = txt.split(" ");
var r = [];
for(var i=0; i<w.length; i++) {
if(w[i].length>40) {
var stops = Math.ceil(w[i].length / 40) + 1;
for(var j=0; j<stops; j++) {
r[i] += w[i].substr(stops, 40) + "&shy;";
}
} else {
r[i] = w[i];
}
}
return r.join(" ");
}
function loadIcon(v_img, v_urls) {
var el = new Image();
var img = v_img;
var urls = v_urls;
var f = function() {
if(urls.length > 0) {
el.urls = urls;
el.onload = function() {
this.onerror = null;
img.setAttribute("src", this.src);
//            el = null;
}
el.onerror = function() {
if(this.urls.length > 0) {
var url = "";
while(!url && (this.urls.length > 0) && (trim(url) == "")) {
url = urls.shift();
}
if(url) {
if(url.indexOf("http://") == -1) {
url = "http://" + url;
}
this.setAttribute("src", url);
}
} else {
this.onerror = null;
}
}
el.onerror();
}
}
setTimeout(f, 100);
}
function fix_event(event) {
if (!event) {
event = window.event;
}
if (event.target) {
if (event.target.nodeType == 3) event.target = event.target.parentNode;
} else if (event.srcElement) {
event.target = event.srcElement;
}
var tg = event.target;
while((tg.entityInfo == undefined) && (tg != document.body)) {
tg = tg.parentNode;
}
event.target.entityInfo = tg.entityInfo;
return event;
}
/*********************************************
*
*   DEBUG
*
********************************************/
function varp(v) {
alert(Dump(v));
}
function varpw(v) {
win = open("", "varp", "width=900,toolbar=no,status=no,titlebar=no,scroollbars=yes");
win.document.write("<html><body><pre style='font-family: Tahoma, Verdana, Arial; font-size: 11px;'>"+Dump(v)+"</pre></body></html>");
}
function info(v) {
var s ='';
for(var i in v) {
s+=i + '; ';
}
alert(s);
}
function Dump(d,l) {
if (l == null) l = 1;
var s = '';
if (typeof(d) == "object") {
s += " {\n";
for (var k in d) {
for (var i=0; i<l; i++) s += "  ";
s += k+": " + Dump(d[k],l+1);
}
for (var i=0; i<l-1; i++) s += "  ";
s += "}\n"
} else {
s += "" + d + "\n";
}
return s;
}
function toCode(d,l) {
if (l == null) l = 1;
var s = '';
if (typeof(d) == "object") {
var items = [];
var i = 0;
if(d) {
var isList = d.length != undefined;
} else {
var isList = false;
}
for (var k in d) {
switch(typeof(d[k])) {
case "integet":
var v = parseInt(d[k]);
break;
case "string":
var v = "'" + d[k] + "'";
break;
default:
var v = toCode(d[k],l+1);
break;
}
items[i] = isList ? v : (k + ":" + v);
i++;
}
if(isList) {
s += "[" + items.join(",") + "]";
} else {
s += "{" + items.join(",") + "}";
}
} else {
s += "" + d;
}
return s;
}
function toValue(str) {
if(str) {
eval("var r = "+str);
return r;
} else {
return {}
}
}
/*********************************************
*
*   COOKIES
*
********************************************/
function getCookie(name) {
var cookie = " " + document.cookie;
var search = " " + name + "=";
var setStr = "";
var offset = 0;
var end = 0;
if (cookie.length > 0) {
offset = cookie.indexOf(search);
if (offset != -1) {
offset += search.length;
end = cookie.indexOf(";", offset)
if (end == -1) {
end = cookie.length;
}
setStr = unescape(cookie.substring(offset, end));
}
}
return(setStr);
}
function setCookie(name, value) {
var today = new Date();
today.setTime(today.getTime());
var expires_date = new Date(today.getTime() + 31536000000);
document.cookie = name + "=" + escape(value) + ";expires=" + expires_date.toGMTString();
}
function delCookie(name) {
if(getCookie(name)) {
document.cookie = name + "=;expires=Thu, 01-Jan-1970 00:00:01 GMT";
}
}
/*********************************************
*
*   STRINGS
*
********************************************/
function text2html(txt) {
txt = txt.replace(/\&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\n/g, "<br>");
return txt;
}
function html2text(html) {
html = html.replace(/<br>/g,"\n").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">");
return html;
}
String.prototype.addSlashes = function() {
return this.replace(/\\/g,'\\\\').replace(/\"/g,"\\\"").replace(/\'/g,"\\\'");
}
String.prototype.stripSlashes = function() {
return this.replace(/\\'/g,'\'').replace(/\\"/g,'"').replace(/\\\\/g,'\\');
}
String.prototype.wordWrap = function(w) {
var i, j, s, r = this.split("\n");
if(w > 0) for(i in r){
for(s = r[i], r[i] = ""; s.length > w;
r[i] += s.substr(0, w) + ((s = s.substr(w)).length ? "&shy;" : "")
);
r[i] += s;
}
return r.join("\n");
}
String.prototype.jsEscape = function() {
return this.replace(/\%/g, "%jcp").replace(/\n/g, "%jcn").replace(/\r/g, "%jcr").replace(/"/g, "%jcqq").replace(/'/g, "%jcq").replace(/\\/g, "%jcbs");
}
String.prototype.jsUnescape = function() {
return this.replace(/\%jcr/g, " ").replace(/\%jcn/g, "\n").replace(/\%jcqq/g, "\"").replace(/\%jcq/g, "'").replace(/\%jcbs/g, "\\").replace(/\%jcp/g, "%");
}
String.prototype.parseUrl = function(){
var lines = this.split("<br>");
for(var z=0; z<lines.length; z++){
var tmp = lines[z].split(" ");
for(var i=0; i<tmp.length; i++){
if(tmp[i].indexOf("www.")!=-1 && tmp[i].indexOf("http://")==-1){
tmp[i] = "<a href='http://"+tmp[i]+"' target='_blank'>"+tmp[i]+"</a>";
} else if(tmp[i].indexOf("http://")!=-1 || tmp[i].indexOf("ftp://")!=-1 || tmp[i].indexOf("https://")!=-1){
tmp[i] = "<a href='"+tmp[i]+"' target='_blank'>"+tmp[i]+"</a>";
} else if (tmp[i].indexOf("@") != -1 && tmp[i].charAt(0) != "@" && tmp[i].charAt(tmp[i].length-1) != "@") {
tmp[i] = "<a href='mailto:"+tmp[i]+"'>"+tmp[i]+"</a>";
}
}
lines[z] = tmp.join(" ");
}
return lines.join("<br>");
}
requests_counter = 0;
function updateLoadingIcon(ofs) {
requests_counter += ofs;
if(requests_counter <= 0) {
hideEl(elById("loading_spinner"));
} else {
showEl(elById("loading_spinner"));
}
//    elById("dbg").innerHTML = requests_counter;
}
function Request() {
this.controllerURL = "controller.php";
this.convertParams = function(hash) {
var res = [];
for(k in hash) {
res.push(k + "=" + encodeURIComponent(hash[k]));
}
return res.join("&");
}
this.d422 = function() {
return ("" + Math.random()).slice(2, 8);
}
this.d423 = function() {
var req;
if (window.XMLHttpRequest) {
try { req = new XMLHttpRequest() } catch(e) {}
} else if (window.ActiveXObject) {
try { req = new ActiveXObject("Microsoft.XMLHTTP") } catch(e) {}
if (!req) {
try { req = new ActiveXObject("Msxml2.XMLHTTP") } catch (e) {}
}
}
return req;
}
this.send = function(params, widget, method) {
var req = this.d423();
if(!req) {
return false;
}
var d603 = widget.id;
params.module = widget.cfg.module;
//        if(!mozilla_nav) {
var date = new Date();
params["_nc"] = this.d422();
//        }
req.onreadystatechange = function() {
if (req.readyState == 4) {
if ((req.status < 400) && req.responseText) {
updateLoadingIcon(-1);
try {
eval("if(kernel.getWidget(d603)) { kernel.getWidget(d603).d455("+req.responseText+")}");
} catch(e) {
//                        alert("Error in \n"+e.fileName+"\nat line: "+e.lineNumber+"\n"+e.message);
}
} else {
//    				alert(req.statusText);
}
}
}
if (method == "POST") {
req.open("POST", this.controllerURL, false);
req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8;');
req.send(this.convertParams(params));
} else {
req.open("GET", this.controllerURL + "?" + this.convertParams(params), true);
req.send(null);
}
updateLoadingIcon(1);
return req;
}
this.d424 = function(url, obj, callback) {
var req = this.d423();
var o = obj
var cb = callback;
req.onreadystatechange = function() {
if (req.readyState == 4) {
if (req.status < 400) {
updateLoadingIcon(-1);
if(req.responseXML) {
o[cb](req.responseXML.documentElement);
}
} else {
o[cb](null);
}
}
}
if(url.indexOf("http:") != -1) {
req.open("GET", "xmlproxy.php?url=" + escape(url) + "&_nc=" + this.d422(), true);
} else {
req.open("GET", url + "?_nc=" + this.d422(), true);
}
updateLoadingIcon(1);
req.send(null);
return req;
}
}
function XMLRequest() {
this.send = function(url, widget, callback, params, noProxy) {
var req;
if (window.XMLHttpRequest) {
try { req = new XMLHttpRequest() } catch(e) {}
} else if (window.ActiveXObject) {
try { req = new ActiveXObject("MSXML2.XMLHttp") } catch (e) {}
if (!req) {
try { req = new ActiveXObject("Microsoft.XMLHTTP") } catch(e) {}
}
}
if(!req) {
return false;
}
//        if(!mozilla_nav) {
var date = new Date();
noCache = '&_nc='+ request.d422();
//        } else {
//            noCache = '';
//        }
var paramStr = "";
if(params) {
for(var i in params) {
paramStr += "&"+i+"="+escape(params[i]);
}
}
var d603 = widget.id;
var cf = callback;
req.onreadystatechange = function() {
updateLoadingIcon(-1);
if (req.readyState == 4) {
if (req.status == 200) {
updateLoadingIcon(-1);
try {
if(kernel.getWidget(d603)) {
kernel.getWidget(d603)[cf](req);
}
} catch(e) {
//                        alert("Error in \n"+e.fileName+"\nat line: "+e.lineNumber+"\n"+e.message);
}
} else {
//    				alert(req.statusText);
}
}
}
if(noProxy == true) {
req.open("GET", url+"?"+noCache, true);
} else {
req.open("GET", "xmlproxy.php?url="+escape(url)+paramStr+noCache, true);
}
req.send(null);
updateLoadingIcon(1);
return req;
}
}
var XMLParser = {
xml2hash: function(xmlDocElem, tagItemName) {
var self = XMLParser;
var xmlElemArray = new Array;
var xmlElemRow;
var objArray = [];
if(!tagItemName) {
tagItemName = 'item';
}
if (xmlDocElem.hasChildNodes()) {
xmlElemArray = xmlDocElem.getElementsByTagName(tagItemName);
if(xmlElemArray && xmlElemArray.length == 0) {
xmlElemArray = xmlDocElem.getElementsByTagName('entry');
}
xmlElemRow = xmlElemArray[0];
for (var j = 0; j < xmlElemArray.length; j++) {
xmlElemRow = xmlElemArray[j];
objArray[j] = self.xmlElem2Obj(xmlElemArray[j]);
}
}
var linkEl = xmlDocElem.getElementsByTagName("link")[0];
if(linkEl) {
if(linkEl.firstChild) {
var siteUrl = linkEl.firstChild.nodeValue;
} else if(linkEl.attributes["href"]) {
var siteUrl = linkEl.attributes["href"].nodeValue;
}
}
var title = "";
if(xmlDocElem.getElementsByTagName("title")[0]) {
title = xmlDocElem.getElementsByTagName("title")[0].firstChild.nodeValue;
}
var updated = "";
if(xmlDocElem.getElementsByTagName("updated")[0]) {
updated = xmlDocElem.getElementsByTagName("updated")[0].firstChild.nodeValue;
} else if(xmlDocElem.getElementsByTagName("pubDate")[0]) {
updated = xmlDocElem.getElementsByTagName("pubDate")[0].firstChild.nodeValue;
}
return title ? { title: title, siteUrl: siteUrl, items: objArray, updated: updated} : null;
},
d636: function(node) {
var self = XMLParser;
var res = [];
var tags = [];
self.d636Node(res, tags, node.getElementsByTagName("DL")[0]);
return res ? res : null;
},
d636Node: function(res, tags, node) {
var self = XMLParser;
switch(node.tagName) {
case "A":
var curTags = clone(tags);
res.push({ title: node.firstChild.nodeValue,
url: node.getAttribute("HREF"),
tags: curTags.length>0 ? curTags : null});
break;
case "H3":
tags.push(node.firstChild.nodeValue);
break;
case "DL":
for(var i=0; i<node.childNodes.length; i++) {
if(node.childNodes[i].nodeType == 1 && node.childNodes[i].firstChild) {
self.d636Node(res, tags, node.childNodes[i]);
}
}
tags.pop();
break;
}
return res;
},
xmlElem2Obj: function(xmlElem) {
var self = XMLParser;
var ret = new Object();
self.setPropertiesRecursive(ret, xmlElem);
return ret;
},
setPropertiesRecursive: function(obj, node) {
var self = XMLParser;
if (node.childNodes.length > 0) {
for (var i = 0; i < node.childNodes.length; i++) {
if(node.childNodes[i].nodeName == "content") {
obj["content"] = self.toHTML(node.childNodes[i].firstChild.nodeValue);
} else if(node.childNodes[i].nodeName == "content:encoded") {
obj["content"] = node.childNodes[i].firstChild.nodeValue;
} else if(node.childNodes[i].nodeType == 1) {
if(node.childNodes[i].firstChild) {
if(node.childNodes[i].childNodes.length == 1) {
obj[node.childNodes[i].tagName] = node.childNodes[i].firstChild.nodeValue;
}
else {
obj[node.childNodes[i].tagName] = [];
self.setPropertiesRecursive(obj[node.childNodes[i].tagName], node.childNodes[i]);
}
} else if (node.childNodes[i].attributes.length>0) {
var attrs = {};
for(var a = 0; a < node.childNodes[i].attributes.length; a++) {
attrs[node.childNodes[i].attributes[a].nodeName] = node.childNodes[i].attributes[a].nodeValue;
}
obj[node.childNodes[i].tagName] = attrs;
}
}
}
}
},
cleanXMLObjText: function(xmlObj) {
var self = XMLParser;
var cleanObj = xmlObj;
for (var prop in cleanObj) {
cleanObj[prop] = cleanText(cleanObj[prop]);
}
return cleanObj;
},
cleanText: function(str) {
var self = XMLParser;
var ret = str;
ret = ret.replace(/\n/g, '');
ret = ret.replace(/\r/g, '');
ret = ret.replace(/\'/g, "\\'");
ret = ret.replace(/\[CDATA\[/g, '');
ret = ret.replace(/\]]/g, '');
return ret;
},
toHTML: function(str) {
var html = str;
html = html.replace(/\&lt\;/, '<');
html = html.replace(/\&gt\;/, '>');
return html;
},
rendered2Source: function(str) {
var self = XMLParser;
var proc = str;
proc = proc.replace(/</g, '&lt;');
proc = proc.replace(/>/g, '&gt;');
return '<pre>' + proc + '</pre>';
},
d424DocElem: function(xmlDivId, xmlNodeName) {
var self = XMLParser;
var xmlElemArray = [];
var xmlDocElem = null;
if (document.all) {
var xmlStr = document.getElementById(xmlDivId).innerHTML;
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.loadXML(xmlStr);
xmlDocElem = xmlDoc.documentElement;
}
else {
xmlElemArray = window.document.body.getElementsByTagName(xmlNodeName);
xmlDocElem = xmlElemArray[0]; ;
}
return xmlDocElem;
}
}
function plog(info) {
if(DEBUG) {
desktop.d428.debug_info.innerHTML = info + "<br>" + desktop.d428.debug_info.innerHTML;
}
}
colorsChart = [
["#FFEEEE", "#FFCCCC", "#FFAAAA", "#FF8888", "#FF6666", "#FF4444", "#FF2222", "#FF0000", "#EE0000", "#CC0000", "#AA0000", "#880000", "#770000", "#660000", "#550000", "#440000", "#330000"],
["#EEFFEE", "#CCFFCC", "#AAFFAA", "#88FF88", "#66FF66", "#44FF44", "#22FF22", "#00FF00", "#00EE00", "#00CC00", "#00AA00", "#008800", "#007700", "#006600", "#005500", "#004400", "#003300"],
["#EEEEFF", "#CCCCFF", "#AAAAFF", "#8888FF", "#6666FF", "#4444FF", "#2222FF", "#0000FF", "#0000EE", "#0000CC", "#0000AA", "#000088", "#000077", "#000066", "#000055", "#000044", "#000033"],
["#FFFFEE", "#FFFFCC", "#FFFFAA", "#FFFF88", "#FFFF66", "#FFFF44", "#FFFF22", "#FFFF00", "#EEEE00", "#CCCC00", "#AAAA00", "#888800", "#777700", "#666600", "#555500", "#444400", "#333300"],
["#FFEEFF", "#FFCCFF", "#FFAAFF", "#FF88FF", "#FF66FF", "#FF44FF", "#FF22FF", "#FF00FF", "#EE00EE", "#CC00CC", "#AA00AA", "#880088", "#770077", "#660066", "#550055", "#440044", "#330033"],
["#FFF0D0", "#FFEECC", "#FFEEBB", "#FFDDAA", "#FFCC99", "#FFC090", "#EEBB88", "#DDAA77", "#CC9966", "#BB8855", "#AA7744", "#886633", "#775522", "#664411", "#553300", "#442200", "#331100"],
["#EEFFFF", "#CCFFFF", "#AAFFFF", "#88FFFF", "#66FFFF", "#44FFFF", "#22FFFF", "#00FFFF", "#00EEEE", "#00CCCC", "#00AAAA", "#008888", "#007777", "#006666", "#005555", "#004444", "#003333"],
["#FFFFFF", "#EEEEEE", "#DDDDDD", "#CCCCCC", "#BBBBBB", "#AAAAAA", "#A0A0A0", "#999999", "#888888", "#777777", "#666666", "#555555", "#444444", "#333333", "#222222", "#111111", "#000000"]
];
function createColorSelectDom(title, target, id) {
var colorsTable = { tag: "table", cellSpacing: "0", cellPadding: "0",
style: {borderLeft: "1px solid gray", borderTop: "1px solid gray"},
childs: [] }
for(var i=0; i<colorsChart.length; i++) {
var tds = [];
for(var j=0; j<colorsChart[i].length; j++) {
tds.push({ tag: "td",
childs: [
{ tag: "div",
style: {borderRight: "1px solid gray", borderBottom: "1px solid gray", background: colorsChart[i][j], width: "16px", height: "16px", cursor: "pointer"},
events: {onclick: "d567(\""+id+"_popup\",\"" + target + "\", \"" + colorsChart[i][j] + "\")"}
}
]
});
}
colorsTable.childs.push({tag: "tr", childs: tds});
}
return [
createButtonDom(title, "d565(\""+id+"\",\""+id+"_popup\")", "static/client/select_color.gif", id),
{ tag: "div", className: "panel", id: id+"_popup", display: false,
style: {position: "absolute", width: "298px"},
childs: [
{ tag: "div", className: "caption",
childs: [
createTableDom([{content: "<b>Select color</b>", width: "100%"},
{content: createButtonDom(false, "d566(\""+id+"_popup\")", "static/client/close.gif"), width: "1%"}
])
]
},
{ tag: "div", className: "content",
childs: [ colorsTable ]
}
]
}
]
}
// make interface
function createButtonDom(title, action, icon, id, img_id) {
if((icon != false) && (icon != null) && (icon != undefined)) {
if(title) {
var button =
{ tag: "span",
childs: [
{ tag: "img", id: img_id, src: icon,
style: { margin: "0px 4px 0px 0px", verticalAlign: "middle"}},
{ tag: "a", href: "void", events: {onclick: action}, innerHTML: title }
]}
if(id) button.childs[1].id = id;
} else {
var button = { tag: "a", href: "void", events: {onclick: action},
childs: [
{ tag: "img", id: img_id, src: icon}
]};
if(id) button.id = id;
}
} else {
var button = { tag: "a", href: "void", events: {onclick: action}, innerHTML: title};
if(id) button.id = id;
}
return button;
}
// tds: [{content:dom, width: ""}]
function createTableDom(tds, width) {
var table = { tag: "table", width: (width ? width : "95%"),
childs: {
tr: { tag: "tr",
childs: {} }
}
};
for(var i=0; i<tds.length; i++) {
if(typeof(tds[i].content) == "string") {
table.childs.tr.childs[i] = { tag: "td", width: tds[i].width, innerHTML: tds[i].content };
} else {
table.childs.tr.childs[i] = { tag: "td", width: tds[i].width,
childs: [tds[i].content] };
}
}
return table;
}
//content: array of doms. will be closed with panel sections
function createPanelDom(name, title, content) {
var m =
{ tag: "div", className: "panel",
display: false,
id: "panel_" + name,
childs: [
{ tag: "div", className: "panel_header",
childs: [
{ tag: "div", className: "panel_title",
innerHTML: title },
{ tag: "div", className: "panel_close_icon",
events: { onclick: "d456('panel_" + name + "')"} }
]}
]}
for(var i in content) {
m.childs.push({ tag: "div", className: "panel_section", childs: content[i] });
}
return m;
}
// CRC32
(function() {
var table = "00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D";
/* Number */
crc32 = function( /* String */ str, /* Number */ crc ) {
if( crc == window.undefined ) crc = 0;
var n = 0; //a number between 0 and 255
var x = 0; //an hex number
crc = crc ^ (-1);
for( var i = 0, iTop = str.length; i < iTop; i++ ) {
n = ( crc ^ str.charCodeAt( i ) ) & 0xFF;
x = "0x" + table.substr( n * 9, 8 );
crc = ( crc >>> 8 ) ^ x;
}
return crc ^ (-1);
};
})();
function Widget() {
this.d425 = {
title: ""
}
this.d426 =
{ tag: "div", className: "window", id: "window",
childs: [
{ tag: "div",
childs: [
{ tag: "table", className: "plan_table", style: { width: "100%"},
childs: [
{ tag: "tr",
childs: [
{ tag: "td", className: "window_caption_left" },
{ tag: "td", className: "window_caption_middle",
childs: [
{ tag: "div", className: "window_caption",
id: "caption" }
]},
{ tag: "td", className: "window_caption_right" }
]}
]}
]},
{ tag: "div", className: "window_setting", id: "settings"},
{ tag: "div", className: "window_content",
id: "content" },
{ tag: "div", className: "window_footer", id: "footer",
childs: [
{ tag: "table", className: "plan_table", style: {width: "100%"},
childs: [
{ tag: "tr",
childs: [
{ tag: "td", className: "window_footer_left" },
{ tag: "td", className: "window_footer_middle", innerHTML: "&nbsp;"},
{ tag: "td", className: "window_footer_right" }
]}
]}
]}
]}// d426
this.init = function() {
this.d428 = {};
this.id = null;
this.d429 = false;
this.d430 = true;
this.d431 = {};
this.d432 = false;
}
this.init();
this.open = function(parent, id, d431) {
this.d433(parent);
this.d434();
if(this.d428.window) {
this.d428.window.wid = this.id;
}
this.d435();
}
this.setParent = function(parentEl) {
this.d428.window.parentNode.removeChild(this.d428.window);
parentEl.appendChild(this.d428.window);
}
this.d433 = function(parent) {
this.d426.display = !this.cfg.isOpenHidden;
if(this.cfg.hasDrag) {
this.d426.events = { onmouseover: "d441(1)", onmouseout: "d441(0)"}
}
this.d436(parent, this.d426);
var m = [];
if(this.cfg.hasSizeBtn) {
m.push(
{ tag: "div",
className: "caption_left_element",
display: false,
id: "showhide_div",
childs: [
{ tag: "div", id: "btn_hide", className: "btn_hide",
title: loc.text("wbtn_hide"),
events: {onclick: "d442()"} },
{ tag: "div", id: "btn_show", className: "btn_show",
title: loc.text("wbtn_show"),
events: {onclick: "d442()"},
display: false}
]}
);
}
if(this.cfg.hasIcon) {
m.push(
{ tag: "div", id: "icon_div",
className: "caption_left_element",
childs: [
{ tag: "img", id: "icon", src: "widgets/"+this.cfg.module.toLowerCase()+"/ico.gif",
style: { width: "16px", height: "16px"}}
]}
);
}
m.push(
{ tag: "div", id: "title", className: "caption_title" }
);
if(this.cfg.hasCloseBtn) {
m.push(
{ tag: "a", href: "void",
title: loc.text("wbtn_close"),
className: "btn_close",
display: !this.cfg.hasDrag,
events: {onclick: "close()"},
id: "btn_close" }
);
}
if(this.cfg.hasSettingsBtn) {
m.push(
{ tag: "a", href: "void",
title: loc.text("wbtn_settings"),
className: "btn_settings",
display: !this.cfg.hasDrag,
events: {onclick: "d446()"},
id: "btn_settings" }
);
}
if(this.cfg.hasRefreshBtn) {
m.push(
{ tag: "a", href: "void",
title: loc.text("wbtn_refresh"),
className: "btn_refresh",
display: !this.cfg.hasDrag,
events: {onclick: "refresh()"},
id: "btn_refresh" }
);
}
this.d436(this.d428["caption"], m);
}
this.initDtagAndDrop = function() {
if(this.cfg.hasDrag) {
this.d428.caption.style.cursor = 'move';
this.d428.window.drag = new Drag(this.d428.window, this.d428.caption);
}
}
this.d434 = function() {
if(!this.d432) {
this.initDtagAndDrop();
}
this.d436(this.d428.settings,
{ tag: "div", className: "settings_section",
childs: [
{tag: "span", innerHTML: loc.text("inp_title"), className: "settings_label"},
{tag: "input", id: "input_title", type: "text", size: "15", className: "settings_control"},
{tag: "input", type: "button", value: loc.text("btn_set"), events: {onclick: "d449()"}, className: "settings_control"}
]}
);
this.d437();
}
this.disableOnClosePrompt = false;
this.d438 = false;
this.d439 = function() {
this.d438 = true;
this.disableOnClosePrompt = true;
this.close();
}
this.close = function() {
var flag = (this.cfg.hasOnCloseConfirm && !this.disableOnClosePrompt) ?
confirm(loc.text("desktop_confirm_widget_remove"))
:
true;
if(flag) {
this.onClose();
kernel.d460(this.id);
if(this.d428.window) {
deleteEl(this.d428.window);
this.d428.window.innerHTML = '';
this.d428.window = null;
}
this.d431 = false;
this.save();
if(this.cfg.hasDrag && !this.d438) {
desktop.d500();
}
}
}
this.d440 = function(html) {
this.d428.title.innerHTML = html;
}
this.d441 = function(mouse_in) {
if (mouse_in==1 || this.d430==false) {
if(this.cfg.hasCloseBtn && !this.d432)    this.d428.btn_close.style.display = 'block';
if(this.cfg.hasSettingsBtn) this.d428.btn_settings.style.display = 'block';
if(this.cfg.hasRefreshBtn)  this.d428.btn_refresh.style.display = 'block';
if(this.cfg.hasSizeBtn){
this.d428.showhide_div.style.display = 'block';
if(this.cfg.hasIcon) this.d428.icon_div.style.display = 'none';
}
}
else {
if(this.cfg.hasCloseBtn)    this.d428.btn_close.style.display = 'none';
if(this.cfg.hasSettingsBtn) this.d428.btn_settings.style.display = 'none';
if(this.cfg.hasRefreshBtn)  this.d428.btn_refresh.style.display = 'none';
if(this.cfg.hasSizeBtn){
this.d428.showhide_div.style.display = 'none';
if(this.cfg.hasIcon) this.d428.icon_div.style.display = 'block';
}
}
}
this.d442 = function() {
if(this.d429) {
this.show();
} else {
this.hide();
}
}
this.show = function() {
hideEl(this.d428.btn_show);
showEl(this.d428.btn_hide);
if(this.d428.content) {
showEl(this.d428.content);
}
this.d443();
this.d429 = false;
}
this.hide = function() {
hideEl(this.d428.btn_hide);
showEl(this.d428.btn_show);
if(this.d428.content) {
hideEl(this.d428.content);
}
this.d444();
this.d445();
this.d429 = true;
}
this.d446 = function() {
if(this.d430) {
this.d447();
} else {
this.d444();
}
}
this.d447 = function() {
this.d443Settings();
showEl(this.d428.settings);
this.d430 = !this.d430;
}
this.d444 = function() {
if(this.d428.settings) {
hideEl(this.d428.settings);
this.d430 = !this.d430;
}
}
this.attachEvent = function(el, e, cmd) {
var wid = this.id;
if(mozilla_nav) {
el.setAttribute(e, "kernel.getWidget("+wid+")."+cmd+";");
} else {
el[e] = new Function("kernel.getWidget("+wid+")."+cmd+";");
}
}
this.d436 = function(parentEl, data) {
if(data['tag']) {
var el = document.createElement(data.tag);
for (p in data) {
switch(p) {
case null, "tag", "childs": break;
case "id":
this.d428[data.id] = el;
break;
case "style":
for(var s in data.style) {
el.style[s] = data.style[s];
}
break;
case "options":
for(var i in data.options) {
el.options.add(new Option(data.options[i].text, data.options[i].value));
if(data.options[i].isBold) {
el.options[el.options.length - 1].style.fontWeight = "bold";
}
}
break;
case "src":
var src = data.src;
if(src.indexOf("http") == -1) {
src = "http://"+baseUrl+src;
}
if(ie_nav) {
var setSrc = function() { el.src = src }
setTimeout(setSrc, 200);
} else {
el.src = src;
}
break;
case "display":
if(!data[p]) {
el.style.display = 'none';
}
break;
case "href":
if(data.href == "void") {
el.href = "javascript:void(0);";
} else if(data.tag == "a") {
this.attachEvent(el, "onclick", data.href);
el.href = "javascript:void(0);";
} else {
el.href = data.href;
}
break;
case "html":
el.innerHTML = data.html;
break;
case "sysHref":
el.href = data.sysHref;
break;
case "events":
var wid = this.id;
if(typeof(data.events) == "object") {
for(var e in data.events) {
this.attachEvent(el, e, data.events[e]);
}
}
break;
case "sysEvents":
if(typeof(data.sysEvents) == "object") {
for(var e in data.sysEvents) {
el.setAttribute(e, data.sysEvents[e]+";");
}
}
break;
default:
el[p] = data[p];
break;
}
}
parentEl.appendChild(el);
if(data.tag == "table") {
parentEl = el;
var el = document.createElement("tbody");
if(data.id) {
this.d428[data.id+"_tbody"] = el;
}
parentEl.appendChild(el);
}
if(data.childs) {
this.d436(el, data.childs);
}
} else {
for(var e in data) {
this.d436(parentEl, data[e]);
}
}
}
this.d449 = function() {
var t = trim(this.d428.input_title.value);
if(t != this.d431.title) {
this.d431.title = t
this.d440(t);
this.save();
}
}
this.save = function() {
d431r.d524(this);
}
this.d435 = function() {}
this.d437 = function() {}
this.onClose = function() {}
this.d443 = function() {}
this.d445 = function() {}
this.d443Settings = function() {}
this.d450 = function() {}
this.d454 = function() {}
this.refresh = function() {}
this.d455 = function() {}
// SYS
this.d456 = function(id) {
if(this.d428[id]) {
this.d428[id].style.display = 'none';
}
}
this.d457 = function(id, display) {
if(this.d428[id]) {
this.d428[id].style.display = display ? display : 'block';
}
}
}
DRAG_NONE = 0;
DRAG_MOVE = 1;
DRAG_ANIM = 1;
Drag = function(win, caption) {
var div = win;
var action = DRAG_NONE;
var dragging = false;
var targetPos = {left: 0, top: 0};
var animSteps = 5;
var animFrame = 0;
var offset = {left: 0, top: 0};
var tid = null;
function calcOffset(event) {
event = fix_event(event);
var pos = getElPos(div);
offset.left = event.clientX - pos.left;
offset.top = event.clientY - pos.top;
}
function drag(event) {
event = fix_event(event);
if(action == DRAG_MOVE) {
var l = event.clientX - offset.left;
var h = event.clientY - offset.top;
div.style.left = l + "px";
div.style.top = h + "px";
desktop.d505({left: l + Math.ceil(div.offsetWidth / 2),
top: h + 16});
}
}
function processAnimation() {
var f = function() {
clearTimeout(tid);
animFrame ++;
if(animFrame < animSteps) {
var dPos = {
left: div.offsetLeft,
top: div.offsetTop
}
var newPos = {
left: Math.floor(dPos.left + (targetPos.left - dPos.left) / animSteps),
top: Math.floor(dPos.top + (targetPos.top - dPos.top) / animSteps)
}
div.style.left = newPos.left + "px";
div.style.top = newPos.top + "px";
tid = setTimeout(f, 50);
} else {
placeWindow();
}
}
tid = setTimeout(f, 50);
}
function stopDrag(event) {
event = fix_event(event);
document.onmousemove = null;
document.onmouseup = null;
document.ondrag = null;
document.body.onselectstart = null;
document.onselectstart = null;
targetPos = getElPos(desktop.d428.area);
targetPos.top -= 14;
animFrame = 0;
action = DRAG_ANIM;
processAnimation();
}
function placeWindow() {
clearTimeout(tid);
div.style.position = 'static';
desktop.d428.area.parentNode.insertBefore(div, desktop.d428.area);
div.style.width = 'auto';
desktop.d504();
desktop.d500();
action = DRAG_NONE;
}
function startDrag(event) {
event = fix_event(event);
if(action != DRAG_NONE) {
return false;
}
document.ondrag = function () { return false; }
document.body.ondrag = function () { return false; }
document.onselectstart = function () { return false; }
document.body.onselectstart = function () { return false; }
action = DRAG_MOVE;
calcOffset(event);
document.onmousemove = function(event) { drag(event) }
document.onmouseup = function(event) { stopDrag(event) }
putEl(div);
}
function putEl(el) {
var left = getLeft(el);
var top = getTop(el);
var width = el.offsetWidth;
desktop.d503(el);
el.parentNode.removeChild(el);
document.body.appendChild(el);
el.style.position = 'absolute';
el.style.left = left + "px";
el.style.top = top + "px";
el.style.width = width + "px";
}
caption.onmousedown = function(event) {
event = fix_event(event);
if(action == DRAG_MOVE) {
stopDrag(event);
} else {
var e = event.target;
while(e.onclick == null && e != this) {
e = e.parentNode;
}
if(e == this) startDrag(event);
}
}
function fix_event(event) {
if (!event) {
event = window.event;
}
if (event.target) {
if (event.target.nodeType == 3) event.target = event.target.parentNode
} else if (event.srcElement) {
event.target = event.srcElement
}
return event
}
}
// events: onstart, onover, onstop
// mode: drag, menu, all
EntityHandler = function(el, mode, events) {
var div = el;
var divClone = null;
var dragging = false;
var offset = {left: 0, top: 0};
var startPos = {left: 0, top: 0};
var events = events ? events : {};
var belongElement = null;
function waitForDrag(event) {
event = fix_event(event);
if( (Math.abs(event.clientX - startPos.left) > 4) || (Math.abs(event.clientY - startPos.top) > 4)) {
//            desktop.isFileDrag = true;
dragging = true;
offset = {left: div.offsetWidth + 2,
top: div.offsetHeight + 2};
document.onmousemove = function(e) { drag(e) }
document.onmouseup = function(e) { stopDrag(e) }
divClone = div.cloneNode(true);
divClone.style.cssText = divClone.style.cssText + ";opacity: 0.75; -moz-opacity: 0.75; -khtml-opacity: 0.75; filter: alpha(opacity=75);";
document.body.appendChild(divClone);
divClone.style.position = 'absolute';
divClone.style.width = div.offsetWidth + "px";
divClone.style.height = div.offsetHeight + "px";
if(events.d450Start) {
events.d450Start(div.entityInfo);
}
if(event.target.entityInfo && events.onElementOver) {
events.onElementOver(event.target.entityInfo);
}
}
}
function drag(event) {
if(dragging) {
event = fix_event(event);
divClone.style.left = event.clientX + 2 + "px";
divClone.style.top = event.clientY + 2 + "px";
if(event.target.entityInfo && events.onElementOver) {
events.onElementOver(event.target.entityInfo);
}
}
}
function startDrag(event) {
event = fix_event(event);
document.ondrag = function () { return false; }
document.body.ondrag = function () { return false; }
document.onselectstart = function () { return false; }
document.body.onselectstart = function () { return false; }
document.onmousemove = function(e) { waitForDrag(event) }
document.onmouseup = function(e) { stopDrag(event) }
startPos = {left: event.clientX, top: event.clientY};
return false;
}
function stopDrag(event) {
event = fix_event(event);
document.onmousemove = null;
document.onmouseup = null;
document.ondrag = null;
document.body.onselectstart = null;
document.onselectstart = null;
desktop.isFileDrag = false;
if(div.onmouseout) {
div.onmouseout();
}
if(divClone) {
deleteEl(divClone);
}
if(events.d450Stop && dragging) {
events.d450Stop(div.entityInfo);
}
dragging = false;
}
switch(mode) {
case "tabs_drag":
div.onmousedown = function(event) {
desktop.d488Options();
event = fix_event(event);
if(dragging) {
stopDrag(event);
} else {
startDrag(event);
}
if (event.stopPropagation) {
event.stopPropagation();
event.preventDefault();
} else if(window.event) {
window.event.cancelBubble = true;
window.event.returnValue = false;
}
return false;
}
}
}
function startPage() {
request = new Request();
xmlRequest = new XMLRequest();
kernel = new Kernel();
loc = new Loc();
loc.onLoad = function() {
auth = new Auth();
auth.id = kernel.getUniqueId(auth);
kernel.d459(auth);
auth.onLoad = function() {
d431r = new Profiler();
d431r.id = kernel.getUniqueId(d431r);
kernel.d459(d431r);
d431r.onLoad = function() {
desktop = kernel.d461("Desktop", elById("desktop_body"));
auth.open(desktop.addPage("auth"));
settings = kernel.d461("Settings", desktop.addPage("settings"));
menu = kernel.d461("Menu", document.body);
feedback = kernel.d461("Feedback", desktop.addPage("feedback"));
custompage = kernel.d461("Custompage", desktop.addPage("custompage"));
sendtofriend = kernel.d461("SendToFriend", desktop.addPage("sendtofriend"));
rssreader = kernel.d461("RssReader", desktop.addPage("rssreader"));
flashPlayer = kernel.d461("FlashPlayer", desktop.addPage("flashplayer"));
desktop.d509();
}
d431r.d525();
}
auth.start();
}
loc.start();
}
SYS_WIDGETS_ID = 1;
USER_WIDGETS_ID = 100;
cfgWidget = {
hasIcon: true,
hasSizeBtn: true,
hasCloseBtn: true,
hasRefreshBtn: true,
hasSettingsBtn: true,
hasDrag: true,
hasOnCloseConfirm: true,
hasProfile: true,
isOpenHidden: false,
isSystem: false,
title: "",
module: "base",
uniqueId: false,
saveMethod: "GET"
}
function Kernel() {
this.widgets = [];
this.getUniqueId = function(w) {
if(w.cfg.uniqueId) {
return w.cfg.uniqueId;
} else {
var newId = USER_WIDGETS_ID;
while(this.widgets[newId]) newId++;
return newId;
}
}
this.getWidget = function(id) {
return this.widgets[id];
}
this.d459 = function(widget) {
this.widgets[widget.id] = widget;
}
this.d460 = function(id) {
this.widgets[id] = null;
}
this.d461 = function(className, parent, id, d431, objvars) {
var code = 'var w = new ' + className + '();';
try {
eval(code);
} catch(e) {
// Debug info
// alert("Can't run '" + className + "' widget.\n" + e.message);
}
if(w) {
d431 = d431 || false;
w.id = id ? id : this.getUniqueId(w);
if(typeof(objvars) == "object") {
for(var i in objvars) {
w[i] = objvars[i];
}
}
kernel.d459(w);
for(var c in cfgWidget) {
if(typeof(w.cfg[c]) == "undefined") {
w.cfg[c] = cfgWidget[c];
}
}
if(w.cfg.hasProfile) {
d431r.d523(w);
if(d431) {
for(var p in d431) {
w.d431[p] = d431[p];
}
}
}
w.open(parent, false, d431);
return w;
}
}
this.d462 = [];
this.d463 = function(d603, period, noAction) {
if(kernel.widgets[d603]) {
if(noAction != true) {
kernel.getWidget(d603).d454();
}
kernel.d462[d603] = setTimeout("kernel.d463("+d603+","+period+")", period);
}
}
this.d464 = function(d603) {
if(this.d462[d603] != undefined) {
clearTimeout(this.d462[d603]);
this.d462[d603] = undefined;
}
}
}
/*******************************************
*
*   Languages data
*
*******************************************/
function Loc() {
this.data = {};
this.start = function() {
this.lang = getCookie("lng");
if(this.lang == "") {
this.lang = "EN";
}
request.d424("lang/" + this.lang.toLowerCase() + ".xml", this, "d465");
}
this.swapLang = function(lang) {
setCookie('lng', lang);
window.location.reload(true);
}
this.d465 = function(xml) {
this.data = this.d466(xml, "string", "id");
this.onLoad();
}
this.text = function(id, param) {
var text = this.data[id] ? this.data[id] : "loc:" + id;
if(param && text != '') {
if(typeof(param) == "object") {
for(var i in param) {
var mask = new RegExp("%"+i+"%", "ig");
text = text.replace(mask, param[i]);
}
return text;
} else {
return text.replace(/(%\w*%)/ig, param);
}
}
return text;
}
this.d466 = function(node, tagName, key) {
var hash = {};
if(node) {
var nodes = node.getElementsByTagName(tagName);
for(var i=0; i<nodes.length; i++) {
hash[nodes[i].getAttribute(key)] = nodes[i].firstChild ? nodes[i].firstChild.nodeValue : "";
}
}
return hash;
}
this.onLoad = function() {}
}
function Desktop() {
this.init();
this.cfg = {
hasSizeBtn: false,
hasCloseBtn: false,
hasRefreshBtn: false,
hasSettingsBtn: false,
hasDrag: false,
hasOnCloseConfirm: false,
isSystem: true,
title: "",
module: "desktop",
uniqueId: SYS_WIDGETS_ID + 1,
saveMethod: "POST"
}
this.d425["title"] = "";
this.d425["theme"] = "default";
this.d425["tabs"] = []; // [ {t: title, c: columner_id, i }, ...]
this.d425["order"] = []; // array of tab indexes
this.d426 = [
{ tag: "div", display: false, id: "tmp" },
{ tag: "div", id: "content", display: false,
childs: [
{ tag: "div", className: "destop_header",
childs: [
{ tag: "div", id: "top_line", className: "desktop_title",
childs:[
{ tag: "span", id: "title_box", className: "desktop_title_box"},
{ tag: "input", id: "title_input", className: "desktop_title_input", display: false}
]},
{ tag: "div", className: "section", style: {height: "1px", overflow: "hidden"},
childs:[
{ tag: "span", id: "title_box_tmp", className: "desktop_title_box"}
]},
{ tag: "div", className: "float_panel", id: "tray",
childs: [
{ tag: "div", className: "float_left",
childs: [
createButtonDom(loc.text("menu_title"), "d470()", "widgets/menu/ico.gif")
]},
{ tag: "div", className: "float_right",
childs: [
createButtonDom(loc.text("desktop_show_all"), "d507()"),
{ tag: "span", innerHTML: "&nbsp;&nbsp;|&nbsp;&nbsp;" },
createButtonDom(loc.text("desktop_hide_all"), "d508()"),
{ tag: "span", innerHTML: "&nbsp;&nbsp;|&nbsp;&nbsp;" },
createButtonDom(loc.text("desktop_lnk_settings"), "showPage(\"settings\")", "static/client/settings.gif"),
{ tag: "span", innerHTML: "&nbsp;&nbsp;|&nbsp;&nbsp;" },
{ tag: "span", id: "authButton" }
]}
]}
]},
{ tag: "div", id: "pager",
childs: [
{ tag: "div", id: "page_panels" }
]},
{ tag: "div", id: "pages", style: { width: "auto", margin: "0 14% 0 16%" } },
{ tag: "div", align: "center",
style: { marginTop: "22px"},
childs: [
{ tag: "span", className: "footer", align: "center", innerHTML: desktopLangsHTML},
{ tag: "br"},{ tag: "br"},
{ tag: "span", id: "bottom_links_0", align: "center",
childs: [
{ tag: "a", href: "showPage('feedback')",
html: loc.text('desktop_lnk_user_feedback') },
{ tag: "span", html: "&nbsp;&nbsp;|&nbsp;&nbsp;" },
{ tag: "a", href: "showPage('sendtofriend')",
html: loc.text('desktop_lnk_sendtofriend') },
{ tag: "span", html: "&nbsp;&nbsp;|&nbsp;&nbsp;",
display: (mozilla_nav || ie_nav)
},
{ tag: "a", href: "d511('feedback')",
display: (mozilla_nav || ie_nav) ,
html: loc.text('desktop_lnk_favorites') }
]},
{ tag: "span", id: "custom_pages_links", align: "center" },
{ tag: "span", innerHTML: "&nbsp;<br>"}
]}
]},
{ tag: "div", id: "area", className: "area", name: "area", display: false},
{ tag: "div", id: "tab_area", className: "tab_area", name: "area", display: false},
]
this.d467 = null;
this.d435 = function() {
this.d436(document.body, { tag: "link", id: "themes_loader", rel: "stylesheet", media: "screen"});
this.d468();
this.d436(this.d428["page_panels"],
createPanelDom("tab", loc.text("desktop_tab_options"), [
[ { tag: "span", innerHTML: "Title: "},
{ tag: "input", type: "text", id: "input_tab_title" },
{ tag: "input", type: "button", value: loc.text("btn_set"),
events: { onclick: "d492()" }} ],
[ { tag: "div", innerHTML: loc.text("desktop_select_tab_icon")},
{ tag: "div", id: "tab_icons_box" },
{ tag: "div",
childs: [
{ tag: "a", href: "void",
innerHTML: loc.text("desktop_delete_tab_icon"),
events: { onclick: "d494()"}}
]}],
[ { tag: "span", innerHTML: loc.text("desktop_panels_count") },
{ tag: "input", type: "button", value: " 1 ",
events: { onclick: "d496(1)" }},
{ tag: "input", type: "button", value: " 2 ",
events: { onclick: "d496(2)" }},
{ tag: "input", type: "button", value: " 3 ",
events: { onclick: "d496(3)" }},
{ tag: "input", type: "button", value: " 4 ",
events: { onclick: "d496(4)" }} ]
]))
this.d428["panel_tab"].style.position = "absolute";
this.d428["panel_tab"].style.width = "250px";
if (customPagesHTML != '') {
this.d428["custom_pages_links"].innerHTML += "&nbsp;|&nbsp;"+customPagesHTML;
}
}
////////////////////////////
// Main menu
this.d469 = false;
this.d470 = function() {
if(this.d469) {
menu.hide();
} else {
menu.show();
}
}
// Pages
this.d471 = "panels";
this.addPage = function(name) {
//        this.d436(document.body,
this.d436(this.d428["pages"],
{ tag: "div", id: "page_" + name, display: false });
return this.d428["page_" + name];
}
this.showPage = function(name) {
this.d456("page_" + this.d471);
this.d457("page_" + name);
this.d471 = name;
}
this.d472 = function() {
this.d456("page_" + this.d471);
this.d457("page_panels");
this.d471 = "panels";
}
///////////////////////////
// System
this.d433 = function(parent) {
this.d436(parent, this.d426);
}
this.d434 = function() {
//title
if(this.d431["title"] == "") {
this.d431["title"] = loc.text("desktop_title_prompt");
}
with(this.d428) {
var t = this.d431["title"].jsUnescape();
if(t == "") {
t = this.d425.title;
}
document.title = t;
title_box.innerHTML = text2html(t);
title_box.onclick = function() { desktop.d473(); };
title_box_tmp.innerHTML = text2html(t);
title_input.value = t;
}
this.d436(this.d428["page_panels"],
{ tag: "div", className: "tab_panel",
id: "tabs",
childs: [
{ tag: "div", id: "add_page_button",
className: "tab_box",
events: {onclick: "d477()"},
childs: [
{ tag: "div", className: "tab_left" },
{ tag: "div", className: "tab_middle",
childs: [
{ tag: "div", className: "tab_add_icon" }
]},
{ tag: "div", className: "tab_right" }
]}
]});
this.showPage('panels');
}
// TITLE EDITING
this.d473 = function() {
with(this.d428) {
var w = title_box_tmp.offsetWidth;
title_box.style.display = 'none';
title_input.style.display = 'inline';
title_input.style.width = (w+4)+"px";
title_input.focus();
title_input.select();
title_input.onkeyup = function(e) {
e = fix_event(e);
if(e.keyCode == 13) {
this.onblur();
} else {
document.title = this.value;
desktop.d428.title_box_tmp.innerHTML = this.value;
this.style.width = (desktop.d428.title_box_tmp.offsetWidth+4) + "px";
}
}
title_input.onblur = function() {
text = trim(this.value.replace(/\\/g, ""));
if(text == "") {
text = desktop.d425["title"];
}
this.onblur = null;
this.style.display = 'none';
with(desktop.d428) {
title_box.innerHTML = text2html(text);
title_box.style.display = 'inline';
title_box.onclick =  function() { desktop.d473(); };
}
document.title = text;
//                var t = escape(text);
if(text != desktop.d431["title"]) {
desktop.d431["title"] = text.jsEscape();
desktop.save();
}
}
}
}
// TABS
this.d474 = [];
this.d475 = false;
this.d476 = function() {
return this.d431["order"].length + 1;
}
this.d477 = function() {
var title = loc.text("desktop_tab_title") + this.d476();
var idx = arrayFirstFree(this.d431.tabs);
this.d474[idx] = kernel.d461("Columner", document.body);
this.d474[idx].d431["pcount"] = this.d478;
this.d474[idx].save();
this.d431.tabs[idx] = {
t: title,
i: "",
cid: this.d474[idx].id
}
this.d431["order"][idx] = idx;
this.save();
this.d436(this.d428["page_panels"],
this.d479(idx, this.d478));
this.d480(idx, title);
this.d481(idx);
//        this.showDebug();
}
this.d482 = function(icon) {
return "static/tab_icons/" + icon + ".gif";
}
this.d480 = function(n, title, icon) {
var icon_src = icon ? this.d482(icon) : "";
this.d436(this.d428.tmp,
{ tag: "div", id: "tab_"+n,
className: "tab_box",
entityInfo: { type: "tab", idx: n},
events: {onclick: "d481('"+n+"')"},
childs: [
{ tag: "div", className: "tab_left" },
{ tag: "div", className: "tab_middle",
childs: [
{ tag: "div", className: "tab_icon",
childs: [
{ tag: "img", id: "tab_icon_" + n,
src: icon_src,
display: (icon_src != "") }
]},
{ tag: "div", className: "tab_title",
id: "tab_title_" + n,
innerHTML: title },
{ tag: "div", className: "tab_controls",
childs: [
{ tag: "div", className: "tab_close_btn",
events: { onclick: "d495('" + n + "')" }},
{ tag: "div", className: "tab_options_btn",
events: { onclick: "d481Options('" + n + "')" }}
]}
]},
{ tag: "div", className: "tab_right" }
]});
this.d428["tabs"].insertBefore(this.d428["tab_"+n], this.d428["add_page_button"]);
var eh = new EntityHandler(this.d428["tab_"+n], "tabs_drag",
{ d450Start: desktop.d484,
onElementOver: desktop.d485,
d450Stop: desktop.d486});
}
// Drag&drop tabs
this.d483 = null;
this.d484 = function(info) {
}
this.d485 = function(info) {
if(info.type == "tab") {
desktop.d483 = info;
desktop.d457("tab_area");
//dimk
desktop.d428["tab_" + info.idx].parentNode.insertBefore(desktop.d428["tab_area"], desktop.d428["tab_" + info.idx]);
}
}
this.d486 = function(info) {
if((desktop.d483 != null) &&
(desktop.d483.type == "tab") &&
(desktop.d483.idx != info.idx)) {
desktop.d428["tab_" + info.idx].parentNode.insertBefore(
desktop.d428["tab_" + info.idx],
desktop.d428["tab_area"]);
for(var i=0; i< desktop.d431["order"].length; i++) {
if(desktop.d431["order"][i] == desktop.d483.idx) {
var belongIdx = i;
}
if(desktop.d431["order"][i] == info.idx) {
var dragIdx = i;
}
}
desktop.d431["order"].splice(
belongIdx - (belongIdx > dragIdx ? 1 : 0),
0,
desktop.d431["order"].splice(dragIdx, 1)[0]);
desktop.save();
}
this.d483 = null;
desktop.d456("tab_area");
}
// show/hide tabs
this.d487 = null;
this.d488 = function(idx) {
this.d488Options();
this.d428["tab_" + idx].className = "tab_box";
}
this.d481 = function(idx) {
if(this.d487 != null && this.d487 != idx) {
this.d488(this.d487);
this.d456("tab_container_" + this.d487);
}
this.d487 = idx;
this.d428["tab_" + idx].className = "tab_box_selected";
this.d457("tab_container_" + idx);
}
// tab options
this.d481Options = function(idx) {
this.d428["input_tab_title"].value = this.d431.tabs[idx].t;
var pos = getElPos(this.d428["tab_" + idx]);
this.d457("panel_tab");
this.d428["panel_tab"].style.left = Math.min(pos.left, (document.body.clientWidth - 255)) + "px";
this.d428["panel_tab"].style.top = (pos.top + this.d428["tab_" + idx].offsetHeight + 4) + "px";
this.d428["panel_tab"].style.zIndex = 1000000;
if(!this.d475) {
this.d475 = true;
for(var i=0; i< this.d491.length; i++) {
this.d436(this.d428["tab_icons_box"],
{ tag: "a", href: "void",
events: { onclick: "d493('" + this.d491[i] + "')"},
innerHTML: "<img src='" + this.d482(this.d491[i]) + "' style='margin: 1px;'>"});
}
}
}
this.d488Options = function() {
this.d456("panel_tab");
}
// tab managment
this.d492 = function() {
var t = trim(this.d428["input_tab_title"].value);
this.d431.tabs[this.d487].t = t;
this.d428["tab_title_" + this.d487].innerHTML = t;
//        this.showDebug();
this.save();
}
this.d493 = function(icon) {
this.d457("tab_icon_" + this.d487);
this.d428["tab_icon_" + this.d487].src = this.d482(icon);
this.d431.tabs[this.d487].i = icon;
//        this.showDebug();
this.save();
}
this.d494 = function() {
this.d456("tab_icon_" + this.d487);
this.d431.tabs[this.d487].i = "";
//        this.showDebug();
this.save();
}
this.d495 = function() {
if(confirm(loc.text("desktop_close_page_prompt"))) {
this.d488Options();
var widgets = this.d474[this.d487].d431["widgets"];
for(var i in widgets) {
var w = kernel.getWidget(widgets[i].id);
if(w) {
w.d439();
}
}
this.d474[this.d487].close();
deleteEl(this.d428["tab_" + this.d487]);
deleteEl(this.d428["tab_container_" + this.d487]);
delete this.d431["tabs"][this.d487];
for(var o in this.d431["order"]) {
if(this.d431["order"][o] > this.d487) {
this.d431["order"][o] --;
}
}
for(var o in this.d431["order"]) {
if(this.d431["order"][o] == this.d487) {
this.d431["order"].splice(o, 1);
break;
}
}
//            this.showDebug();
this.save();
this.d487 = null;
for(var i=0; i<this.d431.tabs.length; i++) {
if(this.d431.tabs[i] != undefined) {
this.d487 = i;
continue;
}
}
if(this.d487 != null) {
this.d481(this.d487);
}
}
}
/* PANELS */
this.d478 = 3;
//dimk
this.d496 = function(n) {
if(n == this.d474[this.d487].d431["pcount"]) {
return;
}
for(var p=0; p<this.d497(); p++) {
var panel = this.d498(p);
for(; panel.childNodes.length>0; ) {
var wid = panel.childNodes[0].wid;
this.d428["tmp"].appendChild(kernel.getWidget(wid).d428.window);
}
}
for(var i=0; i<this.d497(); i++) {
deleteEl(this.d428["panel_" + this.d487 + "_" + i]);
}
deleteEl(this.d428["tab_container_" + this.d487]);
this.d436(this.d428["page_panels"], this.d479(this.d487, n));
this.d474[this.d487].d431["pcount"] = n;
this.d474[this.d487].save();
for(;this.d428["tmp"].childNodes.length > 0;) {
this.d499().appendChild(this.d428["tmp"].childNodes[0]);
}
this.d500();
}
this.d479 = function(tab_idx, count) {
var p = [];
var pwidth = Math.round(100 / count) + "%";
for(var i=0; i<count; i++) {
p.push(
{ tag: "td",
width: pwidth,
style: { paddingBottom: "50px", width: pwidth, verticalAlign: "top"},
id: "panel_" + tab_idx + "_" + i });
}
var m =
{ tag: "div", id: "tab_container_" + tab_idx,
childs: [
{ tag: "table",
className: "panels_table",
width: "100%",
childs: [
{ tag: "tr", childs: p }
]}
]}
return m;
}
// Panels managment
this.d498 = function(n) {
if(n > this.d497()-1) {
n = this.d497()-1;
}
return this.d428["panel_" + this.d487 + "_" + n];
}
this.d497 = function() {
return this.d474[this.d487] ? this.d474[this.d487].d431["pcount"] : -1;
}
this.d499 = function() {
if(this.d487 == null) {
this.d477();
}
var p = 0;
var minh = 100000;
for(var i = this.d497()-1; i>=0; i--) {
var h = 0;
panel = this.d498(i);
for(var j=0; j<panel.childNodes.length; j++) {
h += panel.childNodes[j].offsetHeight;
}
if(h <= minh) {
minh = h;
p = i;
}
}
return this.d498(p);
}
////////////////////////////////
// Drag and drop
this.d501 = function(pos) {
for(var i=0; i<this.d497(); i++) {
if(isPosInObj(pos, this.d498(i))) {
return this.d498(i);
}
}
return null;
}
this.d502 = function(panel, pos) {
for(var i=0; i<panel.childNodes.length; i++) {
if(isPosInObj(pos, panel.childNodes[i])) {
return panel.childNodes[i];
}
}
return null;
}
this.d503 = function(el) {
with(this.d428) {
area.style.position = 'relative';
el.parentNode.insertBefore(area, el);
area.style.height = el.offsetHeight + "px";
area.style.display = 'block';
}
}
this.d504 = function() {
with(this.d428) {
area.style.height = 0;
area.style.display = 'none';
area.parentNode.removeChild(area);
}
}
this.d505 = function(pos) {
p = this.d501(pos);
if(p) {
if(p.hasChildNodes()) {
w = this.d502(p, pos);
if(w) {
if(w.name != 'area') {
w = this.d502(p, pos);
p.insertBefore(this.d428.area, w);
}
} else {
this.d428.area.parentNode.removeChild(this.d428.area);
p.appendChild(this.d428.area);
}
} else {
this.d428.area.parentNode.removeChild(this.d428.area);
p.appendChild(this.d428.area);
}
}
}
this.d506 = function(pos) {
if(this.d487 == null) {
this.d477();
}
panel = this.d501(mpos);
if(panel) {
drag.el.parentNode.removeChild(drag.el);
panel.insertBefore(drag.el, this.d428.area);
}
}
this.d507 = function() {
for(var p=0; p<this.d497(); p++) {
for(var i=0; i<this.d498(p).childNodes.length; i++) {
var wid = this.d498(p).childNodes[i].wid;
if(wid) {
kernel.getWidget(wid).show();
}
}
}
}
this.d508 = function() {
for(var p=0; p<this.d497(); p++) {
for(var i=0; i<this.d498(p).childNodes.length; i++) {
var wid = this.d498(p).childNodes[i].wid;
if(wid) {
kernel.getWidget(wid).hide();
}
}
}
}
// SAVE/LOAD DESKTOP
this.d500 = function() {
var n = 0;
var panelsCount = this.d497();
if(this.d474[this.d487]) {
this.d474[this.d487].d431["widgets"] = [];
for(var p=0; p<panelsCount; p++) {
for(var i=0; i<this.d498(p).childNodes.length; i++) {
var wid = this.d498(p).childNodes[i].wid;
if(wid) {
this.d474[this.d487].d431["widgets"].push(
{ m: kernel.getWidget(wid).cfg.module,
id:wid,
p: p});
}
}
}
this.d474[this.d487].save();
}
}
this.d509 = function() {
for(var o in this.d431["order"]) {
var i = this.d431["order"][o];
if(this.d431.tabs[i] == undefined) {
continue;
}
this.d480(i, this.d431.tabs[i].t, this.d431.tabs[i].i);
this.d474[i] = kernel.d461("Columner", document.body, this.d431.tabs[i].cid);
this.d436(this.d428["page_panels"],
this.d479(i, this.d474[i].d431["pcount"]));
this.d481(i);
var widgets = this.d474[i].d431["widgets"];
for(var j in widgets) {
kernel.d461(widgets[j].m,
this.d498(widgets[j].p),
widgets[j].id);
}
}
for(var o in this.d431["order"]) {
var i = this.d431["order"][o];
if(this.d431.tabs[i] != undefined) {
this.d481(i);
break;
}
}
if(_GET["add_url"]) {
url = _GET["add_url"];
if(url.indexOf("http://") == -1) {
url = "http://"+url;
}
if(_GET["type"] == "api")  {
var w = kernel.d461("Browser", this.d499(), false, {home_page: url});
w.save();
this.d500();
} else {
this.d467 = url;
xmlRequest.send(url, this, "d510");
}
}
this.d457("content");
hideEl(elById("loading_note"));
showEl(elById("page_header"));
showEl(elById("page_footer"));
}
this.d510 = function(response) {
if(response.responseXML.documentElement) {
var channel = XMLParser.xml2hash(response.responseXML.documentElement);
if(channel) {
menu.d546(channel.title, this.d467);
var w = kernel.d461("Rss", this.d499(), false, {url: this.d467});
w.save();
this.d500();
return;
}
}
}
this.showDebug = function() {
elById("DEBUG").innerHTML = "<pre>" + Dump(this.d431.tabs) + "</pre>";
}
/* THEMES */
this.d468 = function() {
this.d428["themes_loader"].href = "themes/" + this.d431["theme"] + "/theme.css?v=" + (Math.random() * 1000000);
}
this.d511 = function() {
var url = "http://" + baseUrl;
if(mozilla_nav) {
window.sidebar.addPanel(this.d431["title"], url, "");
} else if(ie_nav) {
window.external.AddFavorite(url, this.d431["title"]);
}
}
}
Desktop.prototype = new Widget();
/* columner */
function Columner() {
this.init();
this.cfg = {
hasSizeBtn: false,
hasCloseBtn: false,
hasRefreshBtn: false,
hasSettingsBtn: false,
hasDrag: false,
hasOnCloseConfirm: false,
isSystem: true,
title: "",
module: "columner"
}
this.d425["widgets"] = [];
this.d425["pcount"] = 3;
this.d425["config"] = "";
this.d433 = function(parent) {}
this.d434 = function() {}
}
Columner.prototype = new Widget();
Desktop.prototype.d491 = [
"anchor",
"attach",
"basket",
"bomb",
"book",
"book_addresses",
"book_open",
"brick",
"briefcase",
"bug",
"cake",
"calendar_view_day",
"calendar_view_month",
"camera",
"car",
"cd",
"chart_bar",
"chart_curve",
"chart_organisation",
"chart_pie",
"clock",
"clock_red",
"cog",
"coins",
"color_swatch",
"comment",
"computer",
"connect",
"creditcards",
"door",
"door_open",
"drink",
"drink_empty",
"email",
"email_open",
"email_open_image",
"emoticon_evilgrin",
"emoticon_grin",
"emoticon_happy",
"emoticon_smile",
"emoticon_surprised",
"emoticon_tongue",
"emoticon_unhappy",
"emoticon_waii",
"emoticon_wink",
"exclamation",
"eye",
"feed",
"flag_blue",
"flag_green",
"flag_orange",
"flag_pink",
"flag_purple",
"flag_red",
"flag_yellow",
"folder",
"heart",
"hideMod",
"house",
"image",
"info",
"information",
"ipod",
"keyboard",
"layout",
"lightbulb",
"lightbulb_off",
"lock",
"lock_open",
"lorry",
"lorry_flatbed",
"magnifier",
"money",
"money_dollar",
"money_euro",
"money_pound",
"money_yen",
"monitor",
"mouse",
"music",
"new",
"note",
"note_002",
"page",
"page_copy",
"page_white",
"page_white_acrobat",
"page_white_code",
"page_white_compressed",
"page_white_excel",
"page_white_flash",
"page_white_php",
"page_white_picture",
"page_white_powerpoint",
"page_white_text",
"page_white_word",
"page_white_world",
"palette",
"paste_plain",
"pencil",
"phone",
"photo",
"picture",
"printer",
"printer_empty",
"rainbow",
"rosette",
"server",
"shield",
"sport_8ball",
"sport_basketball",
"sport_football",
"sport_golf",
"sport_raquet",
"sport_shuttlecock",
"sport_soccer",
"sport_tennis",
"star",
"stop",
"tag_blue",
"tag_green",
"tag_orange",
"tag_pink",
"tag_purple",
"tag_red",
"tag_yellow",
"telephone",
"television",
"thumb_down",
"thumb_up",
"trash",
"tux",
"user",
"user_female",
"user_gray",
"user_green",
"user_orange",
"user_red",
"user_suit",
"vcard",
"weather_clouds",
"weather_cloudy",
"weather_lightning",
"weather_rain",
"weather_snow",
"weather_sun",
"world",
"zoom"
]
function Auth() {
this.init();
this.cfg = {
hasIcon: true,
hasSizeBtn: false,
hasCloseBtn: true,
hasRefreshBtn: false,
hasSettingsBtn: false,
hasDrag: false,
hasOnCloseConfirm: false,
isOpenHidden: false,
isSystem: true,
title: loc.text("auth_title"),
module: "Auth",
uniqueId: SYS_WIDGETS_ID + 2
}
this.user = { id: null,
email: null,
password: null}
this.d512 = [
{ tag: "div", className: "float_panel",
id: "login_form",
childs: [
{ tag: "div", className: "float_left",
style: { width: "45%", padding: "8px" },
childs: [
// login exist user
{ tag: "h1", html: loc.text("auth_exist_user") },
{ tag: "div", html: loc.text("inp_email") },
{ tag: "div",
childs: [
{ tag: "input", id: "login_email", size: "30",
type: "text" }
]},
{ tag: "div", html: loc.text("inp_pwd") },
{ tag: "div",
childs: [
{ tag: "input", id: "login_pwd", size: "30",
type: "password" }
]},
{ tag: "div", style: { textAlign: "center", marginTop: "12px"},
childs: [
{ tag: "input", id: "login_btn",
events: { onclick: "d515()"},
type: "button", value: loc.text("auth_load_my_page") }
]},
{ tag: "div", id: "login_msg",
style: { marginTop: "12px", textAlign: "justify"}},
// pwd remind
{ tag: "div",
style: { marginTop: "12px"},
childs: [
{ tag: "div",
id: "pwd_remind_link",
childs: [
{ tag: "a", href: "showRemindForm()",
html: loc.text("auth_lnk_forget_pwd") }
]},
{ tag: "div",
display: false,
id: "pwd_remind_form",
childs: [
{ tag: "h1", html: loc.text("auth_remind_title")},
{ tag: "div", html: loc.text("inp_email") },
{ tag: "div",
childs: [
{ tag: "input", size: "30",
id: "inp_reminder_email",
type: "text" },
{ tag: "input", type: "button",
value: loc.text("btn_send"),
events: { onclick: "remindPwd()"} }
]}
]},
{ tag: "div", id: "pwd_remind_msg",
html: loc.text("msg_sending"),
display: false }
]}
]},
// new user explanation
{ tag: "div", className: "float_right",
style: { width: "45%", padding: "8px" },
childs: [
{ tag: "h1", html: loc.text("auth_new_user") },
{ tag: "div", style: { textAlign: "justify"},
html: loc.text("auth_reg_msg") },
{ tag: "div", style: { textAlign: "center", marginTop: "12px"},
childs: [
{ tag: "input", id: "goreg_btn",
events: { onclick: "d513()"},
type: "button", value: loc.text("auth_registration") }
]}
]}
]},
{ tag: "div", id: "reg_form", className: "float_panel",
display: false,
childs: [
{ tag: "div", className: "float_left",
style: { width: "45%", padding: "8px" },
childs: [
{ tag: "h1", html: loc.text("auth_new_user") },
{ tag: "div", style: { textAlign: "justify"},
html: loc.text("auth_reg_msg") }
]},
{ tag: "div", className: "float_right",
style: { width: "45%", padding: "8px" },
childs: [
{ tag: "h1", html: "&nbsp;" },
{ tag: "div", html: loc.text("inp_email") },
{ tag: "div",
childs: [
{ tag: "input", id: "reg_email", size: "30",
type: "text" }
]},
{ tag: "div", html: loc.text("inp_email2") },
{ tag: "div",
childs: [
{ tag: "input", id: "reg_email2", size: "30",
type: "text" }
]},
{ tag: "div", html: loc.text("inp_pwd") },
{ tag: "div",
childs: [
{ tag: "input", id: "reg_pwd", size: "30",
type: "password" }
]},
{ tag: "div", html: loc.text("inp_pwd2") },
{ tag: "div",
childs: [
{ tag: "input", id: "reg_pwd2", size: "30",
type: "password" }
]},
{ tag: "div", style: { textAlign: "center", marginTop: "12px"},
childs: [
{ tag: "input", id: "reg_btn",
events: { onclick: "d516()"},
type: "button", value: loc.text("auth_process_reg_btn") }
]},
{ tag: "div", id: "reg_msg",
style: { marginTop: "12px", textAlign: "justify"}}
]}
]},
{ tag: "div", id: "reg_ok", className: "float_panel",
display: false,
childs: [
{ tag: "div", className: "float_left",
style: { width: "45%", padding: "8px" },
childs: [
{ tag: "h1", html: loc.text("auth_new_user") },
{ tag: "div", style: { textAlign: "justify"},
html: loc.text("auth_registration_ok") },
{ tag: "div", style: { textAlign: "center", marginTop: "12px"},
childs: [
{ tag: "input", type: "button",
events: { onclick: "regFinish()"},
value: loc.text("btn_ok")}
]}
]}
]}
]
this.d437 = function() {
this.d436(this.d428.content, this.d512);
this.d436(desktop.d428.authButton,
[{ tag: "span", id:"signinBtn",
childs: [createButtonDom(loc.text("auth_lnk_sign_in"), "d519()", "widgets/auth/img/sign_in.gif")]  },
{ tag: "span", id:"signoutBtn",
childs: [createButtonDom(loc.text("auth_lnk_sign_out"), "logout()", "widgets/auth/img/sign_out.gif")]  }]);
if(this.isLogged()) {
hideEl(this.d428.signinBtn);
} else {
hideEl(this.d428.signoutBtn);
}
this.d440(loc.text("auth_title"));
}
this.showRemindForm = function() {
this.d457("pwd_remind_form");
this.d456("pwd_remind_link");
this.d456("pwd_remind_msg");
this.d428["inp_reminder_email"].value = "";
this.d428["inp_reminder_email"].focus();
}
this.regFinish = function() {
this.close();
}
this.remindPwd = function() {
var email = trim(this.d428["inp_reminder_email"].value);
if(this.d517(email)) {
request.send( { act: "remind_pwd", email: email }, this);
this.d456("pwd_remind_form");
this.d457("pwd_remind_msg");
}
}
this.d513 = function() {
this.d457("reg_form");
this.d456("login_form");
}
this.d514 = function() {
this.d456("reg_form");
this.d457("login_form");
}
this.d515 = function() {
var e = trim(this.d428["login_email"].value);
var pwd = trim(this.d428["login_pwd"].value);
if(e != "" && pwd != "") {
request.send({ act: "login_user",
email: e,
password: pwd }, this);
this.d456("login_btn");
this.d456("goreg_btn");
this.d428["login_msg"].innerHTML = loc.text("msg_processing");
}
}
this.d516 = function() {
var e = trim(this.d428["reg_email"].value);
var e2 = trim(this.d428["reg_email2"].value);
var pwd = trim(this.d428["reg_pwd"].value);
var pwd2 = trim(this.d428["reg_pwd2"].value);
if(e != e2 || !this.d517(e)) {
this.d428["reg_msg"].innerHTML = loc.text("auth_email_error");
} else if(pwd != pwd2 || !this.d518(pwd)) {
this.d428["reg_msg"].innerHTML = loc.text("auth_pwd_error");
} else if(e != "" && pwd !="") {
request.send({ act: "register_user",
email: e,
password: pwd }, this);
this.d456("reg_btn");
this.d428["reg_msg"].innerHTML = loc.text("msg_processing");
}
}
this.close = function() {
this.d514();
desktop.d472();
}
this.d519 = function() {
desktop.showPage('auth');
}
this.isLogged = function() {
return this.user.email != '';
}
this.logout = function() {
request.send({act: "logout"}, this);
}
this.d520 = function() {
this.anonymusId = getCookie("anonymusid");
this.user.id = getCookie("userid");
this.user.email = getCookie("useremail");
this.user.password = getCookie("userpassword");
}
this.d521 = function() {
setCookie("userid", this.user.id);
setCookie("useremail", this.user.email);
setCookie("userpassword", this.user.password);
}
this.start = function() {
if(session_user) {
this.user = session_user;
//            this.d521();
this.onLoad();
} else {
this.d520();
if(this.user.email && this.user.password) {
request.send({act: "start_user", user_id: this.user.id, email: this.user.email, password: this.user.password}, this);
} else {
request.send({act: "start_anonymus", user_id: this.user.id}, this);
}
}
}
this.d455 = function(msg) {
switch(msg.status) {
case "":
break;
case "start_result":
this.user = msg.user;
this.d521();
this.onLoad();
break;
case "register_ok":
this.d457("reg_ok");
this.d456("reg_form");
this.d428["signinBtn"].style.display = "none";
this.d428["signoutBtn"].style.display = "inline";
this.user = msg.user;
this.d521();
//dimk
break;
case "register_error":
this.d428["reg_msg"].innerHTML = loc.text("auth_msg_reg_error");
this.d428["reg_email"].value = "";
this.d428["reg_email2"].value = "";
this.d457("reg_btn");
break;
case "login_ok":
setCookie("anonymusid", this.user.id);
this.user = msg.user;
this.d521();
location.reload();
break;
case "login_error":
this.d428["login_msg"].innerHTML = loc.text("auth_login_error");
this.d457("login_btn");
this.d457("goreg_btn");
break;
case "logout_ok":
var anonymusId = getCookie("anonymusid");
if(anonymusId) {
this.user = {id: anonymusId, email: "", password: ""};
this.d521();
delCookie("anonymusid");
} else {
delCookie("userid");
delCookie("useremail");
delCookie("userpassword");
}
location.reload();
break;
case 'user_ok':
if(!this.user.email) {
setCookie("anonymusid", this.user.id);
}
this.user = msg.user;
this.d521();
location.reload();
break;
case "pwd_sent":
this.d428["inp_reminder_email"].value = "";
this.d456("pwd_remind_form");
this.d457("pwd_remind_link");
this.d456("pwd_remind_msg");
break;
}
}
this.onLoad = function() {}
this.d522 = function() {
var errors = [];
email = trim(this.d428.selectEmail.value);
password = trim(this.d428.selectPassword.value);
if(!this.d517(email)) {
errors[errors.length] = "<b>" + loc.text("auth_msg_email_invalid") + "</b>";
}
if(!this.d518(password)) {
errors[errors.length]= "<b>" + loc.text("auth_msg_pwd_invalid") + "</b>";
}
if(errors.length > 0) {
this.d428.messages.innerHTML = errors.join("<BR>");
} else {
hideEl(this.d428.submitButton);
this.d428.messages.innerHTML = loc.text("msg_processing");
request.send({act: "register_user", email: email, password: password}, this);
}
}
this.d517 = function(str) {
return /^[a-zA-Z][a-z0-9\-\_]{1,20}@[a-z0-9\-\_\.]{5,30}$/.test(str);
}
this.d518 = function(str) {
return (str.length > 5);
}
}
Auth.prototype = new Widget();
function Profiler() {
this.data = {};
this.cfg = {
module: "Profiler",
hasProfile: false
}
this.d523 = function(widget) {
var d431 = clone(widget.d425);
if(this.data[widget.id]) {
for(var i in this.data[widget.id]) {
if(d431[i] != undefined) {
d431[i] = this.data[widget.id][i];
}
}
}
widget.d431 = d431;
}
this.d524 = function(widget) {
var wkey = widget.id;//getSignature();
if(widget.d431) {
act = this.data[wkey] ? "update" : "create";
request.send({w: widget.cfg.module, act: act, wkey: wkey, data: escape(toCode(widget.d431))}, this, widget.cfg.saveMethod);
} else {
request.send({act: "delete", wkey: wkey}, this);
}
this.data[wkey] = widget.d431;
}
this.d525 = function() {
request.send({act: "load_data"}, this);
}
this.onLoad = function() {}
this.d455 = function(msg) {
if(msg.status == "loaded") {
d431r.data = {};
for(var i in msg.data) {
try {
d431r.data[i] = toValue(unescape(msg.data[i]));
} catch(e) {
d431r.data[i] = {}
}
}
d431r.onLoad();
}
}
}
CCIDS = 10000;
function Menu() {
this.init();
this.cfg = {
hasSizeBtn: false,
hasRefreshBtn: false,
hasSettingsBtn: false,
hasDrag: false,
isOpenHidden: true,
isSystem: true,
title: loc.text("menu_title"),
module: "Menu",
uniqueId: SYS_WIDGETS_ID + 3
}
this.d425["catalog"] = [];
this.widget = null;
this.catalog = [];
this.catalog[CCIDS] = {categories: [{id: CCIDS+1, name: loc.text("menu_cutom_channels")}], items: []};
this.catalog[CCIDS+1] = {categories: [], items: []};
this.d426Content = [
{ tag: "div", className: "menu_panel", id: "d545MenuItem",
childs: [createButtonDom(loc.text("menu_add_feed"), "d544()", "widgets/menu/img/plus.gif")] },
{ tag: "div", className: "menu_hr"},
{ tag: "div", className: "menu_panel", id: "cat_content"+CCIDS, display: false },
{ tag: "div", className: "menu_hr"},
{ tag: "div", className: "menu_panel", id: "cat_content0", display: false },
{ tag: "div", className: "menu_hr"}
]
this.d426Additional = [
{ tag: "div", className: "panel", id: "preview", display: false, style: {position: "absolute", left: "0px", top: "0px", width: "300px"},
childs: [
{ tag: "div", className: "panel_section",
childs: [createTableDom([{content: createButtonDom("<b>" + loc.text("menu_add2desktop") + "</b>", "d539()", "widgets/menu/img/plus.gif"), width: "99%"},
{content: {tag: "a", href: "void", events: {onclick: "d534()"}, innerHTML: "<img src='static/client/close.gif'>"}, width: "1%"}
]),
{ tag: "div", id: "preview_panel", style: {width: "100%", height: "auto", padding: "0", margin: "0"} }
]
}
]
},
{ tag: "div", className: "panel", id: "d545Panel", display: false, style: {position: "absolute", left: "0px", top: "0px", width: "340px"},
childs: [
{ tag: "div", className: "caption",
childs: [ createTableDom([{content: "<img src='widgets/menu/img/item.gif' style='vertical-align: middle'> &nbsp;<b>" + loc.text("menu_add_feed") + "</b>", width: "99%"},
{content: createButtonDom(false, "d535()", "static/client/close.gif"), width: "1%"}
]),
createTableDom([{content: { tag: "div", innerHTML: loc.text("menu_inp_url"), style: {paddingTop: "15px", paddingBottom: "15px"}}, width: "1%"},
{content: { tag: "input", type: "text", size: "40", id: "selectFeedUrl"}, width: "100%"},
{content: { tag: "input", type: "button", id: "d545Button", events: {onclick: "d545()"}, value: loc.text("btn_add")}, width: "1%"}
]),
{ tag: "div", display: false, id: "d545Status", className: "menu_panel", style: {paddingBottom: "15px"}, align: "center"}
]
}
]
},
{ tag: "div", className: "panel", id: "item_menu", display: false, style: {padding: "6px", position: "absolute", left: "0px", top: "0px", verticalAlign: "middle"},
childs: [
{ tag: "span", id: "item_menu_actions",
childs: [
createButtonDom("<b>"+loc.text("menu_rename")+"</b>", "d551()", "static/client/edit.gif"),
{ tag: "br"},
createButtonDom("<b>"+loc.text("menu_delete")+"</b>", "d553()", "static/client/delete_link.gif")
]},
{ tag: "span", id: "item_menu_rename",
display: false,
innerHTML: "<b>" +loc.text("menu_rename_to")+"</b> &nbsp;",
childs: [
{ tag: "input", type: "text", id: "new_item_title", style: {width: "190px"}},
{ tag: "input", type: "button", value: loc.text("btn_ok"), events: {onclick: "d554()"}},
{ tag: "input", type: "button", value: loc.text("btn_cancel"), events: {onclick: "d533()"} }
]},
{ tag: "span", id: "item_menu_delete",
display: false,
innerHTML: "<b>"+loc.text("menu_delete_prompt")+"</b> &nbsp;",
childs: [
{ tag: "input", type: "button", value: loc.text("btn_yes"), events: {onclick: "d555()"} },
{ tag: "input", type: "button", value: loc.text("btn_no"), events: {onclick: "d533()"} }
]}
]
}
]
this.d528 = 0;
this.d529 = function(id) {
var res = "menu_item_";
if(id) {
res = res + id;
} else {
this.d528 ++;
res = res + this.d528;
}
return res;
}
this.folder_o = new Image();
this.folder_o.src = "static/client/folder-o.gif";
this.folder_s = new Image();
this.folder_s.src = "static/client/folder-s.gif";
this.d437 = function() {
this.d428.window.style.position = "absolute";
this.d428.window.style.margin = "2px";
this.d428.window.style.top = "0px";
this.d428.window.style.left = "0px";
this.d428.window.style.width = "235px";
this.d436(this.d428.content, this.d426Content);
this.d436(document.body, this.d426Additional);
this.d440(this.cfg.title);
for(w in menuWidgets) {
if(menuWidgets[w] == "-") {
this.d436(this.d428["content"], { tag: "div", className: "menu_hr"});
} else {
var mid = this.d529();
var wname = menuWidgets[w].className.toLowerCase();
this.d436(document.body,
{ tag: "div", className: "hint", id: "hint_"+wname, display: false,
style: {position: "absolute", left: "0px", top: "0px", width: "280px", padding: "8px"},
innerHTML: loc.text(wname + "_hint").replace(/\n/g, "<br>") } );
var m = { tag: "div", className: "menu_panel",
events: {
onmouseover: "d541('" + wname + "', '"+mid+"')",
onmouseout: "d537('" + wname + "')"},
childs: [
createButtonDom(loc.text(wname + "_title"), "d536('" + menuWidgets[w].className + "', '"+mid+"')", "widgets/" + wname + "/ico.gif", mid)
]
}
this.d436(this.d428["content"], m);
}
}
// HTML Widgets
this.d436(this.d428["content"], [
{ tag: "div", className: "menu_hr"},
{ tag: "div", id: "html_widgets",
html: loc.text("msg_loading") }
]);
request.send({ act: "get_html_widgets" }, this);
// Load feeds catalog
this.d530(0);
// Custom feeds
var tmp = [];
for(var i=0; i<this.d431.catalog.length; i++) {
if(this.d431.catalog[i] != -1) {
tmp.push(this.d431.catalog[i]);
}
}
this.d431.catalog = null;
this.d431.catalog = tmp;
for(var i in this.d431.catalog) {
this.catalog[CCIDS+1].items[i] = clone(this.d431.catalog[i]);
this.catalog[CCIDS+1].items[i].id = CCIDS + 2 + parseInt(i);
}
this.d531(CCIDS);
}
// open/close sub menus
this.d532 = function(name) {
with (this.d428[name].style) {
display = (display == 'none' ? 'block' : 'none');
}
}
this.show = function() {
if(!desktop.d469) {
showEl(this.d428.window);
desktop.d428.pager.style.marginLeft = this.d428.window.offsetWidth + 2 + "px";
desktop.d428.pager.style.width = "auto";
desktop.d469 = true;
}
}
this.hide = function() {
if(desktop.d469) {
hideEl(this.d428.window);
desktop.d428.pager.style.marginLeft = 0;
desktop.d469 = false;
}
}
this.close = function() {
//        hideEl(desktop.d428.menu);
this.d533();
this.d534();
this.d535();
this.hide();
}
//---------------------------------------------
// PREVIEW
//---------------------------------------------
//dimk
this.d536 = function(widgetClass, mid, params) {
this.d533();
this.d537();
desktop.showPage("panels");
this.d534();
showEl(this.d428.preview);
var pos = {left: getLeft(this.d428.window) + this.d428.window.offsetWidth + 12,
top:  getTop(this.d428[mid])};
setElPos(this.d428.preview, pos);
this.widget = kernel.d461(widgetClass, this.d428["preview_panel"], false, params, { d432: true});
this.d538 = this.widget.disableOnClosePrompt;
this.widget.disableOnClosePrompt = true;
pos.top = pos.top - Math.round(this.d428.preview.offsetHeight / 2);
setElPos(this.d428.preview, pos);
}
this.d534 = function() {
if(this.widget) {
this.widget.close();
}
this.widget = null;
hideEl(this.d428.preview);
this.d428.preview_panel.innerHTML = '';
}
this.d539 = function() {
if(this.widget) {
this.widget.setParent(desktop.d499());
this.widget.save();
this.widget.d432 = false;
this.widget.initDtagAndDrop();
this.widget.disableOnClosePrompt = this.d538;
this.widget = null;
this.d534();
desktop.d500();
}
}
//---------------------------------------------
// HINTS
//---------------------------------------------
this.d540 = null;
this.d541 = function(wname, mid) {
if(!this.widget) {
var pos = {left: getLeft(this.d428.window) + this.d428.window.offsetWidth + 12,
top:  getTop(this.d428[mid])};
setElPos(this.d428["hint_"+wname], pos);
showEl(this.d428["hint_"+wname]);
this.d540 = wname;
this.d533();
}
}
this.d537 = function(wname) {
if(wname) {
hideEl(this.d428["hint_"+wname]);
} else if (this.d540) {
hideEl(this.d428["hint_"+this.d540]);
}
}
//---------------------------------------------
// ADD CHANNELS
//---------------------------------------------
this.d542 = function(html) {
if(html) {
showEl(this.d428.d545Status);
this.d428.d545Status.innerHTML = html;
} else {
clearEl(this.d428.d545Status);
hideEl(this.d428.d545Status);
}
}
this.d543 = false;
this.d544 = function() {
this.d533();
if(!this.d543) {
desktop.showPage("panels");
this.d542(null);
showEl(this.d428.d545Panel);
showEl(this.d428.d545Button);
var pos = {left: getLeft(this.d428.window) + this.d428.window.offsetWidth + 12,
top:  getTop(this.d428.d545MenuItem)};
setElPos(this.d428.d545Panel, pos);
this.d428.selectFeedUrl.focus();
this.d543 = true;
}
}
this.d535 = function() {
if(this.d543) {
hideEl(this.d428.d545Panel);
this.d543 = false;
}
}
this.d545 = function() {
var url = trim(this.d428.selectFeedUrl.value);
if(url!="") {
hideEl(this.d428.d545Button);
this.d542("<b>"+loc.text("menu_msg_cc")+"</b>");
if(url.indexOf("http://") == -1) {
url = "http://"+url;
}
this.d467 = url;
xmlRequest.send(url, this, "d510");
}
}
this.d546 = function(title, url) {
var cn = this.catalog[CCIDS+1].items.length;
this.d431.catalog[cn] = {title: title, url: url};
var newItem = {id: CCIDS+cn+2, title: title.substr(0,25), url: url, icon: ''};
this.catalog[CCIDS+1].items[cn] = newItem;
this.d531(CCIDS+1, true);
this.save();
}
this.d510 = function(response) {
if(response.responseXML.documentElement) {
var channel = XMLParser.xml2hash(response.responseXML.documentElement);
if(channel) {
this.d542("<b>"+loc.text("menu_msg_added", channel.title)+"</b>");
this.d428.selectFeedUrl.value = '';
//        this.d431.catalog[cn] = {title: channel.title, url: this.d467};
this.d546(channel.title, this.d467);
showEl(this.d428.d545Button);
var w = kernel.d461("Rss", desktop.d499(), false, {url: this.d467});
w.save();
desktop.d500();
this.d535();
return;
}
}
this.d542("<b>"+loc.text("menu_msg_no_responce")+ "</b>");
showEl(this.d428.d545Button);
}
//---------------------------------------------
// ITEM MENU
//---------------------------------------------
this.d547 = null;
this.d548 = function(id) {
this.d549();
showEl(this.d428["item_control"+id]);
this.d547 = id;
}
this.d549 = function() {
if(this.d547 != null) {
hideEl(this.d428["item_control"+this.d547]);
}
}
this.d550 = function(mid) {
if(!this.widget && !this.d543) {
hideEl(this.d428.item_menu_rename);
hideEl(this.d428.item_menu_delete);
showEl(this.d428.item_menu_actions);
showEl(this.d428.item_menu);
var pos = {left: getLeft(this.d428.window) + this.d428.window.offsetWidth + 2,
top:  getTop(this.d428[mid]) - 10};
setElPos(this.d428.item_menu, pos);
}
}
this.d533 = function() {
hideEl(this.d428.item_menu);
}
this.d551 = function() {
var n = this.d552(this.d547);
this.d428.new_item_title.value = this.d431.catalog[n].title;
hideEl(this.d428.item_menu_actions);
showEl(this.d428.item_menu_rename);
}
this.d553 = function() {
hideEl(this.d428.item_menu_actions);
showEl(this.d428.item_menu_delete);
}
this.d552 = function(itemId) {
for(var i=0; i<this.catalog[CCIDS+1].items.length; i++) {
if(this.catalog[CCIDS+1].items[i] != -1 && this.catalog[CCIDS+1].items[i].id == itemId) {
return i;
}
}
}
this.d554 = function() {
var title = trim(this.d428.new_item_title.value);
if(title != "") {
var n = this.d552(this.d547);
this.d431.catalog[n].title = title;
this.catalog[CCIDS+1].items[n].title = title;
this.d428["cat_item_title"+this.d547].innerHTML = title;
this.save();
this.d533();
}
}
this.d555 = function() {
var n = this.d552(this.d547);
this.d431.catalog[n] = -1;
this.catalog[CCIDS+1].items[n] = -1;
this.d428["cat_item"+this.d547].parentNode.removeChild(this.d428["cat_item"+this.d547]);
this.d428["cat_item"+this.d547] = null;
this.save();
this.d533();
}
//---------------------------------------------
// CATALOGS
//---------------------------------------------
this.d530 = function(catId) {
this.d533();
var el = this.d428["cat_content"+catId];
if(el.style.display == 'none') {
if(this.catalog[catId]) {
if(this.catalog[catId].rendered) {
showEl(el);
} else {
this.d531(catId);
}
} else {
if(catId < CCIDS) {
el.innerHTML = loc.text("msg_loading");
showEl(el);
request.send({act: "get_category", cat_id: catId}, this);
}
}
if(catId != "0") {
this.d428["fico_" + catId].setAttribute("src", this.folder_o.src);
}
} else {
if(catId != "0") {
this.d428["fico_" + catId].setAttribute("src", this.folder_s.src);
}
hideEl(el);
}
}
this.d556 = {};
this.d531 = function(catId, silent) {
el = this.d428["cat_content"+catId];
el.innerHTML = '';
with(this.catalog[catId]) {
if(categories) {
for(var i in categories) {
this.d436(el,
{ tag: "div", className: "menu_panel", id: "cat"+categories[i].id,
childs: [
createButtonDom(categories[i].name,
"d530("+categories[i].id+")",
this.folder_s.src,
false,
"fico_" + categories[i].id
),
{ tag: "div", id: "cat_content"+categories[i].id, className: "menu_sub_panel", display: false }
]
});
}
}
if(items) {
var m = null;
for(var i in items) {
if(items[i] == -1) {
continue;
}
var ico_id = "item_icon_"+items[i].id;
m = { tag: "div", id: "cat_item"+items[i].id,
style: {width: "100%", padding: "0px"},
childs: []}
var cells = [
{content: createButtonDom(items[i].title,
"d536('Rss', 'cat_item"+items[i].id+"', {url: '"+items[i].url + "'" + (items[i].icon ? ", icon: '"+items[i].icon+"'" : "") + "})",
"widgets/menu/img/item.gif",
"cat_item_title"+items[i].id,
ico_id),
width: "99%"}];
if(items[i].id > CCIDS) {
m.events = {onmouseover: "d548('"+items[i].id+"')", onmouseout: "d549()"};
cells.push({content:
{ tag: "img", src: "static/client/right_arrow.gif",
id: "item_control"+items[i].id,
style: {verticalAlign: "middle", cursor: "pointer"},
display: false,
events: {onmouseover: "d550('cat_item"+items[i].id+"')"}
},
width: "99%"});
}
m.childs.push(createTableDom(cells));
this.d436(el, m);
var icons = [
items[i].icon,
getDomain(items[i].url) + "/favicon.ico",
getDir(items[i].url) + "/favicon.ico"
];
with(this.d428[ico_id].style) {
width = "16px";
heigth = "16px";
}
loadIcon(this.d428[ico_id], icons);
}
}
if(!items  &&  !categories) {
el.innerHTML = loc.text("msg_empty");
}
rendered = true;
}
if(!silent) {
el.style.display = 'block';
}
this.catalog[catId].rendered = true;
}
//---------------------------------------------
// HTML WIDGETS
//---------------------------------------------
this.renderHTMLWidgetsList = function(data) {
if(data) {
this.d428["html_widgets"].innerHTML = "";
for(var i in data) {
var mid = this.d529();
var m = { tag: "div", className: "menu_panel",
childs: [
createButtonDom(data[i].title,
"openHTMLWidget('" + data[i].id + "', '"+mid+"')", "var/hwicons/" + data[i].icon, mid)
]}
this.d436(this.d428["html_widgets"], m);
}
}
}
this.openHTMLWidget = function(hwId, mid) {
//    this.d536 = function(widgetClass, mid, params) {
this.d536("HTMLWidget", mid, { id: hwId });
}
//---------------------------------------------
// DISPATCHER
//---------------------------------------------
this.d455 = function(msg) {
switch (msg.status) {
case "category_data":
this.catalog[msg.cat_id] = { categories: msg.categories, items: msg.items};
this.d531(msg.cat_id);
break;
case "html_widgets":
this.renderHTMLWidgetsList(msg.data);
break;
}
}
}
Menu.prototype = new Widget();
function Settings() {
this.init();
this.cfg = {
hasSizeBtn: false,
hasRefreshBtn: false,
hasSettingsBtn: false,
hasDrag: false,
title: loc.text("settings_title"),
module: "Settings",
uniqueId: SYS_WIDGETS_ID + 4
}
this.d512 = [
// select background
{ tag: "div", className: "menu_panel", style: {textAlign: "center"},
innerHTML: "<h1>"+loc.text("settings_page_bg")+"</h1>",
childs: [
createColorSelectDom(loc.text("settings_page_bg_color"), "background", "select_page_color"),
{ tag: "div", className: "menu_panel", innerHTML: loc.text("settings_page_bg_img"), style: {textAlign: "center"}},
{ tag: "div", className: "menu_panel", style: {textAlign: "center"},
innerHTML: "URL: ",
childs: [
{ tag: "input", type: "text", size: "60", id: "select_background", value: "http://"},
{ tag: "input", type: "button", value: " Test ",
events: { onclick: "d560()" }
}
]},
{ tag: "div", className: "menu_panel", style: {textAlign: "center"},
childs: [
{ tag: "input", type: "button", value: loc.text("btn_save"),
events: { onclick: "d562()" } },
{ tag: "input", type: "button", value: loc.text("btn_delete"),
events: { onclick: "d563()" } }
]}
]},
{ tag: "hr" },
// change password
{ tag: "div", className: "menu_panel", style: {textAlign: "center"},
innerHTML: "<h1>"+loc.text("settings_change_pwd")+"</h1>",
childs: [
{ tag: "div", className: "float_panel",
childs: [
{ tag: "div", className: "float_left",
style: { width: "45%", padding: "2px" },
childs: [
{ tag: "div", html: loc.text("settings_inp_old_pwd")},
{ tag: "div",
childs: [
{ tag: "input", id: "inp_old_pwd", size: "30",
type: "password" }
]},
{ tag: "div", id: "change_pwd_msg",
style: { marginTop: "12px"}}
]},
{ tag: "div", className: "float_right",
style: { width: "45%", padding: "2px" },
childs: [
{ tag: "div", html: loc.text("settings_inp_new_pwd")},
{ tag: "div",
childs: [
{ tag: "input", id: "inp_new_pwd", size: "30",
type: "password" }
]},
{ tag: "div", html: loc.text("settings_inp_new_pwd2")},
{ tag: "div",
childs: [
{ tag: "input", id: "inp_new_pwd2", size: "30",
type: "password" }
]}
]}
]},
{ tag: "div", style: { textAlign: "center", marginTop: "6px", height: "25px"},
childs: [
{ tag: "input", id: "btn_change_pwd",
events: { onclick: "changePwd()"},
type: "button", value: loc.text("settings_btn_change_pwd") }
]}
]},
{ tag: "hr" },
// themes
{ tag: "div", className: "menu_panel", style: { textAlign: "center" },
innerHTML: "<h1>"+loc.text("settings_themes")+"</h1>",
childs: [
{ tag: "div", id: "page_themes", className: "section",
innerHTML: loc.text("msg_loading"),
style: { height: "210px", border: "1px solid #999999", overflow: "auto", textAlign: "left", padding: "4px"} }
]}
]
this.d425["background"] = "";
// Changing password
this.changePwd = function() {
if(auth.isLogged()) {
var p1 = trim(this.d428["inp_new_pwd"].value);
var p2 = trim(this.d428["inp_new_pwd2"].value);
var opwd = trim(this.d428["inp_old_pwd"].value);
if(opwd == auth.user.password) {
if((p1 == p2) && (p1 != "")) {
var opwd = trim(this.d428["inp_old_pwd"].value);
request.send({ act: "change_pwd", npwd: p1}, this);
this.d428["change_pwd_msg"].innerHTML = loc.text("msg_processing");
this.d428["btn_change_pwd"].disabled = true;
} else {
this.d428["change_pwd_msg"].innerHTML = loc.text("settings_new_pwd_wrong");
}
} else {
this.d428["change_pwd_msg"].innerHTML = loc.text("settings_old_pwd_wrong");
}
} else {
alert(loc.text("settings_msg_sign_in"));
}
}
this.d437 = function() {
this.d428["content"].style.height = "540px";
this.d440(this.cfg.title);
this.d436(this.d428.content, this.d512);
this.d557 = document.body.style.background;
this.d558();
}
this.d435 = function() {
request.send({ act: "get_themes" }, this);
}
this.d559 = false;
this.d560 = function() {
this.d559 = "url(" + trim(this.d428["select_background"].value) + ") repeat fixed";
document.body.style.background = this.d559;
}
this.d561 = function(color) {
this.d559 = color;
document.body.style.background = color;
}
this.d562 = function() {
this.d431["background"] = this.d559;
this.save();
desktop.d472();
}
this.d563 = function() {
document.body.style.background = "";
this.d431["background"] = "";
this.save();
}
this.close = function() {
desktop.d472();
}
this.d451 = function(target, color) {
switch(target) {
case "background":
this.d561(color);
break;
}
}
this.d558 = function() {
if(this.d431.background == "") {
return;
}
document.body.style.background = this.d431.background;
}
this.d564 = false;
this.d565 = function(btnEl, popupEl) {
if(this.d564) {
if(this.d564 == popupEl) return;
this.d566(this.d564);
}
this.d564 = popupEl;
var pos = {left: getLeft(this.d428[btnEl]) + 16,
top:  getTop(this.d428[btnEl]) + 16};
showEl(this.d428[popupEl]);
setElPos(this.d428[popupEl], pos);
}
this.d566 = function(popupEl) {
hideEl(this.d428[popupEl]);
this.d564 = false;
}
this.d567 = function(popupEl, target, color) {
this.d566(popupEl);
this.d451(target, color);
}
this.d568 = function(popupEl, target, font) {
this.d566(popupEl);
this.d452(target, font);
}
this.d568Size = function(popupEl, target, fontSize) {
this.d566(popupEl);
this.d452Size(target, fontSize);
}
/* THEMES */
this.d570 = function(list) {
if(list == null) {
this.d428["page_themes"].innerHTML = "No themes found :(";
} else {
this.d428["page_themes"].innerHTML = "";
for(var i=0; i< list.length; i++) {
var cn = (list[i].name == desktop.d431["theme"]) ? "theme_box_selected" : "theme_box";
this.d436(this.d428["page_themes"],
{ tag: "div", className: cn,
id: "theme_box_" + list[i].name,
events: { onclick: "d572('" + list[i].name + "')" },
childs: [
{ tag: "div", className: "theme_thumbnail_box",
childs: [
{ tag: "img", className: "theme_thumbnail",
src: "themes/" + list[i].name + "/thumbnail.jpg" }
]},
{ tag: "div", className: "theme_description_box",
innerHTML: list[i].description }
]}
);
}
}
}
this.d571 = function(name) {
if(this.d428["theme_box_" + name]) {
this.d428["theme_box_" + name].className = "theme_box_selected";
}
}
this.d572 = function(name) {
if(desktop.d431["theme"] != name) {
if(this.d428["theme_box_" + desktop.d431["theme"]]) {
this.d428["theme_box_" + desktop.d431["theme"]].className = "theme_box";
}
this.d428["theme_box_" + name].className = "theme_box_selected";
desktop.d431["theme"] = name;
desktop.d468();
desktop.save();
}
}
this.d455 = function(msg) {
switch (msg.status) {
case "themes_list":
this.d570(msg.data);
break;
case "pwd_changed":
this.d428["change_pwd_msg"].innerHTML = loc.text("settings_pwd_changed");
this.d428["btn_change_pwd"].disabled = false;
this.d428["inp_old_pwd"].value = "";
this.d428["inp_new_pwd"].value = "";
this.d428["inp_new_pwd2"].value = "";
auth.user.password = msg.npwd;
auth.d521();
break;
}
}
}
Settings.prototype = new Widget();
function Feedback() {
this.init();
this.cfg = {
hasSizeBtn: false,
hasRefreshBtn: false,
hasSettingsBtn: false,
hasDrag: false,
hasProfile: false,
title: loc.text('feedback_user_feedback'),
module: "Feedback",
uniqueId: SYS_WIDGETS_ID + 7
}
this.d437 = function() {
this.d440(this.cfg.title);
this.d436(this.d428.content, [
{ tag: "div", align: "center", id: "feedback_status",
html: "<B>" + loc.text("feedback_status") + "</B>"},
{ tag: "hr"},
{ tag: "div", className: "menu_panel",
id: "feedback_sending",
display: false,
innerHTML: "<p><b>"+loc.text('feedback_sending')+"</b></p>" },
{ tag: "table", width: "95%",
id: "feedback_input",
childs: [
{ tag: "tr",
childs: [
{ tag: "td", width: "30%", align: "right",
childs: [{ tag: "div", innerHTML: loc.text('sendtofriend_your_email')}]},
{ tag: "td",
childs: [{ tag: "input", type: "text", id: "inp_email", size: "30"}]}
]
},
{ tag: "tr",
childs: [
{ tag: "td", width: "30%", align: "right", valign: "top",
childs: [{ tag: "div", innerHTML: loc.text('feedback_feedback_text')}]},
{ tag: "td",
childs: [{ tag: "textarea", id: "inp_message", rows: 16, cols: 50, style: {width: "90%"} }]}
]},
{ tag: "tr",
childs: [
{ tag: "td"},
{ tag: "td",
childs: [
{ tag: "input", type: "button", align: "center",
value: loc.text('btn_send'),
events: {onclick: "d575()"}}
]}
]}
]}
]);
this.d428["content"].style.height = "300px";
this.d428["inp_email"].value = auth.user.email;
}
this.close = function() {
desktop.d472();
}
this.d573 = function() {}
this.d574 = function() {}
//-------------------------------------
// SEND
//-------------------------------------
this.d575 = function() {
var str = this.d428["inp_message"].value;
if(str!="") {
hideEl(this.d428.feedback_input);
showEl(this.d428.feedback_sending);
request.send({ act: "feedback",
text: str,
email: this.d428["inp_email"].value},
this, "POST");
}
else {
alert(loc.text('feedback_text_empty'));
}
}
this.d455 = function(msg) {
switch (msg.status) {
case "feedback_saved":
this.d428.feedback_status.innerHTML = "<b>"+loc.text('feedback_msg_saved')+"</b>";
this.d428["inp_message"].value = "";
showEl(this.d428.feedback_input);
hideEl(this.d428.feedback_sending);
break;
case "empty_text":
this.d428.feedback_status.innerHTML = loc.text('feedback_msg_empty');
showEl(this.d428.feedback_input);
hideEl(this.d428.feedback_sending);
break;
}
}
}
Feedback.prototype = new Widget();
function Custompage() {
this.init();
this.cfg = {
hasSizeBtn: false,
hasRefreshBtn: false,
hasSettingsBtn: false,
hasDrag: false,
hasProfile: false,
title: loc.text("custompage_title"),
module: "Custompage",
uniqueId: SYS_WIDGETS_ID + 8
}
this.d437 = function() {
this.d440(loc.text("custompage_title"));
this.d428["content"].style.height = "300px";
this.d428["content"].style.overflow = "auto";
}
this.close = function() {
desktop.d472();
}
this.setData = function(title, content) {
this.d440(title);
this.d428["content"].innerHTML = content.parseUrl();
}
}
Custompage.prototype = new Widget();
function SendToFriend() {
this.init();
this.d576 = {
tag: "div", className: "menu_panel",
childs: [
{ tag: "div", align: "center", id: "send_status",
style: { fontWeight: "bold" },
html: loc.text("sendtofriend_status") },
{tag: "hr"},
{tag: "table", width: "95%",
childs: [
{ tag: "tr",
childs: [
{ tag: "td", width: "30%", align: "right",
childs: [{ tag: "div", innerHTML: loc.text('sendtofriend_your_name')}]
},
{ tag: "td",
childs: [{ tag: "input", type: "text", id: "ed_name", size: "30"}]
}
]
},
{ tag: "tr", childs: [{ tag: "td"},{ tag: "td"}]},
{ tag: "tr",
childs: [
{ tag: "td", width: "30%", align: "right",
childs: [{ tag: "div", innerHTML: loc.text('sendtofriend_your_email')}]
},
{ tag: "td",
childs: [{ tag: "input", type: "text", id: "ed_email", size: "30" }]
}
]
},
{ tag: "tr", childs: [{ tag: "td"},{ tag: "td"}]},
{ tag: "tr",
childs: [
{ tag: "td", width: "30%", align: "right",
childs: [{ tag: "div", innerHTML: loc.text('sendtofriend_friend_email')}]
},
{ tag: "td",
childs: [{ tag: "input", type: "text", id: "ed_friend_email", size: "30" }]
}
]
},
{ tag: "tr", childs: [{ tag: "td"},{ tag: "td"}]},
{ tag: "tr",
childs: [
{ tag: "td", width: "30%", align: "right", valign: "top",
childs: [{ tag: "div", innerHTML: loc.text('sendtofriend_message')}]
},
{ tag: "td",
childs: [{ tag: "textarea", id: "ed_message", rows: "9", cols: "50", style: {width: "90%"} }]
}
]
},
{ tag: "tr", childs: [{ tag: "td", innerHTML: "&nbsp;"},{ tag: "td"}]},
]
},
{ tag: "div", align: "center", id: "btn_send",
childs: [
{ tag: "input",
type: "button", value: loc.text('sendtofriend_send'),
events: {onclick: "d577()"}}
]}
]}
this.cfg = {
hasSizeBtn: false,
hasRefreshBtn: false,
hasSettingsBtn: false,
hasDrag: false,
hasProfile: false,
title: "",
module: "SendToFriend",
uniqueId: SYS_WIDGETS_ID + 9
}
this.d437 = function() {
this.d440(loc.text('sendtofriend_title'));
this.d428["content"].style.height = "300px";
this.d436(this.d428.content, this.d576);
this.d428["ed_email"].value = auth.user.email;
this.d428["ed_message"].value = "http://" + baseUrl;
}
this.close = function() {
desktop.d472();
}
this.d455 = function(msg) {
//alert(msg.status);
switch(msg.status) {
case 'ok':
this.d457("btn_send");
this.d428.send_status.innerHTML = '<font color=green>'+loc.text('sendtofriend_send_ok')+'</font>';
break;
case 'failed':
this.d428.send_status.innerHTML = '<font color=red>'+loc.text('sendtofriend_send_failed')+'</font>';
this.d457("btn_send");
break;
}
}
this.d577 = function() {
var name_val   = this.d428.ed_name.value;
var email_val  = this.d428.ed_email.value;
var femail_val = this.d428.ed_friend_email.value;
var msg_val    = this.d428.ed_message.value;
//todo: e-mail check
if (email_val=="") {
alert(loc.text('sendtofriend_email_empty'));
this.d428.ed_email.focus();
return;
}
if (d517Address(email_val)==false) {
alert(loc.text('sendtofriend_email_invalid'));
this.d428.ed_email.focus();
return;
}
if (femail_val=="") {
alert(loc.text('sendtofriend_femail_empty'));
this.d428.ed_friend_email.focus();
return;
}
if (d517Address(femail_val)==false) {
alert(loc.text('sendtofriend_femail_invalid'));
this.d428.ed_friend_email.focus();
return;
}
this.d428["send_status"].innerHTML = loc.text("msg_processing");
this.d456("btn_send");
request.send({
act    : "send_to_friend",
name   : name_val,
email  : email_val,
femail : femail_val,
msg    : msg_val
},
this);
}
}
SendToFriend.prototype = new Widget();
// E-MAIL
function d517Address(value)
{
//trim(field);
var goodEmail = value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
if (goodEmail)
return true;
else
return false;
}
function Rss() {
this.init();
this.cfg = {
title: loc.text("rss_title"),
module: "Rss"
}
this.d425["cnt"] = 10;
this.d425["opend"] = 0;
this.d425["url"] = "";
this.d425["icon"] = "";
this.d425["period"] = 600;
this.d425["md5"] = [];
this.d578 = [
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", className: "settings_label", innerHTML: loc.text("rss_inp_ncount")},
{ tag: "select", id: "news_count", className: "settings_control",
options: [
{ value:"3", text: "3"},
{ value:"5", text: "5"},
{ value:"8", text: "8"},
{ value:"10", text: "10"},
{ value:"12", text: "12"},
{ value:"15", text: "15"},
{ value:"9999", text: loc.text("rss_all")}
]
},
{ tag: "input", type: "button", value: loc.text("btn_set"), events: {onclick: "d584()"}}
]
},
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", className: "settings_label", innerHTML: loc.text("rss_inp_refresh")},
{ tag: "select", id: "period", className: "settings_control",
options: [
{ value:"120", text: loc.text("rss_p120")},
{ value:"300", text: loc.text("rss_p300")},
{ value:"600", text: loc.text("rss_p600")},
{ value:"1200", text: loc.text("rss_p1200")},
{ value:"1800", text: loc.text("rss_p1800")},
{ value:"3600", text: loc.text("rss_p3600")},
{ value:"10800", text: loc.text("rss_p10800")}
]
},
{ tag: "input", type: "button", value: loc.text("btn_set"), events: {onclick: "d587()"}}
]},
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", className: "settings_label", innerHTML: loc.text("rss_inp_open_to")},
{ tag: "input", type: "checkbox", id: "opend",
events: { onclick: "d583()"}
}
]},
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", innerHTML: loc.text("rss_inp_url"), className: "settings_label"},
{ tag: "input", id: "select_url", type: "text", size: "15", className: "settings_control"},
{ tag: "input", type: "button", value: loc.text("btn_go"), events: {onclick: "d582()"}}
]}
]
this.d579 = null
this.d580 = false;
this.d581 = false;
this.d437 = function() {
this.d428["settings"].innerHTML = "";
this.d436(this.d428.settings, this.d578);
this.d428.period.value = this.d431.period;
this.d428.news_count.value = this.d431.cnt;
this.d428.opend.checked = this.d431.opend == 1;
this.d428.content.style.padding = "6px";
this.d428["select_url"].value = this.d431["url"];
}
this.d582 = function() {
var url = trim(this.d428["select_url"].value);
if(url != "") {
if(url.indexOf("http://") == -1) {
url = "http://" + url;
}
if(this.d431["url"] != url) {
this.d431["url"] = url;
this.save();
this.iconLoaded = false;
kernel.d464(this.id);
kernel.d463(this.id, this.d431.period * 1000, true);
this.refresh();
}
}
this.d444();
}
this.d583 = function() {
this.d431.opend = this.d428.opend.checked ? 1 : 0;
this.save();
}
this.d584 = function() {
this.d431.cnt = this.d428.news_count.value;
this.save();
this.d585();
this.d586();
}
this.d587 = function() {
this.d431.period = this.d428.period.value;
kernel.d464(this.id);
kernel.d463(this.id, this.d431.period * 1000, true);
this.save();
}
this.d435 = function() {
kernel.d463(this.id, this.d431.period * 1000);
}
this.d454 = function() {
if(!this.d581) {
this.refresh();
}
}
this.refresh = function() {
var date = new Date();
this.d579 = date.getSeconds();
this.d440(loc.text("msg_loading"));
var wid = this.id;
var iconEl = this.d428.icon;
xmlRequest.send(this.d431.url, this, "d595");
this.d580 == true;
}
this.d588 = function(wid, feedId) {
if(this.d431.opend == 1) {
window.open(this.data.items[feedId]["link"]);
} else {
this.d581 = true;
rssreader.d601 = this.d579;
rssreader.d428["icon"].src = this.d428["icon"].src;
rssreader.d588(wid, feedId);
}
}
this.d589 = function() {
return Math.min(this.data.items.length, this.d431.cnt);
}
this.d590 = function(itemIdx) {
this.data.items[itemIdx].isRead = 1;
this.d431["readed"][itemIdx] = 1;
this.d585();
this.d428["item_" + itemIdx].className = "rss_box_item_visited";
}
this.d591 = function(itemIdx) {
this.data.items[itemIdx].isRead = 0;
this.d431["readed"][itemIdx] = 0;
this.d585();
this.d428["item_" + itemIdx].className = "rss_box_item";
}
this.d592 = function() {
var count = this.d589();
var res = 0;
for(var i=0; i<count; i++) {
if(this.data.items[i].isRead == 1) {
res ++;
}
}
return res;
}
this.d585 = function() {
if(this.data) {
var count = this.d589();
var readed = this.d592();
this.d428.title.innerHTML = '';
this.d436(this.d428.title,
{ tag: "a", href: "void",
innerHTML: this.data.title.substr(0,25),
events: { onclick: "d598()" } });
if(count > readed) {
this.d436(this.d428.title,
{ tag: "span",
innerHTML: " &nbsp;(" + (count - readed) + ")" });
}
}
}
this.d593 = {
url: null,
time: null
}
this.d594 = function(idx) {
var content = this.data.items[idx]["content"] ? this.data.items[idx]["content"] : this.data.items[idx]["description"];
var str = this.data.items[idx].title + content;
return crc32(str);
}
this.d595 = function(response) {
this.d580 == false;
if(response.responseXML && response.responseXML.documentElement) {
this.data = XMLParser.xml2hash(response.responseXML.documentElement);
var newMd5 = [];
if(this.data) {
var count = this.data.items.length;
var l = this.d431["md5"].length;
for(var i=0; i<count; i++) {
var md5 = this.data.items[i]["md5"] = this.d594(i);
var j = this.d596(md5);
if(j != null) {
this.data.items[i].isRead = 1;
newMd5.push(md5);
l--;
}
}
this.d431["md5"] = newMd5;
if(l != 0) {
this.save();
}
}
this.d586();
this.d585();
} else {
this.d597();
}
}
this.iconLoaded = false;
this.d586 = function() {
if(this.data) {
if(!this.iconLoaded) {
var icons = [
this.d431.icon,
getDir(this.data.siteUrl) + "/favicon.ico",
getDomain(this.data.siteUrl) + "/favicon.ico",
getDir(this.d431.url) + "/favicon.ico",
getDomain(this.d431.url) + "/favicon.ico"
];
loadIcon(this.d428["icon"], icons);
this.iconLoaded = true;
}
var count = this.d589();
this.d428.content.innerHTML = '';
for(var i=0; i<count; i++) {
this.d436(this.d428.content,
{ tag: "div", className: "rss_box_item" + ( (this.data.items[i].isRead == 1) ? "_visited" : ""),
innerHTML: this.data.items[i].title.wordWrap(38),
events: { onclick: "d588("+this.id+","+i+")" },
id: "item_" + i });
}
} else if (!this.d580) {
this.d597();
}
}
this.d597 = function() {
this.d428.title.innerHTML = loc.text("rss_msg_error");
}
this.d598 = function() {
if(this.data) {
window.open(this.data.siteUrl);
}
}
this.onClose = function() {
if(rssreader.d603 && rssreader.d603 == this.id) {
rssreader.close();
}
}
// Read/unread hash
this.d596 = function(md5) {
for(var i=0; i<this.d431["md5"].length; i++) {
if(this.d431["md5"][i] == md5) {
return i;
}
}
return null;
}
this.d599 = function(idx) {
var md5 = this.data.items[idx].md5;
var i = this.d596(md5);
if(i == null) {
this.d431["md5"].push(md5);
}
}
this.und599 = function(idx) {
var md5 = this.data.items[idx].md5;
var i = this.d596(md5);
if(i != null) {
delete(this.d431["md5"][i]);
}
}
this.d590 = function(itemIdx) {
this.data.items[itemIdx].isRead = 1;
this.d599(itemIdx);
this.d585();
this.d428["item_" + itemIdx].className = "rss_box_item_visited";
}
this.d591 = function(itemIdx) {
this.data.items[itemIdx].isRead = 0;
this.und599(itemIdx);
this.d585();
this.d428["item_" + itemIdx].className = "rss_box_item";
}
this.d592 = function() {
var count = this.d589();
var res = 0;
for(var i=0; i<count; i++) {
if(this.data.items[i].isRead == 1) {
res ++;
}
}
return res;
}
}
Rss.prototype = new Widget();
function RssReader() {
this.init();
this.cfg = {
hasSizeBtn: false,
hasRefreshBtn: false,
hasSettingsBtn: false,
hasDrag: false,
hasProfile: false,
title: loc.text("rssreader_title"),
module: "RssReader",
uniqueId: SYS_WIDGETS_ID + 5
}
this.d512 = {
tag: "table",
style: { width: "100%" },
childs: [
{ tag: "tr",
childs: [
{ tag: "td", width: "35%",
childs: [
createButtonDom(loc.text("rssreader_read_all"), "d606()", "widgets/rssreader/img/folder_open.gif"),
{ tag: "span", html: " &nbsp; &nbsp; &nbsp; "},
createButtonDom(loc.text("rssreader_unread_all"), "d607()", "widgets/rssreader/img/folder_close.gif")
]},
{ tag: "td",
childs: [{ tag: "div", id: "channelTitle"}]}
]},
{ tag: "tr",
childs: [
{ tag: "td", width: "35%",
childs: [
{ tag: "div", id: "menu", className: "listBox", style: {width: "auto", height: "340px"}}
]},
{ tag: "td",
childs: [
{ tag: "div", id: "view", className: "listBox", style: {width: "auto", height: "340px"}}
]}
]}
]}
this.d601 = null;
this.d437 = function() {
this.d428["content"].style.height = "390px";
this.d436(this.d428.content, this.d512);
this.d440(this.cfg.title);
}
this.d602 = function() {
//        this.d428.channelTitle.innerHTML = "<h1><a target=\"_blank\" href=\""+this.data.LINK+"\">"+this.data.title+"</a></h1>";
this.d428.channelTitle.innerHTML = "<h1>"+this.data.title+"</h1>";
this.d428.menu.innerHTML = "";
this.d428.view.innerHTML = "";
var count = kernel.getWidget(this.d603).d589();
for(var i=0; i< count; i++) {
this.d436(this.d428.menu,
[{ tag: "div", className: "menu_panel",
childs: [
{ tag: "a",
innerHTML: this.data.items[i].title.wordWrap(38),
id: "menuItem"+i,
href: "void",
events: {onclick: "d604("+i+")"},
className: "listItem" + (this.data.items[i].isRead == 1 ? "Visited" : "") }
]
},
{ tag: "hr", width: "100%"}
]);
}
}
this.d604 = function(feedId) {
this.d428.view.innerHTML = "";
var content = this.data.items[feedId]["content"] ? this.data.items[feedId]["content"] : this.data.items[feedId]["description"];
var url = this.data.items[feedId]["link"]["href"] ? this.data.items[feedId]["link"]["href"] : this.data.items[feedId]["link"];
this.d436(this.d428.view, [
{ tag: "div", className: "float_panel",
childs: [
{ tag: "div", className: "float_left",
display: (feedId > 0),
childs: [
createButtonDom(false, "d604("+(feedId-1)+")", "widgets/rssreader/img/previous.gif", "readPrev")
]},
{ tag: "div", className: "float_right",
display: (feedId < kernel.getWidget(this.d603).d589() - 1),
childs: [
createButtonDom(false, "d604("+(feedId+1)+")", "widgets/rssreader/img/next.gif", "readNext")
]}
]},
{ tag: "hr", width: "100%"},
{ tag: "div", className: "menu_panel",
innerHTML: "<p><a href='" + url + "' class='rssreader_item_title' target=_blank>" + this.data.items[feedId].title + "</a>"+
"<p>"+(content ? content : "")
}
]);
if(kernel.getWidget(this.d603)) {
kernel.getWidget(this.d603).d590(feedId);
kernel.getWidget(this.d603).save();
}
this.d428['menuItem'+feedId].className = "listItemVisited";
this.d605();
}
this.d606 = function() {
var count = kernel.getWidget(this.d603).d589();
for(var i=0; i<count; i++) {
kernel.getWidget(this.d603).d590(i);
}
this.d602();
var w = kernel.getWidget(this.d603);
if(w) {
w.save();
}
this.d605();
}
this.d607 = function() {
var count = kernel.getWidget(this.d603).d589();
for(var i=0; i<count; i++) {
kernel.getWidget(this.d603).d591(i);
}
this.d602();
var w = kernel.getWidget(this.d603);
if(w) {
w.save();
}
this.d605();
}
this.d605 = function() {
if(this.data) {
var count = kernel.getWidget(this.d603).d589();
var readed = kernel.getWidget(this.d603).d592()
this.d428.title.innerHTML = '';
this.d436(this.d428.title,
{ tag: "a", href: "void",
innerHTML: this.data.title.substr(0,25),
events: { onclick: "d598()" } });
if(count > readed) {
this.d436(this.d428.title,
{ tag: "span",
innerHTML: " &nbsp;(" + (count - readed) + ")" });
}
}
}
this.d588 = function(d603, feedId) {
menu.hide();
this.data = kernel.getWidget(d603).data;
this.d603 = d603;
this.d602();
this.d428.icon.src = kernel.getWidget(d603).d428.icon.src;
desktop.showPage('rssreader');
this.d604(feedId);
}
this.close = function() {
if(this.d603 && kernel.getWidget(this.d603)) {
if(this.d601 == kernel.getWidget(this.d603).d579) {
kernel.getWidget(this.d603).d581 = false;
//                kernel.getWidget(this.d603).data = this.data;
}
}
desktop.d472();
}
}
RssReader.prototype = new Widget();
function FlashPlayer() {
this.init();
this.cfg = {
hasSizeBtn: false,
hasRefreshBtn: false,
hasSettingsBtn: false,
hasDrag: false,
hasProfile: false,
title: loc.text("flash_title"),
module: "FlashPlayer",
uniqueId: SYS_WIDGETS_ID + 6
}
this.d437 = function() {
this.d428.content.style.height = "400px";
}
this.d608 = function(d603) {
this.d603 = d603;
var widget = kernel.getWidget(d603);
this.d440(this.cfg.title + ": " + widget.d431.title);
widget.d428.flash_container.parentNode.removeChild(widget.d428.flash_container);
this.d428.content.appendChild(widget.d428.flash_container);
desktop.showPage('flashplayer');
}
this.close = function() {
if(this.d603) {
var widget = kernel.getWidget(this.d603);
widget.d428.flash_container.parentNode.removeChild(widget.d428.flash_container);
widget.d428.flash_content.appendChild(widget.d428.flash_container);
}
desktop.d472();
}
}
FlashPlayer.prototype = new Widget();
function Messenger() {
this.init();
this.cfg = {
hasSettingsBtn: false,
title: loc.text("messenger_title"),
module: "Messenger"
}
this.d512 = [
{ tag: "div", className: "bevel_section", innerHTML: loc.text("messenger_clist"),
style: {cursor: "pointer"},
events: {onclick: "d610('section_contact_list')"}
},
{ tag: "div", className: "menu_panel", id: "section_contact_list", display: false,
childs: [
{ tag: "div", className: "menu_panel", id: "contact_list"},
{ tag: "hr", width: "100%"},
{ tag: "div", className: "menu_panel",
childs: [
{ tag: "span", innerHTML: loc.text("messenger_cadd") },
{ tag: "input", type: "text", style: {width: "120px"}, id: "edit_user_id"},
{ tag: "input", type: "button", value: " Add ", events: {onclick: "d612()"}}
]}
]
},
{ tag: "div", className: "bevel_section", innerHTML: loc.text("messenger_compose"),
style: {cursor: "pointer"},
events: {onclick: "d610('section_compose')"}
},
{ tag: "div", className: "menu_panel", id: "section_compose", display: false,
childs: [
{ tag: "div", className: "menu_panel", innerHTML: loc.text("messenger_recipient"),
childs: [
{ tag: "input", type: "text", size: "30", id: "edit_recipient"}
]
},
{ tag: "div", className: "menu_panel", innerHTML: loc.text("messenger_text") + "<br>",
childs: [
{ tag: "textarea", style: {width: "95%", height: "80"}, id: "edit_body"}
]
},
{ tag: "input", type: "button", value: loc.text("btn_send"), id: "send_btn", events: {onclick: "d616()"}},
{ tag: "div", id: "send_status"}
]
},
{ tag: "div", className: "bevel_section", innerHTML: loc.text("messenger_inbox"),
style: {cursor: "pointer"},
events: {onclick: "d610('section_new_messages')"}
},
{ tag: "div", className: "menu_panel", id: "section_new_messages", display: false,
childs: [
{ tag: "div", id: "new_messages", className:"listBox", style: {width: "auto", height: "300px"}, innerHTML: loc.text("msg_loading") },
{ tag: "div", id: "clear_new_messages", display: false, align: "right",
childs: [
createButtonDom(loc.text("messenger_clear"), "d619()", "widgets/messenger/img/clear.gif")
]
}
]
},
{ tag: "div", id: "tmp", display: false}
]
this.d425["contact_list"] = [];
this.messages = [];
this.d609 = false;
this.d610 = function(sid) {
if(this.d428[sid].style.display == 'none') {
showEl(this.d428[sid]);
} else {
hideEl(this.d428[sid]);
}
}
this.d437 = function() {
this.d436(this.d428.content, this.d512);
this.d611();
this.d440(this.cfg.title);
}
this.d435 = function() {
kernel.d463(this.id, 30000);
}
this.d454 = function() {
this.refresh();
}
this.d612 = function() {
var id = trim(this.d428.edit_user_id.value);
if(id != "") {
this.d431.contact_list[arrayFirstFree(this.d431.contact_list)] = id;
this.save();
this.d611();
this.d428.edit_user_id.value = '';
}
}
this.d613 = function(num) {
if(confirm(  loc.text("messenger_delete_confirm", "\"" + this.d431.contact_list[num] + "\"")  )) {
this.d431.contact_list[num] = undefined;
this.d611();
this.save();
}
}
this.d611 = function() {
var fl = true;
this.d428.contact_list.innerHTML = "";
for(var i=0; i<this.d431.contact_list.length; i++) {
if(this.d431.contact_list[i] != undefined) {
var itemDom = { tag: "div", className: "menu_panel", id: "contact"+i,
childs: [
createTableDom([ {content: createButtonDom(this.d431.contact_list[i], "d614("+i+")", "widgets/messenger/img/user.gif"), width: "90%"},
{content: createButtonDom(false, "d613("+i+")", "static/client/delete_link.gif"), width: "1%"}
])
]
}
this.d436(this.d428.contact_list, itemDom);
fl = false;
}
}
if(fl) {
this.d428.contact_list.innerHTML = loc.text("msg_empty");
}
}
this.d614 = function(contactNum) {
hideEl(this.d428.section_contact_list);
showEl(this.d428.section_compose);
this.d428.edit_recipient.value = this.d431.contact_list[contactNum];
//        this.d428.edit_body.value = '';
this.d428.edit_body.focus();
}
this.d615 = function(email) {
showEl(this.d428.section_compose);
this.d428.edit_recipient.value = email;
this.d428.edit_body.value = '';
this.d428.edit_body.focus();
}
this.refresh = function() {
if(!this.d609) {
request.send({act: "get_new_messages", user_id: auth.user.id}, this);
this.d609 = true;
}
}
this.d616 = function() {
if((trim(this.d428.edit_recipient.value) == "") ||
(trim(this.d428.edit_body.value) == "")) {
this.d428.send_status.innerHTML = "<b>" + loc.text("messenger_send_error")+ "</b>";
return;
}
hideEl(this.d428.send_btn);
showEl(this.d428.send_status);
this.d428.send_status.innerHTML = loc.text("msg_sending");
request.send({act: "send",
user_id: auth.user.id,
to: trim(this.d428.edit_recipient.value),
body: this.d428.edit_body.value}, this);
}
this.d617 = true;
this.d618 = function() {
if(this.messages.length > 0) {
var time = new Date();
if(this.d617) {
this.d428.new_messages.innerHTML = '';
}
this.d617 = false;
var isNewMessages = false;
for(var i=0; i<this.messages.length; i++) {
if(this.messages[i].rendered) {
continue;
}
this.messages[i].rendered = true;
isNewMessages = true;
var from = (this.messages[i].from_email == "") ?
{ tag: "div", innerHTML: "<b>"+loc.text("messenger_anonym")+"</b>" }
:
createButtonDom("<b>"+this.messages[i].from_email+"</b>", "d615('"+this.messages[i].from_email+"')", "widgets/messenger/img/user.gif");
this.d436(this.d428.tmp,
{ tag: "div", className: "menu_panel", id: "last_msg",
childs: [
from ,
{ tag: "div", class_name: "menu_panel", innerHTML: '[' + time.toLocaleString() + ']'},
{ tag: "div", className: "note", innerHTML: text2html(unescape(this.messages[i].body)) }
]
});
if(this.d428.new_messages.firstChild) {
this.d428.new_messages.insertBefore(this.d428.last_msg, this.d428.new_messages.firstChild);
} else {
this.d428.new_messages.appendChild(this.d428.last_msg);
}
}
if(isNewMessages) {
showEl(this.d428.section_new_messages);
}
showEl(this.d428.clear_new_messages);
} else {
this.d428.new_messages.innerHTML = loc.text("messenger_no_messages");
}
}
this.d619 = function() {
this.d617 = true;
this.messages = [];
this.d618();
hideEl(this.d428.clear_new_messages);
}
this.d455 = function(msg) {
this.d609 = false;
if(msg.status) {
switch(msg.status) {
case "new_messages":
if(msg.list.length > 0) {
var ids = [];
for(var i=0; i<msg.list.length; i++) {
this.messages.push(msg.list[i]);
ids.push(msg.list[i].id);
}
request.send({act: "set_received", user_id: auth.user.id, ids: ids.join("_")}, this);
}
this.d618();
break;
case "send_ok":
this.d428.edit_body.value = '';
showEl(this.d428.send_btn);
this.d428.send_status.innerHTML = "Message sent.";
break;
case "send_error":
this.d428.send_status.innerHTML = "<b>Error:</b> Recipient not found...";
showEl(this.d428.send_btn);
break;
}
}
}
}
Messenger.prototype = new Widget();
function PopMail() {
this.init();
this.cfg = {
hasSettingsBtn: true,
title: loc.text("popmail_title"),
module: "PopMail"
}
this.d578 = [
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", className: "settings_label", innerHTML: loc.text("popmail_mcount")},
{ tag: "select", id: "inp_count", className: "settings_control",
options: [
{ value:"3", text: "3"},
{ value:"5", text: "5"},
{ value:"8", text: "8"},
{ value:"10", text: "10"},
{ value:"12", text: "12"},
{ value:"15", text: "15"},
{ value:"20", text: "20"}
]
},
{ tag: "input", type: "button", value: loc.text("btn_set"), events: {onclick: "setItemsCount()"}, className: "settings_control"}
]
},
{ tag: "div", className: "settings_section", align: "center",
innerHTML: "<b>"+ loc.text("popmail_asettings") + "</b>"},
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", className: "settings_label", innerHTML: loc.text("popmail_inp_login")},
{ tag: "input", id: "select_login", type: "text", size: "15", className: "settings_control"}
]},
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", className: "settings_label", innerHTML: loc.text("popmail_inp_pwd")},
{ tag: "input", id: "select_password", type: "password", size: "15", className: "settings_control"}
]},
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", className: "settings_label", innerHTML: loc.text("popmail_inp_protocol")},
{ tag: "select", id: "select_protocol", className: "settings_control",
events: {onchange: "updatePort()"},
options: [
{ value: "pop3", text: "POP3" },
{ value: "imap", text: "IMAP4" },
]
}
]
},
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", className: "settings_label", innerHTML: loc.text("popmail_inp_secure")},
{ tag: "input", type: "checkbox", id: "select_secure",
events: {onchange: "updatePort()"},
className: "settings_control"}
]},
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", className: "settings_label", innerHTML: loc.text("popmail_inp_server")},
{ tag: "input", id: "select_server", type: "text", size: "15", className: "settings_control"}
]},
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", className: "settings_label", innerHTML: loc.text("popmail_inp_port")},
{ tag: "input", id: "select_port", type: "text", size: "5", value: "110"}
]},
{ tag: "div", className: "settings_section", align: "center",
childs: [
{ tag: "input", type: "button", value: loc.text("btn_save"), events: {onclick: "d524()"}}
]}
]
this.d512 = [
{ tag: "div",
style: { width: "100%", zoom: "1", overflow: "hidden" },
childs: [
{ tag: "div", className: "menu_panel", id: "messages", display: false,
childs: [
{ tag: "div", className: "menu_panel",
style: { paddingLeft: "30px", background: "url(widgets/aolmail/ico.gif) no-repeat 0 0"},
childs: [
{ tag: "b", html: loc.text("popmail_total") },
{ tag: "span", id: "total_messages"}
]},
{ tag: "div", id: "mail_list"}
]}
]},
{ tag: "div", className: "menu_panel", id: "loading_note", display: false,
style: { paddingLeft: "30px", background: "url(widgets/popmail/ico.gif) no-repeat 0 0"},
innerHTML: loc.text("msg_loading")},
{ tag: "div", className: "menu_panel", id: "config_note", display: false,
style: { paddingLeft: "30px", background: "url(widgets/popmail/ico.gif) no-repeat 0 0"},
innerHTML: loc.text("popmail_msg_not_configured")},
{ tag: "div", className: "menu_panel", id: "no_messages_note", display: false,
style: { paddingLeft: "30px", background: "url(widgets/popmail/ico.gif) no-repeat 0 0"},
innerHTML: loc.text("popmail_msg_no_mails")}
]
this.d425["login"] = "";
this.d425["password"] = "";
this.d425["protocol"] = "pop3";
this.d425["secure"] = "0";
this.d425["server"] = "";
this.d425["port"] = "110";
this.d425["title"] = loc.text("popmail_title");
this.d425["mcount"] = "8";
this.d580 = false;
this.d437 = function() {
this.d436(this.d428.settings, this.d578);
this.d436(this.d428.content, this.d512);
this.d428.select_login.value = this.d431.login;
this.d428.select_password.value = this.d431.password;
this.d428.select_protocol.value = this.d431.protocol;
this.d428.select_secure.checked = this.d431.secure == 1;
this.d428.select_server.value = this.d431.server;
this.d428.select_port.value = this.d431.port;
this.d428.inp_count.value = this.d431.mcount;
this.d440(this.d431.title);
}
this.d435 = function() {
if(this.d626()) {
this.d627("config_note");
} else {
this.refresh();
}
//        kernel.d463(this.id, 30000);
}
this.updatePort = function() {
this.d428["select_port"].value =
(this.d428["select_protocol"].value == "pop3")
?
(this.d428["select_secure"].checked ? "995" : "110")
:
(this.d428["select_secure"].checked ? "993" : "143")
}
this.d626 = function() {
return this.d431.login == "" || this.d431.password == "" || this.d431.server == "";
}
this.d627 = function(section) {
var sections = ["config_note", "loading_note", "messages", "no_messages_note"];
for(var i = 0; i<sections.length; i++) {
if(section == sections[i]) {
this.d457(sections[i]);
} else {
this.d456(sections[i]);
}
}
}
this.d524 = function() {
this.d431.login = trim(this.d428.select_login.value);
this.d431.password = trim(this.d428.select_password.value);
this.d431.protocol = this.d428.select_protocol.value;
this.d431.secure = this.d428.select_secure.checked ? 1 : 0;
this.d431.server = trim(this.d428.select_server.value);
this.d431.port = trim(this.d428.select_port.value);
if(this.d626()) {
this.d627("config_note");
} else {
this.save();
this.refresh();
}
}
this.setItemsCount = function() {
var c = this.d428["inp_count"].value;
if(this.d431.mcount != c) {
this.d431.mcount = c;
this.save();
this.d618();
}
}
this.d454 = function() {
if(this.d626()) {
this.d627("config_note");
} else {
this.refresh();
}
}
this.req = null;
this.timerId = null;
this.refresh = function() {
if(!this.d626() && !this.d580) {
this.d580 = true;
this.d627("loading_note");
var protocol = "/" + this.d431.protocol +
((this.d431.secure == 1) ? "/ssl" : "") +
"/novalidate-cert";
this.req = request.send({ login: this.d431.login,
password: this.d431.password,
protocol: protocol,
server: this.d431.server,
port: this.d431.port }, this);
var self = this;
var f = function() {
updateLoadingIcon(-1);
self.req.onreadystatechange = function() {};
self.d580 = false;
self.d627("config_note");
}
this.timerId = setTimeout(f, 30000);
}
}
this.d618 = function() {
if(this.data) {
this.d627("messages");
this.d428.total_messages.innerHTML = "<B>" + this.d628 + "<B>";
this.d428.mail_list.innerHTML = '';
var cnt = Math.min(this.data.length, this.d431.mcount);
for(var i=0; i<cnt; i++) {
try {
this.d436(this.d428.mail_list,
{ tag: "div", className: "menu_panel",
innerHTML: "<B>" + this.data[i].from + "</B>",
childs: [
{ tag: "div", className: "note", innerHTML: this.data[i].subj.wordWrap(20) }
]
});
} catch(e) {}
}
}
}
this.d455 = function(msg) {
clearTimeout(this.timerId);
this.d580 = false;
switch(msg.status) {
case "empty":
this.d627("no_messages_note");
break;
case "data":
this.data = msg.data;
this.d628 = msg.total;
this.d618();
break;
case "error":
this.d627("config_note");
break;
}
}
}
PopMail.prototype = new Widget();
function Gmail() {
this.init();
this.cfg = {
hasSettingsBtn: true,
title: "",
module: "Gmail"
}
this.d578 = [
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", innerHTML: loc.text("gmail_inp_mcount"), className: "settings_label"},
{ tag: "select", id: "news_count", className: "settings_control",
options: [
{ value:"3", text: "3"},
{ value:"5", text: "5"},
{ value:"8", text: "8"},
{ value:"10", text: "10"},
{ value:"12", text: "12"},
{ value:"15", text: "15"},
{ value:"20", text: "20"}
]
},
{ tag: "input", type: "button", value: loc.text("btn_set"), events: {onclick: "d584()"}, className: "settings_control"}
]
},
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", innerHTML: loc.text("gmail_inp_account"), className: "settings_label"},
{ tag: "input", id: "select_email", type: "text", size: "15", className: "settings_control"}
]},
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", innerHTML: loc.text("gmail_inp_pwd"), className: "settings_label"},
{ tag: "input", id: "select_password", type: "password", size: "15", className: "settings_control"}
]},
{ tag: "div", className: "settings_section", align: "center",
childs: [
{ tag: "input", type: "button", value: loc.text("btn_save"), events: {onclick: "d524()"}} ]}
]
this.d512 = [
{ tag: "div", id: "messages_area",
display: false,
childs: [
{ tag: "div",
style: { padding: "0 0 0 30px", height: "24px", background: "url(widgets/gmail/ico.gif) no-repeat 0 0"},
childs: [
{ tag: "span", id: "mail_total" },
{ tag: "input", type: "checkbox",
style: { margin: "0 0 0 16px"},
events: {onclick: "d623()"}, id: "switcher"}
]},
{ tag: "div", id: "mail_list"}
]
},
{ tag: "div", id: "config_note",
style: { paddingLeft: "30px", background: "url(widgets/gmail/ico.gif) no-repeat 0 0"},
innerHTML: loc.text("gmail_msg_not_configured")},
{ tag: "div", className: "menu_panel", id: "msg_no_new_mails", innerHTML: loc.text("gmail_msg_no_mails"), display: false}
]
this.d425["title"] = "";
this.d425["email"] = "";
this.d425["password"] = "";
this.d425["newsCount"] = "8";
this.d437 = function() {
this.d436(this.d428.settings, this.d578);
this.d436(this.d428.content, this.d512);
this.d428.news_count.value = this.d431.newsCount;
this.d428.select_email.value = this.d431.email;
this.d428.select_password.value = this.d431.password;
if(this.d431["email"] != "" && this.d431["password"] != "") {
this.d456("config_note");
}
}
this.d435 = function() {
if(trim(this.d431.title) == "") {
this.d431.title = loc.text("gmail_title");
}
this.d440(this.d431.title);
kernel.d463(this.id, 600*1000);
}
this.d454 = function() {
this.refresh();
}
this.d524 = function() {
this.d431.email = "" + trim(this.d428.select_email.value).split("@gmail.com")[0];
this.d431.password = trim(this.d428.select_password.value);
this.save();
this.d456("messages_area");
this.refresh();
}
this.d584 = function() {
this.d431.newsCount = this.d428.news_count.value;
this.save();
this.d618();
}
var d580 = false;
this.refresh = function() {
this.d456("msg_no_new_mails");
if(this.d431["email"] != "" && this.d431["password"] != "") {
if(!d580) {
d580 = true;
this.d440(loc.text("msg_loading"));
this.d456("config_note");
xmlRequest.send("https://mail.google.com/mail/feed/atom/", this, "d620", {login: this.d431.email, password: this.d431.password});
}
} else {
this.d457("config_note");
}
}
this.d620 = function(response) {
d580 = false;
if(response.responseXML && response.responseXML.documentElement) {
var te = response.responseXML.documentElement.getElementsByTagName("TITLE");
if(!(te[0] && te[0].firstChild.nodeValue == "Unauthorized")) {
try {
this.data = XMLParser.xml2hash(response.responseXML.documentElement, "entry");
this.d621 = response.responseXML.documentElement.getElementsByTagName("fullcount")[0].firstChild.nodeValue;
if(this.data) {
this.d618();
return true;
}
} catch(e) {}
}
}
this.d622();
}
this.d622 = function() {
this.d440(this.d431.title);
this.d457("config_note");
this.d456("messages_area");
}
this.d623 = function() {
if(this.data.items) {
var count = Math.min(this.data.items.length, this.d431.newsCount);
for(var i=0; i<count; i++) {
if(this.d428.switcher.checked) {
this.d457("mail_content" + i);
} else {
this.d456("mail_content" + i);
}
}
}
}
this.d618 = function() {
this.d428.title.innerHTML = '';
this.d436(this.d428.title,
createButtonDom(this.d431.title, "d624()"));
if(this.data && this.data.items.length > 0) {
this.d456("msg_no_new_mails");
this.d456("config_note");
this.d457("messages_area");
this.d428.mail_list.innerHTML = '';
this.d428.mail_total.innerHTML = '<b>' + loc.text("gmail_msg_total", this.d621) + '</b>';
this.d428.switcher.checked = false;
var count = Math.min(this.data.items.length, this.d431.newsCount);
for(var i=0; i<count; i++) {
try {
if(this.data.items[i].author) {
var from = this.data.items[i].author["name"] ? this.data.items[i].author["name"] : this.data.items[i].author["email"];
} else {
var from = "[...]";
}
var subj = this.data.items[i].title ? this.data.items[i].title : "[...]";
var content = this.data.items[i].summary ? this.data.items[i].summary : "[...]";
this.d436(this.d428.mail_list,
{ tag: "div", className: "menu_panel",
childs: [
{ tag: "a", sysHref: this.data.items[i].link.href, target: "_blank",
innerHTML: "<b>" + from + "</b> - " + subj },
{ tag: "div", id: "mail_content"+i, className: "note", display: false,
innerHTML: content }
]
});
} catch(e) {}
}
} else {
this.d457("msg_no_new_mails");
}
}
this.d624 = function() {
window.open("http://mail.google.com/mail");
}
}
Gmail.prototype = new Widget();
function AolMail() {
this.init();
this.cfg = {
hasSettingsBtn: true,
title: "",
module: "AolMail"
}
this.d578 = [
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", className: "settings_label", innerHTML: loc.text("popmail_mcount")},
{ tag: "select", id: "inp_count", className: "settings_control",
options: [
{ value:"3", text: "3"},
{ value:"5", text: "5"},
{ value:"8", text: "8"},
{ value:"10", text: "10"},
{ value:"12", text: "12"},
{ value:"15", text: "15"},
{ value:"20", text: "20"}
]
},
{ tag: "input", type: "button", value: loc.text("btn_set"), events: {onclick: "setItemsCount()"}, className: "settings_control"}
]
},
{ tag: "div", className: "settings_section", align: "center",
innerHTML: "<b>"+ loc.text("popmail_asettings") + "</b>"},
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", className: "settings_label", innerHTML: loc.text("popmail_inp_login")},
{ tag: "input", id: "select_login", type: "text", size: "15", className: "settings_control"}
]},
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", className: "settings_label", innerHTML: loc.text("popmail_inp_pwd")},
{ tag: "input", id: "select_password", type: "password", size: "15", className: "settings_control"}
]},
{ tag: "div", className: "settings_section", align: "center",
childs: [
{ tag: "input", type: "button", value: loc.text("btn_save"), events: {onclick: "d524()"}}
]}
]
this.d512 = [
{ tag: "div", className: "menu_panel", id: "messages", display: false,
childs: [
{ tag: "div", className: "menu_panel",
style: { paddingLeft: "30px", background: "url(widgets/aolmail/ico.gif) no-repeat 0 0"},
childs: [
{ tag: "b", html: loc.text("popmail_total") },
{ tag: "span", id: "total_messages"}
]},
{ tag: "div", id: "mail_list"}
]},
{ tag: "div", className: "menu_panel", id: "loading_note", display: false,
style: { paddingLeft: "30px", background: "url(widgets/aolmail/ico.gif) no-repeat 0 0"},
innerHTML: loc.text("msg_loading")},
{ tag: "div", className: "menu_panel", id: "config_note", display: false,
style: { paddingLeft: "30px", background: "url(widgets/aolmail/ico.gif) no-repeat 0 0"},
innerHTML: loc.text("popmail_msg_not_configured")},
{ tag: "div", className: "menu_panel", id: "no_messages_note", display: false,
style: { paddingLeft: "30px", background: "url(widgets/aolmail/ico.gif) no-repeat 0 0"},
innerHTML: loc.text("popmail_msg_no_mails")}
]
this.d425["login"] = "";
this.d425["password"] = "";
this.d425["title"] = "";
this.d425["mcount"] = "8";
var d580 = false;
this.d437 = function() {
this.d436(this.d428.settings, this.d578);
this.d436(this.d428.content, this.d512);
this.d428.select_login.value = this.d431.login;
this.d428.select_password.value = this.d431.password;
this.d428.inp_count.value = this.d431.mcount;
var t = this.d431.title != "" ? this.d431.title : loc.text("aolmail_title");
this.d440(t);
}
this.d435 = function() {
if(this.d626()) {
this.d627("config_note");
} else {
this.refresh();
}
}
this.d626 = function() {
return this.d431.login == "" || this.d431.password == "";
}
this.d627 = function(section) {
var sections = ["config_note", "loading_note", "messages", "no_messages_note"];
for(var i = 0; i<sections.length; i++) {
if(section == sections[i]) {
showEl(this.d428[sections[i]]);
} else {
hideEl(this.d428[sections[i]]);
}
}
}
this.d524 = function() {
var l = trim(this.d428.select_login.value);
if(l.indexOf("@") != -1) {
l = l.substr(0, l.indexOf("@"));
this.d428.select_login.value = l;
}
var p = trim(this.d428.select_password.value);
if(this.d431.login != l || this.d431.password != p) {
this.d431.login = l;
this.d431.password = p;
this.save();
}
if(this.d626()) {
this.d627("config_note");
} else {
this.refresh();
}
}
this.setItemsCount = function() {
var c = this.d428["inp_count"].value;
if(this.d431.mcount != c) {
this.d431.mcount = c;
this.save();
this.d618();
}
}
this.d454 = function() {
if(this.d626()) {
this.d627("config_note");
} else {
this.refresh();
}
}
this.req = null;
this.timerId = null;
this.refresh = function() {
if(!this.d626() && !d580) {
d580 = true;
this.d627("loading_note");
var protocol = "/imap/ssl/novalidate-cert";
this.req = request.send({ login: this.d431.login,
password: this.d431.password,
protocol: protocol,
server: "imap.aol.com",
port: 993 }, this);
var self = this;
var f = function() {
updateLoadingIcon(-1);
self.req.onreadystatechange = function() {};
self.d580 = false;
self.d627("config_note");
}
this.timerId = setTimeout(f, 30000);
}
}
this.d618 = function() {
if(this.data) {
this.d627("messages");
this.d428.total_messages.innerHTML = "<B>" + this.d628 + "<B>";
this.d428.mail_list.innerHTML = '';
var cnt = Math.min(this.data.length, this.d431.mcount);
for(var i=0; i<cnt; i++) {
try {
this.d436(this.d428.mail_list,
{ tag: "div", className: "menu_panel",
innerHTML: "<B>" + this.data[i].from + "</B>",
childs: [
{ tag: "div", className: "note", innerHTML: this.data[i].subj }
]
});
} catch(e) {}
}
}
}
this.d455 = function(msg) {
clearTimeout(this.timerId);
d580 = false;
switch(msg.status) {
case "empty":
this.d627("no_messages_note");
break;
case "data":
this.data = msg.data;
this.d628 = msg.total;
this.d618();
break;
case "error":
this.d627("config_note");
break;
}
}
}
AolMail.prototype = new Widget();
function YahooMail() {
this.init();
this.cfg = {
hasSettingsBtn: true,
title: "",
module: "YahooMail"
}
this.d578 = [
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", className: "settings_label", innerHTML: loc.text("popmail_mcount")},
{ tag: "select", id: "inp_count", className: "settings_control",
options: [
{ value:"3", text: "3"},
{ value:"5", text: "5"},
{ value:"8", text: "8"},
{ value:"10", text: "10"},
{ value:"12", text: "12"},
{ value:"15", text: "15"},
{ value:"20", text: "20"}
]
},
{ tag: "input", type: "button", value: loc.text("btn_set"), events: {onclick: "setItemsCount()"}, className: "settings_control"}
]
},
{ tag: "div", className: "settings_section", align: "center",
innerHTML: "<b>"+ loc.text("popmail_asettings") + "</b>"},
{ tag: "div", className: "settings_section",
childs: [
{ tag: "a", sysHref: "http://help.yahoo.com/help/us/mail/pop/pop-40.html",
target: "_blank",
html: loc.text("yahoomail_info") }
]},
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", className: "settings_label", innerHTML: loc.text("popmail_inp_login")},
{ tag: "input", id: "select_login", type: "text", size: "15", className: "settings_control"}
]},
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", className: "settings_label", innerHTML: loc.text("popmail_inp_pwd")},
{ tag: "input", id: "select_password", type: "password", size: "15", className: "settings_control"}
]},
{ tag: "div", className: "settings_section", align: "center",
childs: [
{ tag: "input", type: "button", value: loc.text("btn_save"), events: {onclick: "d524()"}}
]}
]
this.d512 = [
{ tag: "div", className: "menu_panel", id: "messages", display: false,
childs: [
{ tag: "div", className: "menu_panel",
style: { paddingLeft: "30px", background: "url(widgets/aolmail/ico.gif) no-repeat 0 0"},
childs: [
{ tag: "b", html: loc.text("popmail_total") },
{ tag: "span", id: "total_messages"}
]},
{ tag: "div", id: "mail_list"}
]},
{ tag: "div", className: "menu_panel", id: "loading_note", display: false,
style: { paddingLeft: "30px", background: "url(widgets/yahoomail/ico.gif) no-repeat 0 0"},
innerHTML: loc.text("msg_loading")},
{ tag: "div", className: "menu_panel", id: "config_note", display: false,
style: { paddingLeft: "30px", background: "url(widgets/yahoomail/ico.gif) no-repeat 0 0"},
innerHTML: loc.text("popmail_msg_not_configured")},
{ tag: "div", className: "menu_panel", id: "no_messages_note", display: false,
style: { paddingLeft: "30px", background: "url(widgets/yahoomail/ico.gif) no-repeat 0 0"},
innerHTML: loc.text("popmail_msg_no_mails")}
]
this.d425["login"] = "";
this.d425["password"] = "";
this.d425["title"] = "";
this.d425["mcount"] = "8";
var d580 = false;
this.d437 = function() {
this.d436(this.d428.settings, this.d578);
this.d436(this.d428.content, this.d512);
this.d428.select_login.value = this.d431.login;
this.d428.select_password.value = this.d431.password;
this.d428.inp_count.value = this.d431.mcount;
var t = this.d431.title != "" ? this.d431.title : loc.text("yahoomail_title");
this.d440(t);
}
this.d435 = function() {
if(this.d626()) {
this.d627("config_note");
} else {
this.refresh();
}
}
this.d626 = function() {
return this.d431.login == "" || this.d431.password == "";
}
this.d627 = function(section) {
var sections = ["config_note", "loading_note", "messages", "no_messages_note"];
for(var i = 0; i<sections.length; i++) {
if(section == sections[i]) {
showEl(this.d428[sections[i]]);
} else {
hideEl(this.d428[sections[i]]);
}
}
}
this.d524 = function() {
var l = trim(this.d428.select_login.value);
if(l.indexOf("@") != -1) {
l = l.substr(0, l.indexOf("@"));
this.d428.select_login.value = l;
}
var p = trim(this.d428.select_password.value);
if(this.d431.login != l || this.d431.password != p) {
this.d431.login = l;
this.d431.password = p;
this.save();
}
if(this.d626()) {
this.d627("config_note");
} else {
this.refresh();
}
}
this.setItemsCount = function() {
var c = this.d428["inp_count"].value;
if(this.d431.mcount != c) {
this.d431.mcount = c;
this.save();
this.d618();
}
}
this.d454 = function() {
if(this.d626()) {
this.d627("config_note");
} else {
this.refresh();
}
}
this.req = null;
this.timerId = null;
this.refresh = function() {
if(!this.d626() && !d580) {
d580 = true;
this.d627("loading_note");
var protocol = "/pop3/ssl/novalidate-cert";
this.req = request.send({ login: this.d431.login,
password: this.d431.password,
protocol: protocol,
server: "pop.mail.yahoo.com",
port: 995 }, this);
var self = this;
var f = function() {
updateLoadingIcon(-1);
self.req.onreadystatechange = function() {};
self.d580 = false;
self.d627("config_note");
}
this.timerId = setTimeout(f, 30000);
}
}
this.d618 = function() {
if(this.data) {
this.d627("messages");
this.d428.total_messages.innerHTML = "<B>" + this.d628 + "<B>";
this.d428.mail_list.innerHTML = '';
var cnt = Math.min(this.data.length, this.d431.mcount);
for(var i=0; i<cnt; i++) {
try {
this.d436(this.d428.mail_list,
{ tag: "div", className: "menu_panel",
innerHTML: "<B>" + this.data[i].from + "</B>",
childs: [
{ tag: "div", className: "note", innerHTML: this.data[i].subj }
]
});
} catch(e) {}
}
}
}
this.d455 = function(msg) {
clearTimeout(this.timerId);
d580 = false;
switch(msg.status) {
case "empty":
this.d627("no_messages_note");
break;
case "data":
this.data = msg.data;
this.d628 = msg.total;
this.d618();
break;
case "error":
this.d627("config_note");
break;
}
}
}
YahooMail.prototype = new Widget();
function Bookmarks() {
this.init();
this.cfg = {
hasRefreshBtn: false,
title: loc.text("bookmarks_title"),
module: "Bookmarks",
saveMethod: "POST"
}
this.d578 = [
{ tag: "div", className: "bevel_section", innerHTML: loc.text("bookmarks_import"),
style: {cursor: "pointer"},
events: {onclick: "d610('section_import')"}
},
{ tag: "div", className: "menu_panel", id: "section_import", display: false, align: "center",
innerHTML: "<iframe name='upload_frame' style='width: 0px; height: 0px; border: 0px'></iframe>",
childs: [
{ tag: "form", method: "post", enctype: "multipart/form-data", action:"bookmarks.php",
target: "upload_frame",
id: "upload_form",
style: {padding: "0px", margin: "0px"},
childs: [
{ tag: "input", type: "hidden", name: "MAX_FILE_SIZE", value:"500000"},
{ tag: "input", type: "hidden", id: "form_wid", name: "wid"},
{ tag: "input", type: "hidden", id: "form_user_id", name: "user_id"},
{ tag: "input", type: "file", name:"user_file", id: "user_file"},
{ tag: "input", type: "button", value: loc.text("bookmarks_btn_import"), id: "upload_submit_btn", events: {onclick: "d632()"}}
]},
{ tag: "div", id: "import_msg", style: {width: "100%", display: "block"}, display: false}
]
},
{ tag: "div", className: "bevel_section", innerHTML: loc.text("bookmarks_sec_delete"),
style: {cursor: "pointer"},
events: {onclick: "d610('section_delete')"}
},
{ tag: "div", className: "menu_panel", id: "section_delete", display: false, align: "center",
childs: [
{ tag: "input", type: "button", value: loc.text("bookmarks_btn_delete_all"), events: {onclick: "d644()"}}
]
},
{ tag: "div", className: "bevel_section", innerHTML: loc.text("bookmarks_sec_add"), id: "add_bookmark",
style: {cursor: "pointer"},
events: {onclick: "d610('section_add')"}
},
{ tag: "div", className: "menu_panel", id: "section_add", display: false,
childs: [
{ tag: "div", className: "menu_panel", innerHTML: loc.text("bookmarks_inp_title"),
childs: [
{ tag: "input", type: "text", size: "30", id: "select_title"}
]
},
{ tag: "div", className: "menu_panel", innerHTML: loc.text("bookmarks_inp_url"),
childs: [
{ tag: "input", type: "text", size: "30", id: "select_url"}
]
},
{ tag: "div", className: "menu_panel", innerHTML: loc.text("bookmarks_inp_tags"),
childs: [
{ tag: "input", type: "text", size: "30", id: "select_tags"}
]
},
{ tag: "div", className: "menu_panel", align: "center",
childs: [
{ tag: "input", type: "button", value: loc.text("btn_save"), events: {onclick: "d645()"}}
]
}
]
}
];
this.d512 = [
{ tag: "div", className: "bevel_section", innerHTML: loc.text("bookmarks_sec_edit"), id: "edit_bookmark", display: false,
style: {cursor: "pointer"},
events: {onclick: "d610('section_edit')"}
},
{ tag: "div", className: "menu_panel", id: "section_edit", display: false,
childs: [
{ tag: "div", className: "menu_panel", innerHTML: loc.text("bookmarks_inp_title"),
childs: [
{ tag: "input", type: "text", size: "30", id: "edit_title"}
]
},
{ tag: "div", className: "menu_panel", innerHTML: loc.text("bookmarks_inp_url"),
childs: [
{ tag: "input", type: "text", size: "30", id: "edit_url"}
]
},
{ tag: "div", className: "menu_panel", innerHTML: loc.text("bookmarks_inp_tags"),
childs: [
{ tag: "input", type: "text", size: "30", id: "edit_tags"}
]
},
{ tag: "div", className: "menu_panel", align: "center",
childs: [
{ tag: "input", type: "button", value: loc.text("btn_save"), events: {onclick: "d642()"}}
]
}
]
},
{ tag: "div", className: "bevel_section", innerHTML: loc.text("bookmark_sec_tags"),
style: {cursor: "pointer"},
events: {onclick: "d610('section_tags')"}},
{ tag: "div", className: "menu_panel", id: "section_tags", display: false, align: "left"},
{ tag: "hr", width: "100%"},
{ tag: "div", className: "menu_panel", id: "bookmarks", align: "left"}
]
this.d425["title"] = loc.text("bookmarks_title");
this.d425["tags"] = ['default'];
this.d425["bookmarks"] = [];
this.d629 = 0;
this.d437 = function() {
this.d436(this.d428.settings, this.d578);
this.d436(this.d428.content, this.d512);
this.d630(0);
this.d428.form_wid.value = this.id;
this.d428.form_user_id.value = auth.user.id;
}
this.d443Settings = function() {
this.d631();
}
this.d449 = function() {
this.d431.title = trim(this.d428.input_title.value);
this.d440(this.d431.title + ": "+ this.d431.tags[this.d629]);
this.save();
}
this.d610 = function(sid) {
if(this.d428[sid].style.display == 'none') {
showEl(this.d428[sid]);
} else {
hideEl(this.d428[sid]);
}
}
// importing
this.d632 = function() {
if(trim(this.d428.user_file.value)!="") {
showEl(this.d428.import_msg);
this.d428.import_msg.innerHTML = loc.text("bookmarks_msg_import");
hideEl(this.d428.upload_submit_btn);
this.d428.upload_form.submit();
}
}
this.d633 = function() {
showEl(this.d428.upload_submit_btn);
this.d428.import_msg.innerHTML = loc.text("bookmarks_msg_import_error");
}
this.d634 = function(file) {
if(file) {
xmlRequest.send("var/tmp/"+file, this, "d636");
this.d635 = file;
} else {
showEl(this.d428.upload_submit_btn);
this.d428.import_msg.innerHTML = loc.text("bookmarks_msg_import_error");
}
}
this.d636 = function(response) {
showEl(this.d428.upload_submit_btn);
if(response.responseText) {
var tmp = document.createElement("span");
tmp.innerHTML = response.responseText.replace(/\<p\>/g, '').replace(/\r\n/g, '').replace(/>\s*</g, '><').replace(/<DT>/g, "").replace(/<DD>/g, '');
var data = XMLParser.d636(tmp);
for(var i=0; i<data.length; i++) {
this.d637(data[i].title, data[i].url, data[i].tags);
}
this.d638();
showEl(this.d428.section_tags);
this.d630(this.d629);
this.save();
if(this.d635) {
request.send({act: "delete", file: this.d635}, this);
}
hideEl(this.d428.import_msg);
hideEl(this.d428.section_import);
this.d444();
return;
}
this.d428.import_msg.innerHTML = loc.text("bookmarks_msg_import_error");
}
this.d639 = null;
this.d631 = function() {
if(this.d639 != null) {
hideEl(this.d428.section_edit);
hideEl(this.d428.edit_bookmark);
this.d640 = null;
}
}
this.d641 = function(id) {
this.d639 = id;
var tags = [];
for(var i = 0; i < this.d431.bookmarks[id].tags.length; i++) {
tags.push(this.d431.tags[this.d431.bookmarks[id].tags[i]])
}
this.d428.edit_title.value = this.d431.bookmarks[id].title;
this.d428.edit_url.value = this.d431.bookmarks[id].url;
this.d428.edit_tags.value = tags.join(", ");
showEl(this.d428.section_edit);
showEl(this.d428.edit_bookmark);
hideEl(this.d428.settings);
}
this.d642 = function() {
if(this.d639 != null) {
var title = trim(this.d428.edit_title.value);
var url = trim(this.d428.edit_url.value);
if(title != "" && url != "") {
this.d643(this.d639, title, url, trim(this.d428.edit_tags.value));
this.d630(this.d629);
this.save();
}
}
this.d631();
}
this.d644 = function() {
this.d431.bookmarks = this.d425["bookmarks"];
this.d431.tags = this.d425["tags"];
this.d630(0);
}
this.d645 = function() {
var title = trim(this.d428.select_title.value);
var url = trim(this.d428.select_url.value);
if(title != "" && url != "") {
this.d631();
this.d637(title, url, trim(this.d428.select_tags.value));
this.save();
this.d630(this.d629);
this.d428.select_title.value = '';
this.d428.select_url.value = '';
this.d428.select_tags.value = '';
}
}
this.d638 = function() {
this.d428.section_tags.innerHTML = '';
for(var t=0; t<this.d431.tags.length; t++) {
if(this.d431.tags[t] != undefined) {
if(this.d629 != t) {
this.d436(this.d428.section_tags,
{ tag: "a",
href: "void", events: { onclick: "d630("+t+")"},
innerHTML: this.d431.tags[t],
style: { margin: "4px"}
});
} else {
this.d436(this.d428.section_tags,
{ tag: "span", innerHTML: this.d431.tags[t],
style: { margin: "4px"}
});
}
}
}
}
this.d630 = function(tagId) {
this.d631();
this.d629 = tagId;
this.d440(this.d431.title + ": "+ this.d431.tags[tagId]);
var list = this.d646(tagId);
this.d428.bookmarks.innerHTML = '';
for(var i = 0; i<list.length; i++) {
var itemDom = { tag: "div", className: "menu_panel", id: "item"+list[i],
childs: [
createTableDom([ {content: {tag: "a", id: "item_title"+list[i], sysHref: this.d431.bookmarks[list[i]].url, target: "_blank", innerHTML: this.d431.bookmarks[list[i]].title}, width: "95%"},
{content: createButtonDom(false, "d641("+list[i]+")", "static/client/edit.gif"), width: "1%"},
{content: createButtonDom(false, "d555("+list[i]+")", "static/client/delete_link.gif"), width: "1%"}
], "95%")
]
}
this.d436(this.d428.bookmarks, itemDom);
}
this.d638();
}
this.d555 = function(id) {
if(confirm(loc.text("bookmarks_delete_prompt", this.d431.bookmarks[id].title))) {
this.d631();
this.d647(id);
if(this.d431.tags[this.d629]) {
this.d630(this.d629);
} else {
this.d630(0);
}
this.save();
}
}
this.d643 = function(id, title, url, tags) {
this.d647(id);
this.d637(title, url, tags);
}
this.d637 = function(title, url, tagsData) {
var newBookmark = { title: title,
url: url,
tags: [] };
if(typeof(tagsData) == "string") {
var tags = tagsData!= "" ? tagsData.split(",") : false;
} else {
var tags = tagsData;
}
if(tags) {
for(var i = 0; i<tags.length; i++) {
tags[i] = trim(tags[i]);
var tn = arraySearch(tags[i], this.d431.tags)
if(tn != undefined) {
newBookmark.tags.push(tn);
} else {
var idx = arrayFirstFree(this.d431.tags);
this.d431.tags[idx] = tags[i];
newBookmark.tags.push(idx);
}
}
} else {
newBookmark.tags = [0];
}
this.d629 = newBookmark.tags[0];
this.d431.bookmarks[arrayFirstFree(this.d431.bookmarks)] = newBookmark;
}
this.d647 = function(id) {
var tags = this.d431.bookmarks[id].tags;
for(var i=0; i<tags.length; i++) {
if(tags[i] != 0) {
var count = 0;
for(var j=0; j<this.d431.bookmarks.length; j++) {
if(this.d431.bookmarks[j] && arraySearch(tags[i], this.d431.bookmarks[j].tags) != undefined) {
count++;
}
}
if(count<2) {
this.d431.tags[tags[i]] = undefined;
}
}
}
this.d431.bookmarks[id] = undefined;
}
this.d646 = function(tagId) {
var res = [];
for(var i=0; i<this.d431.bookmarks.length; i++) {
if(this.d431.bookmarks[i] &&
this.d431.bookmarks[i].tags != undefined &&
arraySearch(tagId, this.d431.bookmarks[i].tags) != undefined) {
res.push(i);
}
}
return res;
}
}
Bookmarks.prototype = new Widget();
function ToDoList() {
this.init();
this.cfg = {
hasRefreshBtn: false,
title_prefix: loc.text("todolist_title_prefix"),
title: "",
module: "ToDoList"
}
this.d425["items"] = [];
this.d425["title"] = "";
this.d578 = [
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", innerHTML: loc.text("todolist_inp_todo"), className: "settings_label"},
{tag: "input", id: "todo_title", type: "text", size: "15", className: "settings_control"},
{tag: "input", type: "button", value: " Add ", events: {onclick: "d650()"}, className: "settings_control"}
]}
]
this.d512 = { tag: "table", className: "sys_table", id: "items_table",
width: "100%",
childs: [] }
this.d437 = function() {
this.d436(this.d428.settings, this.d578);
this.d648();
}
this.d435 = function() {
this.d440(this.d431.title);
}
this.d440 = function(html) {
this.d428.title.innerHTML = this.cfg.title_prefix + html;
}
this.d648 = function() {
this.d428.content.innerHTML = "";
this.d436(this.d428.content, this.d512);
for(var i=0; i<this.d431.items.length; i++) {
this.d649(i);
}
}
this.d649 = function(n) {
this.d436(this.d428.items_table_tbody,
{ tag: "tr", id: "item"+n,
childs: [
{ tag: "td", width: "1%",
childs: [
{ tag: "input", id: "item_checkbox"+n, type: "checkbox", events: {onclick: "d651("+n+")"}, checked: this.d431.items[n].completed}
]},
{ tag: "td", width: "95%",
childs: [
{ tag: "div",
style: {textDecoration: this.d431.items[n].completed ? "line-through" : "", overflow: "hidden"},
id: "item_title"+n, innerHTML: this.d431.items[n].title.wordWrap(10) }
]},
{ tag: "td", width: "1%",
childs: [ createButtonDom(false, "d652("+n+")", "static/client/move_up.gif") ]},
{ tag: "td", width: "1%",
childs: [ createButtonDom(false, "d654("+n+")", "static/client/move_down.gif") ]},
{ tag: "td", width: "1%",
childs: [ createButtonDom(false, "d655("+n+")", "static/client/edit.gif") ]},
{ tag: "td", width: "1%",
childs: [ createButtonDom(false, "d555("+n+")", "static/client/delete_link.gif") ]}
]
});
}
this.d650 = function() {
var title = trim(this.d428.todo_title.value);
if(!title) {
return;
}
var newId = this.d431.items.length;
var newItem = {title: title, completed: false};
this.d431.items[newId] = newItem;
this.d649(newId);
this.save();
this.d428.todo_title.value = '';
}
this.d651 = function(id) {
this.d431.items[id].completed = !this.d431.items[id].completed;
this.d428['item_title'+id].style.textDecoration = this.d431.items[id].completed ? "line-through" : "" ;
this.save();
}
this.d652 = function(id) {
if(id > 0) {
this.d653(id, id-1);
this.d648();
this.save();
}
}
this.d654 = function(id) {
if(id < this.d431.items.length - 1) {
this.d653(id, id+1);
this.d648();
this.save();
}
}
this.d655 = function(id) {
var res = trim(prompt(loc.text("todolist_todo_edit"), this.d431.items[id].title));
if(res) {
this.d431.items[id].title = res;
this.d428['item_title'+id].innerHTML = res.wordWrap(10);
}
this.save();
}
this.d555 = function(id) {
if(confirm(  loc.text("todolist_delete_confirm", this.d431.items[id].title)  )) {
var tmp = [];
for(var i=0; i<this.d431.items.length; i++) {
if(i != id) {
tmp.push(this.d431.items[i]);
}
}
this.d431.items = tmp;
tmp = null;
this.d648();
this.save();
}
}
this.d653 = function(a,b) {
var tmp = this.d431.items[a];
this.d431.items[a] = this.d431.items[b];
this.d431.items[b] = tmp;
}
}
ToDoList.prototype = new Widget();
function Webnote() {
this.init();
this.cfg = {
hasRefreshBtn: false,
title: loc.text("webnote_title"),
module: "Webnote"
}
this.d425["title"] = this.cfg.title;
this.d425["text"] = loc.text("webnote_text");
this.d656 = [
{ tag: "div", id: "text_show",
className: "webnote_text"},
{ tag: "textarea", id: "text_edit",
display: false,
className: "webnote_textarea",
events: {onclick: "d574()", onblur: "d573()"}}
]
this.d437 = function() {
this.d436(this.d428.content, this.d656);
var text_show = this.d428.text_show;
var text_edit = this.d428.text_edit;
var widget = this;
this.d428.text_show["onclick"] = function() { widget.d657(widget, text_show, text_edit); };
var t = this.d431.text.jsUnescape();
this.d428.text_show.innerHTML = text2html(t).parseUrl();
this.d428.text_edit.value = t;
this.d440(this.d431.title);
}
this.d657 = function(widget, text_show, text_edit) {
var h = text_show.offsetHeight;
hideEl(text_show);
showEl(text_edit);
text_edit.style.height = (h+16)+"px";
text_edit.focus();
text_edit.onkeyup = function() {
text_show.innerHTML = text2html(this.value);
showEl(text_show);
this.style.height = (text_show.offsetHeight+16) + "px";
hideEl(text_show);
}
text_edit.onblur = function() {
text = this.value.replace(/\\/g, "");
this.onblur = null;
hideEl(this);
htmlText = text2html(text);
text_show.innerHTML = htmlText.jsUnescape().parseUrl();
text_show.style.display = "block";
text_show.onclick =  function() { widget.d657(widget, text_show, text_edit); };
widget.d431.text = text.jsEscape();
widget.save();
}
}
this.d573 = function() {}
this.d574 = function() {}
}
Webnote.prototype = new Widget();
function Flash() {
this.init();
this.cfg = {
hasRefreshBtn: false,
hasSettingsBtn: false,
itemsDir: 'var/flash/',
title: loc.text("flash_title"),
module: "Flash"
}
this.flash_catalog = [];
this.d512 = [
{ tag: "div", className: "menu_panel", id: "controls", display: false,
childs: [
createTableDom([{content: createButtonDom(loc.text("flash_open"), "d660()", "widgets/flash/img/full_screen.gif"), width: "70%"},
{content: createButtonDom(loc.text("flash_stop"), "d661()", "widgets/flash/img/stop.gif"), width: "30%"}]),
]
},
{ tag: "div", style: {padding: "0px", margin: "0px"}, id: "flash_content",
childs: [
{ tag: "div", id: "flash_container", style: {width: "100%", height: "100%"} }
]
},
{ tag: "div", className: "menu_panel", id: "flash_cat_content0", display: false }
];
this.d425["file"] = "";
this.d425["title"] = loc.text("flash_title");
this.d437 = function() {
this.d436(this.d428.content, this.d512);
this.d658(0);
this.d440(this.d431.title);
if(this.d431.file != "") {
this.d659();
}
}
this.d660 = function() {
flashPlayer.d608(this.id);
}
this.d661 = function() {
this.d428.flash_container.innerHTML = '';
hideEl(this.d428.flash_content);
hideEl(this.d428.controls);
this.d431.title = this.cfg.title;
this.d431.file = "";
this.d440(this.d431.title);
this.save();
}
this.d658 = function(catId) {
var el = this.d428["flash_cat_content"+catId];
if(el.style.display == 'none') {
if(this.flash_catalog[catId]) {
if(this.flash_catalog[catId].rendered) {
el.style.display = 'block';
} else {
this.d662(catId);
}
} else {
el.innerHTML = loc.text("msg_loading");
el.style.display = 'block';
request.send({act: "get_flash_category", cat_id: catId}, this);
}
if(catId != "0") {
this.d428["fico_" + catId].setAttribute("src", menu.folder_o.src);
}
} else {
if(catId != "0") {
this.d428["fico_" + catId].setAttribute("src", menu.folder_s.src);
}
el.style.display = 'none';
}
}
this.d662 = function(catId, silent) {
el = this.d428["flash_cat_content"+catId];
el.innerHTML = '';
with(this.flash_catalog[catId]) {
if(categories) {
for(var i in categories) {
this.d436(el,
{ tag: "div", className: "menu_panel", id: "flash_cat"+categories[i].id,
childs: [
createButtonDom(categories[i].name,
"d658("+categories[i].id+")",
menu.folder_s.src,
null,
"fico_" + categories[i].id),
{ tag: "div", id: "flash_cat_content"+categories[i].id, className: "menu_sub_panel", display: false }
]
});
}
}
if(items) {
for(var i in items) {
this.d436(el,
{ tag: "div", className: "menu_panel", id: "flash_cat_item"+items[i].id,
childs: [
createButtonDom(items[i].title,
"d608('"+items[i].file+"', '"+items[i].title.addSlashes()+"')",
"widgets/flash/img/item.gif",
"flash_cat_item"+items[i].id)
]
});
}
}
if(!items  &&  !categories) {
el.innerHTML = loc.text("msg_empty");
}
rendered = true;
}
if(!silent) {
el.style.display = 'block';
}
this.flash_catalog[catId].rendered = true;
}
this.d608 = function(file, title) {
this.d431.title = title;
this.d431.file = file;
this.d659(file, title);
this.save();
}
this.d659 = function() {
if(this.d431.file) {
showEl(this.d428.controls);
this.d440(this.d431.title);
showEl(this.d428.flash_content);
this.d428.flash_content.style.height = "200px";
this.d428.flash_container.style.height = "100%";
this.d428.flash_container.align = "center";
this.d428.flash_container.innerHTML = '';
var h = (mozilla_nav ? "90%" : "100%");
this.d428.flash_container.innerHTML =
'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+
'        codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=5,0,0,0" '+
'        height='+h+' width=100%>'+
'<param name=movie '+
'       value="'+this.cfg.itemsDir+this.d431.file+'">'+
'<param name=quality value=high>'+
'<param name=bgcolor value=#ffffff>'+
'<embed src="'+this.cfg.itemsDir+this.d431.file+'" '+
'       quality=high bgcolor=#FFFFFF '+
'       height='+h+' width=100%'+
'       type="application/x-shockwave-flash" '+
'       pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>'+
'</object>';
}
}
this.d455 = function(msg) {
switch (msg.status) {
case "flash_category_data":
this.flash_catalog[msg.cat_id] = { categories: msg.categories, items: msg.items};
this.d662(msg.cat_id);
break;
}
}
}
Flash.prototype = new Widget();
function Flickr() {
this.init();
this.cfg = {
title: loc.text("flickr_title_postfix"),
module: "Flickr"
}
this.d425["tags"] = "";
this.d425["layout"] = "s"; // s|t
this.d425["target"] = "s"; // s|f
this.d663 = "http://www.flickr.com/services/feeds/photos_public.gne?format=rss_200";
this.d578 = [
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", innerHTML: loc.text("flickr_inp_tags"), className: "settings_label"},
{ tag: "input", type: "text", size: "15", id: "selectTags", className: "settings_control"},
{ tag: "input", type: "button", events: {onclick: "d667()"}, value: " Set ", className: "settings_control"},
]},
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", innerHTML: loc.text("flickr_inp_layout"), className: "settings_label"},
{ tag: "select", id: "selectLayout", events: {onclick: "d664()"}, className: "settings_control",
options: [
{ value:"s", text: loc.text("flickr_slides")},
{ value:"t", text: loc.text("flickr_thumbs")}
]
}
]},
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", innerHTML: loc.text("flickr_open_to"), className: "settings_label"},
{ tag: "select", id: "selectTarget", events: {onclick: "d666()"}, className: "settings_control",
options: [
{ value:"s", text: loc.text("flickr_to_site")},
{ value:"f", text: loc.text("flickr_to_full")}
]
}
]}
]
this.d512 = [ { tag: "div", className: "menu_panel", id: "head", display: false,
style: { textAlign: "center"},
childs: [
createButtonDom(false, "d671()", "widgets/flickr/img/previous.gif"),
{ tag: "span", innerHTML: "&nbsp;"},
createButtonDom(false, "d672()", "widgets/flickr/img/next.gif")
]
},
{ tag: "div", className: "menu_panel", id: "view_big", style: {textAlign: "center"}, display: false,
childs: [
{ tag: "a", href: "void", events: {onclick: "d673()"},
childs: [
{ tag: "img", id: "big_photo" }
]}
]},
{ tag: "div", className: "menu_panel", id: "view_thumbs", style: {textAlign: "center"}, display: false }];
this.d437 = function() {
this.d428["settings"].innerHTML = "";
this.d436(this.d428.settings, this.d578);
this.d436(this.d428.content, this.d512);
this.d428.selectTags.value = this.d431.tags;
this.d428.selectLayout.value = this.d431.layout;
this.d428.selectTarget.value = this.d431.target;
}
this.d664 = function() {
this.d431.layout = this.d428.selectLayout.value;
this.save();
this.d665();
}
this.d666 = function() {
this.d431.target = this.d428.selectTarget.value;
this.save();
}
this.d667 = function() {
var tags = trim(this.d428.selectTags.value);
if(tags != "") {
this.d431.tags = tags;
this.save();
this.refresh();
}
}
this.d435 = function() {
this.refresh();
}
this.refresh = function() {
this.d440(loc.text("msg_loading"));
xmlRequest.send(this.d663 + (this.d431.tags=="" ? "" :  "&tags="+escape(this.d431.tags)), this, "d675");
}
this.d665 = function() {
if(this.data) {
if(this.d431.layout == "s") {
if(this.data.items.length > 1) {
showEl(this.d428.head);
} else {
hideEl(this.d428.head);
}
this.d668 = 0;
this.d669(this.d668);
} else {
this.d507Photos();
}
}
}
/// photo rotate
this.d668 = 0;
this.d671 = function() {
this.d668--;
if(this.d668<0) {
this.d668 = this.data.items.length-1;
}
this.d669(this.d668);
}
this.d672 = function() {
this.d668++;
if(this.d668 >= this.data.items.length) {
this.d668 = 0;
}
this.d669(this.d668);
}
// show photos
this.d669 = function(n) {
hideEl(this.d428.view_thumbs);
showEl(this.d428.view_big);
var src = this.data.items[n]["media:thumbnail"]["url"];
src = src.substr(0, src.length-5) + 'm.jpg';
if(ie_nav) {
preloadImg(this.d428.big_photo, src);
} else {
this.d428.big_photo.src = src;
}
showEl(this.d428.head);
}
this.d507Photos = function() {
showEl(this.d428.view_thumbs);
hideEl(this.d428.view_big);
hideEl(this.d428.head);
var photosDom = [];
for(var i=0; i<this.data.items.length; i++) {
photosDom[photosDom.length] = { tag: "a", href: "void", events: {onclick: "d674("+i+")"},
innerHTML: "<img width=75 src='"+this.data.items[i]["media:thumbnail"].url+"'> "};
}
this.d428.view_thumbs.innerHTML = '';
this.d436(this.d428.view_thumbs, photosDom);
}
this.d673 = function() {
this.d674(this.d668);
}
this.d674 = function(n) {
open((this.d431.target == "s") ? this.data.items[n].link : this.data.items[n]["media:content"].url);
}
this.d675 = function(response) {
if(response.responseXML.documentElement) {
this.data = XMLParser.xml2hash(response.responseXML.documentElement);
if(this.data) {
this.d440(this.data.title);
this.d665();
}
}
}
}
Flickr.prototype = new Widget();
function FoxVideo() {
this.init();
this.cfg = {
title: "",
module: "FoxVideo"
};
this.channels = [
{text:"Top News", value:"http://rss.video.msn.com/s/us/rss.aspx?t=Fox%20Sports&c=Top%20News&title=Fox%20Sports%20video%20-%20Top%20news&p=33"},
{text:"Most Watched", value:"http://rss.video.msn.com/s/us/rss.aspx?t=hotVideo&c=topsports&title=%20MSN%20Video%20-%20sports&p=05"},
{text:"MLB", value:"http://rss.video.msn.com/s/us/rss.aspx?t=Fox%20Sports&c=Baseball%20News&title=Fox%20Sports%20video%20-%20Baseball%20News&p=33"},
{text:"NFL", value:"http://rss.video.msn.com/s/us/rss.aspx?t=Fox%20Sports&c=NFL%20News&title=Fox%20Sports%20video%20-%20NFL%20news&p=33"},
{text:"NCAA FB", value:"http://rss.video.msn.com/s/us/rss.aspx?t=Fox%20Sports&c=College%20FB%20News&title=Fox%20Sports%20video%20-%20College%20FB%20News&p=33"},
{text:"NBA", value:"http://rss.video.msn.com/s/us/rss.aspx?t=Fox%20Sports&c=NBA%20News&title=Fox%20Sports%20video%20-%20NBA%20news&p=33"},
{text:"NHL", value:"http://rss.video.msn.com/s/us/rss.aspx?t=Fox%20Sports&c=Hockey%20News&title=Fox%20Sports%20video%20-%20Hockey%20news&p=33"},
{text:"NCAA BK", value:"http://rss.video.msn.com/s/us/rss.aspx?t=Fox%20Sports&c=College%20BK%20News&title=Fox%20Sports%20video%20-%20College%20BK%20News&p=33"},
{text:"NASCAR", value:"http://rss.video.msn.com/s/us/rss.aspx?t=Fox%20Sports&c=More%20Fox%20Sports&title=Fox%20Sports%20video%20-%20More%20Fox%20Sports%25&p=33"},
{text:"GOLF", value:"http://rss.video.msn.com/s/us/rss.aspx?t=Fox%20Sports&c=More%20Fox%20Sports&title=Fox%20Sports%20video%20-%20More%20Fox%20Sports%25&p=33"}
];
this.d425["title"] = "";
this.d425["channel"] = "0";
this.d425["count"] = "6";
var d580 = false;
var req = null;
var content = null;
var itemsCount = 25;
var sel_count_options = [];
for(var i=1; i<=itemsCount; i++) {
sel_count_options.push({value: i, text: " " + i + " "});
}
this.d578 = [
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", innerHTML: loc.text("foxvideo_inp_channel"), className: "settings_label"},
{ tag: "select", id: "inp_channel", events: {onchange: "d676()"}, className: "settings_control",
options: this.channels }
]},
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", innerHTML: loc.text("foxvideo_inp_count"), className: "settings_label"},
{ tag: "select", id: "inp_count", events: {onchange: "d677()"}, className: "settings_control",
options: sel_count_options }
]}
]
this.d437 = function() {
this.d436(this.d428.settings, this.d578);
this.d428["inp_channel"].selectedIndex = this.d431.channel;
this.d428["inp_count"].value = this.d431.count;
}
this.d676 = function() {
if(d580) {
this.d428["inp_channel"].selectedIndex = this.d431.channel;
} else {
var c = this.d428["inp_channel"].selectedIndex;
if(c != this.d431.channel) {
this.d431.channel = this.d428["inp_channel"].selectedIndex;
this.save();
req = null;
d580 = false;
this.refresh();
}
}
}
this.d677 = function() {
var c = this.d428["inp_count"].value;
if(c != this.d431.count) {
this.d431.count = c;
this.save();
this.d678();
}
}
this.d435 = function() {
this.refresh();
}
this.refresh = function() {
if(!d580) {
this.d440(loc.text("msg_loading"));
req = xmlRequest.send(this.channels[this.d431.channel].value, this, "d679");
d580 = true;
}
}
this.d679 = function(response) {
d580 = false;
if(response.responseXML && response.responseXML.documentElement) {
content = XMLParser.xml2hash(response.responseXML.documentElement);
} else {
content = null;
}
this.d678();
}
this.d678 = function() {
if(content) {
if(this.d431.title != "") {
this.d440(this.d431.title);
} else {
this.d440(content.title);
}
var l = Math.min(content.items.length, this.d431.count);
var c = "";
var st = "";
for(var i=0; i<l; i++) {
st = i % 2 ? "background: #F0F0F0;" : "";
var lnk = content.items[i]["link"];
c += "<tr style='"+st+"'>"+
"<td valign=top style='padding: 4px;'><a href='"+lnk+"' target=_blank><img style='border: 0' src='"+ content.items[i].enclosure.url +"'/></a></td>"+
"<td style='padding: 4px;'><a href='"+lnk+"' target=_blank><b>"+content.items[i].title+"</b></a>"+
"<p>" +content.items[i].description + "</td>" +
"</tr>";
}
this.d428["content"].innerHTML = "<table class='plan_table'>" + c + "</table>";
} else {
this.d440(loc.text("msg_error"));
}
}
}
FoxVideo.prototype = new Widget();
function AolVideo() {
this.init();
this.cfg = {
title: "",
module: "AolVideo"
};
this.channel = "http://spinner.aol.com/musicsessions/sessions_archive.adp";
this.d425["title"] = "";
this.d425["count"] = "6";
var loading = false;
var req = null;
var content = null;
var itemsCount = 25;
var sel_count_options = [];
for(var i=1; i<=itemsCount; i++) {
sel_count_options.push({value: i, text: " " + i + " "});
}
this.d578 = [
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", innerHTML: loc.text("aolvideo_inp_count"), className: "settings_label"},
{ tag: "select", id: "inp_count", events: {onchange: "d677()"}, className: "settings_control",
options: sel_count_options }
]}
]
this.d437 = function() {
this.d436(this.d428.settings, this.d578);
this.d428["inp_count"].value = this.d431.count;
}
this.d677 = function() {
var c = this.d428["inp_count"].value;
if(c != this.d431.count) {
this.d431.count = c;
this.save();
this.d678();
}
}
this.d435 = function() {
this.refresh();
}
this.refresh = function() {
if(!loading) {
this.d440(loc.text("msg_loading"));
req = xmlRequest.send(this.channel, this, "d679");
loading = true;
}
}
this.d679 = function(response) {
loading = false;
if(response.responseXML && response.responseXML.documentElement) {
try {
var doc = response.responseXML.documentElement;
var items = doc.getElementsByTagName("session");
content = [];
var last = items.length - Math.min(itemsCount, items.length);
if(last <0) {
last = 0;
}
for(var i=items.length-1; i>last; i--) {
if(!items[i].getElementsByTagName("artistThumb")[0].firstChild) {
if(last > 0) last--;
} else {
content.push({
id: items[i].getAttribute("id"),
name: items[i].getElementsByTagName("artistName")[0].firstChild.nodeValue,
thumb: items[i].getElementsByTagName("artistThumb")[0].firstChild.nodeValue
});
}
}
} catch(e) {
content = null;
}
} else {
content = null;
}
this.d678();
}
this.d678 = function() {
if(content) {
if(this.d431.title != "") {
this.d440(this.d431.title);
} else {
this.d440(loc.text("aolvideo_title"));
}
var l = Math.min(content.length, this.d431.count);
var c = "";
var st = "";
for(var i=0; i<l; i++) {
st = i % 2 ? "background: #F0F0F0;" : "";
var lnk = "http://music.aol.com/videos/sessions/sessions_flash.adp?ncid=AOLMUS00050000000052&defaultShow=" + content[i].id;
c += "<tr style='"+st+"'>"+
"<td valign=top style='padding: 4px;' width=10%><a href='"+lnk+"' target=_blank><img style='border: 0' src='"+ content[i].thumb +"'/></a></td>"+
"<td style='padding: 4px;' valign=top>" + content[i].name + "<br>" + loc.text("aolvideo_session") + content[i].id + "<br>" +
"<a href='"+lnk+"' target=_blank>"+
"<img src='widgets/aolvideo/cam.gif' style='margin-right: 4px; height: 8px; border: 0; vertical-align: middle;'>"+
"<b>"+loc.text("aolvideo_lnk_watch")+"</b></a>"+"</td>" +
"</tr>";
}
this.d428["content"].innerHTML = "<table class='plan_table' width=99%>" + c + "</table>";
} else {
this.d440(loc.text("msg_error"));
}
}
}
AolVideo.prototype = new Widget();
function GoogleVideo() {
this.init();
this.cfg = {
title: "",
module: "GoogleVideo"
};
this.channels = [
{text:"Popular", value:"http://video.google.com/videofeed?type=top100new&num=10"},
{text:"Featured", value:"http://video.google.com/videofeed?type=search&q=is:forsale&so=1&num=10"},
{text:"Comedy", value:"http://video.google.com/videofeed?type=search&q=genre:comedy&so=1&num=10"},
{text:"Music", value:"http://video.google.com/videofeed?type=search&q=type:music_video&so=1&num=10"},
{text:"TV Shows", value:"http://video.google.com/videofeed?type=search&q=type:tvshow&so=1&num=10"},
{text:"Sports", value:"http://video.google.com/videofeed?type=search&q=type:sports%20OR%20genre:sports&so=1&num=10"},
{text:"Education", value:"http://video.google.com/videofeed?type=search&q=genre:educational&so=1&num=10"}
];
this.d425["title"] = "";
this.d425["channel"] = "0";
this.d425["count"] = "6";
var d580 = false;
var req = null;
var content = null;
var itemsCount = 10;
var sel_count_options = [];
for(var i=1; i<=itemsCount; i++) {
sel_count_options.push({value: i, text: " " + i + " "});
}
this.d578 = [
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", innerHTML: loc.text("googlevideo_inp_channel"), className: "settings_label"},
{ tag: "select", id: "inp_channel", events: {onchange: "d676()"}, className: "settings_control",
options: this.channels }
]},
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", innerHTML: loc.text("googlevideo_inp_count"), className: "settings_label"},
{ tag: "select", id: "inp_count", events: {onchange: "d677()"}, className: "settings_control",
options: sel_count_options }
]}
]
this.d437 = function() {
this.d436(this.d428.settings, this.d578);
this.d428["inp_channel"].selectedIndex = this.d431.channel;
this.d428["inp_count"].value = this.d431.count;
}
this.d676 = function() {
if(d580) {
this.d428["inp_channel"].selectedIndex = this.d431.channel;
} else {
var c = this.d428["inp_channel"].selectedIndex;
if(c != this.d431.channel) {
this.d431.channel = this.d428["inp_channel"].selectedIndex;
this.save();
req = null;
d580 = false;
this.refresh();
}
}
}
this.d677 = function() {
var c = this.d428["inp_count"].value;
if(c != this.d431.count) {
this.d431.count = c;
this.save();
this.d678();
}
}
this.d435 = function() {
this.refresh();
}
this.refresh = function() {
if(!d580) {
this.d440(loc.text("msg_loading"));
req = xmlRequest.send(this.channels[this.d431.channel].value, this, "d679");
d580 = true;
}
}
this.d679 = function(response) {
d580 = false;
if(response.responseXML && response.responseXML.documentElement) {
content = XMLParser.xml2hash(response.responseXML.documentElement);
//            varpw(content);
} else {
content = null;
}
this.d678();
}
this.d678 = function() {
if(content) {
if(this.d431.title != "") {
this.d440(this.d431.title);
} else {
this.d440(content.title);
}
var l = Math.min(content.items.length, this.d431.count);
var c = "";
var st = "";
for(var i=0; i<l; i++) {
st = i % 2 == "1" ? "background: #F0F0F0;" : "";
var lnk = content.items[i]["link"];
c += "<tr style='"+st+"'>"+
"<td valign=top style='padding: 4px;'><a href='"+lnk+"' target=_blank><img border=0 width=80 src='"+ content.items[i]["media:group"]["media:thumbnail"].url +"'/></a></td>"+
"<td valign=top style='padding: 4px;'><a href='"+lnk+"' target=_blank><b>"+content.items[i]["media:group"]["media:title"]+"</b></a>"+
"<p>" +content.items[i]["media:group"]["media:description"] + "</td>" +
"</tr>";
}
this.d428["content"].innerHTML = "<table class='plan_table'>" + c + "</table>";
} else {
this.d440(loc.text("msg_error"));
}
}
}
GoogleVideo.prototype = new Widget();
function YoutubeVideo() {
this.init();
this.cfg = {
title: "",
module: "YoutubeVideo"
};
this.channels = [
{text:"- Video -", value: "", isBold: true},
{text:"Recently Added", value: "http://youtube.com/rss/global/recently_added.rss"},
{text:"Recently Featured", value: "http://youtube.com/rss/global/recently_featured.rss"},
{text:"Top Favorites", value: "http://youtube.com/rss/global/top_favorites.rss"},
{text:"Top Rated", value: "http://youtube.com/rss/global/top_rated.rss"},
{text:"- Most Viewed Videos -", value: "", isBold: true},
{text:"Today", value: "http://youtube.com/rss/global/top_viewed_today.rss"},
{text:"This Week", value: "http://youtube.com/rss/global/top_viewed_week.rss"},
{text:"This Month", value: "http://youtube.com/rss/global/top_viewed_month.rss"},
{text:"All Time", value: "http://youtube.com/rss/global/top_viewed.rss"},
{text:"- Most Discussed Videos -", value: "", isBold: true},
{text:"Today", value: "http://youtube.com/rss/global/most_discussed_today.rss"},
{text:"This Week", value: "http://youtube.com/rss/global/most_discussed_week.rss"},
{text:"This Month", value: "http://youtube.com/rss/global/most_discussed_month.rss"}
];
this.d425["title"] = "";
this.d425["channel"] = "1";
this.d425["count"] = "6";
var d580 = false;
var req = null;
var content = null;
var itemsCount = 15;
var sel_count_options = [];
for(var i=1; i<=itemsCount; i++) {
sel_count_options.push({value: i, text: " " + i + " "});
}
this.d578 = [
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", innerHTML: loc.text("googlevideo_inp_channel"), className: "settings_label"},
{ tag: "select", id: "inp_channel", events: {onchange: "d676()"}, className: "settings_control",
options: this.channels }
]},
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", innerHTML: loc.text("googlevideo_inp_count"), className: "settings_label"},
{ tag: "select", id: "inp_count", events: {onchange: "d677()"}, className: "settings_control",
options: sel_count_options }
]}
]
this.d437 = function() {
this.d436(this.d428.settings, this.d578);
this.d428["inp_channel"].selectedIndex = this.d431.channel;
this.d428["inp_count"].value = this.d431.count;
}
this.d676 = function() {
if(d580) {
this.d428["inp_channel"].selectedIndex = this.d431.channel;
} else {
var c = this.d428["inp_channel"].selectedIndex;
if(c != this.d431.channel && this.channels[c].value != "") {
this.d431.channel = c;
this.save();
req = null;
d580 = false;
this.refresh();
}
}
}
this.d677 = function() {
var c = this.d428["inp_count"].value;
if(c != this.d431.count) {
this.d431.count = c;
this.save();
this.d678();
}
}
this.d435 = function() {
this.refresh();
}
this.refresh = function() {
if(!d580) {
this.d440(loc.text("msg_loading"));
req = xmlRequest.send(this.channels[this.d431.channel].value, this, "d679");
d580 = true;
}
}
this.d679 = function(response) {
d580 = false;
if(response.responseXML && response.responseXML.documentElement) {
content = XMLParser.xml2hash(response.responseXML.documentElement);
//            varpw(content);
} else {
content = null;
}
this.d678();
}
this.d678 = function() {
if(content) {
if(this.d431.title != "") {
this.d440(this.d431.title);
} else {
this.d440(content.title);
}
var l = Math.min(content.items.length, this.d431.count);
var c = "";
var st = "";
for(var i=0; i<l; i++) {
st = i % 2 == "1" ? "background: #F0F0F0;" : "";
var lnk = content.items[i]["link"];
var lnk2 = content.items[i]["enclosure"].url;
c += "<tr style='"+st+"'>"+
"<td valign=top style='padding: 4px;'>"+
"<a href='"+lnk+"' target=_blank><img border=0 width=120 src='"+ content.items[i]["media:thumbnail"].url +"'/></a>"+
"</td><td valign=top style='padding: 4px;'>"+
"<a href='"+lnk+"' target=_blank><b>"+content.items[i].title+"</b></a>" +
"<br><br><a href='"+lnk2+"' target=_blank>"+
"<img src='widgets/youtubevideo/cam.gif' style='margin-right: 4px; height: 8px; border: 0; vertical-align: middle;'>"+
loc.text("youtubevideo_lnk_watch")+"</a>"
"</td>"+
"</tr>";
}
this.d428["content"].innerHTML = "<table class='plan_table' width=100%>" + c + "</table>";
} else {
this.d440(loc.text("msg_error"));
}
}
}
YoutubeVideo.prototype = new Widget();
function Weather() {
this.init();
this.cfg = {
title: loc.text("weather_title"),
module: "Weather"
};
this.d425["city"] = "RSXX0199";
this.d425["unit"] = "c";
this.d578 = [
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", innerHTML: loc.text("weather_inp_unit"), className: "settings_label"},
{ tag: "select", id: "d680", events: {onclick: "d680()"}, className: "settings_control",
options: [
{ value:"c", text: loc.text("weather_celsius")},
{ value:"f", text: loc.text("weather_fahrenheit")},
]
}
]
},
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", innerHTML: loc.text("weather_inp_town"), className: "settings_label"},
{ tag: "input", type: "text", size: 15, id: "d684", className: "settings_control"},
{ tag: "input", type: "button", events: {onclick: "d682()"}, value: loc.text("btn_set"), className: "settings_control"},
]},
{ tag: "div", className: "settings_section", id: "citiesList", display: false}
]
this.d437 = function() {
this.d428["settings"].innerHTML = "";
this.d436(this.d428.settings, this.d578);
this.d428.d680.value = this.d431.unit;
}
this.d435 = function() {
this.refresh();
}
var loading = false;
this.refresh = function() {
if(!loading) {
loading = true;
this.d440(loc.text("msg_loading"));
xmlRequest.send("http://xoap.weather.com/weather/local/"+this.d431.city+"?cc=*&unit=d&dayf=4", this, "d687");
}
}
this.d680 = function() {
this.d431.unit = this.d428.d680.value;
this.d681();
this.save();
}
this.d682 = function() {
xmlRequest.send("http://xoap.weather.com/search/search?where="+this.d428.d684.value, this, "d683");
}
this.d683 = function(response) {
this.d428.citiesList.innerHTML = '';
showEl(this.d428.citiesList);
var doc = response.responseXML.documentElement;
var r = doc.getElementsByTagName("loc");
if(r.length == 1) {
this.d684(r[0].getAttribute("id"))
} else if (r.length == 0) {
this.d428.citiesList.innerHTML = "<b>" + loc.text("weather_no_cities") + "</b>";
} else {
var clistDom = [];
for(var i=0; i<r.length; i++) {
clistDom[i] = { tag: "li",
childs: [
{ tag: "a", href: "void", events: {onclick: "d684('"+r[i].getAttribute("id")+"')"},
innerHTML: r[i].firstChild.nodeValue}
]
}
}
this.d436(this.d428.citiesList, { tag: "ul", childs: clistDom });
}
}
this.d684 = function(id) {
this.d431.city = id;
hideEl(this.d428.citiesList);
this.save();
this.refresh();
}
this.d685 = function(n) {
var calc = Math.round((n-32)*5/9);
return (isNaN(calc)) ? loc.text("weather_na") : calc + "&#176;";
}
this.d686 = function(node) {
var hi = node.getElementsByTagName("hi")[0].firstChild.nodeValue;
var low = node.getElementsByTagName("low")[0].firstChild.nodeValue;
if(this.d431.unit == "c") {
hi = this.d685(hi);
low = this.d685(low);
}
return low+" / "+hi+"";
}
this.d681 = function() {
if(!this.data) {
return false;
}
var days = this.data.getElementsByTagName("day");
var mDays = [];
var pic;
for(var i=0; i<days.length; i++) {
pic = parseInt(days[i].getElementsByTagName("icon")[0].firstChild.nodeValue);
pic = ((pic < 10) ? "0" : "") + pic + ".gif";
mDays.push({ tag: "td", style: {textAlign: "center"},
childs: [
{ tag: "div", innerHTML: days[i].getAttribute("t") },
{ tag: "img", src: 'static/weather/' + pic },
{ tag: "div", innerHTML: this.d686(days[i]) }
]});
}
var m = { tag: "table", className: "sys_table", style: {width: "100%"},
childs: [
{ tag: "tr",
childs: mDays }
]};
this.d428["content"].innerHTML = '';
this.d436(this.d428["content"], m);
if(this.data.getElementsByTagName("dnam").length>0) {
this.d440(this.cfg.title + " : " + this.data.getElementsByTagName("dnam")[0].firstChild.nodeValue);
}
}
this.d687 = function(response) {
this.data = response.responseXML.documentElement;
this.d681();
loading = false;
}
}
Weather.prototype = new Widget();
function Websearch() {
this.init();
this.cfg = {
hasRefreshBtn: false,
title: loc.text("websearch_title"),
module: "Websearch"
}
this.d425["openHere"] = "0";
this.d425["serverId"] = 1;
this.d578 = [
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", innerHTML: loc.text("websearch_results_target"), className: "settings_label"},
{ tag: "input", id: "set_target", type: "checkbox", events: {onclick: "d666()"}, className: "settings_control"}
]}
]
this.d512 = [
{ tag: "div", className: "menu_panel", style: {marginTop: "4px", padding: "0px"}, id: "servers_tabs", innerHTML: " "},
{ tag: "div", className: "menu_panel", style: {background: "#EAEAFF", padding: "6px", marginTop: "6px"},
childs: [
createTableDom([{content: { tag: "img", id: "server_logo", border: "0", display: false, style: {marginRight: "10px"} }, width: "1%"},
{content: { tag: "input", id: "search_text", type: "text", style: {width: "95%", align: "center"}}, width: "98%"},
{content: { tag: "input", type: "button", value: loc.text("btn_go"), events: {onclick: "d690()"}}, width: "1%"}], "90%")
]}
]
this.d437 = function() {
this.d428["settings"].innerHTML = "";
this.d436(this.d428.settings, this.d578);
this.d436(this.d428.content, this.d512);
for(var i=0; i<websearch_servers.length; i++) {
this.d436(this.d428.servers_tabs,
{ tag: "span", className: "bevel_section",
style: {cursor: "pointer", fontWeight: "normal"},
id: "tab_"+i, align: "center",
innerHTML: websearch_servers[i].title,
events: {onclick: "d689('"+i+"')"}});
}
if(this.d431.serverId > websearch_servers.length - 1) {
this.d431.serverId = websearch_servers.length - 1;
} else if (!websearch_servers[this.d431.serverId]) {
this.d431.serverId = 0;
}
this.d428.set_target.checked = (this.d431.openHere == 1);
this.d688(this.d431.serverId);
//        this.d440(this.d431.title);
var widget = this;
this.d428["search_text"]["onkeyup"] = function(event) { if (!event) { event = window.event } if(event.keyCode == 13) { widget.d690() } };
}
this.d666 = function() {
this.d431.openHere = (this.d428.set_target.checked ? "1" : "0");
this.save();
}
this.d689 = function(serverId) {
this.d431.serverId = serverId;
this.d688(serverId);
this.save();
}
this.d487 = null;
this.d688 = function(serverId) {
if(this.d487) {
this.d428["tab_"+this.d487].style.backgroundColor = "#EAEAFF";
this.d428["tab_"+this.d487].style.fontWeight = "normal";
}
this.d428["tab_"+serverId].style.backgroundColor = "#FFFFFF";
this.d428["tab_"+serverId].style.fontWeight = "bold";
this.d487 = serverId;
if(websearch_servers[serverId].logo != "") {
showEl(this.d428.server_logo);
this.d428.server_logo.src = 'var/img/'+websearch_servers[serverId].logo;
} else {
hideEl(this.d428.server_logo);
}
this.d440(websearch_servers[serverId].title);
}
this.d690 = function() {
var str = this.d428.search_text.value;
if(str == "") {
return;
}
var url = websearch_servers[this.d431.serverId].url+escape(str);
if(this.d431.openHere == 1) {
document.location = url;
} else {
window.open(url);
}
}
}
Websearch.prototype = new Widget();
function Browser() {
this.init();
this.cfg = {
hasRefreshBtn: false,
hasProfile: true,
title: loc.text("browser_title"),
module: "Browser"
};
this.d425["home_page"] = "";
this.d578 = [
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", innerHTML: loc.text("browser_inp_url"), className: "settings_label"},
{ tag: "input", type: "text", size: 15, id: "inp_home_page", className: "settings_control"},
{ tag: "input", type: "button", events: {onclick: "d692()"}, value: loc.text("btn_go"), className: "settings_control"}
]}
]
this.d512 = [
{ tag: "iframe",
id: "browser",
vspace: "0",
hspace: "0",
marginwidth: "0",
marginheight: "0",
frameBorder: "0",
style: { width: "100%", height: "340px", border: "0" }}
]
this.d437 = function() {
this.d440(loc.text("browser_title"));
this.d428.settings.innerHTML = "";
this.d436(this.d428.settings, this.d578);
this.d436(this.d428.content, this.d512);
this.d428["inp_home_page"].value = this.d431["home_page"];
}
this.d435 = function() {
this.d691();
}
this.d692 = function() {
this.d431["home_page"] = this.d693(this.d428["inp_home_page"].value);
this.d428["inp_home_page"].value = this.d431["home_page"];
this.d691();
this.save();
this.d446();
}
this.d691 = function() {
this.d428["browser"].src = this.d431["home_page"];
}
this.d693 = function(str) {
var url = trim(str);
if(url.indexOf("http://") == -1) {
url = "http://"+url;
}
return url;
}
}
Browser.prototype = new Widget();
function Calculator() {
this.init();
this.cfg = {
hasProfile: false,
title: "",
hasSettingsBtn: false,
hasRefreshBtn: false,
module: "Calculator"
}
this.numpadButtons = [
[ {type: "sys1", numkey: "sys", action: "memoryClear()", text: "MC"},
{type: "sys1", numkey: "sys", action: "memoryRestore()", text: "MR"},
{type: "sys1", numkey: "sys", action: "memoryStore()", text: "MS"},
{type: "sys1", numkey: "sys", action: "memoryAdd()", text: "M+"},
{type: "sys2", numkey: "sys", action: "clear()", text: "C"},
{type: "sys2", numkey: "sys", action: "clearE()", text: "CE"} ],
[ {type: "std", numkey: "num", action: "addNumber(7)", text: "7"},
{type: "std", numkey: "num", action: "addNumber(8)", text: "8"},
{type: "std", numkey: "num", action: "addNumber(9)", text: "9"},
{type: "std", numkey: "op", action: "setOperation('/')", text: "/"},
{type: "std", numkey: "op", action: "evalSqrt()", text: "sqrt"} ],
[ {type: "std", numkey: "num", action: "addNumber(4)", text: "4"},
{type: "std", numkey: "num", action: "addNumber(5)", text: "5"},
{type: "std", numkey: "num", action: "addNumber(6)", text: "6"},
{type: "std", numkey: "op", action: "setOperation('*')", text: "*"},
{type: "std", numkey: "op", action: "evalPercent()", text: "%"} ],
[ {type: "std", numkey: "num", action: "addNumber(1)", text: "1"},
{type: "std", numkey: "num", action: "addNumber(2)", text: "2"},
{type: "std", numkey: "num", action: "addNumber(3)", text: "3"},
{type: "std", numkey: "op", action: "setOperation('-')", text: "-"},
{type: "std", numkey: "op", action: "eval1x()", text: "1/x"} ],
[ {type: "std", numkey: "op", action: "changeSign()", text: "+/-"},
{type: "std", numkey: "num", action: "addNumber(0)", text: "0"},
{type: "std", numkey: "num", action: "addPoint()", text: ","},
{type: "std", numkey: "op", action: "setOperation('+')", text: "+"},
{type: "std", numkey: "op", action: "evalute()", text: "="} ]
]
this.d437 = function() {
var numpadModel = [];
for(var r in this.numpadButtons) {
var rowModel = [];
for(var b in this.numpadButtons[r]) {
rowModel.push(
{ tag: "div", className: "calc_btn_" + this.numpadButtons[r][b].type,
childs: [
{ tag: "button", innerHTML: this.numpadButtons[r][b].text, className: "calc_padkey_"+ this.numpadButtons[r][b].numkey,
events: { onclick: this.numpadButtons[r][b].action }}
]});
}
numpadModel.push(
{ tag: "div", className: "calc_numpad_row",
childs: rowModel });
}
this.d436(this.d428["content"], [
{ tag: "div", className: "calc_display", innerHTML: "0",
id: "display"},
{ tag: "div", className: "calc_numpad",
childs: numpadModel }
]);
}
this.d435 = function() {
this.d440(loc.text("calculator_title"));
}
this.addPointFlag = false;
this.memory = null;
this.operation = null;
this.activeNumber = 0;
this.needClear = false;
this.isError = false;
this.getValue = function() {
var v = trim(this.d428["display"].innerHTML);
if(v == "E") {
this.setValue(0);
v = "0";
}
return v;
}
this.setValue = function(v) {
this.d428["display"].innerHTML = v;
}
this.addNumber = function(n) {
if(this.isError) {
this.setValue(0);
this.isError = false;
}
if(this.needClear) {
this.setValue(0);
this.needClear = false;
}
if((this.getValue() == "0") && !this.addPointFlag) {
this.setValue(n);
} else {
if(this.addPointFlag) {
this.d428["display"].innerHTML += ".";
}
this.d428["display"].innerHTML += n;
}
this.addPointFlag = false;
}
this.addPoint = function() {
if(this.needClear) {
this.setValue(0);
this.needClear = false;
}
if(this.getValue().indexOf(".") == -1) {
this.addPointFlag = true;
}
}
this.setOperation = function(op) {
if(this.operation != null) {
this.evalute();
}
this.addPointFlag = false;
this.activeNumber = parseFloat(this.getValue());
this.operation = op;
this.needClear = true;
}
this.evalute = function() {
if(this.operation != null) {
var v = parseFloat(this.getValue());
switch(this.operation) {
case "*":
this.setValue(v * this.activeNumber);
break;
case "+":
this.setValue(v + this.activeNumber);
break;
case "-":
this.setValue(this.activeNumber - v);
break;
case "/":
if(v != 0) {
this.setValue(this.activeNumber / v);
} else {
this.setValue("E");
}
break;
}
this.operation = false;
this.addPointFlag = false;
this.needClear = true;
}
}
this.evalPercent = function() {
if(this.activeNumber != null && this.operation != null) {
this.addPointFlag = false;
var v = parseFloat(this.getValue());
this.setValue(v*this.activeNumber/100);
}
}
this.evalSqrt = function() {
this.addPointFlag = false;
var v = parseFloat(this.getValue());
this.setValue(Math.sqrt(v));
}
this.eval1x = function() {
this.addPointFlag = false;
var v = parseFloat(this.getValue());
if(v != 0) {
this.setValue(1/v);
} else {
this.setValue("E");
}
}
this.changeSign = function() {
var v = parseFloat(this.getValue());
if(v != 0) {
this.setValue(-v);
}
}
this.memoryClear = function() {
this.memory = null;
}
this.memoryRestore = function() {
if(this.memory != null) {
this.setValue(this.memory);
this.needClear = true;
}
}
this.memoryStore = function() {
this.memory = parseFloat(this.getValue());
}
this.memoryAdd = function() {
if(this.memory == null) {
this.memory = 0;
}
this.memory += parseFloat(this.getValue());
}
this.clear = function() {
this.addPointFlag = false;
this.operation = null;
this.activeNumber = 0;
this.setValue(0);
}
this.clearE = function() {
this.addPointFlag = false;
this.setValue(0);
}
}
Calculator.prototype = new Widget();
function HTMLBox() {
this.init();
this.cfg = {
hasRefreshBtn: false,
title: loc.text("htmlbox_title"),
module: "HTMLBox"
}
this.d425["title"] = loc.text("htmlbox_title");
this.d425["html"] = "";
this.d437 = function() {
this.d436(this.d428["settings"], [
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", innerHTML: loc.text("htmlbox_inp_source"), className: "settings_label"},
{ tag: "br"},
{ tag: "textarea", id: "inp_source",
style: { overflow: "auto", width: "98%", height: "120px"} }
]},
{ tag: "div", className: "settings_section",
childs: [
{ tag: "input", type: "button", value: loc.text("btn_ok"),
events: { onclick: "onChangeSource()" }, className: "settings_control"}
]}
]);
}
this.onChangeSource = function() {
var t = this.d428["inp_source"].value;
this.renderHTML(t);
this.d431["html"] = t.jsEscape();
this.save();
this.d444();
}
this.d435 = function() {
this.d440(this.d431["title"]);
this.d428["input_title"].value = this.d431["title"];
this.d428["content"].style.textAlign = "center";
var html = this.d431["html"].jsUnescape();
this.d428["inp_source"].value = html;
this.d428["inp_source"].onfocus = function() {
this.select();
}
this.renderHTML(html);
}
this.setIcon = function(html) {
var url = html.substring(html.indexOf('http://'));
var favIcon = url.substring(0, url.indexOf('/', 8));
if(favIcon == "") {
favIcon = "http://" + baseUrl + "widgets/htmlbox/ico.gif";
} else {
favIcon += "/favicon.ico";
}
this.d428["icon"].setAttribute("src", favIcon);
}
this.renderHTML = function(html) {
this.setIcon(html);
if(!(html && html.length)) {
this.d428["content"].innerHTML = "<div style='text-align: left'>" + loc.text("htmlbox_help") + "</div>";
} else {
if(html.indexOf('<script') != -1) {
this.d428["content"].innerHTML = "";
this.d436(this.d428["content"],
{ tag: "iframe",
id: "iframe",
scrolling: "no",
border: "0",
frameBorder: "0" });
this.d428["iframe"].src = "ewloader.php?wid=" + this.id + "&code=" + encodeURIComponent(html);
} else {
if (html.match(/^http:\/\/.*\.(jpg|png|gif|bmp)$/)) {
html = '&nbsp;<img src="' + html + '" />';
}
this.d428["content"].innerHTML = html;
}
}
}
this.updateIframeSize = function(w, h) {
this.d428["iframe"].style.width = w + "px";
this.d428["iframe"].style.height = w + "px";
}
}
HTMLBox.prototype = new Widget();
function HTMLWidget() {
this.init();
this.cfg = {
hasRefreshBtn: false,
hasSettingsBtn: false,
title: "",
module: "HTMLWidget"
}
this.d425["id"] = "";
this.d435 = function() {
this.d440(loc.text("msg_loading"));
request.send({ act: "get_data", id: this.d431["id"]}, this);
}
this.renderHTML = function(html) {
if(html.indexOf('<script') != -1) {
this.d428["content"].innerHTML = "";
this.d436(this.d428["content"],
{ tag: "iframe",
id: "iframe",
scrolling: "no",
border: "0",
frameBorder: "0" });
this.d428["iframe"].src = "ewloader.php?wid=" + this.id + "&code=" + encodeURIComponent(html);
} else {
this.d428["content"].innerHTML = html;
}
}
this.updateIframeSize = function(w, h) {
this.d428["iframe"].style.width = w + "px";
this.d428["iframe"].style.height = w + "px";
}
this.d455 = function(msg) {
switch(msg.status) {
case "data":
this.d428["content"].style.textAlign = "center";
this.d440(msg.data.title);
this.renderHTML(msg.data.source);
this.d428["icon"].setAttribute("src", "var/hwicons/" + msg.data.icon);
break;
case "error":
this.d428["content"].innerHTML = loc.text("msg_error");
this.d440(loc.text("msg_error"));
break;
}
}
}
HTMLWidget.prototype = new Widget();

