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.d273 = function() {
return ("" + Math.random()).slice(2, 8);
}
this.d274 = 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.d274();
if(!req) {
return false;
}
var d454 = widget.id;
params.module = widget.cfg.module;
//        if(!mozilla_nav) {
var date = new Date();
params["_nc"] = this.d273();
//        }
req.onreadystatechange = function() {
if (req.readyState == 4) {
if ((req.status < 400) && req.responseText) {
updateLoadingIcon(-1);
try {
eval("if(kernel.getWidget(d454)) { kernel.getWidget(d454).d306("+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.d275 = function(url, obj, callback) {
var req = this.d274();
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.d273(), true);
} else {
req.open("GET", url + "?_nc=" + this.d273(), 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.d273();
//        } else {
//            noCache = '';
//        }
var paramStr = "";
if(params) {
for(var i in params) {
paramStr += "&"+i+"="+escape(params[i]);
}
}
var d454 = widget.id;
var cf = callback;
req.onreadystatechange = function() {
updateLoadingIcon(-1);
if (req.readyState == 4) {
if (req.status == 200) {
updateLoadingIcon(-1);
try {
if(kernel.getWidget(d454)) {
kernel.getWidget(d454)[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;
},
d487: function(node) {
var self = XMLParser;
var res = [];
var tags = [];
self.d487Node(res, tags, node.getElementsByTagName("DL")[0]);
return res ? res : null;
},
d487Node: 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.d487Node(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>';
},
d275DocElem: 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.d279.debug_info.innerHTML = info + "<br>" + desktop.d279.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: "d418(\""+id+"_popup\",\"" + target + "\", \"" + colorsChart[i][j] + "\")"}
}
]
});
}
colorsTable.childs.push({tag: "tr", childs: tds});
}
return [
createButtonDom(title, "d416(\""+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, "d417(\""+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: "d307('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.d276 = {
title: ""
}
this.d277 =
{ 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" }
]}
]}
]}
]}// d277
this.init = function() {
this.d279 = {};
this.id = null;
this.d280 = false;
this.d281 = true;
this.d282 = {};
this.d283 = false;
}
this.init();
this.open = function(parent, id, d282) {
this.d284(parent);
this.d285();
if(this.d279.window) {
this.d279.window.wid = this.id;
}
this.d286();
}
this.setParent = function(parentEl) {
this.d279.window.parentNode.removeChild(this.d279.window);
parentEl.appendChild(this.d279.window);
}
this.d284 = function(parent) {
this.d277.display = !this.cfg.isOpenHidden;
if(this.cfg.hasDrag) {
this.d277.events = { onmouseover: "d292(1)", onmouseout: "d292(0)"}
}
this.d287(parent, this.d277);
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: "d293()"} },
{ tag: "div", id: "btn_show", className: "btn_show",
title: loc.text("wbtn_show"),
events: {onclick: "d293()"},
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: "d297()"},
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.d287(this.d279["caption"], m);
}
this.initDtagAndDrop = function() {
if(this.cfg.hasDrag) {
this.d279.caption.style.cursor = 'move';
this.d279.window.drag = new Drag(this.d279.window, this.d279.caption);
}
}
this.d285 = function() {
if(!this.d283) {
this.initDtagAndDrop();
}
this.d287(this.d279.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: "d300()"}, className: "settings_control"}
]}
);
this.d288();
}
this.disableOnClosePrompt = false;
this.d289 = false;
this.d290 = function() {
this.d289 = 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.d311(this.id);
if(this.d279.window) {
deleteEl(this.d279.window);
this.d279.window.innerHTML = '';
this.d279.window = null;
}
this.d282 = false;
this.save();
if(this.cfg.hasDrag && !this.d289) {
desktop.d351();
}
}
}
this.d291 = function(html) {
this.d279.title.innerHTML = html;
}
this.d292 = function(mouse_in) {
if (mouse_in==1 || this.d281==false) {
if(this.cfg.hasCloseBtn && !this.d283)    this.d279.btn_close.style.display = 'block';
if(this.cfg.hasSettingsBtn) this.d279.btn_settings.style.display = 'block';
if(this.cfg.hasRefreshBtn)  this.d279.btn_refresh.style.display = 'block';
if(this.cfg.hasSizeBtn){
this.d279.showhide_div.style.display = 'block';
if(this.cfg.hasIcon) this.d279.icon_div.style.display = 'none';
}
}
else {
if(this.cfg.hasCloseBtn)    this.d279.btn_close.style.display = 'none';
if(this.cfg.hasSettingsBtn) this.d279.btn_settings.style.display = 'none';
if(this.cfg.hasRefreshBtn)  this.d279.btn_refresh.style.display = 'none';
if(this.cfg.hasSizeBtn){
this.d279.showhide_div.style.display = 'none';
if(this.cfg.hasIcon) this.d279.icon_div.style.display = 'block';
}
}
}
this.d293 = function() {
if(this.d280) {
this.show();
} else {
this.hide();
}
}
this.show = function() {
hideEl(this.d279.btn_show);
showEl(this.d279.btn_hide);
if(this.d279.content) {
showEl(this.d279.content);
}
this.d294();
this.d280 = false;
}
this.hide = function() {
hideEl(this.d279.btn_hide);
showEl(this.d279.btn_show);
if(this.d279.content) {
hideEl(this.d279.content);
}
this.d295();
this.d296();
this.d280 = true;
}
this.d297 = function() {
if(this.d281) {
this.d298();
} else {
this.d295();
}
}
this.d298 = function() {
this.d294Settings();
showEl(this.d279.settings);
this.d281 = !this.d281;
}
this.d295 = function() {
if(this.d279.settings) {
hideEl(this.d279.settings);
this.d281 = !this.d281;
}
}
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.d287 = 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.d279[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.d279[data.id+"_tbody"] = el;
}
parentEl.appendChild(el);
}
if(data.childs) {
this.d287(el, data.childs);
}
} else {
for(var e in data) {
this.d287(parentEl, data[e]);
}
}
}
this.d300 = function() {
var t = trim(this.d279.input_title.value);
if(t != this.d282.title) {
this.d282.title = t
this.d291(t);
this.save();
}
}
this.save = function() {
d282r.d375(this);
}
this.d286 = function() {}
this.d288 = function() {}
this.onClose = function() {}
this.d294 = function() {}
this.d296 = function() {}
this.d294Settings = function() {}
this.d301 = function() {}
this.d305 = function() {}
this.refresh = function() {}
this.d306 = function() {}
// SYS
this.d307 = function(id) {
if(this.d279[id]) {
this.d279[id].style.display = 'none';
}
}
this.d308 = function(id, display) {
if(this.d279[id]) {
this.d279[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.d356({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.d279.area);
targetPos.top -= 14;
animFrame = 0;
action = DRAG_ANIM;
processAnimation();
}
function placeWindow() {
clearTimeout(tid);
div.style.position = 'static';
desktop.d279.area.parentNode.insertBefore(div, desktop.d279.area);
div.style.width = 'auto';
desktop.d355();
desktop.d351();
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.d354(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.d301Start) {
events.d301Start(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.d301Stop && dragging) {
events.d301Stop(div.entityInfo);
}
dragging = false;
}
switch(mode) {
case "tabs_drag":
div.onmousedown = function(event) {
desktop.d339Options();
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.d310(auth);
auth.onLoad = function() {
d282r = new Profiler();
d282r.id = kernel.getUniqueId(d282r);
kernel.d310(d282r);
d282r.onLoad = function() {
desktop = kernel.d312("Desktop", elById("desktop_body"));
auth.open(desktop.addPage("auth"));
settings = kernel.d312("Settings", desktop.addPage("settings"));
menu = kernel.d312("Menu", document.body);
feedback = kernel.d312("Feedback", desktop.addPage("feedback"));
custompage = kernel.d312("Custompage", desktop.addPage("custompage"));
sendtofriend = kernel.d312("SendToFriend", desktop.addPage("sendtofriend"));
rssreader = kernel.d312("RssReader", desktop.addPage("rssreader"));
flashPlayer = kernel.d312("FlashPlayer", desktop.addPage("flashplayer"));
desktop.d360();
}
d282r.d376();
}
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.d310 = function(widget) {
this.widgets[widget.id] = widget;
}
this.d311 = function(id) {
this.widgets[id] = null;
}
this.d312 = function(className, parent, id, d282, 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) {
d282 = d282 || false;
w.id = id ? id : this.getUniqueId(w);
if(typeof(objvars) == "object") {
for(var i in objvars) {
w[i] = objvars[i];
}
}
kernel.d310(w);
for(var c in cfgWidget) {
if(typeof(w.cfg[c]) == "undefined") {
w.cfg[c] = cfgWidget[c];
}
}
if(w.cfg.hasProfile) {
d282r.d374(w);
if(d282) {
for(var p in d282) {
w.d282[p] = d282[p];
}
}
}
w.open(parent, false, d282);
return w;
}
}
this.d313 = [];
this.d314 = function(d454, period, noAction) {
if(kernel.widgets[d454]) {
if(noAction != true) {
kernel.getWidget(d454).d305();
}
kernel.d313[d454] = setTimeout("kernel.d314("+d454+","+period+")", period);
}
}
this.d315 = function(d454) {
if(this.d313[d454] != undefined) {
clearTimeout(this.d313[d454]);
this.d313[d454] = undefined;
}
}
}
/*******************************************
*
*   Languages data
*
*******************************************/
function Loc() {
this.data = {};
this.start = function() {
this.lang = getCookie("lng");
if(this.lang == "") {
this.lang = "EN";
}
request.d275("lang/" + this.lang.toLowerCase() + ".xml", this, "d316");
}
this.swapLang = function(lang) {
setCookie('lng', lang);
window.location.reload(true);
}
this.d316 = function(xml) {
this.data = this.d317(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.d317 = 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.d276["title"] = "";
this.d276["theme"] = "default";
this.d276["tabs"] = []; // [ {t: title, c: columner_id, i }, ...]
this.d276["order"] = []; // array of tab indexes
this.d277 = [
{ 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"), "d321()", "widgets/menu/ico.gif")
]},
{ tag: "div", className: "float_right",
childs: [
createButtonDom(loc.text("desktop_show_all"), "d358()"),
{ tag: "span", innerHTML: "&nbsp;&nbsp;|&nbsp;&nbsp;" },
createButtonDom(loc.text("desktop_hide_all"), "d359()"),
{ 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: "d362('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.d318 = null;
this.d286 = function() {
this.d287(document.body, { tag: "link", id: "themes_loader", rel: "stylesheet", media: "screen"});
this.d319();
this.d287(this.d279["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: "d343()" }} ],
[ { 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: "d345()"}}
]}],
[ { tag: "span", innerHTML: loc.text("desktop_panels_count") },
{ tag: "input", type: "button", value: " 1 ",
events: { onclick: "d347(1)" }},
{ tag: "input", type: "button", value: " 2 ",
events: { onclick: "d347(2)" }},
{ tag: "input", type: "button", value: " 3 ",
events: { onclick: "d347(3)" }},
{ tag: "input", type: "button", value: " 4 ",
events: { onclick: "d347(4)" }} ]
]))
this.d279["panel_tab"].style.position = "absolute";
this.d279["panel_tab"].style.width = "250px";
if (customPagesHTML != '') {
this.d279["custom_pages_links"].innerHTML += "&nbsp;|&nbsp;"+customPagesHTML;
}
}
////////////////////////////
// Main menu
this.d320 = false;
this.d321 = function() {
if(this.d320) {
menu.hide();
} else {
menu.show();
}
}
// Pages
this.d322 = "panels";
this.addPage = function(name) {
//        this.d287(document.body,
this.d287(this.d279["pages"],
{ tag: "div", id: "page_" + name, display: false });
return this.d279["page_" + name];
}
this.showPage = function(name) {
this.d307("page_" + this.d322);
this.d308("page_" + name);
this.d322 = name;
}
this.d323 = function() {
this.d307("page_" + this.d322);
this.d308("page_panels");
this.d322 = "panels";
}
///////////////////////////
// System
this.d284 = function(parent) {
this.d287(parent, this.d277);
}
this.d285 = function() {
//title
if(this.d282["title"] == "") {
this.d282["title"] = loc.text("desktop_title_prompt");
}
with(this.d279) {
var t = this.d282["title"].jsUnescape();
if(t == "") {
t = this.d276.title;
}
document.title = t;
title_box.innerHTML = text2html(t);
title_box.onclick = function() { desktop.d324(); };
title_box_tmp.innerHTML = text2html(t);
title_input.value = t;
}
this.d287(this.d279["page_panels"],
{ tag: "div", className: "tab_panel",
id: "tabs",
childs: [
{ tag: "div", id: "add_page_button",
className: "tab_box",
events: {onclick: "d328()"},
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.d324 = function() {
with(this.d279) {
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.d279.title_box_tmp.innerHTML = this.value;
this.style.width = (desktop.d279.title_box_tmp.offsetWidth+4) + "px";
}
}
title_input.onblur = function() {
text = trim(this.value.replace(/\\/g, ""));
if(text == "") {
text = desktop.d276["title"];
}
this.onblur = null;
this.style.display = 'none';
with(desktop.d279) {
title_box.innerHTML = text2html(text);
title_box.style.display = 'inline';
title_box.onclick =  function() { desktop.d324(); };
}
document.title = text;
//                var t = escape(text);
if(text != desktop.d282["title"]) {
desktop.d282["title"] = text.jsEscape();
desktop.save();
}
}
}
}
// TABS
this.d325 = [];
this.d326 = false;
this.d327 = function() {
return this.d282["order"].length + 1;
}
this.d328 = function() {
var title = loc.text("desktop_tab_title") + this.d327();
var idx = arrayFirstFree(this.d282.tabs);
this.d325[idx] = kernel.d312("Columner", document.body);
this.d325[idx].d282["pcount"] = this.d329;
this.d325[idx].save();
this.d282.tabs[idx] = {
t: title,
i: "",
cid: this.d325[idx].id
}
this.d282["order"][idx] = idx;
this.save();
this.d287(this.d279["page_panels"],
this.d330(idx, this.d329));
this.d331(idx, title);
this.d332(idx);
//        this.showDebug();
}
this.d333 = function(icon) {
return "static/tab_icons/" + icon + ".gif";
}
this.d331 = function(n, title, icon) {
var icon_src = icon ? this.d333(icon) : "";
this.d287(this.d279.tmp,
{ tag: "div", id: "tab_"+n,
className: "tab_box",
entityInfo: { type: "tab", idx: n},
events: {onclick: "d332('"+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: "d346('" + n + "')" }},
{ tag: "div", className: "tab_options_btn",
events: { onclick: "d332Options('" + n + "')" }}
]}
]},
{ tag: "div", className: "tab_right" }
]});
this.d279["tabs"].insertBefore(this.d279["tab_"+n], this.d279["add_page_button"]);
var eh = new EntityHandler(this.d279["tab_"+n], "tabs_drag",
{ d301Start: desktop.d335,
onElementOver: desktop.d336,
d301Stop: desktop.d337});
}
// Drag&drop tabs
this.d334 = null;
this.d335 = function(info) {
}
this.d336 = function(info) {
if(info.type == "tab") {
desktop.d334 = info;
desktop.d308("tab_area");
//dimk
desktop.d279["tab_" + info.idx].parentNode.insertBefore(desktop.d279["tab_area"], desktop.d279["tab_" + info.idx]);
}
}
this.d337 = function(info) {
if((desktop.d334 != null) &&
(desktop.d334.type == "tab") &&
(desktop.d334.idx != info.idx)) {
desktop.d279["tab_" + info.idx].parentNode.insertBefore(
desktop.d279["tab_" + info.idx],
desktop.d279["tab_area"]);
for(var i=0; i< desktop.d282["order"].length; i++) {
if(desktop.d282["order"][i] == desktop.d334.idx) {
var belongIdx = i;
}
if(desktop.d282["order"][i] == info.idx) {
var dragIdx = i;
}
}
desktop.d282["order"].splice(
belongIdx - (belongIdx > dragIdx ? 1 : 0),
0,
desktop.d282["order"].splice(dragIdx, 1)[0]);
desktop.save();
}
this.d334 = null;
desktop.d307("tab_area");
}
// show/hide tabs
this.d338 = null;
this.d339 = function(idx) {
this.d339Options();
this.d279["tab_" + idx].className = "tab_box";
}
this.d332 = function(idx) {
if(this.d338 != null && this.d338 != idx) {
this.d339(this.d338);
this.d307("tab_container_" + this.d338);
}
this.d338 = idx;
this.d279["tab_" + idx].className = "tab_box_selected";
this.d308("tab_container_" + idx);
}
// tab options
this.d332Options = function(idx) {
this.d279["input_tab_title"].value = this.d282.tabs[idx].t;
var pos = getElPos(this.d279["tab_" + idx]);
this.d308("panel_tab");
this.d279["panel_tab"].style.left = Math.min(pos.left, (document.body.clientWidth - 255)) + "px";
this.d279["panel_tab"].style.top = (pos.top + this.d279["tab_" + idx].offsetHeight + 4) + "px";
this.d279["panel_tab"].style.zIndex = 1000000;
if(!this.d326) {
this.d326 = true;
for(var i=0; i< this.d342.length; i++) {
this.d287(this.d279["tab_icons_box"],
{ tag: "a", href: "void",
events: { onclick: "d344('" + this.d342[i] + "')"},
innerHTML: "<img src='" + this.d333(this.d342[i]) + "' style='margin: 1px;'>"});
}
}
}
this.d339Options = function() {
this.d307("panel_tab");
}
// tab managment
this.d343 = function() {
var t = trim(this.d279["input_tab_title"].value);
this.d282.tabs[this.d338].t = t;
this.d279["tab_title_" + this.d338].innerHTML = t;
//        this.showDebug();
this.save();
}
this.d344 = function(icon) {
this.d308("tab_icon_" + this.d338);
this.d279["tab_icon_" + this.d338].src = this.d333(icon);
this.d282.tabs[this.d338].i = icon;
//        this.showDebug();
this.save();
}
this.d345 = function() {
this.d307("tab_icon_" + this.d338);
this.d282.tabs[this.d338].i = "";
//        this.showDebug();
this.save();
}
this.d346 = function() {
if(confirm(loc.text("desktop_close_page_prompt"))) {
this.d339Options();
var widgets = this.d325[this.d338].d282["widgets"];
for(var i in widgets) {
var w = kernel.getWidget(widgets[i].id);
if(w) {
w.d290();
}
}
this.d325[this.d338].close();
deleteEl(this.d279["tab_" + this.d338]);
deleteEl(this.d279["tab_container_" + this.d338]);
delete this.d282["tabs"][this.d338];
for(var o in this.d282["order"]) {
if(this.d282["order"][o] > this.d338) {
this.d282["order"][o] --;
}
}
for(var o in this.d282["order"]) {
if(this.d282["order"][o] == this.d338) {
this.d282["order"].splice(o, 1);
break;
}
}
//            this.showDebug();
this.save();
this.d338 = null;
for(var i=0; i<this.d282.tabs.length; i++) {
if(this.d282.tabs[i] != undefined) {
this.d338 = i;
continue;
}
}
if(this.d338 != null) {
this.d332(this.d338);
}
}
}
/* PANELS */
this.d329 = 3;
//dimk
this.d347 = function(n) {
if(n == this.d325[this.d338].d282["pcount"]) {
return;
}
for(var p=0; p<this.d348(); p++) {
var panel = this.d349(p);
for(; panel.childNodes.length>0; ) {
var wid = panel.childNodes[0].wid;
this.d279["tmp"].appendChild(kernel.getWidget(wid).d279.window);
}
}
for(var i=0; i<this.d348(); i++) {
deleteEl(this.d279["panel_" + this.d338 + "_" + i]);
}
deleteEl(this.d279["tab_container_" + this.d338]);
this.d287(this.d279["page_panels"], this.d330(this.d338, n));
this.d325[this.d338].d282["pcount"] = n;
this.d325[this.d338].save();
for(;this.d279["tmp"].childNodes.length > 0;) {
this.d350().appendChild(this.d279["tmp"].childNodes[0]);
}
this.d351();
}
this.d330 = 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.d349 = function(n) {
if(n > this.d348()-1) {
n = this.d348()-1;
}
return this.d279["panel_" + this.d338 + "_" + n];
}
this.d348 = function() {
return this.d325[this.d338] ? this.d325[this.d338].d282["pcount"] : -1;
}
this.d350 = function() {
if(this.d338 == null) {
this.d328();
}
var p = 0;
var minh = 100000;
for(var i = this.d348()-1; i>=0; i--) {
var h = 0;
panel = this.d349(i);
for(var j=0; j<panel.childNodes.length; j++) {
h += panel.childNodes[j].offsetHeight;
}
if(h <= minh) {
minh = h;
p = i;
}
}
return this.d349(p);
}
////////////////////////////////
// Drag and drop
this.d352 = function(pos) {
for(var i=0; i<this.d348(); i++) {
if(isPosInObj(pos, this.d349(i))) {
return this.d349(i);
}
}
return null;
}
this.d353 = 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.d354 = function(el) {
with(this.d279) {
area.style.position = 'relative';
el.parentNode.insertBefore(area, el);
area.style.height = el.offsetHeight + "px";
area.style.display = 'block';
}
}
this.d355 = function() {
with(this.d279) {
area.style.height = 0;
area.style.display = 'none';
area.parentNode.removeChild(area);
}
}
this.d356 = function(pos) {
p = this.d352(pos);
if(p) {
if(p.hasChildNodes()) {
w = this.d353(p, pos);
if(w) {
if(w.name != 'area') {
w = this.d353(p, pos);
p.insertBefore(this.d279.area, w);
}
} else {
this.d279.area.parentNode.removeChild(this.d279.area);
p.appendChild(this.d279.area);
}
} else {
this.d279.area.parentNode.removeChild(this.d279.area);
p.appendChild(this.d279.area);
}
}
}
this.d357 = function(pos) {
if(this.d338 == null) {
this.d328();
}
panel = this.d352(mpos);
if(panel) {
drag.el.parentNode.removeChild(drag.el);
panel.insertBefore(drag.el, this.d279.area);
}
}
this.d358 = function() {
for(var p=0; p<this.d348(); p++) {
for(var i=0; i<this.d349(p).childNodes.length; i++) {
var wid = this.d349(p).childNodes[i].wid;
if(wid) {
kernel.getWidget(wid).show();
}
}
}
}
this.d359 = function() {
for(var p=0; p<this.d348(); p++) {
for(var i=0; i<this.d349(p).childNodes.length; i++) {
var wid = this.d349(p).childNodes[i].wid;
if(wid) {
kernel.getWidget(wid).hide();
}
}
}
}
// SAVE/LOAD DESKTOP
this.d351 = function() {
var n = 0;
var panelsCount = this.d348();
if(this.d325[this.d338]) {
this.d325[this.d338].d282["widgets"] = [];
for(var p=0; p<panelsCount; p++) {
for(var i=0; i<this.d349(p).childNodes.length; i++) {
var wid = this.d349(p).childNodes[i].wid;
if(wid) {
this.d325[this.d338].d282["widgets"].push(
{ m: kernel.getWidget(wid).cfg.module,
id:wid,
p: p});
}
}
}
this.d325[this.d338].save();
}
}
this.d360 = function() {
for(var o in this.d282["order"]) {
var i = this.d282["order"][o];
if(this.d282.tabs[i] == undefined) {
continue;
}
this.d331(i, this.d282.tabs[i].t, this.d282.tabs[i].i);
this.d325[i] = kernel.d312("Columner", document.body, this.d282.tabs[i].cid);
this.d287(this.d279["page_panels"],
this.d330(i, this.d325[i].d282["pcount"]));
this.d332(i);
var widgets = this.d325[i].d282["widgets"];
for(var j in widgets) {
kernel.d312(widgets[j].m,
this.d349(widgets[j].p),
widgets[j].id);
}
}
for(var o in this.d282["order"]) {
var i = this.d282["order"][o];
if(this.d282.tabs[i] != undefined) {
this.d332(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.d312("Browser", this.d350(), false, {home_page: url});
w.save();
this.d351();
} else {
this.d318 = url;
xmlRequest.send(url, this, "d361");
}
}
this.d308("content");
hideEl(elById("loading_note"));
showEl(elById("page_header"));
showEl(elById("page_footer"));
}
this.d361 = function(response) {
if(response.responseXML.documentElement) {
var channel = XMLParser.xml2hash(response.responseXML.documentElement);
if(channel) {
menu.d397(channel.title, this.d318);
var w = kernel.d312("Rss", this.d350(), false, {url: this.d318});
w.save();
this.d351();
return;
}
}
}
this.showDebug = function() {
elById("DEBUG").innerHTML = "<pre>" + Dump(this.d282.tabs) + "</pre>";
}
/* THEMES */
this.d319 = function() {
this.d279["themes_loader"].href = "themes/" + this.d282["theme"] + "/theme.css?v=" + (Math.random() * 1000000);
}
this.d362 = function() {
var url = "http://" + baseUrl;
if(mozilla_nav) {
window.sidebar.addPanel(this.d282["title"], url, "");
} else if(ie_nav) {
window.external.AddFavorite(url, this.d282["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.d276["widgets"] = [];
this.d276["pcount"] = 3;
this.d276["config"] = "";
this.d284 = function(parent) {}
this.d285 = function() {}
}
Columner.prototype = new Widget();
Desktop.prototype.d342 = [
"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.d363 = [
{ 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: "d366()"},
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: "d364()"},
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: "d367()"},
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.d288 = function() {
this.d287(this.d279.content, this.d363);
this.d287(desktop.d279.authButton,
[{ tag: "span", id:"signinBtn",
childs: [createButtonDom(loc.text("auth_lnk_sign_in"), "d370()", "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.d279.signinBtn);
} else {
hideEl(this.d279.signoutBtn);
}
this.d291(loc.text("auth_title"));
}
this.showRemindForm = function() {
this.d308("pwd_remind_form");
this.d307("pwd_remind_link");
this.d307("pwd_remind_msg");
this.d279["inp_reminder_email"].value = "";
this.d279["inp_reminder_email"].focus();
}
this.regFinish = function() {
this.close();
}
this.remindPwd = function() {
var email = trim(this.d279["inp_reminder_email"].value);
if(this.d368(email)) {
request.send( { act: "remind_pwd", email: email }, this);
this.d307("pwd_remind_form");
this.d308("pwd_remind_msg");
}
}
this.d364 = function() {
this.d308("reg_form");
this.d307("login_form");
}
this.d365 = function() {
this.d307("reg_form");
this.d308("login_form");
}
this.d366 = function() {
var e = trim(this.d279["login_email"].value);
var pwd = trim(this.d279["login_pwd"].value);
if(e != "" && pwd != "") {
request.send({ act: "login_user",
email: e,
password: pwd }, this);
this.d307("login_btn");
this.d307("goreg_btn");
this.d279["login_msg"].innerHTML = loc.text("msg_processing");
}
}
this.d367 = function() {
var e = trim(this.d279["reg_email"].value);
var e2 = trim(this.d279["reg_email2"].value);
var pwd = trim(this.d279["reg_pwd"].value);
var pwd2 = trim(this.d279["reg_pwd2"].value);
if(e != e2 || !this.d368(e)) {
this.d279["reg_msg"].innerHTML = loc.text("auth_email_error");
} else if(pwd != pwd2 || !this.d369(pwd)) {
this.d279["reg_msg"].innerHTML = loc.text("auth_pwd_error");
} else if(e != "" && pwd !="") {
request.send({ act: "register_user",
email: e,
password: pwd }, this);
this.d307("reg_btn");
this.d279["reg_msg"].innerHTML = loc.text("msg_processing");
}
}
this.close = function() {
this.d365();
desktop.d323();
}
this.d370 = function() {
desktop.showPage('auth');
}
this.isLogged = function() {
return this.user.email != '';
}
this.logout = function() {
request.send({act: "logout"}, this);
}
this.d371 = function() {
this.anonymusId = getCookie("anonymusid");
this.user.id = getCookie("userid");
this.user.email = getCookie("useremail");
this.user.password = getCookie("userpassword");
}
this.d372 = 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.d372();
this.onLoad();
} else {
this.d371();
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.d306 = function(msg) {
switch(msg.status) {
case "":
break;
case "start_result":
this.user = msg.user;
this.d372();
this.onLoad();
break;
case "register_ok":
this.d308("reg_ok");
this.d307("reg_form");
this.d279["signinBtn"].style.display = "none";
this.d279["signoutBtn"].style.display = "inline";
this.user = msg.user;
this.d372();
//dimk
break;
case "register_error":
this.d279["reg_msg"].innerHTML = loc.text("auth_msg_reg_error");
this.d279["reg_email"].value = "";
this.d279["reg_email2"].value = "";
this.d308("reg_btn");
break;
case "login_ok":
setCookie("anonymusid", this.user.id);
this.user = msg.user;
this.d372();
location.reload();
break;
case "login_error":
this.d279["login_msg"].innerHTML = loc.text("auth_login_error");
this.d308("login_btn");
this.d308("goreg_btn");
break;
case "logout_ok":
var anonymusId = getCookie("anonymusid");
if(anonymusId) {
this.user = {id: anonymusId, email: "", password: ""};
this.d372();
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.d372();
location.reload();
break;
case "pwd_sent":
this.d279["inp_reminder_email"].value = "";
this.d307("pwd_remind_form");
this.d308("pwd_remind_link");
this.d307("pwd_remind_msg");
break;
}
}
this.onLoad = function() {}
this.d373 = function() {
var errors = [];
email = trim(this.d279.selectEmail.value);
password = trim(this.d279.selectPassword.value);
if(!this.d368(email)) {
errors[errors.length] = "<b>" + loc.text("auth_msg_email_invalid") + "</b>";
}
if(!this.d369(password)) {
errors[errors.length]= "<b>" + loc.text("auth_msg_pwd_invalid") + "</b>";
}
if(errors.length > 0) {
this.d279.messages.innerHTML = errors.join("<BR>");
} else {
hideEl(this.d279.submitButton);
this.d279.messages.innerHTML = loc.text("msg_processing");
request.send({act: "register_user", email: email, password: password}, this);
}
}
this.d368 = function(str) {
return /^[a-zA-Z][a-z0-9\-\_]{1,20}@[a-z0-9\-\_\.]{5,30}$/.test(str);
}
this.d369 = function(str) {
return (str.length > 5);
}
}
Auth.prototype = new Widget();
function Profiler() {
this.data = {};
this.cfg = {
module: "Profiler",
hasProfile: false
}
this.d374 = function(widget) {
var d282 = clone(widget.d276);
if(this.data[widget.id]) {
for(var i in this.data[widget.id]) {
if(d282[i] != undefined) {
d282[i] = this.data[widget.id][i];
}
}
}
widget.d282 = d282;
}
this.d375 = function(widget) {
var wkey = widget.id;//getSignature();
if(widget.d282) {
act = this.data[wkey] ? "update" : "create";
request.send({w: widget.cfg.module, act: act, wkey: wkey, data: escape(toCode(widget.d282))}, this, widget.cfg.saveMethod);
} else {
request.send({act: "delete", wkey: wkey}, this);
}
this.data[wkey] = widget.d282;
}
this.d376 = function() {
request.send({act: "load_data"}, this);
}
this.onLoad = function() {}
this.d306 = function(msg) {
if(msg.status == "loaded") {
d282r.data = {};
for(var i in msg.data) {
try {
d282r.data[i] = toValue(unescape(msg.data[i]));
} catch(e) {
d282r.data[i] = {}
}
}
d282r.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.d276["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.d277Content = [
{ tag: "div", className: "menu_panel", id: "d396MenuItem",
childs: [createButtonDom(loc.text("menu_add_feed"), "d395()", "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.d277Additional = [
{ 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>", "d390()", "widgets/menu/img/plus.gif"), width: "99%"},
{content: {tag: "a", href: "void", events: {onclick: "d385()"}, 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: "d396Panel", 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, "d386()", "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: "d396Button", events: {onclick: "d396()"}, value: loc.text("btn_add")}, width: "1%"}
]),
{ tag: "div", display: false, id: "d396Status", 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>", "d402()", "static/client/edit.gif"),
{ tag: "br"},
createButtonDom("<b>"+loc.text("menu_delete")+"</b>", "d404()", "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: "d405()"}},
{ tag: "input", type: "button", value: loc.text("btn_cancel"), events: {onclick: "d384()"} }
]},
{ 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: "d406()"} },
{ tag: "input", type: "button", value: loc.text("btn_no"), events: {onclick: "d384()"} }
]}
]
}
]
this.d379 = 0;
this.d380 = function(id) {
var res = "menu_item_";
if(id) {
res = res + id;
} else {
this.d379 ++;
res = res + this.d379;
}
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.d288 = function() {
this.d279.window.style.position = "absolute";
this.d279.window.style.margin = "2px";
this.d279.window.style.top = "0px";
this.d279.window.style.left = "0px";
this.d279.window.style.width = "235px";
this.d287(this.d279.content, this.d277Content);
this.d287(document.body, this.d277Additional);
this.d291(this.cfg.title);
for(w in menuWidgets) {
if(menuWidgets[w] == "-") {
this.d287(this.d279["content"], { tag: "div", className: "menu_hr"});
} else {
var mid = this.d380();
var wname = menuWidgets[w].className.toLowerCase();
this.d287(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: "d392('" + wname + "', '"+mid+"')",
onmouseout: "d388('" + wname + "')"},
childs: [
createButtonDom(loc.text(wname + "_title"), "d387('" + menuWidgets[w].className + "', '"+mid+"')", "widgets/" + wname + "/ico.gif", mid)
]
}
this.d287(this.d279["content"], m);
}
}
// HTML Widgets
this.d287(this.d279["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.d381(0);
// Custom feeds
var tmp = [];
for(var i=0; i<this.d282.catalog.length; i++) {
if(this.d282.catalog[i] != -1) {
tmp.push(this.d282.catalog[i]);
}
}
this.d282.catalog = null;
this.d282.catalog = tmp;
for(var i in this.d282.catalog) {
this.catalog[CCIDS+1].items[i] = clone(this.d282.catalog[i]);
this.catalog[CCIDS+1].items[i].id = CCIDS + 2 + parseInt(i);
}
this.d382(CCIDS);
}
// open/close sub menus
this.d383 = function(name) {
with (this.d279[name].style) {
display = (display == 'none' ? 'block' : 'none');
}
}
this.show = function() {
if(!desktop.d320) {
showEl(this.d279.window);
desktop.d279.pager.style.marginLeft = this.d279.window.offsetWidth + 2 + "px";
desktop.d279.pager.style.width = "auto";
desktop.d320 = true;
}
}
this.hide = function() {
if(desktop.d320) {
hideEl(this.d279.window);
desktop.d279.pager.style.marginLeft = 0;
desktop.d320 = false;
}
}
this.close = function() {
//        hideEl(desktop.d279.menu);
this.d384();
this.d385();
this.d386();
this.hide();
}
//---------------------------------------------
// PREVIEW
//---------------------------------------------
//dimk
this.d387 = function(widgetClass, mid, params) {
this.d384();
this.d388();
desktop.showPage("panels");
this.d385();
showEl(this.d279.preview);
var pos = {left: getLeft(this.d279.window) + this.d279.window.offsetWidth + 12,
top:  getTop(this.d279[mid])};
setElPos(this.d279.preview, pos);
this.widget = kernel.d312(widgetClass, this.d279["preview_panel"], false, params, { d283: true});
this.d389 = this.widget.disableOnClosePrompt;
this.widget.disableOnClosePrompt = true;
pos.top = pos.top - Math.round(this.d279.preview.offsetHeight / 2);
setElPos(this.d279.preview, pos);
}
this.d385 = function() {
if(this.widget) {
this.widget.close();
}
this.widget = null;
hideEl(this.d279.preview);
this.d279.preview_panel.innerHTML = '';
}
this.d390 = function() {
if(this.widget) {
this.widget.setParent(desktop.d350());
this.widget.save();
this.widget.d283 = false;
this.widget.initDtagAndDrop();
this.widget.disableOnClosePrompt = this.d389;
this.widget = null;
this.d385();
desktop.d351();
}
}
//---------------------------------------------
// HINTS
//---------------------------------------------
this.d391 = null;
this.d392 = function(wname, mid) {
if(!this.widget) {
var pos = {left: getLeft(this.d279.window) + this.d279.window.offsetWidth + 12,
top:  getTop(this.d279[mid])};
setElPos(this.d279["hint_"+wname], pos);
showEl(this.d279["hint_"+wname]);
this.d391 = wname;
this.d384();
}
}
this.d388 = function(wname) {
if(wname) {
hideEl(this.d279["hint_"+wname]);
} else if (this.d391) {
hideEl(this.d279["hint_"+this.d391]);
}
}
//---------------------------------------------
// ADD CHANNELS
//---------------------------------------------
this.d393 = function(html) {
if(html) {
showEl(this.d279.d396Status);
this.d279.d396Status.innerHTML = html;
} else {
clearEl(this.d279.d396Status);
hideEl(this.d279.d396Status);
}
}
this.d394 = false;
this.d395 = function() {
this.d384();
if(!this.d394) {
desktop.showPage("panels");
this.d393(null);
showEl(this.d279.d396Panel);
showEl(this.d279.d396Button);
var pos = {left: getLeft(this.d279.window) + this.d279.window.offsetWidth + 12,
top:  getTop(this.d279.d396MenuItem)};
setElPos(this.d279.d396Panel, pos);
this.d279.selectFeedUrl.focus();
this.d394 = true;
}
}
this.d386 = function() {
if(this.d394) {
hideEl(this.d279.d396Panel);
this.d394 = false;
}
}
this.d396 = function() {
var url = trim(this.d279.selectFeedUrl.value);
if(url!="") {
hideEl(this.d279.d396Button);
this.d393("<b>"+loc.text("menu_msg_cc")+"</b>");
if(url.indexOf("http://") == -1) {
url = "http://"+url;
}
this.d318 = url;
xmlRequest.send(url, this, "d361");
}
}
this.d397 = function(title, url) {
var cn = this.catalog[CCIDS+1].items.length;
this.d282.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.d382(CCIDS+1, true);
this.save();
}
this.d361 = function(response) {
if(response.responseXML.documentElement) {
var channel = XMLParser.xml2hash(response.responseXML.documentElement);
if(channel) {
this.d393("<b>"+loc.text("menu_msg_added", channel.title)+"</b>");
this.d279.selectFeedUrl.value = '';
//        this.d282.catalog[cn] = {title: channel.title, url: this.d318};
this.d397(channel.title, this.d318);
showEl(this.d279.d396Button);
var w = kernel.d312("Rss", desktop.d350(), false, {url: this.d318});
w.save();
desktop.d351();
this.d386();
return;
}
}
this.d393("<b>"+loc.text("menu_msg_no_responce")+ "</b>");
showEl(this.d279.d396Button);
}
//---------------------------------------------
// ITEM MENU
//---------------------------------------------
this.d398 = null;
this.d399 = function(id) {
this.d400();
showEl(this.d279["item_control"+id]);
this.d398 = id;
}
this.d400 = function() {
if(this.d398 != null) {
hideEl(this.d279["item_control"+this.d398]);
}
}
this.d401 = function(mid) {
if(!this.widget && !this.d394) {
hideEl(this.d279.item_menu_rename);
hideEl(this.d279.item_menu_delete);
showEl(this.d279.item_menu_actions);
showEl(this.d279.item_menu);
var pos = {left: getLeft(this.d279.window) + this.d279.window.offsetWidth + 2,
top:  getTop(this.d279[mid]) - 10};
setElPos(this.d279.item_menu, pos);
}
}
this.d384 = function() {
hideEl(this.d279.item_menu);
}
this.d402 = function() {
var n = this.d403(this.d398);
this.d279.new_item_title.value = this.d282.catalog[n].title;
hideEl(this.d279.item_menu_actions);
showEl(this.d279.item_menu_rename);
}
this.d404 = function() {
hideEl(this.d279.item_menu_actions);
showEl(this.d279.item_menu_delete);
}
this.d403 = 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.d405 = function() {
var title = trim(this.d279.new_item_title.value);
if(title != "") {
var n = this.d403(this.d398);
this.d282.catalog[n].title = title;
this.catalog[CCIDS+1].items[n].title = title;
this.d279["cat_item_title"+this.d398].innerHTML = title;
this.save();
this.d384();
}
}
this.d406 = function() {
var n = this.d403(this.d398);
this.d282.catalog[n] = -1;
this.catalog[CCIDS+1].items[n] = -1;
this.d279["cat_item"+this.d398].parentNode.removeChild(this.d279["cat_item"+this.d398]);
this.d279["cat_item"+this.d398] = null;
this.save();
this.d384();
}
//---------------------------------------------
// CATALOGS
//---------------------------------------------
this.d381 = function(catId) {
this.d384();
var el = this.d279["cat_content"+catId];
if(el.style.display == 'none') {
if(this.catalog[catId]) {
if(this.catalog[catId].rendered) {
showEl(el);
} else {
this.d382(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.d279["fico_" + catId].setAttribute("src", this.folder_o.src);
}
} else {
if(catId != "0") {
this.d279["fico_" + catId].setAttribute("src", this.folder_s.src);
}
hideEl(el);
}
}
this.d407 = {};
this.d382 = function(catId, silent) {
el = this.d279["cat_content"+catId];
el.innerHTML = '';
with(this.catalog[catId]) {
if(categories) {
for(var i in categories) {
this.d287(el,
{ tag: "div", className: "menu_panel", id: "cat"+categories[i].id,
childs: [
createButtonDom(categories[i].name,
"d381("+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,
"d387('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: "d399('"+items[i].id+"')", onmouseout: "d400()"};
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: "d401('cat_item"+items[i].id+"')"}
},
width: "99%"});
}
m.childs.push(createTableDom(cells));
this.d287(el, m);
var icons = [
items[i].icon,
getDomain(items[i].url) + "/favicon.ico",
getDir(items[i].url) + "/favicon.ico"
];
with(this.d279[ico_id].style) {
width = "16px";
heigth = "16px";
}
loadIcon(this.d279[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.d279["html_widgets"].innerHTML = "";
for(var i in data) {
var mid = this.d380();
var m = { tag: "div", className: "menu_panel",
childs: [
createButtonDom(data[i].title,
"openHTMLWidget('" + data[i].id + "', '"+mid+"')", "var/hwicons/" + data[i].icon, mid)
]}
this.d287(this.d279["html_widgets"], m);
}
}
}
this.openHTMLWidget = function(hwId, mid) {
//    this.d387 = function(widgetClass, mid, params) {
this.d387("HTMLWidget", mid, { id: hwId });
}
//---------------------------------------------
// DISPATCHER
//---------------------------------------------
this.d306 = function(msg) {
switch (msg.status) {
case "category_data":
this.catalog[msg.cat_id] = { categories: msg.categories, items: msg.items};
this.d382(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.d363 = [
// 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: "d411()" }
}
]},
{ tag: "div", className: "menu_panel", style: {textAlign: "center"},
childs: [
{ tag: "input", type: "button", value: loc.text("btn_save"),
events: { onclick: "d413()" } },
{ tag: "input", type: "button", value: loc.text("btn_delete"),
events: { onclick: "d414()" } }
]}
]},
{ 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.d276["background"] = "";
// Changing password
this.changePwd = function() {
if(auth.isLogged()) {
var p1 = trim(this.d279["inp_new_pwd"].value);
var p2 = trim(this.d279["inp_new_pwd2"].value);
var opwd = trim(this.d279["inp_old_pwd"].value);
if(opwd == auth.user.password) {
if((p1 == p2) && (p1 != "")) {
var opwd = trim(this.d279["inp_old_pwd"].value);
request.send({ act: "change_pwd", npwd: p1}, this);
this.d279["change_pwd_msg"].innerHTML = loc.text("msg_processing");
this.d279["btn_change_pwd"].disabled = true;
} else {
this.d279["change_pwd_msg"].innerHTML = loc.text("settings_new_pwd_wrong");
}
} else {
this.d279["change_pwd_msg"].innerHTML = loc.text("settings_old_pwd_wrong");
}
} else {
alert(loc.text("settings_msg_sign_in"));
}
}
this.d288 = function() {
this.d279["content"].style.height = "540px";
this.d291(this.cfg.title);
this.d287(this.d279.content, this.d363);
this.d408 = document.body.style.background;
this.d409();
}
this.d286 = function() {
request.send({ act: "get_themes" }, this);
}
this.d410 = false;
this.d411 = function() {
this.d410 = "url(" + trim(this.d279["select_background"].value) + ") repeat fixed";
document.body.style.background = this.d410;
}
this.d412 = function(color) {
this.d410 = color;
document.body.style.background = color;
}
this.d413 = function() {
this.d282["background"] = this.d410;
this.save();
desktop.d323();
}
this.d414 = function() {
document.body.style.background = "";
this.d282["background"] = "";
this.save();
}
this.close = function() {
desktop.d323();
}
this.d302 = function(target, color) {
switch(target) {
case "background":
this.d412(color);
break;
}
}
this.d409 = function() {
if(this.d282.background == "") {
return;
}
document.body.style.background = this.d282.background;
}
this.d415 = false;
this.d416 = function(btnEl, popupEl) {
if(this.d415) {
if(this.d415 == popupEl) return;
this.d417(this.d415);
}
this.d415 = popupEl;
var pos = {left: getLeft(this.d279[btnEl]) + 16,
top:  getTop(this.d279[btnEl]) + 16};
showEl(this.d279[popupEl]);
setElPos(this.d279[popupEl], pos);
}
this.d417 = function(popupEl) {
hideEl(this.d279[popupEl]);
this.d415 = false;
}
this.d418 = function(popupEl, target, color) {
this.d417(popupEl);
this.d302(target, color);
}
this.d419 = function(popupEl, target, font) {
this.d417(popupEl);
this.d303(target, font);
}
this.d419Size = function(popupEl, target, fontSize) {
this.d417(popupEl);
this.d303Size(target, fontSize);
}
/* THEMES */
this.d421 = function(list) {
if(list == null) {
this.d279["page_themes"].innerHTML = "No themes found :(";
} else {
this.d279["page_themes"].innerHTML = "";
for(var i=0; i< list.length; i++) {
var cn = (list[i].name == desktop.d282["theme"]) ? "theme_box_selected" : "theme_box";
this.d287(this.d279["page_themes"],
{ tag: "div", className: cn,
id: "theme_box_" + list[i].name,
events: { onclick: "d423('" + 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.d422 = function(name) {
if(this.d279["theme_box_" + name]) {
this.d279["theme_box_" + name].className = "theme_box_selected";
}
}
this.d423 = function(name) {
if(desktop.d282["theme"] != name) {
if(this.d279["theme_box_" + desktop.d282["theme"]]) {
this.d279["theme_box_" + desktop.d282["theme"]].className = "theme_box";
}
this.d279["theme_box_" + name].className = "theme_box_selected";
desktop.d282["theme"] = name;
desktop.d319();
desktop.save();
}
}
this.d306 = function(msg) {
switch (msg.status) {
case "themes_list":
this.d421(msg.data);
break;
case "pwd_changed":
this.d279["change_pwd_msg"].innerHTML = loc.text("settings_pwd_changed");
this.d279["btn_change_pwd"].disabled = false;
this.d279["inp_old_pwd"].value = "";
this.d279["inp_new_pwd"].value = "";
this.d279["inp_new_pwd2"].value = "";
auth.user.password = msg.npwd;
auth.d372();
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.d288 = function() {
this.d291(this.cfg.title);
this.d287(this.d279.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: "d426()"}}
]}
]}
]}
]);
this.d279["content"].style.height = "300px";
this.d279["inp_email"].value = auth.user.email;
}
this.close = function() {
desktop.d323();
}
this.d424 = function() {}
this.d425 = function() {}
//-------------------------------------
// SEND
//-------------------------------------
this.d426 = function() {
var str = this.d279["inp_message"].value;
if(str!="") {
hideEl(this.d279.feedback_input);
showEl(this.d279.feedback_sending);
request.send({ act: "feedback",
text: str,
email: this.d279["inp_email"].value},
this, "POST");
}
else {
alert(loc.text('feedback_text_empty'));
}
}
this.d306 = function(msg) {
switch (msg.status) {
case "feedback_saved":
this.d279.feedback_status.innerHTML = "<b>"+loc.text('feedback_msg_saved')+"</b>";
this.d279["inp_message"].value = "";
showEl(this.d279.feedback_input);
hideEl(this.d279.feedback_sending);
break;
case "empty_text":
this.d279.feedback_status.innerHTML = loc.text('feedback_msg_empty');
showEl(this.d279.feedback_input);
hideEl(this.d279.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.d288 = function() {
this.d291(loc.text("custompage_title"));
this.d279["content"].style.height = "300px";
this.d279["content"].style.overflow = "auto";
}
this.close = function() {
desktop.d323();
}
this.setData = function(title, content) {
this.d291(title);
this.d279["content"].innerHTML = content.parseUrl();
}
}
Custompage.prototype = new Widget();
function SendToFriend() {
this.init();
this.d427 = {
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: "d428()"}}
]}
]}
this.cfg = {
hasSizeBtn: false,
hasRefreshBtn: false,
hasSettingsBtn: false,
hasDrag: false,
hasProfile: false,
title: "",
module: "SendToFriend",
uniqueId: SYS_WIDGETS_ID + 9
}
this.d288 = function() {
this.d291(loc.text('sendtofriend_title'));
this.d279["content"].style.height = "300px";
this.d287(this.d279.content, this.d427);
this.d279["ed_email"].value = auth.user.email;
this.d279["ed_message"].value = "http://" + baseUrl;
}
this.close = function() {
desktop.d323();
}
this.d306 = function(msg) {
//alert(msg.status);
switch(msg.status) {
case 'ok':
this.d308("btn_send");
this.d279.send_status.innerHTML = '<font color=green>'+loc.text('sendtofriend_send_ok')+'</font>';
break;
case 'failed':
this.d279.send_status.innerHTML = '<font color=red>'+loc.text('sendtofriend_send_failed')+'</font>';
this.d308("btn_send");
break;
}
}
this.d428 = function() {
var name_val   = this.d279.ed_name.value;
var email_val  = this.d279.ed_email.value;
var femail_val = this.d279.ed_friend_email.value;
var msg_val    = this.d279.ed_message.value;
//todo: e-mail check
if (email_val=="") {
alert(loc.text('sendtofriend_email_empty'));
this.d279.ed_email.focus();
return;
}
if (d368Address(email_val)==false) {
alert(loc.text('sendtofriend_email_invalid'));
this.d279.ed_email.focus();
return;
}
if (femail_val=="") {
alert(loc.text('sendtofriend_femail_empty'));
this.d279.ed_friend_email.focus();
return;
}
if (d368Address(femail_val)==false) {
alert(loc.text('sendtofriend_femail_invalid'));
this.d279.ed_friend_email.focus();
return;
}
this.d279["send_status"].innerHTML = loc.text("msg_processing");
this.d307("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 d368Address(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.d276["cnt"] = 10;
this.d276["opend"] = 0;
this.d276["url"] = "";
this.d276["icon"] = "";
this.d276["period"] = 600;
this.d276["md5"] = [];
this.d429 = [
{ 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: "d435()"}}
]
},
{ 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: "d438()"}}
]},
{ 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: "d434()"}
}
]},
{ 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: "d433()"}}
]}
]
this.d430 = null
this.d431 = false;
this.d432 = false;
this.d288 = function() {
this.d279["settings"].innerHTML = "";
this.d287(this.d279.settings, this.d429);
this.d279.period.value = this.d282.period;
this.d279.news_count.value = this.d282.cnt;
this.d279.opend.checked = this.d282.opend == 1;
this.d279.content.style.padding = "6px";
this.d279["select_url"].value = this.d282["url"];
}
this.d433 = function() {
var url = trim(this.d279["select_url"].value);
if(url != "") {
if(url.indexOf("http://") == -1) {
url = "http://" + url;
}
if(this.d282["url"] != url) {
this.d282["url"] = url;
this.save();
this.iconLoaded = false;
kernel.d315(this.id);
kernel.d314(this.id, this.d282.period * 1000, true);
this.refresh();
}
}
this.d295();
}
this.d434 = function() {
this.d282.opend = this.d279.opend.checked ? 1 : 0;
this.save();
}
this.d435 = function() {
this.d282.cnt = this.d279.news_count.value;
this.save();
this.d436();
this.d437();
}
this.d438 = function() {
this.d282.period = this.d279.period.value;
kernel.d315(this.id);
kernel.d314(this.id, this.d282.period * 1000, true);
this.save();
}
this.d286 = function() {
kernel.d314(this.id, this.d282.period * 1000);
}
this.d305 = function() {
if(!this.d432) {
this.refresh();
}
}
this.refresh = function() {
var date = new Date();
this.d430 = date.getSeconds();
this.d291(loc.text("msg_loading"));
var wid = this.id;
var iconEl = this.d279.icon;
xmlRequest.send(this.d282.url, this, "d446");
this.d431 == true;
}
this.d439 = function(wid, feedId) {
if(this.d282.opend == 1) {
window.open(this.data.items[feedId]["link"]);
} else {
this.d432 = true;
rssreader.d452 = this.d430;
rssreader.d279["icon"].src = this.d279["icon"].src;
rssreader.d439(wid, feedId);
}
}
this.d440 = function() {
return Math.min(this.data.items.length, this.d282.cnt);
}
this.d441 = function(itemIdx) {
this.data.items[itemIdx].isRead = 1;
this.d282["readed"][itemIdx] = 1;
this.d436();
this.d279["item_" + itemIdx].className = "rss_box_item_visited";
}
this.d442 = function(itemIdx) {
this.data.items[itemIdx].isRead = 0;
this.d282["readed"][itemIdx] = 0;
this.d436();
this.d279["item_" + itemIdx].className = "rss_box_item";
}
this.d443 = function() {
var count = this.d440();
var res = 0;
for(var i=0; i<count; i++) {
if(this.data.items[i].isRead == 1) {
res ++;
}
}
return res;
}
this.d436 = function() {
if(this.data) {
var count = this.d440();
var readed = this.d443();
this.d279.title.innerHTML = '';
this.d287(this.d279.title,
{ tag: "a", href: "void",
innerHTML: this.data.title.substr(0,25),
events: { onclick: "d449()" } });
if(count > readed) {
this.d287(this.d279.title,
{ tag: "span",
innerHTML: " &nbsp;(" + (count - readed) + ")" });
}
}
}
this.d444 = {
url: null,
time: null
}
this.d445 = 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.d446 = function(response) {
this.d431 == 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.d282["md5"].length;
for(var i=0; i<count; i++) {
var md5 = this.data.items[i]["md5"] = this.d445(i);
var j = this.d447(md5);
if(j != null) {
this.data.items[i].isRead = 1;
newMd5.push(md5);
l--;
}
}
this.d282["md5"] = newMd5;
if(l != 0) {
this.save();
}
}
this.d437();
this.d436();
} else {
this.d448();
}
}
this.iconLoaded = false;
this.d437 = function() {
if(this.data) {
if(!this.iconLoaded) {
var icons = [
this.d282.icon,
getDir(this.data.siteUrl) + "/favicon.ico",
getDomain(this.data.siteUrl) + "/favicon.ico",
getDir(this.d282.url) + "/favicon.ico",
getDomain(this.d282.url) + "/favicon.ico"
];
loadIcon(this.d279["icon"], icons);
this.iconLoaded = true;
}
var count = this.d440();
this.d279.content.innerHTML = '';
for(var i=0; i<count; i++) {
this.d287(this.d279.content,
{ tag: "div", className: "rss_box_item" + ( (this.data.items[i].isRead == 1) ? "_visited" : ""),
innerHTML: this.data.items[i].title.wordWrap(38),
events: { onclick: "d439("+this.id+","+i+")" },
id: "item_" + i });
}
} else if (!this.d431) {
this.d448();
}
}
this.d448 = function() {
this.d279.title.innerHTML = loc.text("rss_msg_error");
}
this.d449 = function() {
if(this.data) {
window.open(this.data.siteUrl);
}
}
this.onClose = function() {
if(rssreader.d454 && rssreader.d454 == this.id) {
rssreader.close();
}
}
// Read/unread hash
this.d447 = function(md5) {
for(var i=0; i<this.d282["md5"].length; i++) {
if(this.d282["md5"][i] == md5) {
return i;
}
}
return null;
}
this.d450 = function(idx) {
var md5 = this.data.items[idx].md5;
var i = this.d447(md5);
if(i == null) {
this.d282["md5"].push(md5);
}
}
this.und450 = function(idx) {
var md5 = this.data.items[idx].md5;
var i = this.d447(md5);
if(i != null) {
delete(this.d282["md5"][i]);
}
}
this.d441 = function(itemIdx) {
this.data.items[itemIdx].isRead = 1;
this.d450(itemIdx);
this.d436();
this.d279["item_" + itemIdx].className = "rss_box_item_visited";
}
this.d442 = function(itemIdx) {
this.data.items[itemIdx].isRead = 0;
this.und450(itemIdx);
this.d436();
this.d279["item_" + itemIdx].className = "rss_box_item";
}
this.d443 = function() {
var count = this.d440();
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.d363 = {
tag: "table",
style: { width: "100%" },
childs: [
{ tag: "tr",
childs: [
{ tag: "td", width: "35%",
childs: [
createButtonDom(loc.text("rssreader_read_all"), "d457()", "widgets/rssreader/img/folder_open.gif"),
{ tag: "span", html: " &nbsp; &nbsp; &nbsp; "},
createButtonDom(loc.text("rssreader_unread_all"), "d458()", "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.d452 = null;
this.d288 = function() {
this.d279["content"].style.height = "390px";
this.d287(this.d279.content, this.d363);
this.d291(this.cfg.title);
}
this.d453 = function() {
//        this.d279.channelTitle.innerHTML = "<h1><a target=\"_blank\" href=\""+this.data.LINK+"\">"+this.data.title+"</a></h1>";
this.d279.channelTitle.innerHTML = "<h1>"+this.data.title+"</h1>";
this.d279.menu.innerHTML = "";
this.d279.view.innerHTML = "";
var count = kernel.getWidget(this.d454).d440();
for(var i=0; i< count; i++) {
this.d287(this.d279.menu,
[{ tag: "div", className: "menu_panel",
childs: [
{ tag: "a",
innerHTML: this.data.items[i].title.wordWrap(38),
id: "menuItem"+i,
href: "void",
events: {onclick: "d455("+i+")"},
className: "listItem" + (this.data.items[i].isRead == 1 ? "Visited" : "") }
]
},
{ tag: "hr", width: "100%"}
]);
}
}
this.d455 = function(feedId) {
this.d279.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.d287(this.d279.view, [
{ tag: "div", className: "float_panel",
childs: [
{ tag: "div", className: "float_left",
display: (feedId > 0),
childs: [
createButtonDom(false, "d455("+(feedId-1)+")", "widgets/rssreader/img/previous.gif", "readPrev")
]},
{ tag: "div", className: "float_right",
display: (feedId < kernel.getWidget(this.d454).d440() - 1),
childs: [
createButtonDom(false, "d455("+(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.d454)) {
kernel.getWidget(this.d454).d441(feedId);
kernel.getWidget(this.d454).save();
}
this.d279['menuItem'+feedId].className = "listItemVisited";
this.d456();
}
this.d457 = function() {
var count = kernel.getWidget(this.d454).d440();
for(var i=0; i<count; i++) {
kernel.getWidget(this.d454).d441(i);
}
this.d453();
var w = kernel.getWidget(this.d454);
if(w) {
w.save();
}
this.d456();
}
this.d458 = function() {
var count = kernel.getWidget(this.d454).d440();
for(var i=0; i<count; i++) {
kernel.getWidget(this.d454).d442(i);
}
this.d453();
var w = kernel.getWidget(this.d454);
if(w) {
w.save();
}
this.d456();
}
this.d456 = function() {
if(this.data) {
var count = kernel.getWidget(this.d454).d440();
var readed = kernel.getWidget(this.d454).d443()
this.d279.title.innerHTML = '';
this.d287(this.d279.title,
{ tag: "a", href: "void",
innerHTML: this.data.title.substr(0,25),
events: { onclick: "d449()" } });
if(count > readed) {
this.d287(this.d279.title,
{ tag: "span",
innerHTML: " &nbsp;(" + (count - readed) + ")" });
}
}
}
this.d439 = function(d454, feedId) {
menu.hide();
this.data = kernel.getWidget(d454).data;
this.d454 = d454;
this.d453();
this.d279.icon.src = kernel.getWidget(d454).d279.icon.src;
desktop.showPage('rssreader');
this.d455(feedId);
}
this.close = function() {
if(this.d454 && kernel.getWidget(this.d454)) {
if(this.d452 == kernel.getWidget(this.d454).d430) {
kernel.getWidget(this.d454).d432 = false;
//                kernel.getWidget(this.d454).data = this.data;
}
}
desktop.d323();
}
}
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.d288 = function() {
this.d279.content.style.height = "400px";
}
this.d459 = function(d454) {
this.d454 = d454;
var widget = kernel.getWidget(d454);
this.d291(this.cfg.title + ": " + widget.d282.title);
widget.d279.flash_container.parentNode.removeChild(widget.d279.flash_container);
this.d279.content.appendChild(widget.d279.flash_container);
desktop.showPage('flashplayer');
}
this.close = function() {
if(this.d454) {
var widget = kernel.getWidget(this.d454);
widget.d279.flash_container.parentNode.removeChild(widget.d279.flash_container);
widget.d279.flash_content.appendChild(widget.d279.flash_container);
}
desktop.d323();
}
}
FlashPlayer.prototype = new Widget();
function Messenger() {
this.init();
this.cfg = {
hasSettingsBtn: false,
title: loc.text("messenger_title"),
module: "Messenger"
}
this.d363 = [
{ tag: "div", className: "bevel_section", innerHTML: loc.text("messenger_clist"),
style: {cursor: "pointer"},
events: {onclick: "d461('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: "d463()"}}
]}
]
},
{ tag: "div", className: "bevel_section", innerHTML: loc.text("messenger_compose"),
style: {cursor: "pointer"},
events: {onclick: "d461('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: "d467()"}},
{ tag: "div", id: "send_status"}
]
},
{ tag: "div", className: "bevel_section", innerHTML: loc.text("messenger_inbox"),
style: {cursor: "pointer"},
events: {onclick: "d461('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"), "d470()", "widgets/messenger/img/clear.gif")
]
}
]
},
{ tag: "div", id: "tmp", display: false}
]
this.d276["contact_list"] = [];
this.messages = [];
this.d460 = false;
this.d461 = function(sid) {
if(this.d279[sid].style.display == 'none') {
showEl(this.d279[sid]);
} else {
hideEl(this.d279[sid]);
}
}
this.d288 = function() {
this.d287(this.d279.content, this.d363);
this.d462();
this.d291(this.cfg.title);
}
this.d286 = function() {
kernel.d314(this.id, 30000);
}
this.d305 = function() {
this.refresh();
}
this.d463 = function() {
var id = trim(this.d279.edit_user_id.value);
if(id != "") {
this.d282.contact_list[arrayFirstFree(this.d282.contact_list)] = id;
this.save();
this.d462();
this.d279.edit_user_id.value = '';
}
}
this.d464 = function(num) {
if(confirm(  loc.text("messenger_delete_confirm", "\"" + this.d282.contact_list[num] + "\"")  )) {
this.d282.contact_list[num] = undefined;
this.d462();
this.save();
}
}
this.d462 = function() {
var fl = true;
this.d279.contact_list.innerHTML = "";
for(var i=0; i<this.d282.contact_list.length; i++) {
if(this.d282.contact_list[i] != undefined) {
var itemDom = { tag: "div", className: "menu_panel", id: "contact"+i,
childs: [
createTableDom([ {content: createButtonDom(this.d282.contact_list[i], "d465("+i+")", "widgets/messenger/img/user.gif"), width: "90%"},
{content: createButtonDom(false, "d464("+i+")", "static/client/delete_link.gif"), width: "1%"}
])
]
}
this.d287(this.d279.contact_list, itemDom);
fl = false;
}
}
if(fl) {
this.d279.contact_list.innerHTML = loc.text("msg_empty");
}
}
this.d465 = function(contactNum) {
hideEl(this.d279.section_contact_list);
showEl(this.d279.section_compose);
this.d279.edit_recipient.value = this.d282.contact_list[contactNum];
//        this.d279.edit_body.value = '';
this.d279.edit_body.focus();
}
this.d466 = function(email) {
showEl(this.d279.section_compose);
this.d279.edit_recipient.value = email;
this.d279.edit_body.value = '';
this.d279.edit_body.focus();
}
this.refresh = function() {
if(!this.d460) {
request.send({act: "get_new_messages", user_id: auth.user.id}, this);
this.d460 = true;
}
}
this.d467 = function() {
if((trim(this.d279.edit_recipient.value) == "") ||
(trim(this.d279.edit_body.value) == "")) {
this.d279.send_status.innerHTML = "<b>" + loc.text("messenger_send_error")+ "</b>";
return;
}
hideEl(this.d279.send_btn);
showEl(this.d279.send_status);
this.d279.send_status.innerHTML = loc.text("msg_sending");
request.send({act: "send",
user_id: auth.user.id,
to: trim(this.d279.edit_recipient.value),
body: this.d279.edit_body.value}, this);
}
this.d468 = true;
this.d469 = function() {
if(this.messages.length > 0) {
var time = new Date();
if(this.d468) {
this.d279.new_messages.innerHTML = '';
}
this.d468 = 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>", "d466('"+this.messages[i].from_email+"')", "widgets/messenger/img/user.gif");
this.d287(this.d279.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.d279.new_messages.firstChild) {
this.d279.new_messages.insertBefore(this.d279.last_msg, this.d279.new_messages.firstChild);
} else {
this.d279.new_messages.appendChild(this.d279.last_msg);
}
}
if(isNewMessages) {
showEl(this.d279.section_new_messages);
}
showEl(this.d279.clear_new_messages);
} else {
this.d279.new_messages.innerHTML = loc.text("messenger_no_messages");
}
}
this.d470 = function() {
this.d468 = true;
this.messages = [];
this.d469();
hideEl(this.d279.clear_new_messages);
}
this.d306 = function(msg) {
this.d460 = 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.d469();
break;
case "send_ok":
this.d279.edit_body.value = '';
showEl(this.d279.send_btn);
this.d279.send_status.innerHTML = "Message sent.";
break;
case "send_error":
this.d279.send_status.innerHTML = "<b>Error:</b> Recipient not found...";
showEl(this.d279.send_btn);
break;
}
}
}
}
Messenger.prototype = new Widget();
function PopMail() {
this.init();
this.cfg = {
hasSettingsBtn: true,
title: loc.text("popmail_title"),
module: "PopMail"
}
this.d429 = [
{ 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: "d375()"}}
]}
]
this.d363 = [
{ 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.d276["login"] = "";
this.d276["password"] = "";
this.d276["protocol"] = "pop3";
this.d276["secure"] = "0";
this.d276["server"] = "";
this.d276["port"] = "110";
this.d276["title"] = loc.text("popmail_title");
this.d276["mcount"] = "8";
this.d431 = false;
this.d288 = function() {
this.d287(this.d279.settings, this.d429);
this.d287(this.d279.content, this.d363);
this.d279.select_login.value = this.d282.login;
this.d279.select_password.value = this.d282.password;
this.d279.select_protocol.value = this.d282.protocol;
this.d279.select_secure.checked = this.d282.secure == 1;
this.d279.select_server.value = this.d282.server;
this.d279.select_port.value = this.d282.port;
this.d279.inp_count.value = this.d282.mcount;
this.d291(this.d282.title);
}
this.d286 = function() {
if(this.d477()) {
this.d478("config_note");
} else {
this.refresh();
}
//        kernel.d314(this.id, 30000);
}
this.updatePort = function() {
this.d279["select_port"].value =
(this.d279["select_protocol"].value == "pop3")
?
(this.d279["select_secure"].checked ? "995" : "110")
:
(this.d279["select_secure"].checked ? "993" : "143")
}
this.d477 = function() {
return this.d282.login == "" || this.d282.password == "" || this.d282.server == "";
}
this.d478 = 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.d308(sections[i]);
} else {
this.d307(sections[i]);
}
}
}
this.d375 = function() {
this.d282.login = trim(this.d279.select_login.value);
this.d282.password = trim(this.d279.select_password.value);
this.d282.protocol = this.d279.select_protocol.value;
this.d282.secure = this.d279.select_secure.checked ? 1 : 0;
this.d282.server = trim(this.d279.select_server.value);
this.d282.port = trim(this.d279.select_port.value);
if(this.d477()) {
this.d478("config_note");
} else {
this.save();
this.refresh();
}
}
this.setItemsCount = function() {
var c = this.d279["inp_count"].value;
if(this.d282.mcount != c) {
this.d282.mcount = c;
this.save();
this.d469();
}
}
this.d305 = function() {
if(this.d477()) {
this.d478("config_note");
} else {
this.refresh();
}
}
this.req = null;
this.timerId = null;
this.refresh = function() {
if(!this.d477() && !this.d431) {
this.d431 = true;
this.d478("loading_note");
var protocol = "/" + this.d282.protocol +
((this.d282.secure == 1) ? "/ssl" : "") +
"/novalidate-cert";
this.req = request.send({ login: this.d282.login,
password: this.d282.password,
protocol: protocol,
server: this.d282.server,
port: this.d282.port }, this);
var self = this;
var f = function() {
updateLoadingIcon(-1);
self.req.onreadystatechange = function() {};
self.d431 = false;
self.d478("config_note");
}
this.timerId = setTimeout(f, 30000);
}
}
this.d469 = function() {
if(this.data) {
this.d478("messages");
this.d279.total_messages.innerHTML = "<B>" + this.d479 + "<B>";
this.d279.mail_list.innerHTML = '';
var cnt = Math.min(this.data.length, this.d282.mcount);
for(var i=0; i<cnt; i++) {
try {
this.d287(this.d279.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.d306 = function(msg) {
clearTimeout(this.timerId);
this.d431 = false;
switch(msg.status) {
case "empty":
this.d478("no_messages_note");
break;
case "data":
this.data = msg.data;
this.d479 = msg.total;
this.d469();
break;
case "error":
this.d478("config_note");
break;
}
}
}
PopMail.prototype = new Widget();
function Gmail() {
this.init();
this.cfg = {
hasSettingsBtn: true,
title: "",
module: "Gmail"
}
this.d429 = [
{ 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: "d435()"}, 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: "d375()"}} ]}
]
this.d363 = [
{ 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: "d474()"}, 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.d276["title"] = "";
this.d276["email"] = "";
this.d276["password"] = "";
this.d276["newsCount"] = "8";
this.d288 = function() {
this.d287(this.d279.settings, this.d429);
this.d287(this.d279.content, this.d363);
this.d279.news_count.value = this.d282.newsCount;
this.d279.select_email.value = this.d282.email;
this.d279.select_password.value = this.d282.password;
if(this.d282["email"] != "" && this.d282["password"] != "") {
this.d307("config_note");
}
}
this.d286 = function() {
if(trim(this.d282.title) == "") {
this.d282.title = loc.text("gmail_title");
}
this.d291(this.d282.title);
kernel.d314(this.id, 600*1000);
}
this.d305 = function() {
this.refresh();
}
this.d375 = function() {
this.d282.email = "" + trim(this.d279.select_email.value).split("@gmail.com")[0];
this.d282.password = trim(this.d279.select_password.value);
this.save();
this.d307("messages_area");
this.refresh();
}
this.d435 = function() {
this.d282.newsCount = this.d279.news_count.value;
this.save();
this.d469();
}
var d431 = false;
this.refresh = function() {
this.d307("msg_no_new_mails");
if(this.d282["email"] != "" && this.d282["password"] != "") {
if(!d431) {
d431 = true;
this.d291(loc.text("msg_loading"));
this.d307("config_note");
xmlRequest.send("https://mail.google.com/mail/feed/atom/", this, "d471", {login: this.d282.email, password: this.d282.password});
}
} else {
this.d308("config_note");
}
}
this.d471 = function(response) {
d431 = 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.d472 = response.responseXML.documentElement.getElementsByTagName("fullcount")[0].firstChild.nodeValue;
if(this.data) {
this.d469();
return true;
}
} catch(e) {}
}
}
this.d473();
}
this.d473 = function() {
this.d291(this.d282.title);
this.d308("config_note");
this.d307("messages_area");
}
this.d474 = function() {
if(this.data.items) {
var count = Math.min(this.data.items.length, this.d282.newsCount);
for(var i=0; i<count; i++) {
if(this.d279.switcher.checked) {
this.d308("mail_content" + i);
} else {
this.d307("mail_content" + i);
}
}
}
}
this.d469 = function() {
this.d279.title.innerHTML = '';
this.d287(this.d279.title,
createButtonDom(this.d282.title, "d475()"));
if(this.data && this.data.items.length > 0) {
this.d307("msg_no_new_mails");
this.d307("config_note");
this.d308("messages_area");
this.d279.mail_list.innerHTML = '';
this.d279.mail_total.innerHTML = '<b>' + loc.text("gmail_msg_total", this.d472) + '</b>';
this.d279.switcher.checked = false;
var count = Math.min(this.data.items.length, this.d282.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.d287(this.d279.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.d308("msg_no_new_mails");
}
}
this.d475 = function() {
window.open("http://mail.google.com/mail");
}
}
Gmail.prototype = new Widget();
function AolMail() {
this.init();
this.cfg = {
hasSettingsBtn: true,
title: "",
module: "AolMail"
}
this.d429 = [
{ 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: "d375()"}}
]}
]
this.d363 = [
{ 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.d276["login"] = "";
this.d276["password"] = "";
this.d276["title"] = "";
this.d276["mcount"] = "8";
var d431 = false;
this.d288 = function() {
this.d287(this.d279.settings, this.d429);
this.d287(this.d279.content, this.d363);
this.d279.select_login.value = this.d282.login;
this.d279.select_password.value = this.d282.password;
this.d279.inp_count.value = this.d282.mcount;
var t = this.d282.title != "" ? this.d282.title : loc.text("aolmail_title");
this.d291(t);
}
this.d286 = function() {
if(this.d477()) {
this.d478("config_note");
} else {
this.refresh();
}
}
this.d477 = function() {
return this.d282.login == "" || this.d282.password == "";
}
this.d478 = 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.d279[sections[i]]);
} else {
hideEl(this.d279[sections[i]]);
}
}
}
this.d375 = function() {
var l = trim(this.d279.select_login.value);
if(l.indexOf("@") != -1) {
l = l.substr(0, l.indexOf("@"));
this.d279.select_login.value = l;
}
var p = trim(this.d279.select_password.value);
if(this.d282.login != l || this.d282.password != p) {
this.d282.login = l;
this.d282.password = p;
this.save();
}
if(this.d477()) {
this.d478("config_note");
} else {
this.refresh();
}
}
this.setItemsCount = function() {
var c = this.d279["inp_count"].value;
if(this.d282.mcount != c) {
this.d282.mcount = c;
this.save();
this.d469();
}
}
this.d305 = function() {
if(this.d477()) {
this.d478("config_note");
} else {
this.refresh();
}
}
this.req = null;
this.timerId = null;
this.refresh = function() {
if(!this.d477() && !d431) {
d431 = true;
this.d478("loading_note");
var protocol = "/imap/ssl/novalidate-cert";
this.req = request.send({ login: this.d282.login,
password: this.d282.password,
protocol: protocol,
server: "imap.aol.com",
port: 993 }, this);
var self = this;
var f = function() {
updateLoadingIcon(-1);
self.req.onreadystatechange = function() {};
self.d431 = false;
self.d478("config_note");
}
this.timerId = setTimeout(f, 30000);
}
}
this.d469 = function() {
if(this.data) {
this.d478("messages");
this.d279.total_messages.innerHTML = "<B>" + this.d479 + "<B>";
this.d279.mail_list.innerHTML = '';
var cnt = Math.min(this.data.length, this.d282.mcount);
for(var i=0; i<cnt; i++) {
try {
this.d287(this.d279.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.d306 = function(msg) {
clearTimeout(this.timerId);
d431 = false;
switch(msg.status) {
case "empty":
this.d478("no_messages_note");
break;
case "data":
this.data = msg.data;
this.d479 = msg.total;
this.d469();
break;
case "error":
this.d478("config_note");
break;
}
}
}
AolMail.prototype = new Widget();
function YahooMail() {
this.init();
this.cfg = {
hasSettingsBtn: true,
title: "",
module: "YahooMail"
}
this.d429 = [
{ 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: "d375()"}}
]}
]
this.d363 = [
{ 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.d276["login"] = "";
this.d276["password"] = "";
this.d276["title"] = "";
this.d276["mcount"] = "8";
var d431 = false;
this.d288 = function() {
this.d287(this.d279.settings, this.d429);
this.d287(this.d279.content, this.d363);
this.d279.select_login.value = this.d282.login;
this.d279.select_password.value = this.d282.password;
this.d279.inp_count.value = this.d282.mcount;
var t = this.d282.title != "" ? this.d282.title : loc.text("yahoomail_title");
this.d291(t);
}
this.d286 = function() {
if(this.d477()) {
this.d478("config_note");
} else {
this.refresh();
}
}
this.d477 = function() {
return this.d282.login == "" || this.d282.password == "";
}
this.d478 = 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.d279[sections[i]]);
} else {
hideEl(this.d279[sections[i]]);
}
}
}
this.d375 = function() {
var l = trim(this.d279.select_login.value);
if(l.indexOf("@") != -1) {
l = l.substr(0, l.indexOf("@"));
this.d279.select_login.value = l;
}
var p = trim(this.d279.select_password.value);
if(this.d282.login != l || this.d282.password != p) {
this.d282.login = l;
this.d282.password = p;
this.save();
}
if(this.d477()) {
this.d478("config_note");
} else {
this.refresh();
}
}
this.setItemsCount = function() {
var c = this.d279["inp_count"].value;
if(this.d282.mcount != c) {
this.d282.mcount = c;
this.save();
this.d469();
}
}
this.d305 = function() {
if(this.d477()) {
this.d478("config_note");
} else {
this.refresh();
}
}
this.req = null;
this.timerId = null;
this.refresh = function() {
if(!this.d477() && !d431) {
d431 = true;
this.d478("loading_note");
var protocol = "/pop3/ssl/novalidate-cert";
this.req = request.send({ login: this.d282.login,
password: this.d282.password,
protocol: protocol,
server: "pop.mail.yahoo.com",
port: 995 }, this);
var self = this;
var f = function() {
updateLoadingIcon(-1);
self.req.onreadystatechange = function() {};
self.d431 = false;
self.d478("config_note");
}
this.timerId = setTimeout(f, 30000);
}
}
this.d469 = function() {
if(this.data) {
this.d478("messages");
this.d279.total_messages.innerHTML = "<B>" + this.d479 + "<B>";
this.d279.mail_list.innerHTML = '';
var cnt = Math.min(this.data.length, this.d282.mcount);
for(var i=0; i<cnt; i++) {
try {
this.d287(this.d279.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.d306 = function(msg) {
clearTimeout(this.timerId);
d431 = false;
switch(msg.status) {
case "empty":
this.d478("no_messages_note");
break;
case "data":
this.data = msg.data;
this.d479 = msg.total;
this.d469();
break;
case "error":
this.d478("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.d429 = [
{ tag: "div", className: "bevel_section", innerHTML: loc.text("bookmarks_import"),
style: {cursor: "pointer"},
events: {onclick: "d461('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: "d483()"}}
]},
{ 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: "d461('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: "d495()"}}
]
},
{ tag: "div", className: "bevel_section", innerHTML: loc.text("bookmarks_sec_add"), id: "add_bookmark",
style: {cursor: "pointer"},
events: {onclick: "d461('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: "d496()"}}
]
}
]
}
];
this.d363 = [
{ tag: "div", className: "bevel_section", innerHTML: loc.text("bookmarks_sec_edit"), id: "edit_bookmark", display: false,
style: {cursor: "pointer"},
events: {onclick: "d461('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: "d493()"}}
]
}
]
},
{ tag: "div", className: "bevel_section", innerHTML: loc.text("bookmark_sec_tags"),
style: {cursor: "pointer"},
events: {onclick: "d461('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.d276["title"] = loc.text("bookmarks_title");
this.d276["tags"] = ['default'];
this.d276["bookmarks"] = [];
this.d480 = 0;
this.d288 = function() {
this.d287(this.d279.settings, this.d429);
this.d287(this.d279.content, this.d363);
this.d481(0);
this.d279.form_wid.value = this.id;
this.d279.form_user_id.value = auth.user.id;
}
this.d294Settings = function() {
this.d482();
}
this.d300 = function() {
this.d282.title = trim(this.d279.input_title.value);
this.d291(this.d282.title + ": "+ this.d282.tags[this.d480]);
this.save();
}
this.d461 = function(sid) {
if(this.d279[sid].style.display == 'none') {
showEl(this.d279[sid]);
} else {
hideEl(this.d279[sid]);
}
}
// importing
this.d483 = function() {
if(trim(this.d279.user_file.value)!="") {
showEl(this.d279.import_msg);
this.d279.import_msg.innerHTML = loc.text("bookmarks_msg_import");
hideEl(this.d279.upload_submit_btn);
this.d279.upload_form.submit();
}
}
this.d484 = function() {
showEl(this.d279.upload_submit_btn);
this.d279.import_msg.innerHTML = loc.text("bookmarks_msg_import_error");
}
this.d485 = function(file) {
if(file) {
xmlRequest.send("var/tmp/"+file, this, "d487");
this.d486 = file;
} else {
showEl(this.d279.upload_submit_btn);
this.d279.import_msg.innerHTML = loc.text("bookmarks_msg_import_error");
}
}
this.d487 = function(response) {
showEl(this.d279.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.d487(tmp);
for(var i=0; i<data.length; i++) {
this.d488(data[i].title, data[i].url, data[i].tags);
}
this.d489();
showEl(this.d279.section_tags);
this.d481(this.d480);
this.save();
if(this.d486) {
request.send({act: "delete", file: this.d486}, this);
}
hideEl(this.d279.import_msg);
hideEl(this.d279.section_import);
this.d295();
return;
}
this.d279.import_msg.innerHTML = loc.text("bookmarks_msg_import_error");
}
this.d490 = null;
this.d482 = function() {
if(this.d490 != null) {
hideEl(this.d279.section_edit);
hideEl(this.d279.edit_bookmark);
this.d491 = null;
}
}
this.d492 = function(id) {
this.d490 = id;
var tags = [];
for(var i = 0; i < this.d282.bookmarks[id].tags.length; i++) {
tags.push(this.d282.tags[this.d282.bookmarks[id].tags[i]])
}
this.d279.edit_title.value = this.d282.bookmarks[id].title;
this.d279.edit_url.value = this.d282.bookmarks[id].url;
this.d279.edit_tags.value = tags.join(", ");
showEl(this.d279.section_edit);
showEl(this.d279.edit_bookmark);
hideEl(this.d279.settings);
}
this.d493 = function() {
if(this.d490 != null) {
var title = trim(this.d279.edit_title.value);
var url = trim(this.d279.edit_url.value);
if(title != "" && url != "") {
this.d494(this.d490, title, url, trim(this.d279.edit_tags.value));
this.d481(this.d480);
this.save();
}
}
this.d482();
}
this.d495 = function() {
this.d282.bookmarks = this.d276["bookmarks"];
this.d282.tags = this.d276["tags"];
this.d481(0);
}
this.d496 = function() {
var title = trim(this.d279.select_title.value);
var url = trim(this.d279.select_url.value);
if(title != "" && url != "") {
this.d482();
this.d488(title, url, trim(this.d279.select_tags.value));
this.save();
this.d481(this.d480);
this.d279.select_title.value = '';
this.d279.select_url.value = '';
this.d279.select_tags.value = '';
}
}
this.d489 = function() {
this.d279.section_tags.innerHTML = '';
for(var t=0; t<this.d282.tags.length; t++) {
if(this.d282.tags[t] != undefined) {
if(this.d480 != t) {
this.d287(this.d279.section_tags,
{ tag: "a",
href: "void", events: { onclick: "d481("+t+")"},
innerHTML: this.d282.tags[t],
style: { margin: "4px"}
});
} else {
this.d287(this.d279.section_tags,
{ tag: "span", innerHTML: this.d282.tags[t],
style: { margin: "4px"}
});
}
}
}
}
this.d481 = function(tagId) {
this.d482();
this.d480 = tagId;
this.d291(this.d282.title + ": "+ this.d282.tags[tagId]);
var list = this.d497(tagId);
this.d279.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.d282.bookmarks[list[i]].url, target: "_blank", innerHTML: this.d282.bookmarks[list[i]].title}, width: "95%"},
{content: createButtonDom(false, "d492("+list[i]+")", "static/client/edit.gif"), width: "1%"},
{content: createButtonDom(false, "d406("+list[i]+")", "static/client/delete_link.gif"), width: "1%"}
], "95%")
]
}
this.d287(this.d279.bookmarks, itemDom);
}
this.d489();
}
this.d406 = function(id) {
if(confirm(loc.text("bookmarks_delete_prompt", this.d282.bookmarks[id].title))) {
this.d482();
this.d498(id);
if(this.d282.tags[this.d480]) {
this.d481(this.d480);
} else {
this.d481(0);
}
this.save();
}
}
this.d494 = function(id, title, url, tags) {
this.d498(id);
this.d488(title, url, tags);
}
this.d488 = 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.d282.tags)
if(tn != undefined) {
newBookmark.tags.push(tn);
} else {
var idx = arrayFirstFree(this.d282.tags);
this.d282.tags[idx] = tags[i];
newBookmark.tags.push(idx);
}
}
} else {
newBookmark.tags = [0];
}
this.d480 = newBookmark.tags[0];
this.d282.bookmarks[arrayFirstFree(this.d282.bookmarks)] = newBookmark;
}
this.d498 = function(id) {
var tags = this.d282.bookmarks[id].tags;
for(var i=0; i<tags.length; i++) {
if(tags[i] != 0) {
var count = 0;
for(var j=0; j<this.d282.bookmarks.length; j++) {
if(this.d282.bookmarks[j] && arraySearch(tags[i], this.d282.bookmarks[j].tags) != undefined) {
count++;
}
}
if(count<2) {
this.d282.tags[tags[i]] = undefined;
}
}
}
this.d282.bookmarks[id] = undefined;
}
this.d497 = function(tagId) {
var res = [];
for(var i=0; i<this.d282.bookmarks.length; i++) {
if(this.d282.bookmarks[i] &&
this.d282.bookmarks[i].tags != undefined &&
arraySearch(tagId, this.d282.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.d276["items"] = [];
this.d276["title"] = "";
this.d429 = [
{ 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: "d501()"}, className: "settings_control"}
]}
]
this.d363 = { tag: "table", className: "sys_table", id: "items_table",
width: "100%",
childs: [] }
this.d288 = function() {
this.d287(this.d279.settings, this.d429);
this.d499();
}
this.d286 = function() {
this.d291(this.d282.title);
}
this.d291 = function(html) {
this.d279.title.innerHTML = this.cfg.title_prefix + html;
}
this.d499 = function() {
this.d279.content.innerHTML = "";
this.d287(this.d279.content, this.d363);
for(var i=0; i<this.d282.items.length; i++) {
this.d500(i);
}
}
this.d500 = function(n) {
this.d287(this.d279.items_table_tbody,
{ tag: "tr", id: "item"+n,
childs: [
{ tag: "td", width: "1%",
childs: [
{ tag: "input", id: "item_checkbox"+n, type: "checkbox", events: {onclick: "d502("+n+")"}, checked: this.d282.items[n].completed}
]},
{ tag: "td", width: "95%",
childs: [
{ tag: "div",
style: {textDecoration: this.d282.items[n].completed ? "line-through" : "", overflow: "hidden"},
id: "item_title"+n, innerHTML: this.d282.items[n].title.wordWrap(10) }
]},
{ tag: "td", width: "1%",
childs: [ createButtonDom(false, "d503("+n+")", "static/client/move_up.gif") ]},
{ tag: "td", width: "1%",
childs: [ createButtonDom(false, "d505("+n+")", "static/client/move_down.gif") ]},
{ tag: "td", width: "1%",
childs: [ createButtonDom(false, "d506("+n+")", "static/client/edit.gif") ]},
{ tag: "td", width: "1%",
childs: [ createButtonDom(false, "d406("+n+")", "static/client/delete_link.gif") ]}
]
});
}
this.d501 = function() {
var title = trim(this.d279.todo_title.value);
if(!title) {
return;
}
var newId = this.d282.items.length;
var newItem = {title: title, completed: false};
this.d282.items[newId] = newItem;
this.d500(newId);
this.save();
this.d279.todo_title.value = '';
}
this.d502 = function(id) {
this.d282.items[id].completed = !this.d282.items[id].completed;
this.d279['item_title'+id].style.textDecoration = this.d282.items[id].completed ? "line-through" : "" ;
this.save();
}
this.d503 = function(id) {
if(id > 0) {
this.d504(id, id-1);
this.d499();
this.save();
}
}
this.d505 = function(id) {
if(id < this.d282.items.length - 1) {
this.d504(id, id+1);
this.d499();
this.save();
}
}
this.d506 = function(id) {
var res = trim(prompt(loc.text("todolist_todo_edit"), this.d282.items[id].title));
if(res) {
this.d282.items[id].title = res;
this.d279['item_title'+id].innerHTML = res.wordWrap(10);
}
this.save();
}
this.d406 = function(id) {
if(confirm(  loc.text("todolist_delete_confirm", this.d282.items[id].title)  )) {
var tmp = [];
for(var i=0; i<this.d282.items.length; i++) {
if(i != id) {
tmp.push(this.d282.items[i]);
}
}
this.d282.items = tmp;
tmp = null;
this.d499();
this.save();
}
}
this.d504 = function(a,b) {
var tmp = this.d282.items[a];
this.d282.items[a] = this.d282.items[b];
this.d282.items[b] = tmp;
}
}
ToDoList.prototype = new Widget();
function Webnote() {
this.init();
this.cfg = {
hasRefreshBtn: false,
title: loc.text("webnote_title"),
module: "Webnote"
}
this.d276["title"] = this.cfg.title;
this.d276["text"] = loc.text("webnote_text");
this.d507 = [
{ tag: "div", id: "text_show",
className: "webnote_text"},
{ tag: "textarea", id: "text_edit",
display: false,
className: "webnote_textarea",
events: {onclick: "d425()", onblur: "d424()"}}
]
this.d288 = function() {
this.d287(this.d279.content, this.d507);
var text_show = this.d279.text_show;
var text_edit = this.d279.text_edit;
var widget = this;
this.d279.text_show["onclick"] = function() { widget.d508(widget, text_show, text_edit); };
var t = this.d282.text.jsUnescape();
this.d279.text_show.innerHTML = text2html(t).parseUrl();
this.d279.text_edit.value = t;
this.d291(this.d282.title);
}
this.d508 = 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.d508(widget, text_show, text_edit); };
widget.d282.text = text.jsEscape();
widget.save();
}
}
this.d424 = function() {}
this.d425 = 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.d363 = [
{ tag: "div", className: "menu_panel", id: "controls", display: false,
childs: [
createTableDom([{content: createButtonDom(loc.text("flash_open"), "d511()", "widgets/flash/img/full_screen.gif"), width: "70%"},
{content: createButtonDom(loc.text("flash_stop"), "d512()", "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.d276["file"] = "";
this.d276["title"] = loc.text("flash_title");
this.d288 = function() {
this.d287(this.d279.content, this.d363);
this.d509(0);
this.d291(this.d282.title);
if(this.d282.file != "") {
this.d510();
}
}
this.d511 = function() {
flashPlayer.d459(this.id);
}
this.d512 = function() {
this.d279.flash_container.innerHTML = '';
hideEl(this.d279.flash_content);
hideEl(this.d279.controls);
this.d282.title = this.cfg.title;
this.d282.file = "";
this.d291(this.d282.title);
this.save();
}
this.d509 = function(catId) {
var el = this.d279["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.d513(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.d279["fico_" + catId].setAttribute("src", menu.folder_o.src);
}
} else {
if(catId != "0") {
this.d279["fico_" + catId].setAttribute("src", menu.folder_s.src);
}
el.style.display = 'none';
}
}
this.d513 = function(catId, silent) {
el = this.d279["flash_cat_content"+catId];
el.innerHTML = '';
with(this.flash_catalog[catId]) {
if(categories) {
for(var i in categories) {
this.d287(el,
{ tag: "div", className: "menu_panel", id: "flash_cat"+categories[i].id,
childs: [
createButtonDom(categories[i].name,
"d509("+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.d287(el,
{ tag: "div", className: "menu_panel", id: "flash_cat_item"+items[i].id,
childs: [
createButtonDom(items[i].title,
"d459('"+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.d459 = function(file, title) {
this.d282.title = title;
this.d282.file = file;
this.d510(file, title);
this.save();
}
this.d510 = function() {
if(this.d282.file) {
showEl(this.d279.controls);
this.d291(this.d282.title);
showEl(this.d279.flash_content);
this.d279.flash_content.style.height = "200px";
this.d279.flash_container.style.height = "100%";
this.d279.flash_container.align = "center";
this.d279.flash_container.innerHTML = '';
var h = (mozilla_nav ? "90%" : "100%");
this.d279.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.d282.file+'">'+
'<param name=quality value=high>'+
'<param name=bgcolor value=#ffffff>'+
'<embed src="'+this.cfg.itemsDir+this.d282.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.d306 = function(msg) {
switch (msg.status) {
case "flash_category_data":
this.flash_catalog[msg.cat_id] = { categories: msg.categories, items: msg.items};
this.d513(msg.cat_id);
break;
}
}
}
Flash.prototype = new Widget();
function Flickr() {
this.init();
this.cfg = {
title: loc.text("flickr_title_postfix"),
module: "Flickr"
}
this.d276["tags"] = "";
this.d276["layout"] = "s"; // s|t
this.d276["target"] = "s"; // s|f
this.d514 = "http://www.flickr.com/services/feeds/photos_public.gne?format=rss_200";
this.d429 = [
{ 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: "d518()"}, 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: "d515()"}, 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: "d517()"}, className: "settings_control",
options: [
{ value:"s", text: loc.text("flickr_to_site")},
{ value:"f", text: loc.text("flickr_to_full")}
]
}
]}
]
this.d363 = [ { tag: "div", className: "menu_panel", id: "head", display: false,
style: { textAlign: "center"},
childs: [
createButtonDom(false, "d522()", "widgets/flickr/img/previous.gif"),
{ tag: "span", innerHTML: "&nbsp;"},
createButtonDom(false, "d523()", "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: "d524()"},
childs: [
{ tag: "img", id: "big_photo" }
]}
]},
{ tag: "div", className: "menu_panel", id: "view_thumbs", style: {textAlign: "center"}, display: false }];
this.d288 = function() {
this.d279["settings"].innerHTML = "";
this.d287(this.d279.settings, this.d429);
this.d287(this.d279.content, this.d363);
this.d279.selectTags.value = this.d282.tags;
this.d279.selectLayout.value = this.d282.layout;
this.d279.selectTarget.value = this.d282.target;
}
this.d515 = function() {
this.d282.layout = this.d279.selectLayout.value;
this.save();
this.d516();
}
this.d517 = function() {
this.d282.target = this.d279.selectTarget.value;
this.save();
}
this.d518 = function() {
var tags = trim(this.d279.selectTags.value);
if(tags != "") {
this.d282.tags = tags;
this.save();
this.refresh();
}
}
this.d286 = function() {
this.refresh();
}
this.refresh = function() {
this.d291(loc.text("msg_loading"));
xmlRequest.send(this.d514 + (this.d282.tags=="" ? "" :  "&tags="+escape(this.d282.tags)), this, "d526");
}
this.d516 = function() {
if(this.data) {
if(this.d282.layout == "s") {
if(this.data.items.length > 1) {
showEl(this.d279.head);
} else {
hideEl(this.d279.head);
}
this.d519 = 0;
this.d520(this.d519);
} else {
this.d358Photos();
}
}
}
/// photo rotate
this.d519 = 0;
this.d522 = function() {
this.d519--;
if(this.d519<0) {
this.d519 = this.data.items.length-1;
}
this.d520(this.d519);
}
this.d523 = function() {
this.d519++;
if(this.d519 >= this.data.items.length) {
this.d519 = 0;
}
this.d520(this.d519);
}
// show photos
this.d520 = function(n) {
hideEl(this.d279.view_thumbs);
showEl(this.d279.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.d279.big_photo, src);
} else {
this.d279.big_photo.src = src;
}
showEl(this.d279.head);
}
this.d358Photos = function() {
showEl(this.d279.view_thumbs);
hideEl(this.d279.view_big);
hideEl(this.d279.head);
var photosDom = [];
for(var i=0; i<this.data.items.length; i++) {
photosDom[photosDom.length] = { tag: "a", href: "void", events: {onclick: "d525("+i+")"},
innerHTML: "<img width=75 src='"+this.data.items[i]["media:thumbnail"].url+"'> "};
}
this.d279.view_thumbs.innerHTML = '';
this.d287(this.d279.view_thumbs, photosDom);
}
this.d524 = function() {
this.d525(this.d519);
}
this.d525 = function(n) {
open((this.d282.target == "s") ? this.data.items[n].link : this.data.items[n]["media:content"].url);
}
this.d526 = function(response) {
if(response.responseXML.documentElement) {
this.data = XMLParser.xml2hash(response.responseXML.documentElement);
if(this.data) {
this.d291(this.data.title);
this.d516();
}
}
}
}
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.d276["title"] = "";
this.d276["channel"] = "0";
this.d276["count"] = "6";
var d431 = 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.d429 = [
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", innerHTML: loc.text("foxvideo_inp_channel"), className: "settings_label"},
{ tag: "select", id: "inp_channel", events: {onchange: "d527()"}, 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: "d528()"}, className: "settings_control",
options: sel_count_options }
]}
]
this.d288 = function() {
this.d287(this.d279.settings, this.d429);
this.d279["inp_channel"].selectedIndex = this.d282.channel;
this.d279["inp_count"].value = this.d282.count;
}
this.d527 = function() {
if(d431) {
this.d279["inp_channel"].selectedIndex = this.d282.channel;
} else {
var c = this.d279["inp_channel"].selectedIndex;
if(c != this.d282.channel) {
this.d282.channel = this.d279["inp_channel"].selectedIndex;
this.save();
req = null;
d431 = false;
this.refresh();
}
}
}
this.d528 = function() {
var c = this.d279["inp_count"].value;
if(c != this.d282.count) {
this.d282.count = c;
this.save();
this.d529();
}
}
this.d286 = function() {
this.refresh();
}
this.refresh = function() {
if(!d431) {
this.d291(loc.text("msg_loading"));
req = xmlRequest.send(this.channels[this.d282.channel].value, this, "d530");
d431 = true;
}
}
this.d530 = function(response) {
d431 = false;
if(response.responseXML && response.responseXML.documentElement) {
content = XMLParser.xml2hash(response.responseXML.documentElement);
} else {
content = null;
}
this.d529();
}
this.d529 = function() {
if(content) {
if(this.d282.title != "") {
this.d291(this.d282.title);
} else {
this.d291(content.title);
}
var l = Math.min(content.items.length, this.d282.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.d279["content"].innerHTML = "<table class='plan_table'>" + c + "</table>";
} else {
this.d291(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.d276["title"] = "";
this.d276["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.d429 = [
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", innerHTML: loc.text("aolvideo_inp_count"), className: "settings_label"},
{ tag: "select", id: "inp_count", events: {onchange: "d528()"}, className: "settings_control",
options: sel_count_options }
]}
]
this.d288 = function() {
this.d287(this.d279.settings, this.d429);
this.d279["inp_count"].value = this.d282.count;
}
this.d528 = function() {
var c = this.d279["inp_count"].value;
if(c != this.d282.count) {
this.d282.count = c;
this.save();
this.d529();
}
}
this.d286 = function() {
this.refresh();
}
this.refresh = function() {
if(!loading) {
this.d291(loc.text("msg_loading"));
req = xmlRequest.send(this.channel, this, "d530");
loading = true;
}
}
this.d530 = 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.d529();
}
this.d529 = function() {
if(content) {
if(this.d282.title != "") {
this.d291(this.d282.title);
} else {
this.d291(loc.text("aolvideo_title"));
}
var l = Math.min(content.length, this.d282.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.d279["content"].innerHTML = "<table class='plan_table' width=99%>" + c + "</table>";
} else {
this.d291(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.d276["title"] = "";
this.d276["channel"] = "0";
this.d276["count"] = "6";
var d431 = 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.d429 = [
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", innerHTML: loc.text("googlevideo_inp_channel"), className: "settings_label"},
{ tag: "select", id: "inp_channel", events: {onchange: "d527()"}, 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: "d528()"}, className: "settings_control",
options: sel_count_options }
]}
]
this.d288 = function() {
this.d287(this.d279.settings, this.d429);
this.d279["inp_channel"].selectedIndex = this.d282.channel;
this.d279["inp_count"].value = this.d282.count;
}
this.d527 = function() {
if(d431) {
this.d279["inp_channel"].selectedIndex = this.d282.channel;
} else {
var c = this.d279["inp_channel"].selectedIndex;
if(c != this.d282.channel) {
this.d282.channel = this.d279["inp_channel"].selectedIndex;
this.save();
req = null;
d431 = false;
this.refresh();
}
}
}
this.d528 = function() {
var c = this.d279["inp_count"].value;
if(c != this.d282.count) {
this.d282.count = c;
this.save();
this.d529();
}
}
this.d286 = function() {
this.refresh();
}
this.refresh = function() {
if(!d431) {
this.d291(loc.text("msg_loading"));
req = xmlRequest.send(this.channels[this.d282.channel].value, this, "d530");
d431 = true;
}
}
this.d530 = function(response) {
d431 = false;
if(response.responseXML && response.responseXML.documentElement) {
content = XMLParser.xml2hash(response.responseXML.documentElement);
//            varpw(content);
} else {
content = null;
}
this.d529();
}
this.d529 = function() {
if(content) {
if(this.d282.title != "") {
this.d291(this.d282.title);
} else {
this.d291(content.title);
}
var l = Math.min(content.items.length, this.d282.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.d279["content"].innerHTML = "<table class='plan_table'>" + c + "</table>";
} else {
this.d291(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.d276["title"] = "";
this.d276["channel"] = "1";
this.d276["count"] = "6";
var d431 = 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.d429 = [
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", innerHTML: loc.text("googlevideo_inp_channel"), className: "settings_label"},
{ tag: "select", id: "inp_channel", events: {onchange: "d527()"}, 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: "d528()"}, className: "settings_control",
options: sel_count_options }
]}
]
this.d288 = function() {
this.d287(this.d279.settings, this.d429);
this.d279["inp_channel"].selectedIndex = this.d282.channel;
this.d279["inp_count"].value = this.d282.count;
}
this.d527 = function() {
if(d431) {
this.d279["inp_channel"].selectedIndex = this.d282.channel;
} else {
var c = this.d279["inp_channel"].selectedIndex;
if(c != this.d282.channel && this.channels[c].value != "") {
this.d282.channel = c;
this.save();
req = null;
d431 = false;
this.refresh();
}
}
}
this.d528 = function() {
var c = this.d279["inp_count"].value;
if(c != this.d282.count) {
this.d282.count = c;
this.save();
this.d529();
}
}
this.d286 = function() {
this.refresh();
}
this.refresh = function() {
if(!d431) {
this.d291(loc.text("msg_loading"));
req = xmlRequest.send(this.channels[this.d282.channel].value, this, "d530");
d431 = true;
}
}
this.d530 = function(response) {
d431 = false;
if(response.responseXML && response.responseXML.documentElement) {
content = XMLParser.xml2hash(response.responseXML.documentElement);
//            varpw(content);
} else {
content = null;
}
this.d529();
}
this.d529 = function() {
if(content) {
if(this.d282.title != "") {
this.d291(this.d282.title);
} else {
this.d291(content.title);
}
var l = Math.min(content.items.length, this.d282.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.d279["content"].innerHTML = "<table class='plan_table' width=100%>" + c + "</table>";
} else {
this.d291(loc.text("msg_error"));
}
}
}
YoutubeVideo.prototype = new Widget();
function Weather() {
this.init();
this.cfg = {
title: loc.text("weather_title"),
module: "Weather"
};
this.d276["city"] = "RSXX0199";
this.d276["unit"] = "c";
this.d429 = [
{ tag: "div", className: "settings_section",
childs: [
{ tag: "span", innerHTML: loc.text("weather_inp_unit"), className: "settings_label"},
{ tag: "select", id: "d531", events: {onclick: "d531()"}, 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: "d535", className: "settings_control"},
{ tag: "input", type: "button", events: {onclick: "d533()"}, value: loc.text("btn_set"), className: "settings_control"},
]},
{ tag: "div", className: "settings_section", id: "citiesList", display: false}
]
this.d288 = function() {
this.d279["settings"].innerHTML = "";
this.d287(this.d279.settings, this.d429);
this.d279.d531.value = this.d282.unit;
}
this.d286 = function() {
this.refresh();
}
var loading = false;
this.refresh = function() {
if(!loading) {
loading = true;
this.d291(loc.text("msg_loading"));
xmlRequest.send("http://xoap.weather.com/weather/local/"+this.d282.city+"?cc=*&unit=d&dayf=4", this, "d538");
}
}
this.d531 = function() {
this.d282.unit = this.d279.d531.value;
this.d532();
this.save();
}
this.d533 = function() {
xmlRequest.send("http://xoap.weather.com/search/search?where="+this.d279.d535.value, this, "d534");
}
this.d534 = function(response) {
this.d279.citiesList.innerHTML = '';
showEl(this.d279.citiesList);
var doc = response.responseXML.documentElement;
var r = doc.getElementsByTagName("loc");
if(r.length == 1) {
this.d535(r[0].getAttribute("id"))
} else if (r.length == 0) {
this.d279.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: "d535('"+r[i].getAttribute("id")+"')"},
innerHTML: r[i].firstChild.nodeValue}
]
}
}
this.d287(this.d279.citiesList, { tag: "ul", childs: clistDom });
}
}
this.d535 = function(id) {
this.d282.city = id;
hideEl(this.d279.citiesList);
this.save();
this.refresh();
}
this.d536 = function(n) {
var calc = Math.round((n-32)*5/9);
return (isNaN(calc)) ? loc.text("weather_na") : calc + "&#176;";
}
this.d537 = function(node) {
var hi = node.getElementsByTagName("hi")[0].firstChild.nodeValue;
var low = node.getElementsByTagName("low")[0].firstChild.nodeValue;
if(this.d282.unit == "c") {
hi = this.d536(hi);
low = this.d536(low);
}
return low+" / "+hi+"";
}
this.d532 = 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.d537(days[i]) }
]});
}
var m = { tag: "table", className: "sys_table", style: {width: "100%"},
childs: [
{ tag: "tr",
childs: mDays }
]};
this.d279["content"].innerHTML = '';
this.d287(this.d279["content"], m);
if(this.data.getElementsByTagName("dnam").length>0) {
this.d291(this.cfg.title + " : " + this.data.getElementsByTagName("dnam")[0].firstChild.nodeValue);
}
}
this.d538 = function(response) {
this.data = response.responseXML.documentElement;
this.d532();
loading = false;
}
}
Weather.prototype = new Widget();
function Websearch() {
this.init();
this.cfg = {
hasRefreshBtn: false,
title: loc.text("websearch_title"),
module: "Websearch"
}
this.d276["openHere"] = "0";
this.d276["serverId"] = 1;
this.d429 = [
{ 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: "d517()"}, className: "settings_control"}
]}
]
this.d363 = [
{ 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: "d541()"}}, width: "1%"}], "90%")
]}
]
this.d288 = function() {
this.d279["settings"].innerHTML = "";
this.d287(this.d279.settings, this.d429);
this.d287(this.d279.content, this.d363);
for(var i=0; i<websearch_servers.length; i++) {
this.d287(this.d279.servers_tabs,
{ tag: "span", className: "bevel_section",
style: {cursor: "pointer", fontWeight: "normal"},
id: "tab_"+i, align: "center",
innerHTML: websearch_servers[i].title,
events: {onclick: "d540('"+i+"')"}});
}
if(this.d282.serverId > websearch_servers.length - 1) {
this.d282.serverId = websearch_servers.length - 1;
} else if (!websearch_servers[this.d282.serverId]) {
this.d282.serverId = 0;
}
this.d279.set_target.checked = (this.d282.openHere == 1);
this.d539(this.d282.serverId);
//        this.d291(this.d282.title);
var widget = this;
this.d279["search_text"]["onkeyup"] = function(event) { if (!event) { event = window.event } if(event.keyCode == 13) { widget.d541() } };
}
this.d517 = function() {
this.d282.openHere = (this.d279.set_target.checked ? "1" : "0");
this.save();
}
this.d540 = function(serverId) {
this.d282.serverId = serverId;
this.d539(serverId);
this.save();
}
this.d338 = null;
this.d539 = function(serverId) {
if(this.d338) {
this.d279["tab_"+this.d338].style.backgroundColor = "#EAEAFF";
this.d279["tab_"+this.d338].style.fontWeight = "normal";
}
this.d279["tab_"+serverId].style.backgroundColor = "#FFFFFF";
this.d279["tab_"+serverId].style.fontWeight = "bold";
this.d338 = serverId;
if(websearch_servers[serverId].logo != "") {
showEl(this.d279.server_logo);
this.d279.server_logo.src = 'var/img/'+websearch_servers[serverId].logo;
} else {
hideEl(this.d279.server_logo);
}
this.d291(websearch_servers[serverId].title);
}
this.d541 = function() {
var str = this.d279.search_text.value;
if(str == "") {
return;
}
var url = websearch_servers[this.d282.serverId].url+escape(str);
if(this.d282.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.d276["home_page"] = "";
this.d429 = [
{ 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: "d543()"}, value: loc.text("btn_go"), className: "settings_control"}
]}
]
this.d363 = [
{ tag: "iframe",
id: "browser",
vspace: "0",
hspace: "0",
marginwidth: "0",
marginheight: "0",
frameBorder: "0",
style: { width: "100%", height: "340px", border: "0" }}
]
this.d288 = function() {
this.d291(loc.text("browser_title"));
this.d279.settings.innerHTML = "";
this.d287(this.d279.settings, this.d429);
this.d287(this.d279.content, this.d363);
this.d279["inp_home_page"].value = this.d282["home_page"];
}
this.d286 = function() {
this.d542();
}
this.d543 = function() {
this.d282["home_page"] = this.d544(this.d279["inp_home_page"].value);
this.d279["inp_home_page"].value = this.d282["home_page"];
this.d542();
this.save();
this.d297();
}
this.d542 = function() {
this.d279["browser"].src = this.d282["home_page"];
}
this.d544 = 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.d288 = 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.d287(this.d279["content"], [
{ tag: "div", className: "calc_display", innerHTML: "0",
id: "display"},
{ tag: "div", className: "calc_numpad",
childs: numpadModel }
]);
}
this.d286 = function() {
this.d291(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.d279["display"].innerHTML);
if(v == "E") {
this.setValue(0);
v = "0";
}
return v;
}
this.setValue = function(v) {
this.d279["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.d279["display"].innerHTML += ".";
}
this.d279["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.d276["title"] = loc.text("htmlbox_title");
this.d276["html"] = "";
this.d288 = function() {
this.d287(this.d279["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.d279["inp_source"].value;
this.renderHTML(t);
this.d282["html"] = t.jsEscape();
this.save();
this.d295();
}
this.d286 = function() {
this.d291(this.d282["title"]);
this.d279["input_title"].value = this.d282["title"];
this.d279["content"].style.textAlign = "center";
var html = this.d282["html"].jsUnescape();
this.d279["inp_source"].value = html;
this.d279["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.d279["icon"].setAttribute("src", favIcon);
}
this.renderHTML = function(html) {
this.setIcon(html);
if(!(html && html.length)) {
this.d279["content"].innerHTML = "<div style='text-align: left'>" + loc.text("htmlbox_help") + "</div>";
} else {
if(html.indexOf('<script') != -1) {
this.d279["content"].innerHTML = "";
this.d287(this.d279["content"],
{ tag: "iframe",
id: "iframe",
scrolling: "no",
border: "0",
frameBorder: "0" });
this.d279["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.d279["content"].innerHTML = html;
}
}
}
this.updateIframeSize = function(w, h) {
this.d279["iframe"].style.width = w + "px";
this.d279["iframe"].style.height = w + "px";
}
}
HTMLBox.prototype = new Widget();
function HTMLWidget() {
this.init();
this.cfg = {
hasRefreshBtn: false,
hasSettingsBtn: false,
title: "",
module: "HTMLWidget"
}
this.d276["id"] = "";
this.d286 = function() {
this.d291(loc.text("msg_loading"));
request.send({ act: "get_data", id: this.d282["id"]}, this);
}
this.renderHTML = function(html) {
if(html.indexOf('<script') != -1) {
this.d279["content"].innerHTML = "";
this.d287(this.d279["content"],
{ tag: "iframe",
id: "iframe",
scrolling: "no",
border: "0",
frameBorder: "0" });
this.d279["iframe"].src = "ewloader.php?wid=" + this.id + "&code=" + encodeURIComponent(html);
} else {
this.d279["content"].innerHTML = html;
}
}
this.updateIframeSize = function(w, h) {
this.d279["iframe"].style.width = w + "px";
this.d279["iframe"].style.height = w + "px";
}
this.d306 = function(msg) {
switch(msg.status) {
case "data":
this.d279["content"].style.textAlign = "center";
this.d291(msg.data.title);
this.renderHTML(msg.data.source);
this.d279["icon"].setAttribute("src", "var/hwicons/" + msg.data.icon);
break;
case "error":
this.d279["content"].innerHTML = loc.text("msg_error");
this.d291(loc.text("msg_error"));
break;
}
}
}
HTMLWidget.prototype = new Widget();
