<?php
if (!defined('IS_DEDI')) die();
include_once($cfg_dedi['dedi_path'].'inc/inc.init_external.php');?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML 3.2//EN">
<HTML id=dlgFind STYLE="width: 440px; height: 250px; ">
   <HEAD>
 <?php echo '<meta http-equiv="content-type" content="text/html; charset='.$lang_charset.'">'."\n"; ?>
      <meta http-equiv="MSThemeCompatible" content="Yes">
      <TITLE>
         Cell Properties
      </TITLE>
      <style>
        html, body, button, div, input, select, fieldset { font-family: MS Shell Dlg; font-size: 8pt; position: absolute; };
      </style>
<script>
opener = window.dialogArguments;
var editor_obj = opener.document.all['_'+opener.getGlobalVar('_editor_field')+'_editor'];
var td = opener.getGlobalVar('_editor_cell');
</script>
<SCRIPT defer>
function _CloseOnEsc() {
  if (event.keyCode == 27) { window.close(); return; }
}
window.onerror = HandleError
function HandleError(message, url, line) {
  var std = "An error has occurred in this dialog." + "\n\n"
  + "Error: " + line + "\n" + message;
  alert(std);
  window.close();
  return true;
}
function Init() {
  // event handlers
  document.body.onkeypress = _CloseOnEsc;
  btnOK.onclick = new Function("btnOKClick()");
  align.selectedIndex = 0;
  for (var i=0; i< align.length; i++) {
     if (align[i].value.toLowerCase() == td.align.toLowerCase()) {
        align.selectedIndex = i;
     }
  }
  vAlign.selectedIndex = 0;
  for (var i=0; i< vAlign.length; i++) {
     if (vAlign[i].value.toLowerCase() == td.vAlign.toLowerCase()) {
        vAlign.selectedIndex = i;
     }
  }
  //if (td.bgColor == ''){
     bgColor.innerText = ' ' + td.bgColor.toUpperCase();
  //}
  bgColor.style.backgroundColor = td.bgColor;
  //if (td.borderColor == ''){
     borderColor.innerText = ' ' + td.borderColor.toUpperCase();
  //}
  borderColor.style.backgroundColor = td.borderColor;
  //if (td.borderColorDark == ''){
     borderColorDark.innerText = ' ' + td.borderColorDark.toUpperCase();
  //}
  borderColorDark.style.backgroundColor = td.borderColorDark;
  //if (td.borderColorLight == ''){
     borderColorLight.innerText = ' ' + td.borderColorLight.toUpperCase();
  //}
  borderColorLight.style.backgroundColor = td.borderColorLight;
  if (td.height == null){
    height.value = '';
    heightExt.value = '';
  } else {
     if (td.height.search(/%/) < 0) {
        height.value = td.height;
        heightExt.value = '';
     } else {
        height.value = td.height.split('%')[0];
        heightExt.value = '%';
     }
  }
  if (td.width == null){
    width.value = '';
    widthExt.value = '';
  } else {
     if (td.width.search(/%/) < 0) {
        widthExt.value = '';
        width.value = td.width;
     } else {
        width.value = td.width.split('%')[0];
        widthExt.value = '%';
     }
  }
  id.value = td.id;
  title.value = td.title;
  if (td.background == null) {
     background.value = '';
  } else {
     background.value = td.background;
  }
  colSpan.value = td.colSpan;
  rowSpan.value = td.rowSpan;
  noWrap.checked = td.noWrap;
}
function radioValue(radioobject){
   for (var i=0; i < radioobject.length; i++) {
      if (direction[i].checked) {
         return radioobject[i].value;
      }
   }
}
function _isValidNumber(txtBox) {
  if (txtBox == '') {
     return true;
  } else {
     var val = parseInt(txtBox);
     if (isNaN(val) || val < 0 || val > 9999) { return false; }
     return true;
  }
}
function btnOKClick() {
   if (!_isValidNumber(height.value)) {
      alert("<?php echo $dedi_lang['wys_pop_NumberRange'].$dedi_lang['wys_pop_height'] ?>");
      heigth.focus();
      return;
   }
   if (height.value == ''){heightExt.value = '';}
   if (!_isValidNumber(width.value)) {
      alert("<?php echo $dedi_lang['wys_pop_NumberRange'].$dedi_lang['wys_pop_width'] ?>");
      width.focus();
      return;
   }
   if (width.value == ''){widthExt.value = '';}
   td.align = align[align.selectedIndex].value;
   td.vAlign = vAlign[vAlign.selectedIndex].value;
   td.bgColor = bgColor.style.backgroundColor;
   td.borderColor = borderColor.style.backgroundColor;
   td.borderColorDark = borderColorDark.style.backgroundColor;
   td.borderColorLight = borderColorLight.style.backgroundColor;
   td.height = height.value + heightExt.value;
   td.id = id.value ;
   if (title.value == ''){
      if (td.getAttribute('title') != null){td.removeAttribute('title');}
   } else {td.title = title.value;}
   if (width.value == ''){
      if (td.getAttribute('width') != null){td.removeAttribute('width');}
   } else {td.width = width.value + widthExt.value;}
   if (background.value == '' ){
      if (td.getAttribute('background') != null){td.removeAttribute('background');}
   } else {td.background = background.value;}
   if (!_isValidNumber(colSpan.value)) {
      alert("<?php echo $dedi_lang['wys_pop_NumberRange'].$dedi_lang['wys_pop_colSpan'] ?>");
      colSpan.focus();
      return;
   }
   if (colSpan.value == '' || colSpan.value == '0' || colSpan.value == '1'){
      if (td.getAttribute('colSpan') != null){td.removeAttribute('colSpan');}
   } else {td.colSpan = colSpan.value;}
   if (!_isValidNumber(rowSpan.value)) {
      alert("<?php echo $dedi_lang['wys_pop_NumberRange'].$dedi_lang['wys_pop_rowSpan'] ?>");
      rowSpan.focus();
      return;
   }
   if (rowSpan.value == '' || rowSpan.value == '0' || rowSpan.value == '1'){
      if (td.getAttribute('rowSpan') != null){td.removeAttribute('rowSpan');}
   } else {td.rowSpan = rowSpan.value;}
   td.noWrap = noWrap.checked;
   window.close();
   return true;
}
function setColors (but) {
   but.style.borderStyle = 'inset';
   var color=showModalDialog('<?php echo $sess->url($cfg_client['htmlpath'].$cfg_client['contentfile'] .'?popup=set_color&view=edit'); ?>',but.style.backgroundColor,'resizable:no;help:no;status:no;scroll:no;');
   if (color == '' || color == null){
     but.innerText = '';
     but.style.backgroundColor = '';
   } else {
     but.innerText = ' #' + color.toUpperCase();
     but.style.backgroundColor =  color;
   }
   but.style.borderStyle = 'outset';
   return;
}
</SCRIPT>
   </HEAD>
   <BODY id=bdy onload="Init()" style="background: threedface; color: windowtext;" scroll=no>
      <DIV id=divHeight style="left: 1em;                    top: 1em; width: 10em; height: 1.9em; ">
        <?php echo $dedi_lang['wys_pop_height'] ?>:
      </DIV>
      <INPUT ID=height type=text style="left: 12em;          top: 0.8em; width: 3em; height: 1.9em; " tabIndex=10>
      <select name="heightExt" style="left: 15.2em;          top: 0.8em; width: 4em; height: 1.9em; " tabIndex=20>
         <option value="">px</option>
         <option value="%" selected>%</option>
      </select>
      <DIV id=divWidth style="left: 20em;                     top: 1em; width: 10em; height: 1.9em; ">
        <?php echo $dedi_lang['wys_pop_width'] ?>:
      </DIV>
      <INPUT ID=width type=text style="left: 31.9em;           top: 0.8em; width: 3em; height: 1.9em; " tabIndex=30>
      <select name="widthExt" style="left: 35.1em;           top: 0.8em; width: 4em; height: 1.9em; " tabIndex=40>
         <option value="">px</option>
         <option value="%" selected>%</option>
      </select>
      <DIV id=divId style="left: 1em;                        top: 3em; width: 10em; height: 1.2168em; ">
        Id:
      </DIV>
      <INPUT ID=id type=text style="left: 12em;              top: 2.8em; width: 27.04em; height: 1.9em; " tabIndex=50 onfocus="select()">
      <DIV id=divTitle style="left: 1em;                     top: 5em; width: 31em; height: 1.2168em; ">
        <?php echo $dedi_lang['wys_pop_Tooltip'] ?>:
      </DIV>
      <INPUT ID=title type=text style="left: 12em;           top: 4.8em; width: 27.04em; height: 1.9em; " tabIndex=60 onfocus="select()">
      <DIV id=divBackground style="left: 1em;                top: 7em; width: 10em; height: 1.2168em; ">
        <?php echo $dedi_lang['wys_pop_Background']." ".$dedi_lang['wys_pop_Image'] ?>:
      </DIV>
      <INPUT ID=background type=text style="left: 12em;      top: 6.8em; width: 27.04em; height: 1.9em; " tabIndex=70 onfocus="select()">
      <DIV id=divAlign style="left: 1em;                     top: 9em; width: 11em; height: 1.2168em; ">
        <?php echo $dedi_lang['wys_pop_hAlign'] ?>:
      </DIV>
      <select name="align" style="left: 12em;                top: 8.8em; width: 6em; height: 1.9em; " tabIndex=80>
           <option value="">---</option>
           <option value="center">Center</option>
           <!-- <option value="justify">Justify</option> -->
           <option value="left">Left</option>
           <option value="right">Right</option>
      </select>
      <DIV id=divvAlign style="left: 20em;                    top: 9em; width: 10em; height: 1.2168em; ">
        <?php echo $dedi_lang['wys_pop_vAlign'] ?>:
      </DIV>
      <select name="vAlign" style="left: 33em;               top: 8.8em; width: 6em; height: 1.9em; " tabIndex=90>
           <option value="">---</option>
           <option value="middle">Middle</option>
           <option value="baseline">Baseline</option>
           <option value="bottom">Bottom</option>
           <option value="top">Top</option>
      </select>
      <DIV id=divBgColor style="left: 1em;                   top: 11em; width: 10em; height: 1.2168em; ">
        <?php echo $dedi_lang['wys_pop_Background']." ".$dedi_lang['wys_pop_Color'] ?>:
      </DIV>
      <DIV id=bgColor style="left: 12em;                     top: 11em; width: 6em; height: 1.2168em;border-style: outset; border-width: thin;" onclick="setColors(this);"></DIV>
      <DIV id=divBorderColor style="left: 20em;              top: 11em; width: 10em; height: 1.2168em; ">
        <?php echo $dedi_lang['wys_pop_Border']." ".$dedi_lang['wys_pop_Color'] ?>:
      </DIV>
      <DIV id=borderColor style="left: 33em;                 top: 11em; width: 6em; height: 1.2168em;border-style: outset; border-width: thin;" onclick="setColors(this);"></DIV>
      <DIV id=divBorderColorDark style="left: 1em;           top: 13em; width: 10em; height: 1.2168em; ">
        <?php echo $dedi_lang['wys_pop_Border']."".$dedi_lang['wys_pop_Color']." ".$dedi_lang['wys_pop_Dark'] ?>:
      </DIV>
      <DIV id=borderColorDark style="left: 12em;             top: 13em; width: 6em; height: 1.2168em;border-style: outset; border-width: thin;" onclick="setColors(this);"></DIV>
      <DIV id=divBorderCOlorLight style="left: 20em;         top: 13em; width: 10em; height: 1.2168em; ">
        <?php echo $dedi_lang['wys_pop_Border']."".$dedi_lang['wys_pop_Color']." ".$dedi_lang['wys_pop_Light'] ?>:
      </DIV>
      <DIV id=borderColorLight style="left: 33em;            top: 13em; width: 6em; height: 1.2168em;border-style: outset; border-width: thin;" onclick="setColors(this);"></DIV>
      <DIV id=divColSpan style="left: 1em;                   top: 15em; width: 10em; height: 1.9em; ">
        <?php echo $dedi_lang['wys_pop_colSpan'] ?>:
      </DIV>
      <INPUT ID=colSpan type=text style="left: 12em;         top: 14.8em; width: 3em; height: 1.9em; " tabIndex=100 onfocus="select()">
      <DIV id=divrowSpan style="left: 16em;                  top: 15em; width: 10em; height: 1.9em; ">
        <?php echo $dedi_lang['wys_pop_rowSpan'] ?>:
      </DIV>
      <INPUT ID=rowSpan type=text style="left: 26em;         top: 14.8em; width: 3em; height: 1.9em; " tabIndex=110 onfocus="select()">
      <DIV id=divrowSpan style="left: 30em;                  top: 15em; width: 10em; height: 1.9em; ">
        <?php echo $dedi_lang['wys_pop_noWrap'] ?>:
      </DIV>
      <input ID=noWrap  type=checkbox  style="left: 37.7em;  top: 15em; width: 1.5em; height: 1.5em; " tabIndex=120 onfocus="select()">
      <BUTTON ID=btnOK style="left: 12em;                    top: 17em; width: 8.5em; height: 2.2em; " type=submit tabIndex=130>
         OK
      </BUTTON>
      <BUTTON ID=btnCancel style="left: 21.9em;              top: 17em; width: 8.5em; height: 2.2em; " type=reset tabIndex=140 onClick="window.close();">
         <?php echo $dedi_lang['gen_abort'] ?>
      </BUTTON>
   </BODY>
</HTML>