Files

951 lines
84 KiB
JavaScript
Raw Permalink Normal View History

2026-02-15 18:29:53 +03:00
/*
* jQuery JavaScript Library v1.3.2
* http://jquery.com/
*
* Copyright (c) 2009 John Resig
* Dual licensed under the MIT and GPL licenses.
* http://docs.jquery.com/License
*
* Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
* Revision: 6246
*/
(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)
/*
* Sizzle CSS Selector Engine - v0.9.3
* Copyright 2009, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
* More information: http://sizzlejs.com/
*/
(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME
var popover_windowWidth = 0; var popover_windowHeight = 0; var popover_hl; var popover_debug = 0; var popover_debug_messages = true; var popover_is_moving = false; var popover_base_y = 0; var popover_base_x = 0; var popover_obj; var popover_x1 = 0, popover_y1 = 0, popover_x2 = 0, popover_y2 = 0; var popover_width = 0, popover_height = 0; var popover_speed = 0; var popover_inited = false; var popover_scrollbars_width = 18; var popover_cx = 0, popover_cy = 0; var popover_modalstatus = 0;
function popover_init(el) {
if (!el) return false;
popover_obj = el;
var oldHtml = el.innerHTML;
el.innerHTML = '<textarea id="SR_scrollbarsTestElement">XXX</textarea>';
var st = document.getElementById('SR_scrollbarsTestElement');
if (st) {
st.wrap = 'off';
popover_scrollbars_width = st.offsetHeight;
st.wrap = 'soft';
popover_scrollbars_width = popover_scrollbars_width - st.offsetHeight;
if (popover_scrollbars_width <= 0)
popover_scrollbars_width = 18;
}
el.innerHTML = oldHtml;
delete st, oldHtml;
popover_windowWidth = window.innerWidth ? window.innerWidth : document.body.offsetWidth;
popover_windowWidth -= popover_scrollbars_width;
popover_windowHeight = window.innerHeight ? window.innerHeight : document.body.offsetHeight;
popover_windowHeight -= 4;
popover_width = parseInt(popover_obj.style.width);
popover_height = parseInt(popover_obj.style.height);
popover_inited = true;
return true;
}
var popover_margin_top = 0,
popover_margin_right = 0,
popover_margin_bottom = 0,
popover_margin_left = 0;
function popover_set_margins(top, right, bottom, left)
{
popover_margin_top = top;
popover_margin_right = right;
popover_margin_bottom = bottom;
popover_margin_left = left;
}
function popover_coord(val, f_asis)
{
val = val.toString();
if (!isNaN(parseInt(val)))
return parseInt(val);
var mtop = popover_margin_top,
mright = popover_margin_right,
mbottom = popover_margin_bottom,
mleft = popover_margin_left,
swidth = popover_scrollbars_width;
if (!(!f_asis))
mtop = mright = mbottom = mleft = swidth = 0;
switch (val.toLowerCase())
{
case 'left': val = 0 + popover_margin_left; break;
case 'center':
val = mleft + parseInt((popover_windowWidth -
mright - mleft - popover_width - swidth) / 2);
break;
case 'right':
val = parseInt(popover_windowWidth - popover_width - mright);
break;
case 'top': val = mtop; break;
case 'middle':
val = mtop +
parseInt((popover_windowHeight -
mbottom - mtop - popover_height) / 2);
break;
case 'bottom': val = popover_windowHeight - popover_height - mbottom; break;
case 'width': val = popover_width; break;
case 'height': val = popover_height; break;
case 'windowheight': val = popover_windowHeight; break;
case 'windowwidth': val = popover_windowWidth; break;
case 'window-width': val = 0 - popover_width; break;
case 'window-height': val = 0 - popover_height; break;
}
return val;
}
function popover_start_to(id, speed, f_jump, x2, y2, func, f_invert)
{
var x1 = parseInt(popover_obj.style.left) - popover_base_x;
var y1 = parseInt(popover_obj.style.top) - popover_base_y;
popover_motion = true;
popover_start(id, speed, f_jump, x1, y1, x2, y2, 1, func, f_invert);
}
popover_is_visible = false;
popover_motion = false;
function popover_start(id, speed, f_jump, x1, y1, x2, y2, f_coordsAsIs, func, f_invert, showModal)
{
if (popover_obj &&
popover_is_visible &&
!popover_motion)
popover_close();
popover_motion = false;
if (!popover_init(document.getElementById(id)))
{
if (popover_debug_messages)
alert('PopOver error: object not found.');
return;
}
popover_is_visible = true;
popover_speed = speed;
document.body.onscroll = popover_onscroll;
window.onscroll = popover_onscroll;
popover_base_y = popover_base_vertical();
var elWidth = popover_width;
var elHeight = popover_height;
if (!x2 &&
isNaN(x2))
x2 = x1;
if (!y2 &&
isNaN(y2))
y2 = y1;
popover_x1 = x1 = popover_coord(x1, f_coordsAsIs);
popover_y1 = y1 = popover_coord(y1, f_coordsAsIs);
popover_x2 = x2 = popover_coord(x2, f_coordsAsIs);
popover_y2 = y2 = popover_coord(y2, f_coordsAsIs);
if (popover_debug)
alert('Press any key to start PopOver from ' + x1 + ',' + y1 + ' to ' + x2 + ',' + y2 + ', speed ' + speed +
"\nmargins: " + popover_margin_top + ',' + popover_margin_right + ',' + popover_margin_bottom + ',' + popover_margin_left);
if (popover_hl)
window.clearTimeout(popover_hl);
popover_move(x1, y1, x2, y2, speed, f_jump, func, f_invert);
}
function popover_move(x1, y1, x2, y2, speed, f_jump, func, f_invert)
{
popover_showmodal();
if (!func)
{
var k, b;
if (Math.abs(x2 - x1) < Math.abs(y2 - y1))
{
f_invert = true;
if (x1 == x2)
{
func = x1;
}
else
{
k = (y2 - y1) / (x2 - x1);
b = y1 - k * x1;
func = '(py - (' + b + ')) / (' + k + ')';
}
}
else
{
if (y1 == y2)
{
func = y1;
}
else
{
f_invert = false;
k = (y2 - y1) / (x2 - x1);
b = y1 - k * x1;
func = 'px * (' + k + ') + (' + b + ')';
}
}
}
if (!f_invert)
popover_move_straight(x1, y1, x2, y2, speed, func, 'popover_move_end(' + f_jump + ')');
else
popover_move_invert(x1, y1, x2, y2, speed, func, 'popover_move_end(' + f_jump + ')');
}
function popover_move_end(f_jump)
{
popover_obj.style.top = popover_base_y + popover_y2;
popover_obj.style.left = popover_x2;
if (f_jump)
popover_harmonic_jumps(popover_speed, popover_x2, popover_y2);
else
popover_move_stop();
}
function popover_harmonic_jumps(speed, x, y, f_rcall, timePassed)
{
if (!popover_obj)
return;
popover_move_stop();
return;
var step = speed > 0 ? -1 : 1;
var cx, cy, px, py;
cx = px = x;
cy = py = y;
var smoothx = 2, csmoothx = 0,
smoothy = 2, csmoothy = 0;
var delay = 1;
var w = 1.5;
var str = 'speed=' + speed + ', w = ' + w + "\n\n";
for (x = 0; x < 10; x ++)
{
//sp = 20 * (Math.cos(w * x) + Math.sin(w * x)) * Math.exp(-1 * w * x);
//sp = 20 * Math.sin(x) * Math.exp(w * x);
//sp = w * Ma
sp = speed - w * Math.pow(x, 2) / 2;
str += x + ' : ' + sp + "\n";
}
alert(str);
return;
}
function popover_move_straight(x1, y1, x2, y2, speed, func, endExec, f_rcall)
{
if (!popover_obj)
return;
if (!f_rcall)
{
popover_obj.style.top = y1;
popover_obj.style.left = x1;
popover_obj.style.display = 'block';
}
if (!endExec)
endExec = '';
popover_is_moving = true;
var step = x1 < x2 ? 1 : -1;
var cx, cy, px, py;
cx = px = x1;
cy = py = y1;
var smoothx = speed * 1, csmoothx = 0,
smoothy = speed * 1, csmoothy = 0;
var delay = 5;
while(x1 != x2)
{
px += step;
eval ('py = Math.round(' + func + ')');
csmoothx = Math.abs(px - cx);
csmoothy = Math.abs(py - cy);
if (csmoothx < smoothx &&
csmoothy < smoothy)
continue;
cx = px;
cy = py;
if (x1 < x2 &&
cx > x2 ||
x1 > x2 &&
cx < x2 ||
cx == x2)
break;
popover_cy = popover_obj.style.top = popover_base_y + cy;
popover_cx = popover_obj.style.left = cx;
popover_hl = window.setTimeout('popover_move_straight(' +
cx + ', ' + cy + ', ' + x2 + ', ' + y2 +
', ' + speed + ', \'' + func + '\', \'' + endExec.replace(/'/g, '\\\'') + '\', 1)', delay);
return;
}
if (endExec.length)
eval(endExec);
}
function popover_move_invert(x1, y1, x2, y2, speed, func, endExec, f_rcall) {
if (!popover_obj) return;
if (!f_rcall) {
popover_obj.style.top = y1;
popover_obj.style.left = x1;
popover_obj.style.display = 'block';
}
if (!endExec) endExec = '';
popover_is_moving = true;
var step = y1 < y2 ? 1 : -1;
var cx, cy, px, py;
cx = px = x1;
cy = py = y1;
var smoothx = speed * 1, csmoothx = 0, smoothy = speed * 1, csmoothy = 0; var delay = 5;
while(y1 != y2) {
py += step;
eval ('px = Math.round(' + func + ')');
csmoothx = Math.abs(px - cx);
csmoothy = Math.abs(py - cy);
if (csmoothx < smoothx &&
csmoothy < smoothy)
continue;
cx = px;
cy = py;
if (y1 < y2 &&
cy > y2 ||
y1 > y2 &&
cy < y2 ||
cy == y2)
break;
popover_cy = popover_obj.style.top = popover_base_y + cy;
popover_cx = popover_obj.style.left = cx;
popover_hl = window.setTimeout('popover_move_invert('+ cx + ', ' + cy + ', ' + x2 + ', ' + y2 + ', ' + speed + ', \'' + func + '\', \'' + endExec.replace(/'/g, '\\\'') + '\', 1)', delay);
return;
}
if (endExec.length) eval(endExec);
}
function popover_base_vertical() {
var y = window.pageYOffset ? window.pageYOffset : document.body.scrollTop;
if (!y) y = 0;
y = parseInt(y);
return y;
}
var popover_move_stop_action;
function popover_move_stop() {
if (popover_hl) window.clearTimeout(popover_hl);
popover_hl = '';
popover_is_moving = false;
if (popover_move_stop_action) {
var act = popover_move_stop_action;
popover_move_stop_action = '';
eval(act);
delete act;
}
}
function popover_close_only() {popover_close();}
function popover_close(el, toExec) {
if (!popover_obj) {
if (popover_debug) alert('PopOver error: object not found.');
return;
}
if (el) {
if (toExec) {
popover_move_stop_action = 'popover_close_only()';
eval(toExec);
return;
}
}
popover_move_stop();
popover_obj.style.display = 'none';
popover_is_visible = false;
popover_hidemodal();
}
var popover_top;
function popover_onscroll() {
if (!popover_is_moving) {
var div = $("#SR_PopOver");
var modalDiv = $("#SR_PopOverModalBackground");
var body = document.body
var docElem = document.documentElement
var scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop;
//alert(scrollTop + ' : ' + popover_top);
// div.css('top', (scrollTop + popover_top));
// modalDiv.css('top', (scrollTop + popover_top));
div.css('top', scrollTop);
modalDiv.css('top', scrollTop);
}
}
var popover_drag_obj; var popover_drag_x; var popover_drag_y; var popover_doc_init = false; var popover_in_stop = false; var popover_doc_onmousemove = ''; var popover_doc_onmouseup = ''; var popover_drag_target = '';
function popover_drag_start(event, el, id) {
if (popover_in_stop || !(popover_drag_obj = document.getElementById(id))) return false;
popover_move_stop_action = '';
popover_move_stop();
popover_doc_init = false;
popover_drag_target = el;
el.style.cursor = 'move';
popover_drag_obj.onmousemove = popover_drag;
popover_drag_obj.onmouseup = popover_drag_stop;
popover_drag_x = event.screenX;
popover_drag_y = event.screenY;
}
function popover_drag(ev) {
if (!ev) ev = event;
if (!popover_drag_obj) return;
if (!popover_doc_init) {
popover_doc_onmousemove = document.onmousemove;
popover_doc_onmouseup = document.onmouseup;
document.onmousemove = popover_drag;
document.onmouseup = popover_drag_stop;
popover_doc_init = true;
}
var cx = ev.screenX, cy = ev.screenY;
if (cx == popover_drag_x && cy == popover_drag_y) return;
popover_drag_target.style.cursor = 'move';
popover_drag_obj.style.left = parseInt(popover_drag_obj.style.left) + parseInt(cx) - parseInt(popover_drag_x);
popover_drag_x = cx;
popover_drag_obj.style.top = parseInt(popover_drag_obj.style.top) + parseInt(cy) - parseInt(popover_drag_y);
popover_drag_y = cy;
}
function popover_drag_stop() {
if (!popover_drag_obj)
return;
popover_in_stop = true;
document.onmousemove = popover_doc_onmousemove;
document.onmouseup = popover_doc_onmouseup;
popover_doc_init = false;
popover_drag_obj.onmousemove = '';
popover_drag_obj.onmouseup = '';
popover_drag_target.style.cursor = 'default';
popover_drag_obj = '';
popover_drag_target = '';
popover_in_stop = false;
}
function popover_check_cookies(par) {
if (par < 0)
{
return true;
}
var clist = document.cookie.split(';');
var viewedCnt, newClist = '', k;
if (clist.length)
{
var separatorPos = 0;
var cookieName = '';
var cookieValue = '';
for(k in clist)
{
separatorPos = clist[k].indexOf('=');
if(separatorPos > -1)
{
cookieName = clist[k].substring(0, separatorPos);
cookieValue = clist[k].substring(separatorPos+1);
if(cookieName == 'SRpopoverCnt' || cookieName == ' SRpopoverCnt')
{
viewedCnt = parseInt(cookieValue);
break;
}
}
}
}
if (!viewedCnt)
{
viewedCnt = 0;
}
if (viewedCnt >= par)
{
return false;
}
viewedCnt ++;
var d = new Date();
d.setTime(d.getTime() + 3600 * 24 * 180 * 1000);
document.cookie = 'SRpopoverCnt=' + viewedCnt + '; expires=' + d.toGMTString();
delete d;
return true;
}
function popover_zoomin(id, position, formStartWidth, formStartHeight, formEndWidth, formEndHeight, speed, showModal, modalColor) {
if (!popover_init(document.getElementById(id)))
{
if (popover_debug_messages)
alert('PopOver error: object not found.');
return;
}
if(showModal)
{
popover_showmodal(modalColor);
}
var div = $("#" + id);
div.css('width', formStartWidth);
div.css('height', formStartHeight);
div.show();
var body = document.body
var docElem = document.documentElement
var scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop;
var top = 400;
var left = 400;
switch(position) {
case 'leftUp':
top = scrollTop + formEndHeight/2;
left = formEndWidth/2;
break;
case 'centerUp':
top = scrollTop + formEndHeight/2;
left = $(window).width()/2;
break;
case 'rightUp':
top = scrollTop + formEndHeight/2;
left = $(window).width() - formEndWidth/2;
break;
case 'leftCenter':
top = scrollTop + $(window).height()/2;
left = formEndWidth/2;
break;
case 'centerCenter':
top = scrollTop + $(window).height()/2;
left = $(window).width()/2;
break;
case 'rightCenter':
top = scrollTop + $(window).height()/2;
left = $(window).width() - formEndWidth/2;
break;
case 'leftDown':
top = scrollTop + $(window).height() - formEndHeight/2;
left = formEndWidth/2;
break;
case 'centerDown':
top = scrollTop + $(window).height() - formEndHeight/2;
left = $(window).width()/2;
break;
case 'rightDown':
top = scrollTop + $(window).height() - formEndHeight/2;
left = $(window).width() - formEndWidth/2;
break;
}
div.css("top", top + 'px');
div.css("left", left + 'px');
div.animate({
width: formEndWidth,
height: formEndHeight,
left: "-=" + (formEndWidth / 2 - formStartWidth / 2) + "px",
top: "-=" + (formEndHeight / 2 - formStartHeight / 2) + "px"
}, speed*3);
}
function popover_zoomout(id, speed) {
var div = $("#" + id);
var formWidth = div.width();
var formHeight = div.height();
div.css('background-color', '#FFFFFF');
div.css('border', '1px #000000 solid');
div.html('');
div.animate({
width: 1,
height: 1,
left: "+=" + (formWidth / 2) + "px",
top: "+=" + (formHeight / 2) + "px"
}, speed*3);
div.fadeOut(0);
popover_hidemodal();
}
function popover_slide(id, fromPosition, toPosition, speed, showModal, modalColor) {
var div = $("#" + id);
div.show();
document.body.onscroll = popover_onscroll;
window.onscroll = popover_onscroll;
popover_base_y = popover_base_vertical();
var formX = 0;
var formY = 0;
var positionDelta = 0;
var action = '+=';
var direction = 'top';
var body = document.body
var docElem = document.documentElement
var scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop;
if(fromPosition == 'leftUp' && toPosition == 'leftUp') {
formX = popover_margin_left;
formY = 0 - div.height();
positionDelta = div.height() + popover_margin_top;
}
else if(fromPosition == 'leftUp' && toPosition == 'leftCenter') {
formX = popover_margin_left;
formY = 0 - div.height();
positionDelta = div.height()/2 + $(window).height()/2;
}
else if(fromPosition == 'leftUp' && toPosition == 'leftDown') {
formX = popover_margin_left;
formY = 0 - div.height();
positionDelta = $(window).height() - popover_margin_bottom;
}
else if(fromPosition == 'centerUp' && toPosition == 'centerUp') {
formX = ($(window).width() - div.width())/2;
formY = 0 - div.height();
positionDelta = div.height() + popover_margin_top;
}
else if(fromPosition == 'centerUp' && toPosition == 'centerCenter') {
formX = ($(document).width() - div.width())/2;
formY = 0 - div.height() + scrollTop;
positionDelta = div.height()/2 + $(window).height()/2;
}
else if(fromPosition == 'centerUp' && toPosition == 'centerDown') {
formX = ($(window).width() - div.width())/2;
formY = 0 - div.height();
positionDelta = $(window).height() - popover_margin_bottom;
}
else if(fromPosition == 'rightUp' && toPosition == 'rightUp') {
formX = $(window).width() - div.width() - popover_margin_right;
formY = 0 - div.height();
positionDelta = div.height() + popover_margin_top;
}
else if(fromPosition == 'rightUp' && toPosition == 'rightCenter') {
formX = $(window).width() - div.width() - popover_margin_right;
formY = 0 - div.height();
positionDelta = div.height()/2 + $(window).height()/2;
}
else if(fromPosition == 'rightUp' && toPosition == 'rightDown') {
formX = $(window).width() - div.width() - popover_margin_right;
formY = 0 - div.height();
positionDelta = $(window).height() - popover_margin_bottom;
}
else if(fromPosition == 'upLeft' && toPosition == 'leftUp') {
formX = 0 - div.width();
formY = popover_margin_top;
positionDelta = div.width() + popover_margin_left;
direction = 'left';
}
else if(fromPosition == 'upLeft' && toPosition == 'centerUp') {
formX = 0 - div.width();
formY = popover_margin_top;
positionDelta = div.width()/2 + $(window).width()/2;
direction = 'left';
}
else if(fromPosition == 'upLeft' && toPosition == 'rightUp') {
formX = 0 - div.width();
formY = popover_margin_top;
positionDelta = $(window).width() - popover_margin_right;
direction = 'left';
}
else if(fromPosition == 'centerLeft' && toPosition == 'leftCenter') {
formX = 0 - div.width();
formY = ($(window).height() - div.height())/2;
positionDelta = div.width() + popover_margin_left;
direction = 'left';
}
else if(fromPosition == 'centerLeft' && toPosition == 'centerCenter') {
formX = 0 - div.width();
formY = ($(window).height() - div.height())/2;
positionDelta = div.width()/2 + $(window).width()/2;
direction = 'left';
}
else if(fromPosition == 'centerLeft' && toPosition == 'rightCenter') {
formX = 0 - div.width();
formY = ($(window).height() - div.height())/2;
positionDelta = $(window).width() - popover_margin_right;
direction = 'left';
}
else if(fromPosition == 'downLeft' && toPosition == 'leftDown') {
formX = 0 - div.width();
formY = $(window).height() - div.height() - popover_margin_bottom;
positionDelta = div.width() + popover_margin_left;
direction = 'left';
}
else if(fromPosition == 'downLeft' && toPosition == 'centerDown') {
formX = 0 - div.width();
formY = $(window).height() - div.height() - popover_margin_bottom;
positionDelta = div.width()/2 + $(window).width()/2;
direction = 'left';
}
else if(fromPosition == 'downLeft' && toPosition == 'rightDown') {
formX = 0 - div.width();
formY = $(window).height() - div.height() - popover_margin_bottom;
positionDelta = $(window).width() - popover_margin_right;
direction = 'left';
}
else if(fromPosition == 'upRight' && toPosition == 'leftUp') {
formX = $(window).width();
formY = popover_margin_top;
positionDelta = $(window).width() - popover_margin_left;
direction = 'left';
action = '-=';
}
else if(fromPosition == 'upRight' && toPosition == 'centerUp') {
formX = $(window).width();
formY = popover_margin_top;
positionDelta = div.width()/2 + $(window).width()/2;
direction = 'left';
action = '-=';
}
else if(fromPosition == 'upRight' && toPosition == 'rightUp') {
formX = $(window).width();
formY = popover_margin_top;
positionDelta = div.width() + popover_margin_right;
direction = 'left';
action = '-=';
}
else if(fromPosition == 'centerRight' && toPosition == 'leftCenter') {
formX = $(window).width();
formY = ($(window).height() - div.height())/2;
positionDelta = $(window).width() - popover_margin_left;
direction = 'left';
action = '-=';
}
else if(fromPosition == 'centerRight' && toPosition == 'centerCenter') {
formX = $(window).width();
formY = ($(window).height() - div.height())/2;
positionDelta = div.width()/2 + $(window).width()/2;
direction = 'left';
action = '-=';
}
else if(fromPosition == 'centerRight' && toPosition == 'rightCenter') {
formX = $(window).width();
formY = ($(window).height() - div.height())/2;
positionDelta = div.width() + popover_margin_right;
direction = 'left';
action = '-=';
}
else if(fromPosition == 'downRight' && toPosition == 'leftDown') {
formX = $(window).width();
formY = $(window).height() - div.height() - popover_margin_bottom;
positionDelta = $(window).width() - popover_margin_left;
direction = 'left';
action = '-=';
}
else if(fromPosition == 'downRight' && toPosition == 'centerDown') {
formX = $(window).width();
formY = $(window).height() - div.height() - popover_margin_bottom;
positionDelta = div.width()/2 + $(window).width()/2;
direction = 'left';
action = '-=';
}
else if(fromPosition == 'downRight' && toPosition == 'rightDown') {
formX = $(window).width();
formY = $(window).height() - div.height() - popover_margin_bottom;
positionDelta = div.width() + popover_margin_right;
direction = 'left';
action = '-=';
}
else if(fromPosition == 'leftDown' && toPosition == 'leftUp') {
formX = popover_margin_left;
formY = $(window).height();
positionDelta = $(window).height() - popover_margin_top;
action = '-=';
}
else if(fromPosition == 'leftDown' && toPosition == 'leftCenter') {
formX = popover_margin_left;
formY = $(window).height();
positionDelta = div.height()/2 + $(window).height()/2;
action = '-=';
}
else if(fromPosition == 'leftDown' && toPosition == 'leftDown') {
formX = popover_margin_left;
formY = $(window).height();
positionDelta = div.height() + popover_margin_bottom;
action = '-=';
}
else if(fromPosition == 'centerDown' && toPosition == 'centerUp') {
formX = ($(window).width() - div.width())/2;
formY = $(window).height();
positionDelta = $(window).height() - popover_margin_top;
action = '-=';
}
else if(fromPosition == 'centerDown' && toPosition == 'centerCenter') {
formX = ($(window).width() - div.width())/2;
formY = $(window).height();
positionDelta = div.height()/2 + $(window).height()/2;
action = '-=';
}
else if(fromPosition == 'centerDown' && toPosition == 'centerDown') {
formX = ($(window).width() - div.width())/2;
formY = $(window).height();
positionDelta = div.height() + popover_margin_bottom;
action = '-=';
}
else if(fromPosition == 'rightDown' && toPosition == 'rightUp') {
formX = $(window).width() - div.width() - popover_margin_right;
formY = $(window).height();
positionDelta = $(window).height() - popover_margin_top;
action = '-=';
}
else if(fromPosition == 'rightDown' && toPosition == 'rightCenter') {
formX = $(window).width() - div.width() - popover_margin_right;
formY = $(window).height();
positionDelta = div.height()/2 + $(window).height()/2;
action = '-=';
}
else if(fromPosition == 'rightDown' && toPosition == 'rightDown') {
formX = $(window).width() - div.width() - popover_margin_right;
formY = $(window).height();
positionDelta = div.height() + popover_margin_bottom;
action = '-=';
}
if(showModal) popover_showmodal(modalColor);
div.css("top", formY + 'px');
div.css("left", formX + 'px');
popover_top = formY;
if(direction == 'top') {
div.animate({
top: action + positionDelta + "px"
}, speed*3);
}
else {
div.animate({
left: action + positionDelta + "px"
}, speed*3);
}
}
function popover_showmodal(modalColor) {
var overlay, isIE6 = !$.support.opacity && !window.XMLHttpRequest;
var body = document.body
var docElem = document.documentElement
var scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop;
// $('body').append(overlay = $('<div id="SR_PopOverModal" style="position: absolute; top: 0px; left: 0px;"></div>'));
//
// if (isIE6)
// {
// overlay.get(0).style.setExpression('height', "document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'");
// }
// else
// {
//// overlay.get(0).style.height = '100%';
// overlay.get(0).style.height = screen.height + 'px';
// }
$(document).ready(function() {
$('#SR_PopOverModalBackground').css({
'top' : '0px',
'width' : screen.width + 'px',
'height' : $(document).height() + 'px',
'background-color' : modalColor,
'opacity' : 0.6,
'display' : 'block'
});
});
}
function popover_hidemodal() {
$('#SR_PopOverModalBackground').css({
'display' : 'none'
});
}
function popover_slideClose(id, direction, speed) {
var div = $("#" + id);
var action = '+=';
var positionDelta = 0;
switch(direction) {
case 'up':
action = '-=';
positionDelta = $(document).height();
break;
case 'right':
action = '+=';
positionDelta = $(window).width();
break;
case 'left':
action = '-=';
positionDelta = $(window).width();
break;
case 'down':
action = '+=';
positionDelta = $(document).height() + div.height();
break;
}
if(direction == 'up' || direction == 'down') {
div.animate({
top: action + positionDelta + "px"
}, speed*3);
}
else {
div.animate({
left: action + positionDelta + "px"
}, speed*3);
}
div.fadeOut(); popover_hidemodal();
}
function popover_close2(id) {
var div = $("#" + id);
div.hide();
popover_hidemodal();
}
function popover_show(id, position, showModal, modalColor) {
if (!popover_init(document.getElementById(id)))
{
if (popover_debug_messages)
alert('PopOver error: object not found.');
return;
}
if(showModal)
{
popover_showmodal(modalColor);
}
var div = $("#" + id);
var body = document.body
var docElem = document.documentElement
var scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop;
var formEndHeight = div.height();
var formEndWidth = div.width();
var top = 400;
var left = 400;
switch(position) {
case 'leftUp':
top = scrollTop + popover_margin_top;
left = popover_margin_left;
break;
case 'centerUp':
top = scrollTop + popover_margin_top;
left = $(window).width()/2 - formEndWidth/2;
break;
case 'rightUp':
top = scrollTop + popover_margin_top;
left = $(window).width() - formEndWidth - popover_margin_right;
break;
case 'leftCenter':
top = scrollTop + $(window).height()/2 - formEndHeight/2;
left = popover_margin_left;
break;
case 'centerCenter':
top = scrollTop + $(window).height()/2 - formEndHeight/2;
left = $(window).width()/2 - formEndWidth/2;
break;
case 'rightCenter':
top = scrollTop + $(window).height()/2 - formEndHeight/2;
left = $(window).width() - formEndWidth - popover_margin_right;
break;
case 'leftDown':
top = scrollTop + $(window).height() - formEndHeight - popover_margin_bottom;
left = popover_margin_left;
break;
case 'centerDown':
top = scrollTop + $(window).height() - formEndHeight - popover_margin_bottom;
left = $(window).width()/2 - formEndWidth/2;
break;
case 'rightDown':
top = scrollTop + $(window).height() - formEndHeight - popover_margin_bottom;
left = $(window).width() - formEndWidth - popover_margin_right;
break;
}
div.css("top", top + 'px');
div.css("left", left + 'px');
div.show();
}