function JavPopup(lnk, vars){
var cfg = new Array();
if(vars){
vars = vars.split(";");
for(i=0; i<vars.length; i++){
a = vars[i].split(":");
cfg[a[0]] = a[1];
}
}
if(cfg['wid_hei'] == 'auto'){
sizes = getPageSize();
cfg['wid'] = sizes[0] - 50;
cfg['hei'] = sizes[1] - 50;
}else{
if(!cfg['wid']){cfg['wid'] = 700;}
if(!cfg['hei']){cfg['hei'] = 550;}
}
var pageScroll = new Array();
pageScroll = getPageScroll();
var pageSize = new Array();
pageSize = getPageSize();
var objWid = cfg['wid'];
var objHei = cfg['hei'];
var centerW = 0;
var centerH = 0;
popup = new Object();
popup.Width = objWid + 'px';
popup.Height = objHei + 'px';
var maxSize2 = pageSize[1];
centerW = (pageSize[0] - objWid - 20) / 2;
centerH = ((pageSize[1]-30) - objHei) / 2;
centerH = centerH + pageScroll[0];
try{
if(document.getElementById('objPop_')){
document.body.removeChild(document.getElementById('objPop_'));
}
}catch(e){}
actual_window = 0;
if(mozilla_ff){
ext = 'png';
}else{
ext = 'gif';
}
ext = 'gif';
popup.BG = document.createElement('div');
popup.BG.id = 'objPop_';
popup.BG.style['background'] = 'url(engine/crm/images/popupbg.gif)';
if(mozilla_ff){
}else{
}
popup.BG.style['position'] = 'absolute';
popup.BG.style['left'] = '0px';
popup.BG.style['top'] = '0px';
popup.BG.style['width'] = pageSize[0]+'px';
popup.BG.style['height'] = pageSize[1]+'px';
popup.BG.style['zIndex'] = '9999';
popup.BG.setAttribute("owner", actual_window);
document.body.insertBefore(popup.BG, document.body.nextSibling);
popup.Base = document.createElement('div');
popup.Base.style['position'] = 'absolute';
popup.Base.style['left'] = centerW + 'px';
popup.Base.style['top'] = centerH + 'px';
popup.BG.appendChild(popup.Base);

table = document.createElement("table");
table.setAttribute("cellPadding", 0);
table.setAttribute("cellSpacing", 0);
popup.Base.appendChild(table);
tb = document.createElement("tbody");
table.appendChild(tb);
tr = document.createElement("tr");
tb.appendChild(tr);
td = document.createElement("td");
td.width = '8px';
td.height = '8px';
td.style['background'] = 'url(engine/core/images/bglt.'+ext+') repeat-x';
tr.appendChild(td);
td = document.createElement("td");
td.height = '8px';
td.width = popup.Width;
td.style['background'] = 'url(engine/core/images/bgtop.gif) repeat-x';
tr.appendChild(td);
td = document.createElement("td");
td.width = '8px';
td.height = '8px';
td.style['background'] = 'url(engine/core/images/bgrt.'+ext+') repeat-x';
tr.appendChild(td);

table = document.createElement("table");
table.setAttribute("cellPadding", 0);
table.setAttribute("cellSpacing", 0);
popup.Base.appendChild(table);
tb = document.createElement("tbody");
table.appendChild(tb);
tr = document.createElement("tr");
tb.appendChild(tr);
td = document.createElement("td");
td.width = '8px';
td.style['background'] = 'url(engine/core/images/bgleft.'+ext+') repeat-y';
tr.appendChild(td);
td = document.createElement("td");
td.width = popup.Width;
td.height = '20px';
td.style['background'] = '#f0f0f0 url(engine/core/images/popup_bg.jpg) repeat-x';
td.setAttribute("align", "right");
td.setAttribute("valign", "middle");
tr.appendChild(td);
sep = document.createElement("textNode");
sep.innerHTML = '&nbsp; &nbsp;';
sep.style['cursor'] = 'default';
td.appendChild(sep);
ico1 = document.createElement("img");
ico1.src = "engine/core/images/close.gif";
ico1.style['margin'] = '0px 2px 0px 0px';
ico1.style['cursor'] = 'pointer';
ico1.onmousedown = function(){
try{JavPopupClose2(popup.Base, iframe);}catch(e){}
try{JavPopupClose(popup.Base, iframe);}catch(e){}
}
td.appendChild(ico1);
td = document.createElement("td");
td.width = '8px';
td.style['background'] = 'url(engine/core/images/bgright.'+ext+') repeat-y';
tr.appendChild(td);

table = document.createElement("table");
table.setAttribute("cellPadding", 0);
table.setAttribute("cellSpacing", 0);
popup.Base.appendChild(table);
tb = document.createElement("tbody");
table.appendChild(tb);
tr = document.createElement("tr");
tb.appendChild(tr);
td = document.createElement("td");
td.width = '8px';
td.style['background'] = 'url(engine/core/images/bgleft.'+ext+') repeat-y';
tr.appendChild(td);
td = document.createElement("td");
td.style['background'] = '#ffffff';
td.width = popup.Width;
td.height = popup.Height;
tr.appendChild(td);
if(mozilla_ff){
preloader = document.createElement("div");
var a = (popup.Height / 2);
preloader.innerHTML = '<embed src="engine/crm/images/preloader.swf" width="50" height="50">';
preloader.width = popup.Width;
preloader.height = popup.Height;
preloader.align = 'center';
td.appendChild(preloader);
}
iframe = document.createElement("iframe");
iframe.src = lnk;
iframe.width = popup.Width;
iframe.height = popup.Height;
iframe.setAttribute("frameborder", "0");
if(mozilla_ff){
iframe.style['display'] = 'none';
}else{
iframe.style['display'] = 'block';
}
iframe.onmousedown = function(){
if(cfg['wid_hei'] == 'auto'){
JavPopupClose2(popup.Base, iframe);
}else{
JavPopupClose(popup.Base, iframe);
}
}
iframe.onload = function(){
preloader.style['display'] = 'none';
iframe.style['display'] = 'block';
}
td.appendChild(iframe);
td = document.createElement("td");
td.width = '8px';
td.style['background'] = 'url(engine/core/images/bgright.'+ext+') repeat-y';
tr.appendChild(td);

table = document.createElement("table");
table.setAttribute("cellPadding", 0);
table.setAttribute("cellSpacing", 0);
popup.Base.appendChild(table);
tb = document.createElement("tbody");
table.appendChild(tb);
tr = document.createElement("tr");
tb.appendChild(tr);
td = document.createElement("td");
td.width = '8px';
td.height = '8px';
td.style['background'] = 'url(engine/core/images/bglb.'+ext+') repeat-x';
tr.appendChild(td);
td = document.createElement("td");
td.height = '8px';
td.width = popup.Width;
td.style['background'] = 'url(engine/core/images/bgbottom.'+ext+') repeat-x';
tr.appendChild(td);
td = document.createElement("td");
td.width = '8px';
td.height = '8px';
td.style['background'] = 'url(engine/core/images/bgrb.'+ext+') repeat-x';
tr.appendChild(td);

}
function JavPopupClose(){
top.document.body.removeChild(top.document.getElementById('objPop_'));
}
function JavPopupClose2(){
document.body.removeChild(document.getElementById('objPop_'));
}
