function cleanTable()
{
  var TmpString=cleaner.document.body.innerHTML;
  TmpString=TmpString.replace(/<\/*o:p>/gi,"");
  TmpString=TmpString.replace(/<\?xml[^>]*>/gi,"");
  TmpString=TmpString.replace(/ style="[^"]*"/gi,"");
  TmpString=TmpString.replace(/ class="[^"]*"/gi,"");
  TmpString=TmpString.replace(/ class=[a-zA-Z0-9]*/gi,"");

  TmpString=TmpString.replace(/ face="[^"]*"/gi,"");
  TmpString=TmpString.replace(/ face=[a-zA-Z]*/gi,"");
  TmpString=TmpString.replace(/ size="[^"]*"/gi,"");
  TmpString=TmpString.replace(/ size=[a-zA-Z0-9]*/gi,"");
  if (!brd.checked)
	{
    TmpString=TmpString.replace(/ border="[^"]*"/gi,"");
    TmpString=TmpString.replace(/ border=[a-zA-Z0-9]*/gi,"");
	}
  if (!tsize.checked)
	{
    TmpString=TmpString.replace(/ width="[^"]*"/gi,"");
    TmpString=TmpString.replace(/ width=[a-zA-Z0-9]*/gi,"");
    TmpString=TmpString.replace(/ height="[^"]*"/gi,"");
    TmpString=TmpString.replace(/ height=[a-zA-Z0-9]*/gi,"");
	}
  if (!tpad.checked)
  {
    TmpString=TmpString.replace(/ cellSpacing=[0-9]*/gi,"");
    TmpString=TmpString.replace(/ cellPadding=[0-9]*/gi,"");
  }
  if (!tcenter.checked)
	{
    TmpString=TmpString.replace(/ align="[^"]*"/gi,"");
    TmpString=TmpString.replace(/ align=[a-zA-Z]*/gi,"");
	}
  if (!tvcenter.checked)
	{
    TmpString=TmpString.replace(/ vAlign="[^"]*"/gi,"");
    TmpString=TmpString.replace(/ vAlign=[a-zA-Z]*/gi,"");
	}

  TmpString=TmpString.replace(/<SPAN>/gi,"");
  TmpString=TmpString.replace(/<\/SPAN>/gi,"");
  TmpString=TmpString.replace(/<P>/gi,"");
  TmpString=TmpString.replace(/<\/P>/gi,"");
  TmpString=TmpString.replace(/<FONT>/gi,"");
  TmpString=TmpString.replace(/<\/FONT>/gi,"");

  if (!bold.checked)
  {
    TmpString=TmpString.replace(/<B>/gi,"");
    TmpString=TmpString.replace(/<\/B>/gi,"");
  }

  if (!cursive.checked)
  {
    TmpString=TmpString.replace(/<I>/gi,"");
    TmpString=TmpString.replace(/<\/I>/gi,"");
  }

  if (!underline.checked)
  {
    TmpString=TmpString.replace(/<U>/gi,"");
    TmpString=TmpString.replace(/<\/U>/gi,"");
  }

  TmpString=TmpString.replace(/<!--[^-]*-->/gi,"");
  cleaner.document.body.innerHTML=TmpString;
} 











function sourceHTML()
{
  if (imgViewSource.title == 'Režim HTML')
  {
    cleaner.document.body.innerText=cleaner.document.body.innerHTML;
    imgViewSource.src='Images/Wysiwyg.gif';
    imgViewSource.title='Režim WYSIWYG';
    lblFunctions.style.visibility = 'hidden';
  }
  else
  {
    cleaner.document.body.innerHTML=cleaner.document.body.innerText;
    imgViewSource.src='Images/Html.gif';
    imgViewSource.title='Režim HTML';
    lblFunctions.style.visibility = '';
    cleaner.focus()
  }
} 








function pasteClipBoard()
{
  cleaner.document.body.innerHTML='';
  cleaner.document.execCommand("Paste");
}

function copyToClipBoard()
{
  cleaner.document.execCommand("SelectAll");
  cleaner.document.execCommand("Copy");
}

function cutToClipBoard()
{
  copyToClipBoard();
  cleaner.document.body.innerHTML='';
}

function cleanFromClipBoard()
{
  pasteClipBoard();
  cleanTable();
  copyToClipBoard();
} 



