window.onresize = function(){
ajx.init();
}
ajx = new Object();
ajx.init = function(parentId){
for(i=0; i < document.getElementsByTagName('iframe').length; i++){
fld = document.getElementsByTagName('iframe')[i];
act = fld.getAttribute("AJX:action");
if(act){
cfg = ajx.getcfg(fld.getAttribute("AJX:cfg"));
switch(act){
case "editable":
ajx.makeEditable(fld, cfg);
break;
}
}
}
try{
for(i=0; i < document.getElementsByTagName('table').length; i++){
fld = document.getElementsByTagName('table')[i];
act = fld.getAttribute("AJX:action");
if(act){
cfg = ajx.getcfg(fld.getAttribute("AJX:cfg"));
switch(act){
case "table":
ajx.table(fld, cfg);
break;
case "table_overflow":
ajx.table_overflow(fld, cfg);
break;
case "table-expanded":
ajx.tableExpanded(fld, cfg);
break;
}
}
}
}catch(e){}
try{
collection = document.getElementsByTagName("div");
cfg = new Array();
for(cx=0; cx<collection.length; cx++){
fld = collection[cx];
act = fld.getAttribute("AJX:action");
if(act){
try{cfg = ajx.getcfg(fld.getAttribute("AJX:cfg"));}catch(e){}
switch(act){
case "divOverflow":
ajx.divOverflow(fld, cfg);
break;
case "dropdown":
ajx.dropdownCreate(fld, cfg);
break;
case "tab":
ajx.tabCreate(fld, cfg);
break;
case "tabSrc":
ajx.tabSrcCreate(fld, cfg);
break;
case "radioList":
ajx.radioListCreate(fld, cfg);
break;
case "resizableDiv":
ajx.createResizableDiv(fld, cfg);
break;
case "radioListHor":
ajx.radioListHor(fld, cfg);
break;
case "radioListVert":
ajx.radioListHor(fld, cfg);
break;
case "resizableTdHor":
ajx.createResizableTdHor(fld, cfg);
break;
case "resizableTd":
ajx.createResizableTd(fld, cfg);
break;
case "filterTabs":
ajx.createfilterTabs(fld, cfg);
break;
case "macStyleMenu":
ajx.macStyleMenu(fld, cfg);
break;
}
}
}
}catch(e){}
try{
collection = document.getElementsByTagName("input");
for(cx=0; cx<collection.length; cx++){
fld = collection[cx];
act = fld.getAttribute("AJX:action");
if(act){
try{cfg = ajx.getcfg(fld.getAttribute("AJX:cfg"));}catch(e){}
switch(act){
case "tipbox":
ajx.tipBoxCreate(fld, cfg);
break;
}
}
}
}catch(e){}
try{
collection = document.getElementsByTagName("img");
for(cx=0; cx<collection.length; cx++){
fld = collection[cx];
act = fld.getAttribute("AJX:action");
if(act){
try{cfg = ajx.getcfg(fld.getAttribute("AJX:cfg"));}catch(e){}
switch(act){
case "expandChilds":
ajx.expandChildsGen(fld, cfg);
break;
}
}
}
}catch(e){}
try{
collection = document.getElementsByTagName("td");
for(cx=0; cx<collection.length; cx++){
fld = collection[cx];
act = fld.getAttribute("AJX:action");
if(act){
try{cfg = ajx.getcfg(fld.getAttribute("AJX:cfg"));}catch(e){}
switch(act){
case "resizableTd":
ajx.createResizableTd(fld, cfg);
break;
case "resizableTdHor":
ajx.createResizableTdHor(fld, cfg);
break;
}
}
}
}catch(e){}
/*
document.onmousemove = function(e){
if(ajx.createResizableTdMouseDownTrue == 1){
actualOffX = (e) ? e.pageX : event.clientX;
actualOffX = parseInt(actualOffX);
widChange = ajx.createResizableTdMouseX - actualOffX;
ajx.createResizableTdMouseX = actualOffX;
ajx.createResizableTdFld.style['width'] = (ajx.createResizableTdFld.offsetWidth - widChange)+'px';
}else if(ajx.createResizableTdHorMouseDownTrue == 1){
actualOffY = (e) ? e.pageY : event.clientY;
actualOffY = parseInt(actualOffY);
heiChange = ajx.createResizableTdHorMouseY - actualOffY;
ajx.createResizableTdHorMouseY = actualOffY;
ajx.createResizableTdHorFld.style['height'] = (ajx.createResizableTdHorFld.offsetHeight - heiChange)+'px';
if(ajx.createResizableTdHorFld.getAttribute("onResizeThisResizableTd")){
eval(ajx.createResizableTdHorFld.getAttribute("onResizeThisResizableTd"));
}
}
}

document.onmouseup=function(){
ajx.createResizableTdHorMouseDownTrue = 0;
ajx.createResizableTdMouseDownTrue = 0;
}
document.onclick = function(){
if(ajx.actualDropdownLock != 1){
try{
if(ajx.dropdownContainerDiv){
ajx.dropdownContainerDiv.onclick();
}
}catch(e){}
}
}
document.onkeydown = function(e){
if(e){
var keycd = e.keyCode ? e.keyCode : e.charCode;
}else{
var keycd = window.event.keyCode;
}
if(ajx.actualSelectedTableExpandedTr){
actnum = 0;
for(cdses=0; cdses<ajx.actualSelectedTableExpandedTr.parentNode.getElementsByTagName("tr").length; cdses++){
if(ajx.actualSelectedTableExpandedTr.parentNode.getElementsByTagName("tr")[cdses] == ajx.actualSelectedTableExpandedTr){
actnum = cdses;
}
}
if(keycd == 40){
ajx.actualSelectedTableExpandedTr.parentNode.getElementsByTagName("tr")[actnum+1].onclick();
}
if(keycd == 38){
ajx.actualSelectedTableExpandedTr.parentNode.getElementsByTagName("tr")[actnum-1].onclick();
}
}
}
*/
}
ajxDialogLaunchDivNr = 0;
ajx.dialogClose = function(fld){
$(fld).parents(".ui-dialog-content").dialog('close');
}
ajx.dialogLaunch = function(tit, url, cg){
try{cfg = ajx.getcfg(cg);}catch(e){}
wid = (cfg['wid']) ? cfg['wid'] : 700;
hei = (cfg['hei']) ? cfg['hei'] :  400;
wid += 'px';
ajxDialogLaunchDivNr++;
div = document.createElement("div");
div.id = "ajxDialogLaunchDiv" + ajxDialogLaunchDivNr;
document.body.appendChild(div);
div.setAttribute("nr", ajxDialogLaunchDivNr);
$('#ajxDialogLaunchDiv'+ajxDialogLaunchDivNr+'').dialog({
title: cfg['title'],
width: wid,
height: hei,
position: 'center',
modal: true
}).load(url, function(){ajx.init();})
}
ajx.loader = function(fld, typ){
if(document.getElementById('loaderFor'+fld.id)){
div = document.getElementById('loaderFor'+fld.id);
if(typ == 'reset'){
div.style['display'] = 'none';
}else{
div.style['width'] = fld.offsetWidth + 'px';
div.style['height'] = fld.offsetHeight + 'px';
div.style['display'] = 'block';
}
}else{
if(typ == "reset"){
}else{
div = document.createElement("div");
div.id = 'loaderFor'+fld.id;
div.className = 'ajxLoaderDiv';
div.style['width'] = fld.offsetWidth + 'px';
div.style['height'] = fld.offsetHeight + 'px';
fld.appendChild(div);
}
}
}
ajxDivOferlowCount = 0;
ajx.divOverflow = function(fldPar, cfg3){
try{cfg3 = ajx.getcfg(cfg2);}catch(e){}
fldPar.loader = function(typ){
ajx.loader(this, typ);
}
fldPar.style['position'] = 'relative';
collection2 = fldPar.getElementsByTagName("div");
cfg2 = new Array();
var pageSize = new Array();
pageSize = getPageSize();
for(cx2=0; cx2<collection2.length; cx2++){
fld2 = collection2[cx2];
try{
act2 = fld2.getAttribute("AJX:action");
if(act2){
try{cfg2 = ajx.getcfg(fld2.getAttribute("AJX:cfg"));}catch(e){}
switch(act2){
case "divResizable":
fld2.style['overflowY'] = 'auto';
fld2.style['height'] = pageSize[3] - 118  + 'px';
break;
case "divResizableCA":
fld2.style['overflowY'] = 'auto';
if(cfg2['hei']){
fld2.style['height'] = cfg2['hei'];
}else{
if(fldPar.parentNode.offsetHeight){
fld2.style['height'] = fldPar.parentNode.offsetHeight + 'px';
}else{
fld2.style['height'] = '200px';
}
}
break;
}
}
}catch(e){}
}
}
ajx.addComment = function(id, fld, url, func){
txt = '';
if(fld.innerHTML){
txt = fld.innerHTML;
}
if(fld.value){
txt = fld.value;
}
if(txt){
params = 'id='+id+'&txt='+txt;
httpAddComment = new XMLHttpRequest();
httpAddComment.open("POST", url, true);
httpAddComment.setRequestHeader('Accept','message/x-formresult')
httpAddComment.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
httpAddComment.setRequestHeader("Connection", "close");
httpAddComment.onreadystatechange = function(){
try{
if(httpAddComment.readyState == 4){
if(httpAddComment.status == 200){
nw = new Date();
response = escape(httpAddComment.responseText);
eval(func);
}
}
}catch(e){}
}
httpAddComment.send(params);
}
}
ajx.confBox = function(txt, func, cfg){
try{cfg = ajx.getcfg(cfg);}catch(e){}
if(func == 'loader'){
if(document.getElementById('dlakfakehjdaehjkgaehjkghaiuh3uy932794')){
document.getElementById('dlakfakehjdaehjkgaehjkghaiuh3uy932794').style['display'] = 'block';
if(txt){
document.getElementById('dlakfakehjdaehjkgaehjkghaiuh3uy932794').innerHTML = txt;
if(cfg['timeout']){
window.setTimeout("ajx.confBox('', 'loader', '');", cfg['timeout']);
}else{
window.setTimeout("ajx.confBox('', 'loader', '');", 1000);
}
}else{
document.getElementById('dlakfakehjdaehjkgaehjkghaiuh3uy932794').style['display'] = 'none';
}
}else{
fld = document.createElement("div");
fld.id = 'dlakfakehjdaehjkgaehjkghaiuh3uy932794';
fld.style['position'] = 'absolute';
fld.style['top'] = '300px';
fld.style['left'] = '200px';
fld.style['background'] = '#000000';
fld.style['opacity'] = '0.8';
fld.style['padding'] = '20px 50px 20px 50px';
fld.style['fontSize'] = '15px';
fld.style['color'] = '#ffffff';
fld.style['fontWeight'] = 'bold';
fld.innerHTML = txt;
document.body.appendChild(fld);
}
}else if(func){
if(confirm(txt)){
eval(func);
}else{
return false;
}
}else{
alert(txt);
}
}
ajx.ajaxSaveFormId = 0;
ajx.ajaxSaveForm = function(fld, url, cfg){
if(JavCheckForm(fld)){
ajx.ajaxSaveFormId++;
fld.id = "ajaxSaveForm"+ajx.ajaxSaveFormId;
fld.setAttribute("cfg", cfg);
try{cfg = ajx.getcfg(cfg);}catch(e){}
if(cfg['noConf'] != 1){
ajx.confBox('Trwają operacje. Proszę czekać...', 'loader', '');
}
urlVars = '';
for(i=0;i<fld.elements.length;i++){
inp = fld.elements[i];
inpName = String(inp.name);
try{
if(inp.name.match("wizard")){
inpName = inpName.replace("wizard[", "");
inpName = inpName.replace("]", "");
switch(inp.type){
case "radio":
if(inp.checked){
urlVars += "&"+inpName+"="+urlencode(inp.value);
}
break;
case "checkbox":
if(inp.checked){
urlVars += "&"+inpName+"="+urlencode(inp.value);
}else{
urlVars += "&"+inpName+"=";
}
break;
default:
urlVars += "&"+inpName+"="+urlencode(inp.value);
break;
}
}
}catch(e){}
}
finUrl = url;
httpSaveForms = new XMLHttpRequest();
httpSaveForms.open("POST", url, true);
httpSaveForms.setRequestHeader('Accept','message/x-formresult')
httpSaveForms.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
httpSaveForms.setRequestHeader("Connection", "close");
httpSaveForms.onreadystatechange = function(){
try{
if(httpSaveForms.readyState == 4){
if(httpSaveForms.status == 200){
response = escape(httpSaveForms.responseText);
if(cfg['test'] == 1){
alert(url+unescape(response));
}
ajx.ajaxSaveFormResponse(response,fld.id);
}
}
}catch(e){}
}
httpSaveForms.send(urlVars);
}
}
ajx.ajaxSaveFormResponse = function(txt, fld){
txt = unescape(txt);
txt = txt.split("id_separator");
fld = document.getElementById(fld);
try{cfg = ajx.getcfg(fld.getAttribute("cfg"));}catch(e){}
for(i=0;i<fld.elements.length;i++){
inp = fld.elements[i];
if(inp.name == "wizard[id]"){
inp.value = txt[0];
}
}
cfg['eval'] = cfg['eval'].replace("{#id#}", txt[0]);
cfg['eval'] = cfg['eval'].replace("{#txt#}", txt[1]);
if(cfg['eval']){
eval(cfg['eval']);
}
if(cfg['noConf'] != 1){
ajx.confBox(txt[1], 'loader', '');
}
}
ajx.makeEditableId = 0;
ajx.makeEditableCont = function(id){
if(document.getElementById(id)){
id = id.replace("makeEditable", "");
}
document.getElementById('makeEditableText'+id).value = document.getElementById('makeEditable'+id).contentWindow.document.body.innerHTML;
}
ajx.makeEditableStart = function(id){
fld = document.getElementById(id);
txt = fld.innerHTML;
txt = txt.replace(new RegExp("&lt;", "g"), "<");
txt = txt.replace(new RegExp("&gt;", "g"), ">");
fld.contentWindow.document.body.innerHTML = txt;
fld.contentWindow.document.designMode = 'on';
document.getElementById('makeEditableText'+fld.getAttribute("makeEditableId")).value = fld.contentWindow.document.body.innerHTML;
}
ajx.makeEditable = function(fld, cfg){
if(!fld.getAttribute("makeEditable")){
ajx.makeEditableId++;
fld.setAttribute("makeEditable", 1);
fld.id = "makeEditable"+ajx.makeEditableId;
fld.className = "editor";
fld.setAttribute("makeEditableId", ajx.makeEditableId);
fld.contentWindow.id = "makeEditableContWind"+ajx.makeEditableId;
textArea = document.createElement("textarea");
textArea.name = fld.name;
fld.name = "makeEditable"+ajx.makeEditableId;
textArea.value = fld.contentWindow.document.body.innerHTML;
textArea.id = 'makeEditableText'+ajx.makeEditableId;
textArea.style['display'] = 'none';
fld.parentNode.appendChild(textArea);
fld.contentWindow.addEventListener("keyup", function(){
id = this.id.replace("makeEditableContWind", "");
ajx.makeEditableCont(id);
}, false);
fld.contentWindow.addEventListener("mousedown", function(){
id = this.id.replace("makeEditableContWind", "");
ajx.makeEditableCont(id);
}, false);
window.setTimeout("ajx.makeEditableStart('"+fld.id+"')", 100);
div = document.createElement("div");
div.innerHTML = "<b>b</b>";
div.setAttribute("fldId", fld.id);
div.setAttribute("action", "bold");
div.className = "editor but";
div.onclick = function(){
document.getElementById(this.getAttribute("fldId")).contentWindow.document.execCommand(this.getAttribute("action"), false, null);
ajx.makeEditableCont(this.getAttribute("fldId"));
}
fld.parentNode.appendChild(div);
div = document.createElement("div");
div.innerHTML = "<i>i</i>";
div.setAttribute("fldId", fld.id);
div.setAttribute("action", "italic");
div.className = "editor but";
div.onclick = function(){
document.getElementById(this.getAttribute("fldId")).contentWindow.document.execCommand(this.getAttribute("action"), false, null);
ajx.makeEditableCont(this.getAttribute("fldId"));
}
fld.parentNode.appendChild(div);
div = document.createElement("div");
div.innerHTML = "<u>u</u>";
div.setAttribute("fldId", fld.id);
div.setAttribute("action", "underline");
div.className = "editor but";
div.onclick = function(){
document.getElementById(this.getAttribute("fldId")).contentWindow.document.execCommand(this.getAttribute("action"), false, null);
ajx.makeEditableCont(this.getAttribute("fldId"));
}
fld.parentNode.appendChild(div);
}
}
ajx.macStyleMenu = function(fld, cfg){
if(!fld.getAttribute("macStyle")){
fld.setAttribute("macStyle", 1);
for(i=0;i<fld.getElementsByTagName("span").length;i++){
chld = fld.getElementsByTagName("span")[i];
chld.onmousemove = function(){
this.childNodes[0].style['width'] = '32px';
this.childNodes[0].style['height'] = '32px';
this.childNodes[0].style['padding'] = '0 0 0 0';
document.getElementById('mainTopMenuDes').innerHTML = this.childNodes[0].getAttribute("lang");
}
chld.onmouseout = function(){
this.childNodes[0].style['width'] = '22px';
this.childNodes[0].style['height'] = '22px';
this.childNodes[0].style['padding'] = '5px 5px 5px 5px';
document.getElementById('mainTopMenuDes').innerHTML = "";
}
}
}
}
scrollHorizontalIntervalID = 0;
ajx.scrollHorizontal = function(fld, cfg){
try{cfg = ajx.getcfg(cfg);}catch(e){}
if(fld){
if(cfg['getWidFrom']){
fldWid = document.getElementById(cfg['getWidFrom']);
}else{
fldWid = fld;
}
if(cfg['x'] > 0){
if(scrollHorizontalIntervalID == 0){
xMax = (fld.scrollLeft + parseInt(cfg['x']));
xMax = (xMax >= fldWid.offsetWidth) ? fldWid.offsetWidth-5 : xMax;
scrollHorizontalIntervalID = window.setInterval('ajx.scrollHorizontalDo("'+fld.id+'", "'+parseInt(cfg['fading'])+'", "0", "'+xMax+'", "'+fldWid.id+'")', 10);
}
}else if(cfg['x'] < 0){
if(scrollHorizontalIntervalID == 0){
xMax = (fld.scrollLeft + parseInt(cfg['x']));
scrollHorizontalIntervalID = window.setInterval('ajx.scrollHorizontalDo("'+fld.id+'", "'+parseInt(-cfg['fading'])+'", "0", "'+xMax+'", "'+fldWid.id+'")', 10);
}
}
}
}
scrollHorizontalDoLastScroll = -1;
ajx.scrollHorizontalDo = function(fld, x, y, xMax, fldWid){
fld = document.getElementById(fld);
if(fldWid){
fldWid = document.getElementById(fldWid);
}
if(x > 0){
if(fld.scrollLeft >= xMax || fld.scrollLeft >= fldWid.offsetWidth){
window.clearInterval(scrollHorizontalIntervalID);
scrollHorizontalIntervalID = 0;
}else{
fld.scrollLeft += parseInt(x);
if(scrollHorizontalDoLastScroll != fld.scrollLeft){
scrollHorizontalDoLastScroll = fld.scrollLeft;
}else{
scrollHorizontalDoLastScroll = 0;
window.clearInterval(scrollHorizontalIntervalID);
scrollHorizontalIntervalID = 0;
}
}
}else{
if(fld.scrollLeft <= xMax || fld.scrollLeft <= 0){
window.clearInterval(scrollHorizontalIntervalID);
scrollHorizontalIntervalID = 0;
}else{
fld.scrollLeft += parseInt(x);
}
}
}
ajx.getAjaxSave = function(fld){
ajx.getAjaxSaveData = "";
collection = document.getElementsByTagName("input");
for(cx=0; cx<collection.length; cx++){
fld = collection[cx];
act = fld.getAttribute("AJX:action");
if(act){
try{cfg = ajx.getcfg(fld.getAttribute("AJX:cfg"));}catch(e){}
switch(act){
case "ajaxSave":
if(fld.name){
ajx.getAjaxSaveData += fld.name+';;;'+urlencode(fld.value)+'||||||||||||||||||||';
}
break;
}
}
}
collection = document.getElementsByTagName("textarea");
for(cx=0; cx<collection.length; cx++){
fld = collection[cx];
act = fld.getAttribute("AJX:action");
if(act){
try{cfg = ajx.getcfg(fld.getAttribute("AJX:cfg"));}catch(e){}
switch(act){
case "ajaxSave":
if(fld.name){
ajx.getAjaxSaveData += fld.name+';;;'+urlencode(fld.value)+'||||||||||||||||||||';
}
break;
}
}
}
collection = document.getElementsByTagName("select");
for(cx=0; cx<collection.length; cx++){
fld = collection[cx];
act = fld.getAttribute("AJX:action");
if(act){
try{cfg = ajx.getcfg(fld.getAttribute("AJX:cfg"));}catch(e){}
switch(act){
case "ajaxSave":
if(fld.name){
ajx.getAjaxSaveData += fld.name+';;;'+urlencode(fld.value)+'||||||||||||||||||||';
}
break;
}
}
}
return ajx.getAjaxSaveData;
ajx.getAjaxSaveData = "";
}
ajx.switchDisplay = function(fld, passThru, passThruMod){
if(fld){
if(passThru){
fld = document.getElementById(fld);
passThruVar = passThru / 10;
debugTrace(passThru+'<br>');
if(passThruMod != "-"){
if(fld.offsetHeight < passThru){
if(parseInt(fld.style['height']) + passThruVar < passThru){
fld.style['height'] = parseInt(fld.style['height']) + passThruVar + 'px';
}else{
fld.style['height'] = passThru + 'px';
passThru = "";
}
window.setTimeout("ajx.switchDisplay('"+fld.id+"', '"+actHei+"')", 20);
}
}else{
if(fld.offsetHeight > 1){
if(parseInt(fld.style['height']) - passThruVar > 0){
fld.style['height'] = parseInt(fld.style['height']) - passThruVar + 'px';
}else{
fld.style['height'] = fld.getAttribute("switchDisplayPassThru")+'px';
fld.style['display'] = 'none';
passThru = "";
}
window.setTimeout("ajx.switchDisplay('"+fld.id+"', '"+actHei+"', '-')", 20);
}
}
}else{
if(fld.style['display'] == 'none'){
fld.style['overflow'] = 'hidden';
fld.style['display'] = 'block';
actHei = fld.offsetHeight;
fld.style['display'] = 'none';
fld.style['height'] = '1px';
fld.style['display'] = 'block';
window.setTimeout("ajx.switchDisplay('"+fld.id+"', '"+actHei+"')", 100);
}else{
fld.style['overflow'] = 'hidden';
fld.setAttribute("switchDisplayPassThru", actHei);
actHei = fld.offsetHeight;
window.setTimeout("ajx.switchDisplay('"+fld.id+"', '"+actHei+"', '-')", 100);
}
}
}
}
ajx.createfilterTabsNum = 0;
ajx.createfilterTabs = function(fld,cfg){
ajx.createfilterTabsNum++;
if(fld){
for(i=0; i<fld.getElementsByTagName("div").length;i++){
fldAct = fld.getElementsByTagName("div")[i];
if(fldAct.className == 'header'){
fldAct.setAttribute("filterTabsNum", ajx.createfilterTabsNum);
fldAct.setAttribute("filterTabsI", i);
fldAct.style['cursor'] = 'pointer';
fldAct.onclick = function(){
fldBod = document.getElementById('bodyForFilterTabsNode'+this.getAttribute("filterTabsNum")+(parseInt(this.getAttribute("filterTabsI"))+1));
ajx.switchDisplay(fldBod);
}
}else if(fldAct.className == 'body'){
fldAct.id = 'bodyForFilterTabsNode'+ajx.createfilterTabsNum+i;
fldAct.style['display'] = 'block';
}
}
}
}
ajx.radioListHor = function(fld, cfg){
try{cfg = ajx.getcfg(cfg);}catch(e){}
if(fld.getAttribute("radioListHor") != 1){
for(i=0; i<fld.getElementsByTagName("div").length; i++){
if(fld.getElementsByTagName("div")[i].getElementsByTagName("li").length > 0){
for(iz=0; iz<fld.getElementsByTagName("div")[i].getElementsByTagName("li").length; iz++){
classNam = (cfg['large'] == 1) ? 'radioListHorElLarge1' : 'radioListHorEl1';
fld.getElementsByTagName("div")[i].getElementsByTagName("li")[iz].className = classNam;
}
}else{
classNam = (cfg['large'] == 1) ? 'radioListHorHdLarge' : 'radioListHorHd';
fld.getElementsByTagName("div")[i].className = classNam;
}
}
}
}
ajx.radioListVert = function(fld, cfg){
try{cfg = ajx.getcfg(cfg);}catch(e){}
if(fld.getAttribute("radioListVert") != 1){
for(i=0; i<fld.getElementsByTagName("div").length; i++){
if(fld.getElementsByTagName("div")[i].getElementsByTagName("li").length > 0){
for(iz=0; iz<fld.getElementsByTagName("div")[i].getElementsByTagName("li").length; iz++){
classNam = (cfg['large'] == 1) ? 'radioListVertElLarge1' : 'radioListVertEl1';
fld.getElementsByTagName("div")[i].getElementsByTagName("li")[iz].className = classNam;
}
}else{
classNam = (cfg['large'] == 1) ? 'radioListVertHdLarge' : 'radioListVertHd';
fld.getElementsByTagName("div")[i].className = classNam;
}
}
}
}
ajx.createResizableTdHorMouseDownTrue = 0;
ajx.createResizableTdHorFld = '';
ajx.createResizableTdHorMouseY = 0;
ajx.createResizableTdHor = function(fld, cfg){
if(fld.getAttribute("resizableTdHorActivated") != 1){
fld.className='horizontalResize';
fld.setAttribute("resizableTdHorActivated", "1");
fld.onmousedown=function(e){
actualOffY = (e) ? e.pageY : event.clientY;
actualOffY = parseInt(actualOffY);
ajx.createResizableTdHorMouseDownTrue = 1;
ajx.createResizableTdHorMouseY = actualOffY;
return false;
}
beforeNode = '';
for(i=0;i<fld.parentNode.parentNode.getElementsByTagName('tr').length;i++){
if(cfg['previousTd']){
if(fld.parentNode.parentNode.getElementsByTagName('tr')[i] == fld.parentNode){
ajx.createResizableTdHorFld = beforeNode.getElementsByTagName('td')[0];
break;
}
beforeNode = fld.parentNode.parentNode.getElementsByTagName('tr')[i];
}else{
if(beforeNode == 1){
ajx.createResizableTdHorFld = fld.parentNode.parentNode.getElementsByTagName('tr')[i].getElementsByTagName('td')[0];
}
if(fld.parentNode.parentNode.getElementsByTagName('tr')[i] == fld.parentNode){
beforeNode = 1;
}
}
}
}
}
ajx.createResizableTdMouseDownTrue = 0;
ajx.createResizableTdFld = '';
ajx.createResizableTdMouseX = 0;
ajx.createResizableTd = function(fld, cfg){
if(fld.getAttribute("resizableTdActivated") != 1){
fld.className='verticalResize';
fld.setAttribute("resizableTdActivated", "1");
fld.onmousedown=function(e){
actualOffX = (e) ? e.pageX : event.clientX;
actualOffX = parseInt(actualOffX);
ajx.createResizableTdMouseDownTrue = 1;
ajx.createResizableTdMouseX = actualOffX;
return false;
}
beforeNode = '';
for(i=0;i<fld.parentNode.getElementsByTagName('td').length;i++){
if(fld.parentNode.getElementsByTagName('td')[i] == fld){
ajx.createResizableTdFld = beforeNode;
break;
}
beforeNode = fld.parentNode.getElementsByTagName('td')[i];
}
}
}
ajx.expandChildsGen = function(fld){
fld.style['cursor'] = 'pointer';
fld.onclick=function(){
ajx.expandChilds(this);
}
}
ajx.expandChilds = function(parFld){
for(i=0; i < parFld.parentNode.parentNode.getElementsByTagName('ul').length; i++){
ulFld = parFld.parentNode.parentNode.getElementsByTagName('ul')[i];
}
if(parFld.src.match(/input_checkbox_plus/)){
parFld.src = "engine/crm/images/input_checkbox_minus.jpg";
for(i=0; i < ulFld.getElementsByTagName('li').length; i++){
ulFld.getElementsByTagName('li')[i].style['display'] = 'block';
}
}else{
parFld.src = "engine/crm/images/input_checkbox_plus.jpg";
for(i=0; i < ulFld.getElementsByTagName('li').length; i++){
if(!ulFld.getElementsByTagName('li')[i].getElementsByTagName('input')[0].checked){
ulFld.getElementsByTagName('li')[i].style['display'] = 'none';
}
}
}
}
ajx.actualTipBox = Array();
ajx.actualTipBoxDisplay = Array();
ajx.actualTipBoxLock = '';
ajx.actualTipBoxCount = 0;
ajx.actualTipBoxNum = 0;
ajx.tipBoxCountActual = 20;
ajx.tipBoxDelayStarted = 0;
ajx.tipBoxActualFld = new Array();
ajx.tipBoxActualCfg = new Array();
ajx.tipBoxCreate = function(fld, cfg){
if(!fld.getAttribute("tipBoxNum")){
ajx.actualTipBoxCount++;
ajx.actualTipBoxNum = ajx.actualTipBoxCount;
ajx.actualTipBoxDisplay[ajx.actualTipBoxNum] = fld;
fld.setAttribute("tipBoxNum", ajx.actualTipBoxNum);
inp = document.createElement("textarea");
inp.name = fld.name;
fld.name = '';
fld.className = "notVal";
inp.style['display'] = 'none';
if(fld.getAttribute("AJX:defaultVal")){
inp.value = fld.getAttribute("AJX:defaultVal");
}else{
inp.value = fld.value;
}
ajx.actualTipBoxDisplay[ajx.actualTipBoxNum].parentNode.insertBefore(inp, ajx.actualTipBoxDisplay[ajx.actualTipBoxNum]);
ajx.actualTipBox[ajx.actualTipBoxNum] = inp;
ajx.actualTipBoxDisplay[ajx.actualTipBoxNum].setAttribute("autocomplete", "off");
if(fld.value){
txt = fld.value.split("::", 2);
if(txt[0] && txt[1]){
ajx.actualTipBox[ajx.actualTipBoxNum].value = txt[0];
ajx.actualTipBoxDisplay[ajx.actualTipBoxNum].value = txt[1];
if(txt[0].length > 0){fld.className = "";}
}else{
ajx.actualTipBox[ajx.actualTipBoxNum].value = txt[0];
ajx.actualTipBoxDisplay[ajx.actualTipBoxNum].value = txt[0];
}
}
cfg['length'] = (!cfg['length']) ? 2 : cfg['length'];
ajx.tipBoxActualFld[ajx.actualTipBoxCount] = ajx.actualTipBoxDisplay[ajx.actualTipBoxNum];
ajx.tipBoxActualCfg[ajx.actualTipBoxCount] = cfg;
ajx.actualTipBoxDisplay[ajx.actualTipBoxNum].onclick = function(){
this.select();
if(this.value.length == 0){this.className = 'notVal';}
}
ajx.actualTipBoxDisplay[ajx.actualTipBoxNum].onkeyup = function(){
if(this.value.length > cfg['length']){
if(ajx.tipBoxDelayStarted != 1){
ajx.tipBoxCountActual = 20;
ajx.actualTipBoxNum = this.getAttribute("tipBoxNum");
ajx.tipBoxCreateDelay(this.getAttribute("tipBoxNum"));
}
}else{
window.setTimeout('ajx.tipBoxAjaxRemove()', 200);
}
if(cfg['allowTextMode'] == 1){
ajx.actualTipBoxNum = this.getAttribute("tipBoxNum");
ajx.actualTipBox[ajx.actualTipBoxNum].value = this.value;
}else{
if(cfg['returnInputContent'] != 1){this.className = 'notVal';}
}
}
ajx.actualTipBoxDisplay[ajx.actualTipBoxNum].onblur = function(){
window.setTimeout('ajx.tipBoxAjaxRemove()', 200);
}
document.onclick = function(){
if(ajx.actualTipBoxLock != 1){
window.setTimeout('ajx.tipBoxAjaxRemove();"', 100);
}
}
}
}
ajx.tipBoxCreateDelay = function(tipBoxNumber){
ajx.tipBoxDelayStarted = 1;
ajx.tipBoxCountActual -= 5;
if(ajx.tipBoxCountActual <= 0){
fld = ajx.tipBoxActualFld[tipBoxNumber];
ggo = 1;
try{if(fld.hasAttribute("readonly")){ggo = 0;}}catch(e){}
cfg = ajx.tipBoxActualCfg[tipBoxNumber];
ajx.actualTipBoxNum = fld.getAttribute("tipBoxNum");
if(fld.value.length > cfg['length']){
var url = '';
if(cfg['liveValue'] == 1){
ajx.actualTipBox[ajx.actualTipBoxNum].value = ajx.actualTipBoxDisplay[ajx.actualTipBoxNum].value;
}
if(cfg['AJAX_CONTENT']){
ajx.actualTipBoxNum = tipBoxNumber;
if(ggo == 1){
AJAX.Send(cfg['AJAX_CONTENT']+urlencode(fld.value), 'ajx.tipBoxAjaxResponse');
}
}
}else if(fld.value.length == 0){
ajx.actualTipBox[ajx.actualTipBoxNum].value = '';
}
ajx.tipBoxCountActual = 20;
ajx.tipBoxDelayStarted = 0;
}else{
window.setTimeout('ajx.tipBoxCreateDelay('+tipBoxNumber+')', 200);
}
}
ajx.tipBoxActualId = "";
ajx.tipBoxRet = function(txt, cf, valto1, valto2, valto3, valto4, valto5){
cg = ajx.tipBoxActualCfg[ajx.actualTipBoxNum]
tt = txt.split("::", 2);
if(tt[1]){
ajx.actualTipBox[ajx.actualTipBoxNum].value = tt[0];
ajx.tipBoxActualFld[ajx.actualTipBoxNum].value = tt[1];
if(tt[0].length > 0){ajx.tipBoxActualFld[ajx.actualTipBoxNum].className = ''}
}else{
ajx.actualTipBox[ajx.actualTipBoxNum].value = txt;
if(cg['returnInputContent'] == 1){
ajx.tipBoxActualFld[ajx.actualTipBoxNum].value = txt;
ajx.tipBoxActualFld[ajx.actualTipBoxNum].className = '';
}else{
ajx.tipBoxActualFld[ajx.actualTipBoxNum].className = 'notVal';
}
}
if(valto1){ajx.insertValueIntoTipBox(cg['valto1'], valto1);}
if(valto2){ajx.insertValueIntoTipBox(cg['valto2'], valto2);}
if(valto3){ajx.insertValueIntoTipBox(cg['valto3'], valto3);}
if(valto4){ajx.insertValueIntoTipBox(cg['valto4'], valto4);}
if(valto5){ajx.insertValueIntoTipBox(cg['valto5'], valto5);}
ajx.tipBoxAjaxRemove();
}
ajx.insertValueIntoTipBox = function(idd, val){
fld = document.getElementById(idd);
switch(fld.tagName){
case "INPUT":
fld.value = val;
break;
case "SELECT":
for(zz=0;zz<fld.length;zz++){
if(fld.options[zz].value == val){
fld.options[zz].selected = true;
}
}
break;
case "DIV":
fld.innerHTML = val;
break;
}
cg = ajx.tipBoxActualCfg[ajx.actualTipBoxNum];
if(cg['clearInputAfter'] == 1){
ajx.tipBoxActualFld[ajx.actualTipBoxNum].value = '';
}
if(cg['hideInputAfter'] == 1){
ajx.tipBoxActualFld[ajx.actualTipBoxNum].style['display'] = 'none';
d = document.createElement("div");
d.innerHTML = '<br /><a href="javascript:void;" onclick="ajx.tipBoxActualFld[ajx.actualTipBoxNum].style[\'display\'] = \'block\'">(zmiana)</a>';
fld.appendChild(d);
}
}
ajx.tipBoxAjaxResponse = function(txt){
txt = unescape(txt);
if(txt){
txt = String(txt);
cg = ajx.tipBoxActualCfg[ajx.actualTipBoxNum];
try{
document.getElementById('grshw4rqwy4wrsjhe5y7w4utdjiet').parentNode.removeChild(document.getElementById('grshw4rqwy4wrsjhe5y7w4utdjiet'));
}catch(e){}
if(!document.getElementById('grshw4rqwy4wrsjhe5y7w4utdjiet')){
div = document.createElement("div");
div.id = 'grshw4rqwy4wrsjhe5y7w4utdjiet2';
div.style['position'] = 'relative';
div.style['zIndex'] = '89999';
div2 = document.createElement("div");
div2.className = 'ajxTipBoxDiv2';
div2.style['position'] = 'absolute';
div2.id = 'grshw4rqwy4wrsjhe5y7w4utdjiet';
if(cg['width']){
div2.style['width'] = cg['width'] + 'px';
}else{
div2.style['width'] = ajx.actualTipBoxDisplay[ajx.actualTipBoxNum].offsetWidth - 2 + 'px';
}
div2.style['overflowY'] = 'auto';
div2.style['zIndex'] = '99000';
if(cg['height'] > 0){
div2.style['height'] = cg['height'];
}else{
div2.style['height'] = '160px';
}
div.appendChild(div2);
ajx.actualTipBoxDisplay[ajx.actualTipBoxNum].parentNode.insertBefore(div, ajx.actualTipBoxDisplay[ajx.actualTipBoxNum]);
}else{
}
dt = txt.split(";;", 2);
div3 = document.createElement("div");
div3.innerHTML = dt[1];
div2.appendChild(div3);
window.setTimeout("ajx.tableExpanded(document.getElementById(dt[0]))", 100);
}
}
ajx.tipBoxAjaxRemove = function(){
try{
try{document.getElementById('grshw4rqwy4wrsjhe5y7w4utdjiet').style['display'] = 'none';}catch(e){}
}catch(e){alert(e)}
}
radioNum = new Array();
radioNumFolders = new Array();
radioNumFolders2 = new Array();
ajx.radioListCreate = function(fld,cfg){
if(!document.getElementById('dskahrfaeohioahtaebkthaeiyea'+cfg['id'])){
radioNum[cfg['id']] = 0;
radioNumFolders[cfg['id']] = 0;
radioNumFolders2[cfg['id']] = 0;
fld.className = "radioListDiv";
fld.id = 'dskahrfaeohioahtaebkthaeiyea'+cfg['id'];
for(i=0; i<fld.getElementsByTagName('div').length; i++){
fld2 = fld.getElementsByTagName('div')[i];
act = fld2.getAttribute("AJX:action");
try{ajx.getcfg(fld2.getAttribute("AJX:cfg"), fld2);}catch(e){}
switch(act){
case "radioEl":
radioNum[cfg['id']]++;
fld2.setAttribute("parentID", cfg['id']);
fld2.setAttribute("radioNum", cfg['id']);
fld2.className = 'radioList';
fld2.id = 'dsakhfaeheiorahghaeio'+cfg['id']+radioNum[cfg['id']];
if(fld2.getAttribute('nostyle') != 'yes'){
if(cfg['selectable'] != 'no'){
fld2.onmousedown = function(){
ajx.radioListSelect(this);
}
}else{
fld2.onmousedown = function(){
if(this.className != 'radioListSelected'){
this.className = 'radioList';
}
}
}
fld2.onmouseover = function(){
if(this.className != 'radioListSelected'){
this.className = 'radioListHover';
}
}
fld2.onmouseout = function(){
if(this.className != 'radioListSelected'){
this.className = 'radioList';
}
}
}
if(radioNum[cfg['id']] == 1){
fld_default = fld2;
}
break;
case "radioFolder":
radioNumFolders[cfg['id']]++;
fld2.setAttribute("parentID", cfg['id']);
fld2.setAttribute("radioNum", cfg['id']);
fld2.className = 'radioListFolder';
break;
case "radioFolder2":
radioNumFolders2[cfg['id']]++;
fld2.setAttribute("parentID", cfg['id']);
fld2.setAttribute("radioNum", cfg['id']);
fld2.className = 'radioListFolder2';
break;
}
}
if(cfg['selectable'] != 'no' && fld_default){
ajx.radioListSelect(fld_default);
}
}
}
ajx.radioListSelect = function(fld){
if(fld){
for(i=0; i<=radioNum[fld.getAttribute('parentID')]; i++){
try{
fld2 = document.getElementById('dsakhfaeheiorahghaeio'+fld.getAttribute('parentID')+i);
fld2.className = 'radioList';
}catch(e){}
}
fld.className = 'radioListSelected';
}
}
tabCount = 0;
tabSrcCount = 0;
tabActivated = 0;
ajx.tabCreate = function(fld,cfg){
if(!fld.getAttribute('tabID')){
tabCount++;
fld.setAttribute('tabID', tabCount);
fld.id = 'dsaklhfaeohirahiotaeaeedwafa'+tabCount;
fld.className = 'tabNormal';
fld.onclick = function(){
ajx.tabSrcActivate(this);
}
}
}
ajx.tabSrcActivate = function(fldPar){
fld = document.getElementById('dsaklhfaeohirahiotaeae'+fldPar.getAttribute('tabID'));
if(fld){
for(i=0; i<=tabSrcCount; i++){
try{
document.getElementById('dsaklhfaeohirahiotaeae'+i).style['display'] = 'none';
document.getElementById('dsaklhfaeohirahiotaeaeedwafa'+i).className = 'tabNormal';
}catch(e){}
}
fld.style['display'] = 'block';
fld.setAttribute("tabActivated", 1);
fldPar.className = 'tabActive';
}
}
ajx.tabSrcCreate = function (fld,cfg){
if(!fld.getAttribute('tabID')){
tabSrcCount++;
fld.id = 'dsaklhfaeohirahiotaeae'+tabSrcCount;
fld.setAttribute('tabID', tabSrcCount);
if(tabSrcCount == 1 && tabActivated == 0){
fld.style['display'] = 'none';
tabActivated = 1;
ajx.tabSrcActivate(document.getElementById('dsaklhfaeohirahiotaeaeedwafa1'));
}else if(fld.getAttribute("tabActivated") != 1){
fld.style['display'] = 'none';
}
}
}
ajx.dropdownEventMousePosition = 0;
ajx.dropdownEventMousePositionX = 0;
ajx.dropdownCfg = '';
ajx.actualDropdownCurrentView = 0;
ajx.dropdownCreate = function (fld,cfg){
ajx.dropdownCfg = cfg;
ajx.dropdownParentNode = fld;
if(ajx.dropdownCfg['nostyle'] != 1){
fld.style['padding'] = '0 9px 0 0';
}
try{
if(fld.childNodes[0].tagName == "INPUT" || fld.childNodes[1].tagName == "INPUT"){
if(mozilla_ff){
if(cfg['nostyle'] != 1){
fld.style['padding'] = '0 10px 0 0';
}
}else{
if(cfg['nostyle'] != 1){
fld.style['padding'] = '0 15px 0 0';
}
}
}
}catch(e){}
if(ajx.dropdownCfg['nostyle'] != 1){
fld.className = 'ajxDropdownDiv';
}
fld.onmouseover = function(e){
if(cfg['nostyle'] != 1){
this.className = 'ajxDropdownDivHover';
}
if(ajx.actualDropdownCurrentView == 1){
if(this != ajx.actualDropdown && cfg['onclick_close'] != 'no'){
ajx.dropdownContainerDiv.onclick(1);
}
}
ajx.dropdownEventMousePosition = (e) ? e.pageY : event.clientY;
ajx.dropdownEventMousePositionX = (e) ? e.pageX : event.clientX;
}
fld.onmouseout = function(){
if(cfg['nostyle'] != 1){
this.className = 'ajxDropdownDiv';
}
}
fld.onmousedown = function(){
ajx.actualDropdownCurrentView = 1;
}
fld.onclick = function(){
ajx.dropdownCfg = cfg;
if(cfg['nostyle'] != 1){
this.className = 'ajxDropdownDivHover';
}
if(cfg['onclick_close'] != 'no'){
try{ajx.dropdownContainerDiv.onclick(1);}catch(e){}
if(ajx.actualDropdown != this){
ajx.dropdownAjax(this);
}else{
ajx.actualDropdown = '';
}
}else{
if(ajx.actualDropdown != this){
try{ajx.dropdownContainerDiv.onclick(1);}catch(e){}
ajx.dropdownAjax(this);
}
}
}
fld.ondblclick = function(){
this.onclick();
}
for(i=0; i < fld.getElementsByTagName('input').length; i++){
disableSelection(fld.getElementsByTagName('input')[i]);
}
}
ajx.dropdownAjax = function(fld){
ajx.actualDropdownLock = 1;
ajx.actualDropdown = fld;
ajx.dropdownMoved = 0;
div = document.createElement("div");
ajx.actualDropdownCurrentView = 1;
ajx.actualDropdownLock = 0;
div.style['position'] = 'relative';
div2 = document.createElement("div");
div2.className = 'ajxDropdownDiv2';
div2.style['padding'] = '1px';
div.id = 'dsaklheaor43ahiotha3i4ak3bntya';
if(ajx.dropdownCfg['width']){
div2.style['width'] = ajx.dropdownCfg['width'] + 'px';
}else{
div2.style['width'] = ajx.actualDropdown.offsetWidth - 12 + 'px';
}
div2.innerHTML = '&nbsp;';
div2.style['opacity'] = '0.7';
div2.style['top'] = '-15px';
div2.style['height'] = '12px';
ajx.dropdownContainerDiv = div2;
ajx.actualDropdown.appendChild(div);
div.appendChild(div2);
if(ajx.dropdownCfg['AJAX_CONTENT']){
AJAX.Send(ajx.dropdownCfg['AJAX_CONTENT'], 'ajx.dropdownAjaxResponse');
}
}
ajx.dropdownAjaxResponse = function(txt){
txt = unescape(txt);
if(txt){
cfg = ajx.dropdownCfg;
div = document.createElement("div");
div.innerHTML = txt;
if(ajx.dropdownCfg['height']){
div.style['height'] = ajx.dropdownCfg['height'] + 'px';
div.style['overflowY'] = 'auto';
}
ajx.dropdownContainerDiv.innerHTML = '';
ajx.dropdownContainerDiv.appendChild(div);
ajx.dropdownContainerDivFinalChild = div;
ajx.dropdownContainerDiv.style['top'] = '2px';
ajx.dropdownContainerDiv.style['left'] = '-2px';
ajx.dropdownContainerDiv.style['height'] = '';
ajx.dropdownContainerDiv.style['opacity'] = '1';
ajx.dropdownContainerDiv.onclick = function(override){
if(override == 1 || cfg['onclick_close'] != "no"){
ajx.actualDropdownCurrentView = 0;
ajx.actualDropdown.onmouseout();
ajx.actualDropdown.removeChild(this.parentNode);
window.setTimeout("ajx.actualDropdown = ''", 100);
}
if(override == 1 && cfg['onclick_close'] == 'no'){
window.setTimeout("ajx.actualDropdown=''", 100);
}
if(cfg['nostyle'] != 1){
ajx.dropdownParentNode.className = 'ajxDropdownDiv';
}
if(cfg['onclick_close'] != 'no'){
}
}
ajx.dropdownMove();
}
}
ajx.dropdownMove = function(e){
if(ajx.dropdownMoved != 1){
offY = (ajx.dropdownEventMousePosition) ? ajx.dropdownEventMousePosition : event.clientY;
maxHei = (document.body.clientHeight) ?  document.body.clientHeight : window.innerHeight;
if((offY + ajx.dropdownContainerDivFinalChild.offsetHeight + 100) > maxHei){
ajx.dropdownContainerDiv.style['top'] = 0 - (ajx.dropdownContainerDiv.offsetHeight) + 'px';
}
offX = (ajx.dropdownEventMousePositionX) ? ajx.dropdownEventMousePositionX : event.clientX;
if(ajx.dropdownCfg['width']){
maxWid = (document.body.clientWidth) ?  document.body.clientWidth : window.innerWidth;
if((offX + ajx.dropdownContainerDivFinalChild.offsetWidth) > maxWid){
finalWid = ajx.dropdownContainerDiv.offsetWidth - ajx.dropdownContainerDiv.parentNode.offsetWidth - 8;
ajx.dropdownContainerDiv.style['left'] = - finalWid + 'px';
}
}
ajx.dropdownMoved = 1;
}
}
ajx.dropdownClose = function(){
ajx.dropdownContainerDiv.onclick(1);
window.setTimeout("ajx.actualDropdown = ''", 100);
}
ajx.tableExpandedcount = 0;
ajx.actualSelectedTableExpandedTr = '';
ajx.tableExpandedContainers = new Array();
ajx.tableExpanded = function(tableNative, cfg){
if(!cfg){
cfg = ajx.getcfg(tableNative.getAttribute("AJX:cfg"));
}
ajx.tableExpandedcount++;
tableContainer = document.createElement('div');
tableContainer.id = 'AJXtableContainer'+ajx.tableExpandedcount;
tableContainer.style['height'] = '300px';
tableContainer.style['width'] = tableNative.offsetWidth;
tableContainer.style['overflowY'] = 'scroll';
tableContainer.style['overflowX'] = 'hidden';
tableNative.parentNode.insertBefore(tableContainer, tableNative);
tableNative.style['visibility'] = 'hidden';
ajx.tableExpandedContainers[tableNative] = ajx.tableExpandedcount;

trContainer = (mozilla_ff) ? tableNative.childNodes[1] : tableNative.childNodes[0]; //push all childs to var
trCount = 0 //show which TR is header
if(trContainer){
for(c=0; c<trContainer.childNodes.length; c++){
checkTagName = trContainer.childNodes[c].tagName;
if(checkTagName == "TR"){ //determine TR
tableElementsTR = trContainer.childNodes[c]; //insert tr into var
if(trCount == 0){ //process header
tableElementsLastTd = document.createElement("td");
tableElementsLastTd.className = "sp";
tableElementsLastTd.style['width'] = "17px";
tableElementsLastTd.innerHTML = "&nbsp;";
tableElementsTR.appendChild(tableElementsLastTd);
trCount = 1; //next TR will be treated as container
htmlTable = document.createElement('table');
htmlTable.className = tableNative.className;
htmlTable.width = '100%';
htmlTable.setAttribute("cellPadding", tableNative.getAttribute("cellPadding"));
htmlTable.setAttribute("cellSpacing", tableNative.getAttribute("cellSpacing"));
htmlTableBody = document.createElement('tbody');
htmlTable.appendChild(htmlTableBody);
htmlTableBody.appendChild(tableElementsTR);
tableContainer.parentNode.insertBefore(htmlTable, tableContainer);
}else{
trContainer.childNodes[c].onclick = function(){
for(cx=0; cx<trContainer.childNodes.length; cx++){
trContainer.childNodes[cx].className = '';
}
if(this.className != 'trselected'){
this.className = 'trselected';
ajx.actualSelectedTableExpandedTr = this;
}
if(this.getAttribute("onClickEval")){
eval(this.getAttribute("onClickEval"));
}
}
trContainer.childNodes[c].onmouseover = function(){
if(this.className != 'trselected'){
this.className = 'trhover';
}
}
trContainer.childNodes[c].onmouseout = function(){
if(this.className != 'trselected'){
this.className = '';
}
}
}
}
}
}
if(!mozilla_ff){
tableNative.style['width'] = tableNative.offsetWidth - 17 + 'px'; //zmniejsz tabele dla IE o 17px z prawej
}
tableNative.style['visibility'] = 'visible';
tableContainer.appendChild(tableNative);
if(cfg['height']){
tableContainer.style['height'] = cfg['height'] + 'px';
}else{
window.setTimeout("ajx.smartResize(tableContainer, '-26', 'sameAsParentEl')", 200);
}
tableContainer.parentNode.parentNode.setAttribute("onResizeThisResizableTd", "ajx.smartResize(document.getElementById(tableContainer.id), '-26', 'sameAsParentEl')");
}
ajx.smartResizeArray = new Array();
ajx.smartResizeArray2 = new Array();
ajx.smartResizeArray3 = new Array();
ajx.smartResizeArray4 = new Array();
ajx.smartResize = function(fieldToResize, modHeight, howDeep, howDeep2){
if(fieldToResize){
ok = 1;
if(ajx.smartResizeArray.length > 0){
for(var i in ajx.smartResizeArray){
if(ajx.smartResizeArray[i] == fieldToResize){
ok = 0;
break;
}
}
}
if(ok == 1){
ajx.smartResizeArray[ajx.smartResizeArray.length] = fieldToResize;
ajx.smartResizeArray2[ajx.smartResizeArray2.length] = modHeight;
ajx.smartResizeArray3[ajx.smartResizeArray3.length] = howDeep;
ajx.smartResizeArray4[ajx.smartResizeArray4.length] = howDeep2;
}
stopChilds = 0;
try{modHeight = (!modHeight) ? 0 : modHeight;}catch(e){}
switch(howDeep){
default:
if(fieldToResize.parentNode.tagName == "table"){
parentEl = fieldToResize.parentNode.parentNode;
}else{
parentEl = fieldToResize.parentNode.parentNode;
}
heightLimit = fieldToResize.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.offsetHeight;
break;
case '1':
parentEl = fieldToResize.parentNode;
heightLimit = fieldToResize.parentNode.parentNode.parentNode.parentNode.parentNode.offsetHeight;
break;
case 'sameAsParentEl':
parentEl = fieldToResize.parentNode.parentNode;
heightLimit = parentEl.offsetHeight;
break;
case "crm-div":
parentEl = fieldToResize.parentNode;
heightLimit = parentEl.offsetHeight;
break;
case "crm-left":
parentEl = fieldToResize.parentNode;
stopChilds = 1;
heightLimit = parentEl.offsetHeight;
break;
}
switch(howDeep2){
case "crm-left":
parentEl2 = fieldToResize.parentNode;
widthLimit = parentEl2.parentNode.offsetWidth;
break;
}
fieldToResize.style['display'] = 'block';
offsetHeightOfChilds = 0;
offsetWidthOfChilds = 0;
if(stopChilds == 0){
for(c=0; c<parentEl.childNodes.length; c++){
if(parentEl.childNodes[c].parentNode == parentEl){
if(parentEl.childNodes[c] != fieldToResize && parentEl.childNodes[c] != fieldToResize.parentNode && parentEl.childNodes[c] != fieldToResize && parentEl.childNodes[c].offsetHeight > 0){
if(!parentEl.childNodes[c].tagName.match(/SCRIPT|!/)){
offsetHeightOfChilds += parentEl.childNodes[c].offsetHeight;
}
}
}
}
}
if(howDeep2){
for(c=0; c<parentEl2.childNodes.length; c++){
if(parentEl2.childNodes[c].parentNode == parentEl2){
if(parentEl2.childNodes[c] != fieldToResize && parentEl2.childNodes[c] != fieldToResize.parentNode && parentEl2.childNodes[c] != fieldToResize && parentEl2.childNodes[c].offsetHeight > 0){
if(!parentEl2.childNodes[c].tagName.match(/SCRIPT|!/)){
offsetWidthOfChilds += parentEl2.childNodes[c].offsetWidth;
}
}
}
}
}
if(heightLimit){
modHeight = parseInt(modHeight);
fieldToResize.style['height'] = heightLimit - offsetHeightOfChilds + modHeight + 'px';
}
if(howDeep2 && widthLimit){
modWidth = 0;
modWidth = parseInt(modWidth);
fieldToResize.style['width'] = widthLimit - offsetWidthOfChilds + modWidth + 'px';
}
}
}
ajx.smartResizeRe = function(){
if(ajx.smartResizeArray.length > 0){
for(c=0; c<ajx.smartResizeArray.length; c++){
try{
ajx.smartResizeArray[c].style['display'] = 'none';
window.setTimeout("ajx.smartResizeReTmp('"+c+"')", 0);
}catch(e){}
}
ajx.smartResizeReTmp = function(c){
a = (ajx.smartResizeArray2[c]) ? ajx.smartResizeArray2[c] : "";
b = (ajx.smartResizeArray3[c]) ? ajx.smartResizeArray3[c] : "";
d = (ajx.smartResizeArray4[c]) ? ajx.smartResizeArray4[c] : "";
ajx.smartResize(ajx.smartResizeArray[c], a, b, d);
}
}
}
ajx.tableId = 0;
ajx.table = function (fld, cfg){
dksajdkaejkgea = 0;
if(!fld.getAttribute("ajxTableId")){
if(!cfg){
cfg = ajx.getcfg(fld.getAttribute("AJX:cfg"));
}
ajx.tableId++;
fld.setAttribute("ajxTableId", ajx.tableId);
if(cfg['ajxTablePagesDivCont']){
div = document.getElementById(cfg['ajxTablePagesDivCont']);
div.id = "ajxTablePagesDiv"+ajx.tableId;
div.innerHTML = 'Strona 1 z 1';
}else{
div = document.createElement("div");
div.className = "tablePages";
div.id = "ajxTablePagesDiv"+ajx.tableId;
div.innerHTML = 'Strona 1 z 1';
fld.parentNode.appendChild(div);
}
}else{
document.getElementById('ajxTablePagesDiv'+fld.getAttribute("ajxTableId")).style['display'] = 'block';
}
}
ajx.table.addContentFromUrl = function(url,cfg2){
cfg = ajx.getcfg(cfg2);
fld = document.getElementById(cfg['fld']);
if(cfg['reload'] == 1 && fld.rows.length > 1){
fldRows = fld.rows.length;
for(i=1;i<fldRows;i++){
}
}
if(cfg['test'] == 1){
alert(url);
}
AJAX.Send(url, 'ajx.table.addContentFromUrlResponse', cfg2);
}
ajx.table.actuallyOpenedRow = new Object();
ajx.table.unselectTr = function(id){
/*
if(id == 'active'){
id = ajx.table.activeTr;
}
if(id){
document.getElementById(id).className = '';
}
*/
document.getElementById(id+'-row-'+ajx.table.actuallyOpenedRow[id]).className = '';
ajx.table.actuallyOpenedRow[id] = "";
}
ajx.table.addContentFromUrlResponse = function(txt, cfg2){
cfg = ajx.getcfg(cfg2);
fld = document.getElementById(cfg['fld']);
cfgFld = ajx.getcfg(fld.getAttribute("AJX:cfg"));
txt = unescape(txt);
rowAm = txt.split('row_amount_separator', 2);
txt = rowAm[1];
rowAm = rowAm[0];
txt = txt.split('next_row_separator');
if(txt[0]){
for(i=0;i<txt.length;i++){
tx = txt[i].split('row_id_separator', 2);
if(tx[0]){
chck = false;
if(chck){
chck.innerHTML = tx[1];
}else{
tr = fld.insertRow(i+1);
tr.innerHTML = tx[1];
tr.id = fld.id+'-row-'+tx[0];
if(cfgFld['tdOnclick']){
tr.setAttribute("tdOnclick", cfgFld['tdOnclick']);
tr.setAttribute("tdDblOnclick", cfgFld['tdDblOnclick']);
tr.setAttribute("parentFld", cfg['fld']);
tr.setAttribute("tx0", tx[0]);
tr.onmouseover = function(){
if(this.className != 'trselected'){this.className = 'trhover';}
}
tr.onmouseout = function(){
if(this.className != 'trselected'){this.className = '';}
}
tr.ondblclick = function(){
tx = this.id.split('-row-', 2);
eval(this.getAttribute("tdDblOnclick")+'("'+tx[1]+'")');
}
tr.onclick = function(){
tx = this.id.split('-row-', 2);
eval(this.getAttribute("tdOnclick")+'("'+tx[1]+'")');
tx = this.parentNode.parentNode;
for(txi=1;txi<tx.getElementsByTagName("tr").length;txi++){
tx.getElementsByTagName("tr")[txi].className = '';
}
this.className = 'trselected';
ajx.table.actuallyOpenedRow[this.getAttribute("parentFld")] = this.getAttribute("tx0");
}
if(tx[0] == ajx.table.actuallyOpenedRow[cfg['fld']]){
trToOnClickdsafaegea = tr.id;
}
}
}
}
}
}
fldRows = fld.rows.length;
for(i=1;i<=fldRows;i++){
if(i > txt.length){
fld.deleteRow(fld.rows.length-1);
}
}
try{
if(trToOnClickdsafaegea){
document.getElementById(trToOnClickdsafaegea).onclick();
}
}catch(e){}
if(rowAm != "none"){
rowAmPerPage = (cfgFld['limitBy']) ? document.getElementById(cfgFld['limitBy']).value : 15;
if(cfg['resetPage'] == 1){
rowAmActPage = 1;
fld.setAttribute("rowAmActPage", 1);
}else{
rowAmActPage = parseInt((fld.getAttribute("rowAmActPage") > 0) ? fld.getAttribute("rowAmActPage") : 1);
}
rowAmPages = String(rowAm / rowAmPerPage);
rowAmPages = rowAmPages.split(".", 2);
rowAmPages = (rowAmPages[1] > 0) ? parseInt(rowAmPages[0])+1 : rowAmPages[0];
if(rowAmPages > 0){
div = document.getElementById('ajxTablePagesDiv'+fld.getAttribute("ajxTableId"));
div.innerHTML = '<div id="ajxTablePagesDivPrev'+fld.getAttribute("ajxTableId")+'">poprzednia</div><div class="divNum">strona '+rowAmActPage+' z '+rowAmPages+'</div><div id="ajxTablePagesDivNext'+fld.getAttribute("ajxTableId")+'">nastepna</div>';
divNext = document.getElementById('ajxTablePagesDivNext'+fld.getAttribute("ajxTableId"));
divNext.setAttribute("pageNextVal", ((rowAmActPage)*rowAmPerPage));
divNext.setAttribute("pageNextNr", rowAmActPage+1);
divNext.setAttribute("func", cfgFld['pagesSwitchFunction']);
divNext.setAttribute("parFld", fld.id);
if((rowAmActPage)*rowAmPerPage < rowAm){
divNext.className = "divNext";
divNext.onclick = function(){
eval(this.getAttribute("func")+"('"+this.getAttribute("pageNextVal")+"')");
document.getElementById(this.getAttribute("parFld")).setAttribute('rowAmActPage',this.getAttribute("pageNextNr"));
}
}else{
divNext.className = "divNextInact";
}
divPrev = document.getElementById('ajxTablePagesDivPrev'+fld.getAttribute("ajxTableId"));
divPrev.setAttribute("pageNextVal", ((rowAmActPage-2)*rowAmPerPage));
divPrev.setAttribute("pageNextNr", rowAmActPage-1);
divPrev.setAttribute("func", cfgFld['pagesSwitchFunction']);
divPrev.setAttribute("parFld", fld.id);
if((rowAmActPage)*rowAmPerPage > rowAmPerPage){
divPrev.className = "divPrev";
divPrev.onclick = function(){
eval(this.getAttribute("func")+"('"+this.getAttribute("pageNextVal")+"')");
document.getElementById(this.getAttribute("parFld")).setAttribute('rowAmActPage',this.getAttribute("pageNextNr"));
}
}else{
divPrev.className = "divPrevInact";
}
}
}
try{document.getElementById('divOverflow'+fld.id).loader('reset');}catch(e){}
$(function(){
$("#"+fld.id+" .tooltip").tooltip({fade:250,track:false,delay:0});
})
ajx.init();
}
ajxDivLoadArray = new Array();
ajx.divLoad = function(id, url, cfg){
ajxDivLoadArray[id] = cfg;
AJAX.Send(url, 'ajx.divLoadResp', id);
}
ajx.divLoadResp = function(txt, fld){
txt = unescape(txt);
try{eval(ajxDivLoadArray[fld]);}catch(e){}
document.getElementById(fld).innerHTML = txt;
ajx.init();
try{ajximg.init()}catch(e){}
}
ajx.table_overflow = function (fld, fld2, cfg, cfg2, wid, hei, prnt, left, top){
dksajdkaejkgea = 0;
try{
if(!cfg){
cfg = ajx.getcfg(fld.getAttribute("AJX:cfg"));
}
}catch(e){}
try{
if(!cfg2){
cfg2 = ajx.getcfg(fld2.getAttribute("AJX:cfg"));
}
}catch(e){}
arr_widths = new Array();
if(prnt){
}
fld.width = wid;
fld2.width = wid - 20;
div = document.createElement("div");
div.appendChild(fld);
prnt.appendChild(div);
div = document.createElement("div");
div.appendChild(fld2);
div.style['height'] = hei + 'px';
div.style['overflowY'] = 'scroll';
div.id = 'div'+fld2.id;
div.onscroll=function(){
saveScrollTop(this.id);
}
prnt.appendChild(div);
ob = (mozilla_ff) ? fld.childNodes[1] : fld.childNodes[0];
for(c=0; c<ob.childNodes.length; c++){
tst = ob.childNodes[c].tagName;
if(tst == "TR"){
tr = ob.childNodes[c];
z = 0;
for(z=0; z<tr.childNodes.length; z++){
td = tr.childNodes[z];
if(z > 0){
arr_widths[z] = td.width;
}
if(td.tagName == "TD"){
if(cfg['header_mouseover_bg']){
td.setAttribute('header_mouseover_bg', td.style['background']);
td.onmouseover = function(){
this.style['background'] = cfg['header_mouseover_bg'];
}
td.onmouseout = function(){
this.style['background'] = this.getAttribute('header_mouseover_bg');
}
}
if(cfg['header_clickable_mouseover_bg']){
if(td.getAttribute("AJX:sortby")){
td.setAttribute('header_clickable_mouseover_bg', td.style['background']);
td.onmouseover = function(){
this.style['background'] = cfg['header_clickable_mouseover_bg'];
}
td.onmouseout = function(){
if(mozilla_ff){
this.style['background'] = this.parentNode.style['background'];
}else{
this.style['background'] = this.parentNode.currentStyle.backgroundImage;
}
}
}
}
if(cfg['header_js_onclick']){
if(td.getAttribute("AJX:sortby")){
td.style['cursor'] = 'pointer';
td.onclick = function(){
try{eval(cfg['header_js_onclick']+'("'+this.getAttribute("AJX:sortby")+'")');}catch(e){}
}
}
}
}
}
}
}
ob = (mozilla_ff) ? fld2.childNodes[1] : fld2.childNodes[0];
for(c=0; c<ob.childNodes.length; c++){
tst = ob.childNodes[c].tagName;
if(tst == "TR"){
tr = ob.childNodes[c];
if(cfg2['tr2bg']){
at = tr.getAttribute("AJX:cfg");
mtch = RegExp("no_bg_over=1");
if(!at || !at.match(mtch)){
if(dksajdkaejkgea == 1){
tr.style['background'] = cfg2['tr2bg'];
dksajdkaejkgea = 0;
}else{
dksajdkaejkgea = 1;
}
}
}
if(cfg2['trover'] && tr.getAttribute('fixed_background') != 1){
tr.setAttribute('tr_default_bg', tr.style['background']);
tr.onmouseover = function(){
if(this.getAttribute('fixed_background') != 1){
for(yu=0; yu<this.childNodes.length; yu++){
tst = this.childNodes[yu].tagName;
if(tst == "TD"){
stp = 0;
try{
at = this.childNodes[yu].getAttribute("AJX:cfg");
mtch = RegExp("no_bg_over=1");
if(at.match(mtch)){
stp = 1;
}
}catch(e){}
if(stp == 0){
this.childNodes[yu].style['background'] = cfg2['trover'];
}
}
}
}
}
tr.onmouseout = function(){
if(this.getAttribute('fixed_background') != 1){
for(yu=0; yu<this.childNodes.length; yu++){
tst = this.childNodes[yu].tagName;
if(tst == "TD"){
stp = 0;
try{
at = this.childNodes[yu].getAttribute("AJX:cfg");
mtch = RegExp("no_bg_over=1");
if(at.match(mtch)){
stp = 1;
}
}catch(e){}
if(stp == 0){
this.childNodes[yu].style['background'] = this.getAttribute('tr_default_bg');
}
}
}
}
}
tr.onclick = function(){
if(this.getAttribute('fixed_background') != 1){
for(yu=0; yu<this.childNodes.length; yu++){
tst = this.childNodes[yu].tagName;
if(tst == "TD"){
stp = 0;
try{
at = this.childNodes[yu].getAttribute("AJX:cfg");
mtch = RegExp("no_bg_over=1");
if(at.match(mtch)){
stp = 1;
}
}catch(e){}
if(stp == 0){
this.childNodes[yu].style['background'] = this.getAttribute('tr_default_bg');
}
}
}
}
}
}
}
}
}
ajx.preloader = function(txt, left, top, wid, hei, wid_min, hei_min){
if(wid == 0 && hei == 0){
size = getPageSize();
wid = size[0];
hei = size[1];
if(wid_min){wid += wid_min;}
if(hei_min){hei += hei_min;}
}
this.preloaderInit(txt, left, top, wid, hei);
this.preloaderClock();
}
ajx.preloaderClock = function(type){
}
ajx.preloaderInit = function(txt, left, top, wid, hei){
div = document.createElement("div");
div.id = 'dsklajdkieahigjaeijfiaehgeadakaejgea';
div.style['position'] = 'absolute';
div.style['left'] = left + 'px';
div.style['top'] = top + 'px';
div.style['width'] = wid + 'px';
div.style['zIndex'] = '100';
div.innerHTML = '<div style="text-align: center; padding-top: '+(hei / 2 - hei * 0.3)+'px;"><div style="color: #999999; background: #ffffff; border-top: solid #ebebeb 1px; border-bottom: solid #ebebeb 1px; padding: 5px;">'+txt+'</div></div>';
document.body.appendChild(div);
div = document.createElement("div");
div.id = 'dsklajdkieahigjaeijfiaehgea';
div.style['position'] = 'absolute';
div.style['left'] = left + 'px';
div.style['top'] = top + 'px';
div.style['width'] = wid + 'px';
div.style['height'] = hei + 'px';
div.style['background'] = '#ffffff';
div.style['opacity'] = '0.7';
div.style['filter'] = 'alpha(opacity:70)';
div.style['color'] = '#4b70ae';
div.style['textAlign'] = 'center';
div.style['fontWeight'] = 'bold';
div.style['fontSize'] = '13px';
div.style['fontFamily'] = 'Tahoma';
div.style['zIndex'] = 10;
div2 = document.createElement("iframe");
div2.setAttribute("frameBorder", "0");
div2.setAttribute("frameSpacing", "0");
div2.setAttribute("marginHeight", "0");
div2.setAttribute("marginWidth", "0");
div2.setAttribute("scrolling", "auto");
div2.style['border'] = '0px';
div2.style['width'] = wid + 'px';
div2.style['height'] = hei + 'px';
div2.style['position'] = 'absolute';
div2.style['left'] = 0;
div2.style['top'] = 0;
div2.style['zIndex'] = 1;
div.appendChild(div2);
document.body.appendChild(div);
}
ajx.preloaderHide = function(){
try{document.body.removeChild(document.getElementById('dsklajdkieahigjaeijfiaehgea'));}catch(e){}
try{document.body.removeChild(document.getElementById('dsklajdkieahigjaeijfiaehgeadakaejgea'));}catch(e){}
}
ajx.getcfg = function(dat, fldSet){
dat = dat.split(";");
cg = new Array();
for(var line in dat){
line = dat[line].split("=", 2);
line[0] = line[0].replace(/^\s+|\s+$/g,"");
if(line[0].length > 0){
line[1] = String(line[1]);
line[1] = line[1].replace("3542kh432jhnds", "=");
line[1] = line[1].replace("3542kh432jhnds", "=");
line[1] = line[1].replace("3542kh432jhnds", "=");
line[1] = line[1].replace("3542kh432jhnds", "=");
line[1] = line[1].replace("3542kh432jhnds", "=");
line[1] = line[1].replace("3542kh432jhnds", "=");
line[1] = line[1].replace("3542kh432jhnds", "=");
cg[line[0]] = line[1];
try{if(fldSet){fldSet.setAttribute(line[0], line[1]);}}catch(e){}
}
}
return cg;
}
