oPopup = window.createPopup();
oPopX = oPopY = 0;
cntLayer = '';
cntCut = '
Cut
';
disCut = ' Cut
';
cntCopy = ' Copy
';
disCopy = ' Copy
';
cntPaste = ' Paste
';
cntInsert = ' Insert
';
cntDelete = ' Delete
';
cntAddGr = ' Add Graphical Text
';
cntEditGr = ' Edit Graphical Text
';
cntInsImg = ' Insert Image / Logo
';
cntChImg = ' Change Image / Logo
';
cntImgProp = ' Image Properties
';
cntUpl = ' Upload File
';
cntLink = ' Create Link
';
cntModif = ' Modify Link
';
cntRem = ' Remove Link
';
cntCStyle = ' Copy Style
';
cntPStyle = ' Paste Style
';
disCStyle = ' Copy Style
';
disPStyle = ' Paste Style
';
cntTable = ' New Table
';
cntTabProp = ' Table Properties
';
cntCellProp = ' Cell Properties
';
cntHead = '';
cntFoot = '
';
function goContext(){
cntRange = foo.document.selection.createRange();
cntRes = '';
sImgSel = foo.event.srcElement.tagName == 'IMG' && foo.event.srcElement.src.toLowerCase().indexOf('.jp') != -1;
firedObj = foo.event.srcElement;
if(firedObj.tagName != 'A')
while(firedObj.tagName != "BODY" && firedObj.tagName != "A")
firedObj = firedObj.parentElement;
sLinkSel = firedObj.tagName == 'A';
rows = 0;
if(sToolbarMode == 'Table'){
if(isCursorInTableCell()){
cntRes += cntTable + cntTabProp + cntCellProp + cntInsert + cntDelete;
rows += 4;
}
}
if(sImgSel){
text = cntAddGr;
for(a in sImgArr)
if(sImgArr[a] == foo.event.srcElement.src.replace(/^.*\/|_s2u_[0-9]*|\?$/ig, '')){
text = cntEditGr;
break;
}
cntRes += text;
rows++;
}
cntRes += sImgSel ? cntChImg + cntImgProp : cntInsImg + cntUpl;
rows += 2;
if(cntRange.text || cntRange.length){
cntRes += sLinkSel ? cntModif : cntLink;
rows++;
}
if(sLinkSel){
cntRes += cntRem;
rows++;
}
if(!cntRange.text && !cntRange.length)
cntRes += disCStyle + disPStyle + disCut + disCopy;
else
cntRes += (cntRange.text ? cntCStyle + cntPStyle : disCStyle + disPStyle) + cntCut + cntCopy;
cntRes += cntPaste;
rows += 5;
oPopup.document.body.innerHTML = cntRes;
oPopX = foo.event.x;
oPopY = foo.event.y;
oStyleSheet = oPopup.document.createStyleSheet();
oStyleSheet.addRule('.cntItem', 'background-color:#cccccc; border:1px solid black; border-top: 1px solid white; border-left:1px solid white; height:19px; color:black; font-family:verdana; font-weight:bold; padding:2px; padding-left:10px; font-size:8pt; cursor:default; behavior: url(inc/sContext.htc);');
oStyleSheet.addRule('.cntSub', 'background-color:#cccccc; background-image:url(img/arr.gif); background-repeat:no-repeat; background-position:right; border:1px solid black; border-top: 1px solid white; border-left:1px solid white; height:19px; color:black; font-family:verdana; font-weight:bold; padding:2px; padding-left:10px; font-size:8pt; cursor:default;');
oStyleSheet.addRule('.cntNest', 'border:2px solid black; border-top:2px solid #cccccc; border-left:2px solid #cccccc; background-color:#666666;');
oPopup.show(oPopX, oPopY, 207, rows*23, foo.document.body);
document.body.onmouseup = foo.document.body.onmouseup = oPopup.document.body.onclick = cntHide;
}
function cntHide(){
oTab.style.display = oDel.style.display = 'none';
oPopup.hide();
document.body.onmouseup = oPopup.document.body.;
}
function overSub(sNest, sDest){
sNest.style.backgroundColor = '#ffffff';
setTimeout('showSub(1, "' + sDest + '")', 200);
}
function outSub(sNest, sDest){
sNest.style.backgroundColor = '#cccccc';
setTimeout('showSub(0, "' + sDest + '")', 200);
}
function showSub(sShow, sDest){
if(sShow && sDest != cntLayer){
eval(sDest + '.style.display = "block";');
eval(sDest + '.style.top = oPopY - 2 + 131;');
eval(sDest + '.style.left = oPopX + 205 + 2;');
eval(sDest + '.style.width = "207px";');
}else if(sShow == 0 && sDest != cntLayer){
eval(sDest + '.style.display = "none";');
}
}