Your IP : 18.225.235.157
var phpVars;
if(!phpVars)
{
phpVars = {
ADMIN_THEME_ID: '.default',
LANGUAGE_ID: 'en',
FORMAT_DATE: 'DD.MM.YYYY',
FORMAT_DATETIME: 'DD.MM.YYYY HH:MI:SS',
opt_context_ctrl: false,
cookiePrefix: 'BITRIX_SM',
titlePrefix: '',
bitrix_sessid: '',
messHideMenu: '',
messShowMenu: '',
messHideButtons: '',
messShowButtons: '',
messFilterInactive: '',
messFilterActive: '',
messFilterLess: '',
messLoading: 'Loading...',
messMenuLoading: '',
messMenuLoadingTitle: '',
messNoData: '',
messExpandTabs: '',
messCollapseTabs: '',
messPanelFixOn: '',
messPanelFixOff: '',
messPanelCollapse: '',
messPanelExpand: ''
};
}
var jsUtils =
{
arEvents: Array(),
addEvent: function(el, evname, func, capture)
{
if(el.attachEvent) // IE
el.attachEvent("on" + evname, func);
else if(el.addEventListener) // Gecko / W3C
el.addEventListener(evname, func, false);
else
el["on" + evname] = func;
this.arEvents[this.arEvents.length] = {'element': el, 'event': evname, 'fn': func};
},
removeEvent: function(el, evname, func)
{
if(el.detachEvent) // IE
el.detachEvent("on" + evname, func);
else if(el.removeEventListener) // Gecko / W3C
el.removeEventListener(evname, func, false);
else
el["on" + evname] = null;
},
removeAllEvents: function(el)
{
var i;
for(i=0; i<this.arEvents.length; i++)
{
if(this.arEvents[i] && (el==false || el==this.arEvents[i].element))
{
jsUtils.removeEvent(this.arEvents[i].element, this.arEvents[i].event, this.arEvents[i].fn);
this.arEvents[i] = null;
}
}
if(el==false)
this.arEvents.length = 0;
},
IsDoctype: function()
{
if (document.compatMode)
return (document.compatMode == "CSS1Compat");
if (document.documentElement && document.documentElement.clientHeight)
return true;
return false;
},
GetRealPos: function(el)
{
if(window.BX)
return BX.pos(el);
if(!el || !el.offsetParent)
return false;
var res = Array();
res["left"] = el.offsetLeft;
res["top"] = el.offsetTop;
var objParent = el.offsetParent;
while(objParent && objParent.tagName != "BODY")
{
res["left"] += objParent.offsetLeft;
res["top"] += objParent.offsetTop;
objParent = objParent.offsetParent;
}
res["right"] = res["left"] + el.offsetWidth;
res["bottom"] = res["top"] + el.offsetHeight;
return res;
},
FindChildObject: function(obj, tag_name, class_name, recursive)
{
if(!obj)
return null;
var tag = tag_name.toUpperCase();
var cl = (class_name? class_name.toLowerCase() : null);
var n = obj.childNodes.length;
for(var j=0; j<n; j++)
{
var child = obj.childNodes[j];
if(child.tagName && child.tagName.toUpperCase() == tag)
if(!class_name || child.className.toLowerCase() == cl)
return child;
if(recursive == true)
{
var deepChild;
if((deepChild = jsUtils.FindChildObject(child, tag_name, class_name, true)))
return deepChild;
}
}
return null;
},
FindParentObject: function(obj, tag_name, class_name)
{
if(!obj)
return null;
var o = obj;
var tag = tag_name.toUpperCase();
var cl = (class_name? class_name.toLowerCase() : null);
while(o.parentNode)
{
var parent = o.parentNode;
if(parent.tagName && parent.tagName.toUpperCase() == tag)
if(!class_name || parent.className.toLowerCase() == cl)
return parent;
o = parent;
}
return null;
},
FindNextSibling: function(obj, tag_name)
{
if(!obj)
return null;
var o = obj;
var tag = tag_name.toUpperCase();
while(o.nextSibling)
{
var sibling = o.nextSibling;
if(sibling.tagName && sibling.tagName.toUpperCase() == tag)
return sibling;
o = sibling;
}
return null;
},
FindPreviousSibling: function(obj, tag_name)
{
if(!obj)
return null;
var o = obj;
var tag = tag_name.toUpperCase();
while(o.previousSibling)
{
var sibling = o.previousSibling;
if(sibling.tagName && sibling.tagName.toUpperCase() == tag)
return sibling;
o = sibling;
}
return null;
},
bOpera : navigator.userAgent.toLowerCase().indexOf('opera') != -1,
bIsIE : document.attachEvent && navigator.userAgent.toLowerCase().indexOf('opera') == -1,
IsIE: function()
{
return this.bIsIE;
},
IsOpera: function()
{
return this.bOpera;
},
IsSafari: function()
{
var userAgent = navigator.userAgent.toLowerCase();
return (/webkit/.test(userAgent));
},
IsEditor: function()
{
var userAgent = navigator.userAgent.toLowerCase();
var version = (userAgent.match( /.+(msie)[\/: ]([\d.]+)/ ) || [])[2];
var safari = /webkit/.test(userAgent);
if (this.IsOpera() || (document.all && !document.compatMode && version < 6) || safari)
return false;
return true;
},
ToggleDiv: function(div)
{
var style = document.getElementById(div).style;
if(style.display!="none")
style.display = "none";
else
style.display = "block";
return (style.display != "none");
},
urlencode: function(s)
{
return escape(s).replace(new RegExp('\\+','g'), '%2B');
},
OpenWindow: function(url, width, height)
{
var w = screen.width, h = screen.height;
if(this.IsOpera())
{
w = document.body.offsetWidth;
h = document.body.offsetHeight;
}
window.open(url, '', 'status=no,scrollbars=yes,resizable=yes,width='+width+',height='+height+',top='+Math.floor((h - height)/2-14)+',left='+Math.floor((w - width)/2-5));
},
SetPageTitle: function(s)
{
document.title = phpVars.titlePrefix+s;
var h1 = document.getElementsByTagName("H1");
if(h1)
h1[0].innerHTML = s;
},
LoadPageToDiv: function(url, div_id)
{
var div = document.getElementById(div_id);
if(!div)
return;
CHttpRequest.Action = function(result)
{
CloseWaitWindow();
document.getElementById(div_id).innerHTML = result;
}
ShowWaitWindow();
CHttpRequest.Send(url);
},
trim: function(s)
{
if (typeof s == 'string' || typeof s == 'object' && s.constructor == String)
{
var r, re;
re = /^[\s\r\n]+/g;
r = s.replace(re, "");
re = /[\s\r\n]+$/g;
r = r.replace(re, "");
return r;
}
else
return s;
},
Redirect: function(args, url)
{
var e = null, bShift = false;
if(args && args.length > 0)
e = args[0];
if(!e)
e = window.event;
if(e)
bShift = e.shiftKey;
if(bShift)
window.open(url);
else
{
window.location.href=url;
}
},
False: function(){return false;},
AlignToPos: function(pos, w, h)
{
var x = pos["left"], y = pos["bottom"];
var scroll = jsUtils.GetWindowScrollPos();
var size = jsUtils.GetWindowInnerSize();
if((size.innerWidth + scroll.scrollLeft) - (pos["left"] + w) < 0)
{
if(pos["right"] - w >= 0 )
x = pos["right"] - w;
else
x = scroll.scrollLeft;
}
if((size.innerHeight + scroll.scrollTop) - (pos["bottom"] + h) < 0)
{
if(pos["top"] - h >= 0)
y = pos["top"] - h;
else
y = scroll.scrollTop;
}
return {'left':x, 'top':y};
},
// evaluate js string in window scope
EvalGlobal: function(script)
{
try {
if (window.execScript)
window.execScript(script, 'javascript');
else if (jsUtils.IsSafari())
window.setTimeout(script, 0);
else
window.eval(script);
} catch (e) {/*alert("Error! jsUtils.EvalGlobal");*/}
},
GetStyleValue: function(el, styleProp)
{
var res;
if(el.currentStyle)
res = el.currentStyle[styleProp];
else if(window.getComputedStyle)
res = document.defaultView.getComputedStyle(el, null).getPropertyValue(styleProp);
if(!res)
res = '';
return res;
},
GetWindowInnerSize: function(pDoc)
{
var width, height;
if (!pDoc)
pDoc = document;
if (self.innerHeight) // all except Explorer
{
width = self.innerWidth;
height = self.innerHeight;
}
else if (pDoc.documentElement && (pDoc.documentElement.clientHeight || pDoc.documentElement.clientWidth)) // Explorer 6 Strict Mode
{
width = pDoc.documentElement.clientWidth;
height = pDoc.documentElement.clientHeight;
}
else if (pDoc.body) // other Explorers
{
width = pDoc.body.clientWidth;
height = pDoc.body.clientHeight;
}
return {innerWidth : width, innerHeight : height};
},
GetWindowScrollPos: function(pDoc)
{
var left, top;
if (!pDoc)
pDoc = document;
if (self.pageYOffset) // all except Explorer
{
left = self.pageXOffset;
top = self.pageYOffset;
}
else if (pDoc.documentElement && (pDoc.documentElement.scrollTop || pDoc.documentElement.scrollLeft)) // Explorer 6 Strict
{
left = document.documentElement.scrollLeft;
top = document.documentElement.scrollTop;
}
else if (pDoc.body) // all other Explorers
{
left = pDoc.body.scrollLeft;
top = pDoc.body.scrollTop;
}
return {scrollLeft : left, scrollTop : top};
},
GetWindowScrollSize: function(pDoc)
{
var width, height;
if (!pDoc)
pDoc = document;
if ( (pDoc.compatMode && pDoc.compatMode == "CSS1Compat"))
{
width = pDoc.documentElement.scrollWidth;
height = pDoc.documentElement.scrollHeight;
}
else
{
if (pDoc.body.scrollHeight > pDoc.body.offsetHeight)
height = pDoc.body.scrollHeight;
else
height = pDoc.body.offsetHeight;
if (pDoc.body.scrollWidth > pDoc.body.offsetWidth ||
(pDoc.compatMode && pDoc.compatMode == "BackCompat") ||
(pDoc.documentElement && !pDoc.documentElement.clientWidth)
)
width = pDoc.body.scrollWidth;
else
width = pDoc.body.offsetWidth;
}
return {scrollWidth : width, scrollHeight : height};
},
GetWindowSize: function()
{
var innerSize = jsUtils.GetWindowInnerSize();
var scrollPos = jsUtils.GetWindowScrollPos();
var scrollSize = jsUtils.GetWindowScrollSize();
return {
innerWidth : innerSize.innerWidth, innerHeight : innerSize.innerHeight,
scrollLeft : scrollPos.scrollLeft, scrollTop : scrollPos.scrollTop,
scrollWidth : scrollSize.scrollWidth, scrollHeight : scrollSize.scrollHeight
};
},
arCustomEvents: {},
addCustomEvent: function(eventName, eventHandler, arParams, handlerContextObject)
{
if (!this.arCustomEvents[eventName])
this.arCustomEvents[eventName] = [];
if (!arParams)
arParams = [];
if (!handlerContextObject)
handlerContextObject = false;
this.arCustomEvents[eventName].push(
{
handler: eventHandler,
arParams: arParams,
obj: handlerContextObject
}
);
},
removeCustomEvent: function(eventName, eventHandler)
{
if (!this.arCustomEvents[eventName])
return;
var l = this.arCustomEvents[eventName].length;
if (l == 1)
{
delete this.arCustomEvents[eventName];
return;
}
for (var i = 0; i < l; i++)
{
if (!this.arCustomEvents[eventName][i])
continue;
if (this.arCustomEvents[eventName][i].handler == eventHandler)
{
delete this.arCustomEvents[eventName][i];
return;
}
}
},
onCustomEvent: function(eventName, arEventParams)
{
if (!this.arCustomEvents[eventName])
return;
if (!arEventParams)
arEventParams = [];
var h;
for (var i = 0, l = this.arCustomEvents[eventName].length; i < l; i++)
{
h = this.arCustomEvents[eventName][i];
if (!h || !h.handler)
continue;
if (h.obj)
h.handler.call(h.obj, h.arParams, arEventParams);
else
h.handler(h.arParams, arEventParams);
}
},
loadJSFile: function(arJs, oCallBack, pDoc)
{
if (!pDoc)
pDoc = document;
if (typeof arJs == 'string')
arJs = [arJs];
var callback = function()
{
if (!oCallBack)
return;
if (typeof oCallBack == 'function')
return oCallBack();
if (typeof oCallBack != 'object' || !oCallBack.func)
return;
var p = oCallBack.params || {};
if (oCallBack.obj)
oCallBack.func.apply(oCallBack.obj, p);
else
oCallBack.func(p);
};
var load_js = function(ind)
{
if (ind >= arJs.length)
return callback();
var oSript = pDoc.body.appendChild(pDoc.createElement('script'));
oSript.src = arJs[ind];
var bLoaded = false;
oSript.onload = oSript.onreadystatechange = function()
{
if (!bLoaded && (!oSript.readyState || oSript.readyState == "loaded" || oSript.readyState == "complete"))
{
bLoaded = true;
setTimeout(function (){load_js(++ind);}, 50);
}
};
};
load_js(0);
},
loadCSSFile: function(arCSS, pDoc, pWin)
{
if (typeof arCSS == 'string')
{
var bSingle = true;
arCSS = [arCSS];
}
var i, l = arCSS.length, pLnk = [];
if (l == 0)
return;
if (!pDoc)
pDoc = document;
if (!pWin)
pWin = window;
if (!pWin.bxhead)
{
var heads = pDoc.getElementsByTagName('HEAD');
pWin.bxhead = heads[0];
}
if (!pWin.bxhead)
return;
for (i = 0; i < l; i++)
{
var lnk = document.createElement('LINK');
lnk.href = arCSS[i];
lnk.rel = 'stylesheet';
lnk.type = 'text/css';
pWin.bxhead.appendChild(lnk);
pLnk.push(lnk);
}
if (bSingle)
return lnk;
return pLnk;
},
appendBXHint : function(node, html)
{
if (!node || !node.parentNode || !html)
return;
var oBXHint = new BXHint(html);
node.parentNode.insertBefore(oBXHint.oIcon, node);
node.parentNode.removeChild(node);
oBXHint.oIcon.style.marginLeft = "5px";
},
PreventDefault : function(e)
{
if(!e) e = window.event;
if(e.stopPropagation)
{
e.preventDefault();
e.stopPropagation();
}
else
{
e.cancelBubble = true;
e.returnValue = false;
}
return false;
},
CreateElement: function(tag, arAttr, arStyles, pDoc)
{
if (!pDoc)
pDoc = document;
var pEl = pDoc.createElement(tag), p;
if(arAttr)
{
for(p in arAttr)
{
if(p == 'className' || p == 'class')
{
pEl.setAttribute('class', arAttr[p]);
if (jsUtils.IsIE())
pEl.setAttribute('className', arAttr[p]);
continue;
}
if (arAttr[p] != undefined && arAttr[p] != null)
pEl.setAttribute(p, arAttr[p]);
}
}
if(arStyles)
{
for(p in arStyles)
pEl.style[p] = arStyles[p];
}
return pEl;
},
in_array: function(needle, haystack)
{
for(var i=0; i<haystack.length; i++)
{
if(haystack[i] == needle)
return true;
}
return false;
},
htmlspecialchars: function(str)
{
if(!str.replace)
return str;
return str.replace(/&/g, '&').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>');
}
}
/************************************************/
function JCFloatDiv()
{
var _this = this;
this.floatDiv = null;
this.x = this.y = 0;
this.Create = function(arParams)
{
var div = document.body.appendChild(document.createElement("DIV"));
div.id = arParams.id;
div.style.position = 'absolute';
div.style.left = '-10000px';
div.style.top = '-10000px';
if(arParams.className)
div.className = arParams.className;
if(arParams.zIndex)
div.style.zIndex = arParams.zIndex;
if(arParams.width)
div.style.width = arParams.width+'px';
if(arParams.height)
div.style.height = arParams.height+'px';
return div;
}
this.Show = function(div, left, top, dxShadow, restrictDrag, showSubFrame)
{
if (showSubFrame !== false)
showSubFrame = true;
var zIndex = parseInt(div.style.zIndex);
if(zIndex <= 0 || isNaN(zIndex))
zIndex = 100;
//document.title = 'zIndex = ' + zIndex;
div.style.zIndex = zIndex;
if (left < 0)
left = 0;
if (top < 0)
top = 0;
div.style.left = parseInt(left) + "px";
div.style.top = parseInt(top) + "px";
if(jsUtils.IsIE() && showSubFrame === true)
{
var frame = document.getElementById(div.id+"_frame");
if(!frame)
{
frame = document.createElement("IFRAME");
frame.src = "javascript:''";
frame.id = div.id+"_frame";
frame.style.position = 'absolute';
frame.style.borderWidth = '0px';
frame.style.zIndex = zIndex-1;
document.body.appendChild(frame);
}
frame.style.width = div.offsetWidth + "px";
frame.style.height = div.offsetHeight + "px";
frame.style.left = div.style.left;
frame.style.top = div.style.top;
frame.style.visibility = 'visible';
}
/*Restrict drag*/
div.restrictDrag = restrictDrag || false;
/*shadow*/
if(isNaN(dxShadow))
dxShadow = 5;
if(dxShadow > 0)
{
var img = document.getElementById(div.id+'_shadow');
if(!img)
{
if(jsUtils.IsIE())
{
img = document.createElement("DIV");
img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/bitrix/themes/"+phpVars.ADMIN_THEME_ID+"/images/shadow.png',sizingMethod='scale')";
}
else
{
img = document.createElement("IMG");
img.src = '/bitrix/themes/' + phpVars.ADMIN_THEME_ID+'/images/shadow.png';
}
img.id = div.id+'_shadow';
img.style.position = 'absolute';
img.style.zIndex = zIndex-2;
img.style.left = '-1000px';
img.style.top = '-1000px';
img.style.lineHeight = 'normal';
img.className = "bx-js-float-shadow";
document.body.appendChild(img);
}
img.style.width = div.offsetWidth+'px';
img.style.height = div.offsetHeight+'px';
img.style.left = parseInt(div.style.left)+dxShadow+'px';
img.style.top = parseInt(div.style.top)+dxShadow+'px';
img.style.visibility = 'visible';
}
div.dxShadow = dxShadow;
}
this.Close = function(div)
{
if(!div)
return;
var sh = document.getElementById(div.id+"_shadow");
if(sh)
sh.style.visibility = 'hidden';
var frame = document.getElementById(div.id+"_frame");
if(frame)
frame.style.visibility = 'hidden';
}
this.Move = function(div, x, y)
{
if(!div)
return;
var dxShadow = div.dxShadow;
var left = parseInt(div.style.left)+x;
var top = parseInt(div.style.top)+y;
if (div.restrictDrag)
{
//Left side
if (left < 0)
left = 0;
//Right side
if ( (document.compatMode && document.compatMode == "CSS1Compat"))
windowWidth = document.documentElement.scrollWidth;
else
{
if (document.body.scrollWidth > document.body.offsetWidth ||
(document.compatMode && document.compatMode == "BackCompat") ||
(document.documentElement && !document.documentElement.clientWidth)
)
windowWidth = document.body.scrollWidth;
else
windowWidth = document.body.offsetWidth;
}
var floatWidth = div.offsetWidth;
if (left > (windowWidth - floatWidth - dxShadow))
left = windowWidth - floatWidth - dxShadow;
//Top side
if (top < 0)
top = 0;
}
div.style.left = left+'px';
div.style.top = top+'px';
this.AdjustShadow(div);
}
this.HideShadow = function(div)
{
var sh = document.getElementById(div.id + "_shadow");
sh.style.visibility = 'hidden';
}
this.UnhideShadow = function(div)
{
var sh = document.getElementById(div.id + "_shadow");
sh.style.visibility = 'visible';
}
this.AdjustShadow = function(div)
{
var sh = document.getElementById(div.id + "_shadow");
if(sh && sh.style.visibility != 'hidden')
{
var dxShadow = div.dxShadow;
sh.style.width = div.offsetWidth+'px';
sh.style.height = div.offsetHeight+'px';
sh.style.left = parseInt(div.style.left)+dxShadow+'px';
sh.style.top = parseInt(div.style.top)+dxShadow+'px';
}
var frame = document.getElementById(div.id+"_frame");
if(frame)
{
frame.style.width = div.offsetWidth + "px";
frame.style.height = div.offsetHeight + "px";
frame.style.left = div.style.left;
frame.style.top = div.style.top;
}
}
this.StartDrag = function(e, div)
{
if(!e)
e = window.event;
this.x = e.clientX + document.body.scrollLeft;
this.y = e.clientY + document.body.scrollTop;
this.floatDiv = div;
jsUtils.addEvent(document, "mousemove", this.MoveDrag);
document.onmouseup = this.StopDrag;
if(document.body.setCapture)
document.body.setCapture();
document.onmousedown = jsUtils.False;
var b = document.body;
b.ondrag = jsUtils.False;
b.onselectstart = jsUtils.False;
b.style.MozUserSelect = _this.floatDiv.style.MozUserSelect = 'none';
b.style.cursor = 'move';
}
this.StopDrag = function(e)
{
if(document.body.releaseCapture)
document.body.releaseCapture();
jsUtils.removeEvent(document, "mousemove", _this.MoveDrag);
document.onmouseup = null;
this.floatDiv = null;
document.onmousedown = null;
var b = document.body;
b.ondrag = null;
b.onselectstart = null;
b.style.MozUserSelect = _this.floatDiv.style.MozUserSelect = '';
b.style.cursor = '';
}
this.MoveDrag = function(e)
{
var x = e.clientX + document.body.scrollLeft;
var y = e.clientY + document.body.scrollTop;
if(_this.x == x && _this.y == y)
return;
_this.Move(_this.floatDiv, (x - _this.x), (y - _this.y));
_this.x = x;
_this.y = y;
}
}
var jsFloatDiv = new JCFloatDiv();
/************************************************/
var BXHint = function(innerHTML, element, addParams)
{
this.oDivOver = false;
this.timeOutID = null;
this.oIcon = null;
this.freeze = false;
this.x = 0;
this.y = 0;
this.time = 700;
if (!innerHTML)
innerHTML = "";
this.Create(innerHTML, element, addParams);
}
BXHint.prototype.Create = function(innerHTML, element, addParams)
{
var
_this = this,
width = 0,
height = 0,
className = null,
type = "icon";
this.bWidth = true;
if (addParams)
{
if (addParams.width === false)
this.bWidth = false;
else if (addParams.width)
width = addParams.width;
if (addParams.height)
height = addParams.height;
if (addParams.className)
className = addParams.className;
if (addParams.type && (addParams.type == "link" || addParams.type == "icon"))
type = addParams.type;
if (addParams.time > 0)
this.time = addParams.time;
}
if (element)
type = "element";
if (type == "icon")
{
var element = document.createElement("IMG");
element.src = (addParams && addParams.iconSrc) ? addParams.iconSrc : "/bitrix/themes/"+phpVars.ADMIN_THEME_ID+"/public/popup/hint.gif";
element.ondrag = jsUtils.False;
}
else if (type == "link")
{
var element = document.createElement("A");
element.href = "";
element.onclick = function(e){return false;}
element.innerHTML = "[?]";
}
this.element = element;
if (type == "element")
{
if(addParams && addParams.show_on_click)
{
jsUtils.addEvent(
element,
"click",
function (event)
{
if (!event)
event = window.event;
_this.GetMouseXY(event);
_this.timeOutID = setTimeout(function () {_this.Show(innerHTML,width,height,className) }, 10);
}
);
}
else
{
jsUtils.addEvent(
element,
"mouseover",
function (event)
{
if (!event)
event = window.event;
_this.GetMouseXY(event);
_this.timeOutID = setTimeout(function () {_this.Show(innerHTML,width,height,className) }, 750);
}
);
}
jsUtils.addEvent(
element,
"mouseout",
function(event)
{
if (_this.timeOutID)
clearTimeout(_this.timeOutID);
_this.SmartHide(_this);
}
);
}
else
{
this.oIcon = element;
element.onmouseover = function(event) {if (!event) event = window.event; _this.GetMouseXY(event); _this.Show(innerHTML,width,height,className)};
element.onmouseout = function() {_this.SmartHide(_this);};
}
}
BXHint.prototype.IsFrozen = function()
{
return this.freeze;
}
BXHint.prototype.Freeze = function()
{
this.freeze = true;
this.Hide();
}
BXHint.prototype.UnFreeze = function()
{
this.freeze = false;
}
BXHint.prototype.GetMouseXY = function(event)
{
if (event.pageX || event.pageY)
{
this.x = event.pageX;
this.y = event.pageY;
}
else if (event.clientX || event.clientY)
{
this.x = event.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft;
this.y = event.clientY + (document.documentElement.scrollTop || document.body.scrollTop) - document.documentElement.clientTop;
}
}
BXHint.prototype.Show = function(innerHTML, width, height, className)
{
//Delete previous hint
var old = document.getElementById("__BXHint_div");
if (old)
this.Hide();
if (this.freeze)
return;
var _this = this;
var oDiv = document.body.appendChild(document.createElement("DIV"));
oDiv.onmouseover = function(){_this.oDivOver = true};
oDiv.onmouseout = function(){_this.oDivOver = false; _this.SmartHide(_this);}
oDiv.id = "__BXHint_div";
oDiv.className = (className) ? className : "bxhint";
oDiv.style.position = 'absolute';
if (width && this.bWidth)
oDiv.style.width = width + "px";
if (height)
oDiv.style.height = height + "px";
oDiv.innerHTML = innerHTML;
var w = oDiv.offsetWidth;
var h = oDiv.offsetHeight;
if (this.bWidth)
{
if (!width && w>200)
w = Math.round(Math.sqrt(1.618*w*h));
oDiv.style.width = w + "px";
h = oDiv.offsetHeight;
}
var pos = {left : this.x + 10, right : this.x + w, top : this.y, bottom : this.y + h};
pos = this.AlignToPos(pos, w, h);
oDiv.style.zIndex = 2100;
jsFloatDiv.Show(oDiv, pos.left, pos.top,3);
// oDiv.ondrag = jsUtils.False;
// oDiv.onselectstart = jsUtils.False;
// oDiv.style.MozUserSelect = 'none';
oDiv = null;
}
BXHint.prototype.AlignToPos = function(pos, w, h)
{
var body = document.body;
if((body.clientWidth + body.scrollLeft) < (pos.left + w))
pos.left = (pos.left - w >= 0) ? (pos.left - w) : body.scrollLeft;
if((body.clientHeight + body.scrollTop) - (pos["bottom"]) < 0)
pos.top = (pos.top - h >= 0) ? (pos.top - h) : body.scrollTop;
return pos;
}
BXHint.prototype.Hide = function()
{
var oDiv = document.getElementById("__BXHint_div");
if (!oDiv)
return;
jsFloatDiv.Close(oDiv);
oDiv.parentNode.removeChild(oDiv);
oDiv = null;
}
BXHint.prototype.SmartHide = function(_this)
{
setTimeout(function ()
{
if (!_this.oDivOver)
_this.Hide();
}, 100
);
}
/************************************************/
function WaitOnKeyPress(e)
{
if(!e) e = window.event
if(!e) return;
if(e.keyCode == 27)
CloseWaitWindow();
}
function ShowWaitWindow()
{
CloseWaitWindow();
var obWndSize = jsUtils.GetWindowSize();
var div = document.body.appendChild(document.createElement("DIV"));
div.id = "wait_window_div";
div.innerHTML = phpVars.messLoading;
div.className = "waitwindow";
//div.style.left = obWndSize.scrollLeft + (obWndSize.innerWidth - div.offsetWidth) - (jsUtils.IsIE() ? 5 : 20) + "px";
div.style.right = (5 - obWndSize.scrollLeft) + 'px';
div.style.top = obWndSize.scrollTop + 5 + "px";
if(jsUtils.IsIE())
{
var frame = document.createElement("IFRAME");
frame.src = "javascript:''";
frame.id = "wait_window_frame";
frame.className = "waitwindow";
frame.style.width = div.offsetWidth + "px";
frame.style.height = div.offsetHeight + "px";
frame.style.right = div.style.right;
frame.style.top = div.style.top;
document.body.appendChild(frame);
}
jsUtils.addEvent(document, "keypress", WaitOnKeyPress);
}
function CloseWaitWindow()
{
jsUtils.removeEvent(document, "keypress", WaitOnKeyPress);
var frame = document.getElementById("wait_window_frame");
if(frame)
frame.parentNode.removeChild(frame);
var div = document.getElementById("wait_window_div");
if(div)
div.parentNode.removeChild(div);
}
/************************************************/
var jsSelectUtils =
{
addNewOption: function(select_id, opt_value, opt_name, do_sort, check_unique)
{
var oSelect = (typeof(select_id) == 'string' || select_id instanceof String? document.getElementById(select_id) : select_id);
if(oSelect)
{
var n = oSelect.length;
if(check_unique !== false)
{
for(var i=0;i<n;i++)
if(oSelect[i].value==opt_value)
return;
}
var newoption = new Option(opt_name, opt_value, false, false);
oSelect.options[n]=newoption;
}
if(do_sort === true)
this.sortSelect(select_id);
},
deleteOption: function(select_id, opt_value)
{
var oSelect = (typeof(select_id) == 'string' || select_id instanceof String? document.getElementById(select_id) : select_id);
if(oSelect)
{
for(var i=0;i<oSelect.length;i++)
if(oSelect[i].value==opt_value)
{
oSelect.remove(i);
break;
}
}
},
deleteSelectedOptions: function(select_id)
{
var oSelect = (typeof(select_id) == 'string' || select_id instanceof String? document.getElementById(select_id) : select_id);
if(oSelect)
{
var i=0;
while(i<oSelect.length)
if(oSelect[i].selected)
{
oSelect[i].selected=false;
oSelect.remove(i);
}
else
i++;
}
},
deleteAllOptions: function(oSelect)
{
if(oSelect)
{
for(var i=oSelect.length-1; i>=0; i--)
oSelect.remove(i);
}
},
optionCompare: function(record1, record2)
{
var value1 = record1.optText.toLowerCase();
var value2 = record2.optText.toLowerCase();
if (value1 > value2) return(1);
if (value1 < value2) return(-1);
return(0);
},
sortSelect: function(select_id)
{
var oSelect = (typeof(select_id) == 'string' || select_id instanceof String? document.getElementById(select_id) : select_id);
if(oSelect)
{
var myOptions = [];
var n = oSelect.options.length;
for (var i=0;i<n;i++)
{
myOptions[i] = {
optText:oSelect[i].text,
optValue:oSelect[i].value
};
}
myOptions.sort(this.optionCompare);
oSelect.length=0;
n = myOptions.length;
for(var i=0;i<n;i++)
{
var newoption = new Option(myOptions[i].optText, myOptions[i].optValue, false, false);
oSelect[i]=newoption;
}
}
},
selectAllOptions: function(select_id)
{
var oSelect = (typeof(select_id) == 'string' || select_id instanceof String? document.getElementById(select_id) : select_id);
if(oSelect)
{
var n = oSelect.length;
for(var i=0;i<n;i++)
oSelect[i].selected=true;
}
},
selectOption: function(select_id, opt_value)
{
var oSelect = (typeof(select_id) == 'string' || select_id instanceof String? document.getElementById(select_id) : select_id);
if(oSelect)
{
var n = oSelect.length;
for(var i=0;i<n;i++)
oSelect[i].selected = (oSelect[i].value == opt_value);
}
},
addSelectedOptions: function(oSelect, to_select_id, check_unique, do_sort)
{
if(!oSelect)
return;
var n = oSelect.length;
for(var i=0; i<n; i++)
if(oSelect[i].selected)
this.addNewOption(to_select_id, oSelect[i].value, oSelect[i].text, do_sort, check_unique);
},
moveOptionsUp: function(oSelect)
{
if(!oSelect)
return;
var n = oSelect.length;
for(var i=0; i<n; i++)
{
if(oSelect[i].selected && i>0 && oSelect[i-1].selected == false)
{
var option1 = new Option(oSelect[i].text, oSelect[i].value);
var option2 = new Option(oSelect[i-1].text, oSelect[i-1].value);
oSelect[i] = option2;
oSelect[i].selected = false;
oSelect[i-1] = option1;
oSelect[i-1].selected = true;
}
}
},
moveOptionsDown: function(oSelect)
{
if(!oSelect)
return;
var n = oSelect.length;
for(var i=n-1; i>=0; i--)
{
if(oSelect[i].selected && i<n-1 && oSelect[i+1].selected == false)
{
var option1 = new Option(oSelect[i].text, oSelect[i].value);
var option2 = new Option(oSelect[i+1].text, oSelect[i+1].value);
oSelect[i] = option2;
oSelect[i].selected = false;
oSelect[i+1] = option1;
oSelect[i+1].selected = true;
}
}
}
}
/************************************************/